lang/org: expand refile commands
Changes 'SPC m r' into a prefix with multiple refiling commands.
This commit is contained in:
parent
bb383d3ede
commit
7b9c13f25f
2 changed files with 71 additions and 1 deletions
64
modules/lang/org/autoload/org-refile.el
Normal file
64
modules/lang/org/autoload/org-refile.el
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
;;; lang/org/autoload/org-refile.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; REVIEW These are all proof-of-concept. Refactor me!
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org/refile-to-current-file (arg)
|
||||||
|
"TODO"
|
||||||
|
(interactive "P")
|
||||||
|
(let ((org-refile-targets `((nil :maxlevel . 10)))
|
||||||
|
(org-refile-use-outline-path nil)
|
||||||
|
(org-refile-keep arg)
|
||||||
|
current-prefix-arg)
|
||||||
|
(call-interactively #'org-refile)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org/refile-to-other-window (arg)
|
||||||
|
"TODO"
|
||||||
|
(interactive "P")
|
||||||
|
(let ((org-refile-keep arg)
|
||||||
|
org-refile-targets
|
||||||
|
current-prefix-arg)
|
||||||
|
(dolist (win (delq (selected-window) (window-list)))
|
||||||
|
(with-selected-window win
|
||||||
|
(and (eq major-mode 'org-mode)
|
||||||
|
buffer-file-name
|
||||||
|
(cl-pushnew (cons buffer-file-name (cons :maxlevel 10))
|
||||||
|
org-refile-targets))))
|
||||||
|
(call-interactively #'org-refile)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org/refile-to-other-buffer (arg)
|
||||||
|
"TODO"
|
||||||
|
(interactive "P")
|
||||||
|
(let ((org-refile-keep arg)
|
||||||
|
org-refile-targets
|
||||||
|
current-prefix-arg)
|
||||||
|
(dolist (buf (delq (current-buffer) (doom-buffers-in-mode 'org-mode)))
|
||||||
|
(with-current-buffer buf
|
||||||
|
(and buffer-file-name
|
||||||
|
(cl-pushnew (cons buffer-file-name (cons :maxlevel 10))
|
||||||
|
org-refile-targets))))
|
||||||
|
(call-interactively #'org-refile)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org/refile-to-running-clock (arg)
|
||||||
|
"TODO"
|
||||||
|
(interactive "P")
|
||||||
|
(unless (bound-and-true-p org-clock-current-task)
|
||||||
|
(user-error "No active clock to refile to"))
|
||||||
|
(let ((org-refile-keep arg))
|
||||||
|
(org-refile 2)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org/refile-to-last-location (arg)
|
||||||
|
"TODO"
|
||||||
|
(interactive "P")
|
||||||
|
(or (assoc (plist-get org-bookmark-names-plist :last-refile)
|
||||||
|
bookmark-alist)
|
||||||
|
(user-error "No saved location to refile to"))
|
||||||
|
(let ((org-refile-keep arg)
|
||||||
|
(completing-read-function
|
||||||
|
(lambda (_p coll _pred _rm _ii _h default &rest _)
|
||||||
|
default)))
|
||||||
|
(org-refile)))
|
|
@ -594,10 +594,16 @@ between the two."
|
||||||
"o" #'org-set-property
|
"o" #'org-set-property
|
||||||
"p" #'org-priority
|
"p" #'org-priority
|
||||||
"q" #'org-set-tags-command
|
"q" #'org-set-tags-command
|
||||||
"r" #'org-refile
|
|
||||||
"s" #'org-schedule
|
"s" #'org-schedule
|
||||||
"t" #'org-todo
|
"t" #'org-todo
|
||||||
"T" #'org-todo-list
|
"T" #'org-todo-list
|
||||||
|
(:prefix ("r" . "refile")
|
||||||
|
"." #'+org/refile-to-current-file
|
||||||
|
"c" #'+org/refile-to-running-clock
|
||||||
|
"l" #'+org/refile-to-last-location
|
||||||
|
"o" #'+org/refile-to-other-window
|
||||||
|
"O" #'+org/refile-to-other-buffers
|
||||||
|
"r" #'org-refile) ; to all `org-refile-targets'
|
||||||
(:prefix ("a" . "attachments")
|
(:prefix ("a" . "attachments")
|
||||||
"a" #'org-attach/file
|
"a" #'org-attach/file
|
||||||
"u" #'org-attach/uri
|
"u" #'org-attach/uri
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue