summary refs log tree commit diff stats
path: root/tag-emacs/emacs.d
diff options
context:
space:
mode:
authorAlan Pearce2015-12-23 16:49:43 +0100
committerAlan Pearce2015-12-23 16:49:43 +0100
commit96d4876b695747286f931355c16da4d145bd31cc (patch)
tree79c778ebb6fca63e788af1f2a487ad15cdf3fe3b /tag-emacs/emacs.d
parentd7974bc08c0f2264f142e120b570967e17c20455 (diff)
downloadnixfiles-96d4876b695747286f931355c16da4d145bd31cc.tar.lz
nixfiles-96d4876b695747286f931355c16da4d145bd31cc.tar.zst
nixfiles-96d4876b695747286f931355c16da4d145bd31cc.zip
Emacs: Switch buffers from persp, not projectile
Diffstat (limited to 'tag-emacs/emacs.d')
-rw-r--r--tag-emacs/emacs.d/init.org18
1 files changed, 8 insertions, 10 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index 53b8f0cb..c6f638d3 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -1383,7 +1383,7 @@ replace helm and ido.
            ("<menu>" . counsel-M-x)
            ("C-c M-x" . execute-extended-command)
            ("C-x C-f" . counsel-find-file)
-           ("C-x b" . counsel-switch-to-projectile-buffer))
+           ("C-x b" . counsel-switch-to-persp-buffer))
     :config (progn
               (defadvice counsel-find-file (after find-file-sudo activate)
                 "Find file as root if necessary."
@@ -1391,16 +1391,14 @@ replace helm and ido.
                            (not (file-writable-p buffer-file-name)))
                   (message "File not writable %s" buffer-file-name)
                   (find-alternate-file (concat "/sudo::" buffer-file-name))))
-              (defun counsel-switch-to-projectile-buffer (arg)
-                "Forward to `projectile-switch-to-buffer'."
+              (defun counsel-switch-to-persp-buffer (arg)
+                "Forward to `persp-switch-to-buffer'."
                 (interactive "P")
-                (if (projectile-project-p)
-                    (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name))
-                              (projectile-project-buffer-names)
-                              :preselect (buffer-name (other-buffer (current-buffer)))
-                              :action #'ivy--switch-buffer-action
-                              :keymap ivy-switch-buffer-map)
-                  (call-interactively #'ivy-switch-buffer)))))
+                (ivy-read (format "Switch to buffer [%s]: " (persp-name persp-curr))
+                          (remq nil (mapcar #'buffer-name (persp-buffers persp-curr)))
+                          :preselect (buffer-name (other-buffer (current-buffer)))
+                          :action #'ivy--switch-buffer-action
+                          :keymap ivy-switch-buffer-map))))
 #+END_SRC