From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] problem with size of inline images Date: Wed, 06 Aug 2014 15:22:21 +0200 Message-ID: <87oavxzraq.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF1A3-00033T-9q for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 09:21:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF19u-0000g4-Cq for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 09:21:47 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:56862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF19u-0000fr-6g for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 09:21:38 -0400 In-Reply-To: (Joe Corneli's message of "Sun, 3 Aug 2014 22:54:23 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Joe Corneli Cc: emacs-orgmode@gnu.org Hello, Joe Corneli writes: > 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. Thanks for your patch. Would you mind providing a commit message and send it again with "git format-patch"? Don't forget to add "TINYCHANGE" at its end if you haven't signed FSF papers. > + (save-match-data > + (when > + (re-search-forward > + "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)" > + (org-element-property > + :post-affiliated paragraph) > + t) > + (string-to-number (match-string 1))))))) It seems that `save-match-data' is useless anyway and can be removed altogether. WDYT? Regards, -- Nicolas Goaziou