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

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

[elpa] externals/org 1425a86ae7: org.el: With an active region, act with


From: ELPA Syncer
Subject: [elpa] externals/org 1425a86ae7: org.el: With an active region, act with latex-preview
Date: Fri, 10 Jun 2022 10:57:47 -0400 (EDT)

branch: externals/org
commit 1425a86ae74556c44f5cf14dd8bacc7f89012bea
Author: Sébastien Miquel <sebastien.miquel@posteo.eu>
Commit: Daniel Fleischer <danflscr@gmail.com>

    org.el: With an active region, act with latex-preview
    
    * lisp/org.el (org-latex-preview): With an active region, display
    images for all fragments in the region. With universal prefix
    argument, remove all images in the region.
---
 lisp/org.el | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ac94fb6142..080962cdb1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15316,7 +15316,8 @@ BEG and END are buffer positions."
 If the cursor is on a LaTeX fragment, create the image and
 overlay it over the source code, if there is none.  Remove it
 otherwise.  If there is no fragment at point, display images for
-all fragments in the current section.
+all fragments in the current section.  With an active region,
+display images for all fragments in the region.
 
 With a `\\[universal-argument]' prefix argument ARG, clear images \
 for all fragments
@@ -15344,10 +15345,18 @@ fragments in the buffer."
    ;; Clear current section.
    ((equal arg '(4))
     (org-clear-latex-preview
-     (if (org-before-first-heading-p) (point-min)
-       (save-excursion
-        (org-with-limited-levels (org-back-to-heading t) (point))))
-     (org-with-limited-levels (org-entry-end-position))))
+     (if (use-region-p)
+         (region-beginning)
+       (if (org-before-first-heading-p) (point-min)
+         (save-excursion
+          (org-with-limited-levels (org-back-to-heading t) (point)))))
+     (if (use-region-p)
+         (region-end)
+       (org-with-limited-levels (org-entry-end-position)))))
+   ((use-region-p)
+    (message "Creating LaTeX previews in region...")
+    (org--latex-preview-region (region-beginning) (region-end))
+    (message "Creating LaTeX previews in region... done."))
    ;; Toggle preview on LaTeX code at point.
    ((let ((datum (org-element-context)))
       (and (memq (org-element-type datum) '(latex-environment latex-fragment))



reply via email to

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