[Helm] Make personal shortcut more customizable

This commit is contained in:
Daniel - 2017-10-27 21:46:50 +02:00
parent ad27f96943
commit ac10e90871
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 36 additions and 31 deletions

View File

@ -251,39 +251,44 @@ If FILE is not given, prompt for one."
;;; helm configuration ;;; helm configuration
(defcustom db/helm-frequently-used-features (defcustom db/helm-frequently-used-features
'((name . "Frequently Used") '(("Mail" . db/gnus)
(candidates . (("Mail" . db/gnus) ("Agenda" . db/org-agenda)
("Agenda" . db/org-agenda) ("Init File" . db/find-user-init-file)
("Init File" . db/find-user-init-file) ("EMMS" . emms)
("EMMS" . emms) ("Gnus" . (lambda ()
("Gnus" . (lambda () (interactive)
(interactive) (find-file gnus-init-file)))
(find-file gnus-init-file))) ("Shell" . shell)
("Shell" . shell) ("EShell" . eshell)
("EShell" . eshell) ("scratch" . db/scratch))
("scratch" . db/scratch)))
(action . (("Open" . funcall)))
(filtered-candidate-transformer . helm-adaptive-sort))
"Helm shortcuts for frequently used features." "Helm shortcuts for frequently used features."
:group 'personal-settings :group 'personal-settings
:type '(alist :key-type symbol :value-type sexp)) :type '(alist :key-type string :value-type sexp))
(defvar db/helm-frequently-used-features-source
'((name . "Frequently Used")
(candidates . db/helm-frequently-used-features)
(action . (("Open" . funcall)))
(filtered-candidate-transformer . helm-adaptive-sort))
"Helm source for `db/helm-frequently-used-features.")
(defcustom db/helm-frequently-visited-locations (defcustom db/helm-frequently-visited-locations
'((name . "Locations") '(("db-utils" . "~/.emacs.d/site-lisp/db-utils.el")
(candidates . (("db-utils" . "~/.emacs.d/site-lisp/db-utils.el") ("db-org" . "~/.emacs.d/site-lisp/db-org.el")
("db-org" . "~/.emacs.d/site-lisp/db-org.el") ("db-private" . "~/.emacs.d/site-lisp/db-private.el")
("db-private" . "~/.emacs.d/site-lisp/db-private.el") ("notes" . "~/Documents/home/notes.org")
("notes" . "~/Documents/home/notes.org") ("pensieve" . "~/Documents/home/pensieve.org.gpg")
("pensieve" . "~/Documents/home/pensieve.org.gpg") ("things (home)" . "~/Documents/home/admin/things.gpg")
("things (home)" . "~/Documents/home/admin/things.gpg") ("things (work)" . "~/Documents/uni/admin/misc/things.gpg"))
("things (work)" . "~/Documents/uni/admin/misc/things.gpg")
("research ideas" . "~/Documents/uni/research/ideas.org")
("teaching ideas" . "~/Documents/uni/lehre/ideas.org")))
(action . (("Open" . find-file)))
(filtered-candidate-transformer . helm-adaptive-sort))
"Helm shortcuts to frequentely visited locations" "Helm shortcuts to frequentely visited locations"
:group 'personal-settings :group 'personal-settings
:type '(alist :key-type symbol :value-type sexp)) :type '(alist :key-type string :value-type sexp))
(defvar db/helm-frequently-visited-locations-source
'((name . "Locations")
(candidates . db/helm-frequently-visited-locations)
(action . (("Open" . find-file)))
(filtered-candidate-transformer . helm-adaptive-sort)))
(defcustom db/important-documents-path "..." ; invalid directory as default (defcustom db/important-documents-path "..." ; invalid directory as default
"Path of important documents." "Path of important documents."
@ -324,7 +329,7 @@ path."
((windows-nt cygwin) (w32-shell-execute "open" path)) ((windows-nt cygwin) (w32-shell-execute "open" path))
((gnu/linux) (start-process "" nil "xdg-open" path)))) ((gnu/linux) (start-process "" nil "xdg-open" path))))
(defcustom db/helm-important-documents (defcustom db/helm-important-documents-source
`((name . "Important files") `((name . "Important files")
(candidates . db/important-documents) (candidates . db/important-documents)
(action . (("Open externally" . db/system-open) (action . (("Open externally" . db/system-open)
@ -337,10 +342,10 @@ path."
"Open helm completion on common locations." "Open helm completion on common locations."
(interactive) (interactive)
(require 'helm-files) (require 'helm-files)
(helm :sources `(db/helm-frequently-used-features (helm :sources `(db/helm-frequently-used-features-source
db/helm-frequently-visited-locations db/helm-frequently-visited-locations-source
,(when (file-directory-p db/important-documents-path) ,(when (file-directory-p db/important-documents-path)
'db/helm-important-documents) 'db/helm-important-documents-source)
helm-source-bookmarks helm-source-bookmarks
helm-source-bookmark-set))) helm-source-bookmark-set)))