From: Amin Bandali Date: Mon, 26 Aug 2019 23:43:09 +0000 (-0400) Subject: emacs: ivy: properly ignore erc-, magit-, and dired-mode buffers X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/commitdiff_plain/fcd365285366e1f465751d365757bcfd257e96d5?hp=9a5ffb3364a8d0704cbcd4eb96ce31010fcbe065 emacs: ivy: properly ignore erc-, magit-, and dired-mode buffers --- 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"