From 96d4876b695747286f931355c16da4d145bd31cc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 16:49:43 +0100 Subject: Emacs: Switch buffers from persp, not projectile --- tag-emacs/emacs.d/init.org | 18 ++++++++---------- 1 file 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. ("" . 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 -- cgit 1.4.1