Commit 230ab992 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-diff-buffer-file-popup: new command

parent 2a37ad56
......@@ -7,6 +7,10 @@ Updates since v2.5.0
* Added a cache, which memorizes the values of some function calls for
the duration of a refresh. This cuts the calls to git in half.
* Added new command `magit-diff-buffer-file-popup' intended for use in
file-visiting buffers. It shows the same popup as `magit-diff-popup'
but starts out already limited to the visited file.
* Added new command `magit-push-refspecs', which allows pushing using
one or more comma-separated and refspecs, which are explicitly typed
in the minibuffer.
......@@ -556,6 +556,24 @@ and"
(default-value 'magit-diff-arguments))))
(magit-invoke-popup 'magit-diff-popup nil arg)))
(defun magit-diff-buffer-file-popup (arg)
"Popup console for diff commans.
This is a variant of `magit-diff-popup' which shows the same popup
but which limits the diff to the file being visited in the current
(interactive "P")
(-if-let (file (magit-file-relative-name))
(let ((magit-diff-arguments
(-if-let (buffer (magit-mode-get-buffer 'magit-diff-mode))
(with-current-buffer buffer
(nth 2 magit-refresh-args))
(default-value 'magit-diff-arguments))
(list file))))
(magit-invoke-popup 'magit-diff-popup nil arg))
(user-error "Buffer isn't visiting a file")))
(defun magit-diff-refresh-popup (arg)
"Popup console for changing diff arguments in the current buffer."
(interactive "P")
......@@ -2262,12 +2262,13 @@ the current repository."
(magit-define-popup magit-file-popup
"Popup console for Magit commands in file-visiting buffers."
:actions '((?s "Stage" magit-stage-file)
(?l "Log" magit-log-buffer-file)
(?c "Commit" magit-commit-popup)
(?u "Unstage" magit-unstage-file)
(?b "Blame" magit-blame-popup) nil nil
(?p "Find blob" magit-blob-previous))
:actions '((?s "Stage" magit-stage-file)
(?d "Diff" magit-diff-buffer-file-popup)
(?b "Blame" magit-blame-popup)
(?u "Unstage" magit-unstage-file)
(?l "Log" magit-log-buffer-file)
(?p "Find blob" magit-blob-previous)
(?c "Commit" magit-commit-popup))
:max-action-columns 3)
(defvar magit-file-mode-lighter "")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment