aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryoctocell <public@yoctocell.xyz>2021-01-04 13:13:48 +0100
committeryoctocell <public@yoctocell.xyz>2021-01-04 13:13:48 +0100
commit02b75637a530adfc4e48dfe3597e8a75df9d7c8d (patch)
treef5988aa27cccd85476022ba54fbc42b37edc7497
parent6fb4be9cac5a4b206ecbabfd8848ac47b02f47d9 (diff)
Add support for ibuffer
Users can send marked buffers as patches, but I am not able to get the filename of the buffer under point. Everytime I run `ibuffer-buffer-file-name' the cursor jumps to the beginning of the buffer and I don't any filename returned. I have tried using `execute-kbd-macro' as well, but the cursor still jumps to the beginning of the buffer and I end up marking all buffers under the section. * git-email.el (git-email--ibuffer): (git-email--get-filenames):
-rw-r--r--git-email.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-email.el b/git-email.el
index cf294bd..393e97c 100644
--- a/git-email.el
+++ b/git-email.el
@@ -125,6 +125,13 @@ If no marks are found, return the filename at point."
(list (vc-dir-current-file)))))
files))
+(defun git-email--ibuffer ()
+ "Return list of filenames for marked files in `ibuffer'."
+ (let ((marked-files (nreverse
+ (mapcar (lambda (b) (buffer-file-name b))
+ (ibuffer-get-marked-buffers)))))
+ marked-files))
+
(defun git-email--get-filenames ()
"Return list of filenames for marked files in `vc-dir'.
If no marks are found, return the filename at point."
@@ -132,6 +139,8 @@ If no marks are found, return the filename at point."
(git-email--dired))
((eq major-mode 'vc-dir-mode)
(git-email--vc-dir))
+ ((eq major-mode 'ibuffer-mode)
+ (git-email--ibuffer))
(t
(message "Not a supported major mode"))))