From 6c0d7661a8169023f21ec19f83d603b81736111b Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 12 Sep 2020 10:54:34 +0200 Subject: [PATCH] Move helm shortcut function to navigation section Makes more sense to me. --- init.el | 85 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/init.el b/init.el index 1269086..d640ee2 100644 --- a/init.el +++ b/init.el @@ -687,50 +687,6 @@ :pin "melpa-stable" :commands (exec-path-from-shell-copy-envs)) - -;; * Start Menu via Helm - -(defun db/helm-shortcuts (arg) - "Open helm completion on common locations. -With given ARG, display files in `db/important-document-path’." - (interactive "p") - (require 'helm-bookmark) - (require 'helm-for-files) ; for helm-source-recentf - (helm :sources (list - (helm-make-source "Frequently Used" 'helm-source-sync - :candidates (mapcar #'(lambda (entry) - (cons (car entry) - (caddr entry))) - db/frequently-used-features) - :action '(("Open" . call-interactively)) - :filtered-candidate-transformer #'helm-adaptive-sort) - - ;; taken from `helm-buffers-list' - (helm-make-source "Buffers" 'helm-source-buffers) - - helm-source-recentf - - ;; if prefix arg is given, extract files from - ;; `db/important-documents-path’ and list them as well - (when (and (= arg 4) - (file-directory-p db/important-documents-path)) - (let ((search-path (expand-file-name db/important-documents-path))) - (helm-make-source "Important files" 'helm-source-sync - :candidates (mapcar #'(lambda (file) - ;; display only relative path, - ;; but keep absolute path for - ;; actions - (cons (string-remove-prefix search-path file) - file)) - (directory-files-recursively search-path "")) - :action '(("Open externally" . db/system-open) - ("Find file" . find-file))))) - - helm-source-bookmarks - - helm-source-buffer-not-found - helm-source-bookmark-set))) - ;; * Org @@ -2108,6 +2064,47 @@ With given ARG, display files in `db/important-document-path’." ;; * Navigation +(defun db/helm-shortcuts (arg) + "Open helm completion on common locations. +With given ARG, display files in `db/important-document-path’." + (interactive "p") + (require 'helm-bookmark) + (require 'helm-for-files) ; for helm-source-recentf + (helm :sources (list + (helm-make-source "Frequently Used" 'helm-source-sync + :candidates (mapcar #'(lambda (entry) + (cons (car entry) + (caddr entry))) + db/frequently-used-features) + :action '(("Open" . call-interactively)) + :filtered-candidate-transformer #'helm-adaptive-sort) + + ;; taken from `helm-buffers-list' + (helm-make-source "Buffers" 'helm-source-buffers) + + helm-source-recentf + + ;; if prefix arg is given, extract files from + ;; `db/important-documents-path’ and list them as well + (when (and (= arg 4) + (file-directory-p db/important-documents-path)) + (let ((search-path (expand-file-name db/important-documents-path))) + (helm-make-source "Important files" 'helm-source-sync + :candidates (mapcar #'(lambda (file) + ;; display only relative path, + ;; but keep absolute path for + ;; actions + (cons (string-remove-prefix search-path file) + file)) + (directory-files-recursively search-path "")) + :action '(("Open externally" . db/system-open) + ("Find file" . find-file))))) + + helm-source-bookmarks + + helm-source-buffer-not-found + helm-source-bookmark-set))) + (use-package ace-window :ensure t :commands (ace-window ace-window-display-mode)