The attached patch restores the ability to specify preview image widths
using the "px" specification, such as

#+attr_org: :width 300px

This behavior was lost during the refactoring in
50be048ad0cbe0e9150ca2351b894b041ae7cf49.

Karthik
>From 9d9532633a2e1f7391ba2e02f295c6250d13f5cc Mon Sep 17 00:00:00 2001
From: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
Date: Thu, 12 Dec 2024 22:24:01 -0800
Subject: [PATCH] ol: Respect pixel image width specification

* lisp/ol.el (org-display-inline-image--width): Ensure that image
widths specified with the "px" suffix in #+attr_* keywords are
respected when previewing images.  Example:
 #+attr_org: 300px
---
 lisp/ol.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index 032610bad..6640bb951 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1103,7 +1103,7 @@ (defun org-display-inline-image--width (link)
                                    ;; Number of pixels
                                    ;; must be a lone number, not
                                    ;; things like 4in
-                                   (seq (1+ (in "0-9")) eos)
+                                   (seq (1+ (in "0-9")) (? "px") eos)
                                    ;; Numbers ending with %
                                    (seq (1+ (in "0-9.")) (group-n 1 "%"))
                                    ;; Fractions
-- 
2.47.0

Reply via email to