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

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

[elpa] externals/org 607c230d74 041/101: org-with-point-at: Accept synta


From: ELPA Syncer
Subject: [elpa] externals/org 607c230d74 041/101: org-with-point-at: Accept syntax node as POM
Date: Sat, 1 Jul 2023 09:59:04 -0400 (EDT)

branch: externals/org
commit 607c230d740f07c8f7ec9ce2b9fbae93e6dab242
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-with-point-at: Accept syntax node as POM
---
 lisp/org-macs.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 51dbfe118a..9a9a939388 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -156,12 +156,18 @@ If BUFFER is nil, use base buffer for `current-buffer'."
      ,@body))
 
 (defmacro org-with-point-at (pom &rest body)
-  "Move to buffer and point of point-or-marker POM for the duration of BODY."
+  "Move to buffer and point of POM for the duration of BODY.
+POM is a point or marker or Org syntax node."
   (declare (debug (form body)) (indent 1))
+  (require 'org-element-ast)
   (org-with-gensyms (mpom)
     `(let ((,mpom ,pom))
        (save-excursion
         (when (markerp ,mpom) (set-buffer (marker-buffer ,mpom)))
+         (when (org-element-property :buffer ,mpom)
+           (set-buffer (org-element-property :buffer ,mpom)))
+         (when (org-element-property :begin ,mpom)
+           (setq ,mpom (org-element-property :begin ,mpom)))
         (org-with-wide-buffer
          (goto-char (or ,mpom (point)))
          ,@body)))))



reply via email to

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