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

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

[elpa] externals/org 50be048ad0 1/2: org-display-inline-image--width: Fi


From: ELPA Syncer
Subject: [elpa] externals/org 50be048ad0 1/2: org-display-inline-image--width: Fix regexp
Date: Thu, 15 Aug 2024 15:58:49 -0400 (EDT)

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

    org-display-inline-image--width: Fix regexp
    
    * lisp/org.el (org-display-inline-image--width): Ignore non-pixel
    specifications like :width 4in (previously treated as 4 pixels).  Do
    not ignore fractional percent values like :width 30.5%.
---
 lisp/org.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index bcab7ca860..d5cb6c36ad 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16935,11 +16935,22 @@ buffer boundaries with possible narrowing."
               (lambda (value)
                 (or (not (stringp value))
                     (unless (string= value "t")
-                      (or (not (string-match-p
-                              (rx bos (opt "+") (opt ".") (in "0-9"))
+                      (or (not (string-match
+                              (rx bos (opt "+")
+                                  (or
+                                   ;; Number of pixels
+                                   ;; must be a lone number, not
+                                   ;; things like 4in
+                                   (seq (1+ (in "0-9")) eos)
+                                   ;; Numbers ending with %
+                                   (seq (1+ (in "0-9.")) (group-n 1 "%"))
+                                   ;; Fractions
+                                   (seq (0+ (in "0-9")) "." (1+ (in "0-9")))))
                               value))
                           (let ((number (string-to-number value)))
-                            (and (floatp number) (not (<= 0.0 number 
2.0)))))))))
+                            (and (floatp number)
+                                 (not (match-string 1 value)) ; X%
+                                 (not (<= 0.0 number 2.0)))))))))
              ;; #+ATTR_BACKEND: :width ...
              (attr-other
               (catch :found



reply via email to

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