about summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
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)