emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-toggle-inline-images bug
@ 2011-08-11  3:13 William Xu
  2011-08-24 18:41 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: William Xu @ 2011-08-11  3:13 UTC (permalink / raw)
  To: emacs-orgmode

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

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

end of thread, other threads:[~2011-08-25  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11  3:13 org-toggle-inline-images bug William Xu
2011-08-24 18:41 ` Bastien
2011-08-25  6:04   ` William Xu
2011-08-25  7:45     ` Bastien

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).