about summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2017-06-22T03·51-0400
committerWilliam Carroll <wpcarro@gmail.com>2017-06-22T03·51-0400
commit689e887354e8d1632d524448e97d045b22fa5875 (patch)
treecf5c360b09f274a5a43ab469b3b20fcc0a9207d5 /emacs
parenta349d4ca8c9aa9e8006a07ad61866e1a4d8e3496 (diff)
Blacklists additional modes from MRU buffer candidates
Diffstat (limited to 'emacs')
-rw-r--r--emacs/wc-helper-functions.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/emacs/wc-helper-functions.el b/emacs/wc-helper-functions.el
index 8c14d43b2c22..e393b1247c6c 100644
--- a/emacs/wc-helper-functions.el
+++ b/emacs/wc-helper-functions.el
@@ -1,3 +1,5 @@
+(require 'cl)
+
 (defun wc/edit-file-in-emacs (file)
   "Edits a file in a buffer in Emacs. On :wq, the buffer is deleted and the previous term session restored."
   (find-file file)
@@ -172,21 +174,6 @@
   (evil-window-down 1))
 
 
-(defun wc/file-buffer-p (buffer-candidate)
-  "Returns t if the buffer argument is backed by a file and is therefore presumably a code buffer."
-  (interactive)
-  (let ((buff-name (buffer-name buffer-candidate))
-        (buff-mode (wc/buffer-major-mode buffer-candidate)))
-    (not (or (string-match-p "^\*.+\*$" buff-name)
-             (string-match-p "^dired-mode$" buff-mode)))))
-
-
-(defun wc/buffer-major-mode (buffer-handle)
-  "Returns a symbol representing the buffer's active major-mode"
-  (interactive)
-  (symbol-name (with-current-buffer buffer-handle major-mode)))
-
-
 (defun wc/switch-to-mru-buffer ()
   "Switches to the most recently used buffer, including visible buffers."
   (interactive)
@@ -199,7 +186,7 @@
   (setq buffer-candidate (car buffer-candidates))
   (setq rest (cdr buffer-candidates))
   (if (string-match-p current-buffer-name (buffer-name buffer-candidate))
-      (wc/do-switch-to-mru-buffer rest)
+      (wc/do-switch-to--buffer rest)
     (if (eq 0 (list-length buffer-candidates))
         (message "No more buffer candidates.")
       (if (wc/file-buffer-p buffer-candidate)
@@ -207,6 +194,20 @@
         (wc/do-switch-to-mru-buffer rest)))))
 
 
+(defun wc/file-buffer-p (buffer-candidate)
+  "Returns t if the buffer argument is backed by a file and is therefore presumably a code buffer."
+  (interactive)
+  (let ((buff-name (buffer-name buffer-candidate))
+        (buff-mode (wc/buffer-major-mode buffer-candidate)))
+    (not (or (string-match-p "*" buff-name)
+             (member buff-mode '(neotree-mode dired-mode))))))
+
+
+(defun wc/buffer-major-mode (buffer-handle)
+  "Returns a buffer's active major-mode."
+  (with-current-buffer buffer-handle major-mode))
+
+
 (defun *-popwin-help-mode-off ()
   "Turn `popwin-mode' off for *Help* buffers."
   (when (boundp 'popwin:special-display-config)