summaryrefslogtreecommitdiffstats
path: root/.emacs.d
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2019-08-26 19:43:09 -0400
committerAmin Bandali <bandali@gnu.org>2019-08-26 19:43:09 -0400
commitfcd365285366e1f465751d365757bcfd257e96d5 (patch)
tree0676026126aa2358ad2b88424855c67e721d70c7 /.emacs.d
parent9a5ffb3364a8d0704cbcd4eb96ce31010fcbe065 (diff)
downloadconfigs-fcd365285366e1f465751d365757bcfd257e96d5.tar.gz
configs-fcd365285366e1f465751d365757bcfd257e96d5.tar.xz
configs-fcd365285366e1f465751d365757bcfd257e96d5.zip
emacs: ivy: properly ignore erc-, magit-, and dired-mode buffers
Diffstat (limited to '')
-rw-r--r--.emacs.d/init.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 6c17967..4c69e2a 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -608,6 +608,19 @@ For disabling the behaviour for certain buffers and/or modes."
ivy-use-virtual-buffers t
ivy-virtual-abbreviate 'abbreviate
ivy-count-format "%d/%d ")
+
+ (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode))
+ (defun b/ivy-ignore-buffer-p (str)
+ "Return non-nil if str names a buffer with a major mode
+derived from one of `b/ivy-ignore-buffer-modes'.
+
+This function is intended for use with `ivy-ignore-buffers'."
+ (let* ((buf (get-buffer str))
+ (mode (and buf (buffer-local-value 'major-mode buf))))
+ (and mode
+ (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes))))
+ (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p)
+
(ivy-mode 1)
;; :custom-face
;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
@@ -2091,9 +2104,6 @@ https://csclub.uwaterloo.ca/~abandali")
(erc-server-reconnect-attempts 5)
(erc-server-reconnect-timeout 3)
:config
- (with-eval-after-load 'ivy
- ;; ignore channel buffer names
- (add-to-list 'ivy-ignore-buffers "^#"))
(defun erc-cmd-OPME ()
"Request chanserv to op me."
(erc-message "PRIVMSG"