emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH v1] Handle image width specification in pixels correctly
@ 2024-12-13  6:33 Karthik Chikmagalur
  2024-12-22 12:50 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Karthik Chikmagalur @ 2024-12-13  6:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ol-Respect-pixel-image-width-specification.patch --]
[-- Type: text/x-patch, Size: 1171 bytes --]

From 9d9532633a2e1f7391ba2e02f295c6250d13f5cc Mon Sep 17 00:00:00 2001
From: Karthik Chikmagalur <karthikchikmagalur@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-22 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13  6:33 [PATCH v1] Handle image width specification in pixels correctly Karthik Chikmagalur
2024-12-22 12:50 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).