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

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

[elpa] externals/org 85aa3c1850 3/5: org-narrow-to-block: Use element AP


From: ELPA Syncer
Subject: [elpa] externals/org 85aa3c1850 3/5: org-narrow-to-block: Use element API and handle all the block types
Date: Sat, 1 Jul 2023 06:59:08 -0400 (EDT)

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

    org-narrow-to-block: Use element API and handle all the block types
    
    * lisp/org.el (org-narrow-to-block): Narrow to any block type,
    including dynamic blocks.  Use org-element API.
    
    Reported-by: pva-outdoor@yandex.ru
    Link: https://orgmode.org/list/87a5wij05o.fsf@yandex.ru
---
 lisp/org.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index fdb920864a..832443c138 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7303,10 +7303,9 @@ Use the command `\\[widen]' to see the whole buffer 
again."
 Use the command `\\[widen]' to see the whole buffer again."
   (interactive)
   (let* ((case-fold-search t)
-        (blockp (org-between-regexps-p "^[ \t]*#\\+begin_.*"
-                                       "^[ \t]*#\\+end_.*")))
-    (if blockp
-       (narrow-to-region (car blockp) (cdr blockp))
+         (element (org-element-at-point)))
+    (if (string-match-p "block" (symbol-name (org-element-type element)))
+        (org-narrow-to-element)
       (user-error "Not in a block"))))
 
 (defun org-clone-subtree-with-time-shift (n &optional shift)



reply via email to

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