emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH v1] Handle image width specification in pixels correctly
Date: Thu, 12 Dec 2024 22:33:39 -0800	[thread overview]
Message-ID: <87wmg4148s.fsf@gmail.com> (raw)

[-- 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


                 reply	other threads:[~2024-12-13  6:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmg4148s.fsf@gmail.com \
    --to=karthikchikmagalur@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).