emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/embark f0dceae70a 5/6: Merge remote-tracking branch 'gi


From: ELPA Syncer
Subject: [elpa] externals/embark f0dceae70a 5/6: Merge remote-tracking branch 'github/remote-org-heading'
Date: Fri, 8 Sep 2023 15:57:48 -0400 (EDT)

branch: externals/embark
commit f0dceae70a2f923d21faabafc6eff4466c95cbff
Merge: 66eb18798d f3c8bc3328
Author: Omar Antolín Camarena <omar.antolin@gmail.com>
Commit: Omar Antolín Camarena <omar.antolin@gmail.com>

    Merge remote-tracking branch 'github/remote-org-heading'
---
 embark-org.el | 69 ++++++++++++++++++++++++++++-------------------------------
 1 file changed, 33 insertions(+), 36 deletions(-)

diff --git a/embark-org.el b/embark-org.el
index cad42054f7..1f7ad228f6 100644
--- a/embark-org.el
+++ b/embark-org.el
@@ -554,7 +554,7 @@ REST are the remaining arguments."
 
 (keymap-set embark-encode-map "o" 'embark-org-export-in-place-map)
 
-;;; Org agenda items
+;;; Org remote headings, such as agenda items
 
 (defun embark-org-target-agenda-item ()
   "Target Org agenda item at point."
@@ -562,45 +562,42 @@ REST are the remaining arguments."
              (get-text-property (line-beginning-position) 'org-marker))
     (let ((start (+ (line-beginning-position) (current-indentation)))
           (end (line-end-position)))
-      `(org-agenda-item ,(buffer-substring start end) ,start . ,end))))
+      `(org-remote-heading ,(buffer-substring start end) ,start . ,end))))
 
 (let ((tail (memq 'embark-org-target-element-context embark-target-finders)))
   (cl-pushnew 'embark-org-target-agenda-item (cdr tail)))
 
-(defvar-keymap embark-org-agenda-item-map
-  :doc "Keymap for actions on Org agenda items"
-  :parent embark-general-map
-  "RET" 'org-agenda-todo
-  "j" 'org-agenda-goto
-  "n" 'org-agenda-next-item
-  "p" 'org-agenda-previous-item
-  "t" 'org-agenda-todo
-  "k" 'org-agenda-kill
-  "u" 'org-agenda-undo
-  "D" 'org-agenda-toggle-deadlines
-  "a" 'org-agenda-archive
-  "i" 'org-agenda-clock-in
-  "o" 'org-agenda-clock-out
-  ":" 'org-agenda-set-tags
-  "," 'org-agenda-priority
-  "s" 'org-agenda-schedule
-  "d" 'org-agenda-deadline
-  "P" 'org-agenda-set-property
-  "e" 'org-agenda-set-effort
-  "r" 'org-agenda-refile
-  "N" 'org-agenda-add-note
-  "b" 'org-agenda-tree-to-indirect-buffer)
-
-(add-to-list 'embark-keymap-alist '(org-agenda-item 
embark-org-agenda-item-map))
-
-(dolist (cmd '(org-agenda-todo org-agenda-next-item org-agenda-previous-item))
-  (cl-pushnew cmd embark-repeat-actions))
-
-(dolist (cmd '(org-agenda-set-tags org-agenda-priority
-               org-agenda-schedule org-agenda-set-property
-               org-agenda-set-effort org-agenda-refile))
-  (cl-pushnew 'embark--ignore-target
-              (alist-get cmd embark-target-injection-hooks)))
+(add-to-list 'embark-keymap-alist '(org-remote-heading embark-org-heading-map))
+
+(cl-defun embark-org--at-remote-heading
+    (&rest rest &key run target &allow-other-keys)
+  "RUN the action at the location of the remote heading.
+The location is given by the `org-marker' text property of
+target.  Applies RUN to the REST of the arguments."
+  (if-let ((marker (get-text-property 0 'org-marker target)))
+    (with-current-buffer (marker-buffer marker)
+      (save-excursion
+        (goto-char marker)
+        (apply run :target target rest)))
+    (apply run :target target rest)))
+
+(defun embark-org-goto-remote-heading (&rest args)
+  "Jump to org remote heading TARGET."
+  (when-let ((target (if (cdr args) (plist-get args :target) (car args)))
+             (marker (get-text-property 0 'org-marker target)))
+    (pop-to-buffer (marker-buffer marker))
+    (goto-char marker)
+    (pulse-momentary-highlight-one-line)))
+
+(map-keymap
+ (lambda (_key cmd)
+   (unless (where-is-internal cmd (list embark-general-map))
+     (cl-pushnew 'embark-org-goto-remote-heading
+                 (alist-get cmd embark-pre-action-hooks))))
+ embark-org-heading-map)
+
+(setf (alist-get 'org-remote-heading embark-default-action-overrides)
+      #'embark-org-goto-remote-heading)
 
 (provide 'embark-org)
 ;;; embark-org.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]