about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-09-15 23:32:25 -0500
committerCase Duckworth2021-09-15 23:32:25 -0500
commit3c1f98064e592c702af8a17a3146d036faed2f06 (patch)
treeacd66bb5081e6524fb8664313c8bfb061a49e20e /lisp
parentRe-sort init.el (diff)
downloademacs-3c1f98064e592c702af8a17a3146d036faed2f06.tar.gz
emacs-3c1f98064e592c702af8a17a3146d036faed2f06.zip
Steal jao-buffer-same-mode
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 472b4ab..d3b0bf9 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -671,5 +671,18 @@ When called with PREFIX, just kill Emacs without confirmation."
671 (ignore-errors 671 (ignore-errors
672 (delete-frame)))) 672 (delete-frame))))
673 673
674
675;;; cribbed
676
677;; https://jao.io/blog/2021-09-08-high-signal-to-noise-emacs-command.html
678(defun jao-buffer-same-mode (&rest modes)
679 "Pop to a buffer with a mode among MODES, or the current one if not given."
680 (interactive)
681 (let* ((modes (or modes (list major-mode)))
682 (pred (lambda (b)
683 (let ((b (get-buffer (if (consp b) (car b) b))))
684 (member (buffer-local-value 'major-mode b) modes)))))
685 (pop-to-buffer (read-buffer "Buffer: " nil t pred))))
686
674(provide 'acdw) 687(provide 'acdw)
675;;; acdw.el ends here 688;;; acdw.el ends here