emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: William Xu <william.xwl@gmail.com>
To: emacs-orgmode@gnu.org
Subject: org-toggle-inline-images bug
Date: Thu, 11 Aug 2011 11:13:51 +0800	[thread overview]
Message-ID: <21glhb5od4i8.fsf@gmail.com> (raw)

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

             reply	other threads:[~2011-08-11  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11  3:13 William Xu [this message]
2011-08-24 18:41 ` org-toggle-inline-images bug Bastien
2011-08-25  6:04   ` William Xu
2011-08-25  7:45     ` Bastien

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=21glhb5od4i8.fsf@gmail.com \
    --to=william.xwl@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).