From mboxrd@z Thu Jan 1 00:00:00 1970 From: William Xu Subject: org-toggle-inline-images bug Date: Thu, 11 Aug 2011 11:13:51 +0800 Message-ID: <21glhb5od4i8.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrLik-00045Q-59 for emacs-orgmode@gnu.org; Wed, 10 Aug 2011 23:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrLif-0001jO-Ug for emacs-orgmode@gnu.org; Wed, 10 Aug 2011 23:14:10 -0400 Received: from lo.gmane.org ([80.91.229.12]:44602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrLif-0001jJ-Mp for emacs-orgmode@gnu.org; Wed, 10 Aug 2011 23:14:05 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QrLie-0004ks-HM for emacs-orgmode@gnu.org; Thu, 11 Aug 2011 05:14:04 +0200 Received: from amprx01x.nokia.com ([192.100.130.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Aug 2011 05:14:04 +0200 Received: from william.xwl by amprx01x.nokia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Aug 2011 05:14:04 +0200 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: emacs-orgmode@gnu.org Hi, M-x org-toggle-inline-images doesn't work for links like this: [[./ref/diskStructures.png]] The problem lies in `org-display-inline-images': (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?" (substring (org-image-file-name-regexp) 0 -2) "\\)\\]" (if include-linked "" "\\]"))) old file ov img) org-image-file-name-regexp assumes the last two characters are "\\)\\'" or "\\)\\$". However, in its definition: (defun org-image-file-name-regexp (&optional extensions) "Return regexp matching the file names of images. If EXTENSIONS is given, only match these." (if (and (not extensions) (fboundp 'image-file-name-regexp)) (image-file-name-regexp) ;; snip When image-file-name-regexp is defined, (image-file-name-regexp) doesn't ends with those two specific characters. On my machine, it returns: (image-file-name-regexp) => "\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\'\\|\\.png$\\|\\.jpeg$\\|\\.jpg$\\|\\.gif$\\|\\.tiff$\\|\\.tif$\\|\\.xbm$\\|\\.xpm$\\|\\.pbm$\\|\\.pgm$\\|\\.ppm$\\|\\.pnm$" Thus, the `re' match fails. Maybe we shall not depend on (image-file-name-regexp) ? -- William http://xwl.appspot.com