From: Joe Corneli <holtzermann17@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] problem with size of inline images
Date: Sun, 3 Aug 2014 22:54:23 +0100 [thread overview]
Message-ID: <CAN+qof=oahLhOryG8weONXERTE7z+FH-8piJiGw+yrX9ZdWcjQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 727 bytes --]
Hello:
I've noticed a problem around line 19171 of org.el. The size of
images is supposed to be controlled by attributes and by
`org-image-actual-width'. But it seems like the use of `when',
`save-match-data' and `string-to-number' are in the wrong order in
this region, so that `(match-string 1)' is not defined properly when
it's evaluated. The following instructions should allow you to
reproduce the issue:
Run this:
#+BEGIN_SRC shell
wget http://www.lisperati.com/lisplogo_warning_256.png -O lisp_warning.png
#+END_SRC
Then:
[[elisp:(setq org-image-actual-width '(1200))]]
[[elisp:(org-toggle-inline-images)]]
#+ATTR_ORG: :width 256
[[file:./lisp_warning.png]]
... and the attached patch fixed the problem for me.
[-- Attachment #2: save-match-data.patch --]
[-- Type: application/octet-stream, Size: 864 bytes --]
diff --git a/lisp/org.el b/lisp/org.el
index 0f7a4ef..fdfa478 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19168,13 +19168,14 @@ boundaries."
(when paragraph
(save-excursion
(goto-char (org-element-property :begin paragraph))
- (when (save-match-data
- (re-search-forward
- "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"
- (org-element-property
- :post-affiliated paragraph)
- t))
- (string-to-number (match-string 1))))))
+ (save-match-data
+ (when
+ (re-search-forward
+ "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"
+ (org-element-property
+ :post-affiliated paragraph)
+ t)
+ (string-to-number (match-string 1)))))))
;; Otherwise, fall-back to provided number.
(car org-image-actual-width)))
((numberp org-image-actual-width)
next reply other threads:[~2014-08-03 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-03 21:54 Joe Corneli [this message]
2014-08-06 13:22 ` [PATCH] problem with size of inline images Nicolas Goaziou
2014-08-07 12:49 ` Joe Corneli
2014-08-07 13:05 ` Nicolas Goaziou
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='CAN+qof=oahLhOryG8weONXERTE7z+FH-8piJiGw+yrX9ZdWcjQ@mail.gmail.com' \
--to=holtzermann17@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).