Move shortcut function to utilities package

This is where it should be, all time long.
This commit is contained in:
Daniel Borchmann 2025-08-07 17:01:23 +02:00
parent 7a906344bb
commit 2db4ce7607
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1
2 changed files with 34 additions and 32 deletions

33
init.el
View File

@ -465,6 +465,7 @@ split horizontally again, but this extra work should not matter much."
db/find-default-org-file db/find-default-org-file
db/find-default-refile-file db/find-default-refile-file
db/ement-connect db/ement-connect
db/shortcuts
db/hex-to-ascii db/hex-to-ascii
db/text-to-hex db/text-to-hex
turn-on-lispy-when-available turn-on-lispy-when-available
@ -2488,38 +2489,6 @@ Note that this workaround is incomplete, as explained in this comment."
;; * Navigation ;; * Navigation
(defun db/shortcuts ()
"Open helm completion on common locations."
(interactive)
(let (sources)
(push (list :name "Frequently Used"
:items (mapcar #'(lambda (entry)
(cons (car entry)
(caddr entry)))
db/frequently-used-features)
:annotate #'(lambda (_) "")
:action #'call-interactively)
sources)
(push 'consult--source-bookmark
sources)
(when (file-directory-p db/important-documents-path)
(let ((search-path (expand-file-name db/important-documents-path)))
(push (list :name "Important Files"
:narrow ?f
:items (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 ""))
:annotate #'(lambda (_) "")
:action #'db/system-open)
sources)))
(consult--multi (nreverse sources)
:require-match t
:sort nil)))
(use-package ace-window (use-package ace-window
:ensure t :ensure t
:commands (ace-window :commands (ace-window

View File

@ -30,6 +30,7 @@
(autoload 'find-libary-name "find-func") (autoload 'find-libary-name "find-func")
(autoload 'lm-header "lisp-mnt") (autoload 'lm-header "lisp-mnt")
(autoload 'rectangle-exchange-point-and-mark "rect") (autoload 'rectangle-exchange-point-and-mark "rect")
(autoload 'consult--multi "consult")
(declare-function w32-shell-execute "w32fns.c") (declare-function w32-shell-execute "w32fns.c")
(declare-function org-password-manager-get-password-by-id nil) (declare-function org-password-manager-get-password-by-id nil)
@ -88,6 +89,38 @@
(ement-connect :user-id db/matrix-user-id (ement-connect :user-id db/matrix-user-id
:password password))) :password password)))
(defun db/shortcuts ()
"Open helm completion on common locations."
(interactive)
(let (sources)
(push (list :name "Frequently Used"
:items (mapcar #'(lambda (entry)
(cons (car entry)
(caddr entry)))
db/frequently-used-features)
:annotate #'(lambda (_) "")
:action #'call-interactively)
sources)
(push 'consult--source-bookmark
sources)
(when (file-directory-p db/important-documents-path)
(let ((search-path (expand-file-name db/important-documents-path)))
(push (list :name "Important Files"
:narrow ?f
:items (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 ""))
:annotate #'(lambda (_) "")
:action #'db/system-open)
sources)))
(consult--multi (nreverse sources)
:require-match t
:sort nil)))
;;; General Utilities ;;; General Utilities