Emacs: Make counsel-projectile call my/switch-project.

This commit is contained in:
tastytea 2020-02-11 18:35:29 +01:00
parent 5d535cd318
commit e2db895f45
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,6 @@
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*- ;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-02-11T17:45:47+0100> ;; Time-stamp: <2020-02-11T18:35:21+0100>
;;; Commentary: ;;; Commentary:
;; * treemacs ;; * treemacs
@ -132,6 +132,18 @@
:custom :custom
(counsel-projectile-mode t) ; Turn on projectile-mode and enable keybindings. (counsel-projectile-mode t) ; Turn on projectile-mode and enable keybindings.
(projectile-switch-project-action 'my/switch-project)
:config
(defun my/counsel-projectile-switch-project-action (project)
"Call `my/switch-project'."
(let ((projectile-switch-project-action 'my/switch-project))
(counsel-projectile-switch-project-by-name project)))
(counsel-projectile-modify-action
'counsel-projectile-switch-project-action
'((add ("Y" my/counsel-projectile-switch-project-action
"open project in treemacs") 1)))
) )
;; Switch between named persistent window configurations. ;; Switch between named persistent window configurations.

View File

@ -1,6 +1,6 @@
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*- ;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-02-11T17:47:01+0100> ;; Time-stamp: <2020-02-11T18:31:37+0100>
;;; Commentary: ;;; Commentary:
@ -132,7 +132,7 @@
(substring (shell-command-to-string "nproc --ignore=1") 0 -1))) (substring (shell-command-to-string "nproc --ignore=1") 0 -1)))
(defun my/switch-project () (defun my/switch-project ()
"Add project to treemacs." "Open `treemacs' and add project to workspace."
(treemacs-add-and-display-current-project) (treemacs-add-and-display-current-project)
(treemacs-collapse-other-projects) (treemacs-collapse-other-projects)
(treemacs-toggle-node)) (treemacs-toggle-node))