unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 8174@debbugs.gnu.org
Subject: bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text
Date: Fri, 04 Mar 2011 23:18:10 -0500	[thread overview]
Message-ID: <jwvlj0uursa.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <3DD5910E07E34DD4B7A6E4B75B340674@us.oracle.com> (Drew Adams's message of "Fri, 4 Mar 2011 14:16:06 -0800")

> (defun foo ()
>   (interactive)
>   (require 'image-dired)
>   (save-excursion
>     (goto-char (point-min))
>     (re-search-forward "tata")
>     (let* ((file  "@@@@@")
>     (strg  (apply #'propertize "AAAAAA"
>     `(display ,(image-dired-get-thumbnail-image file)
>        rear-nonsticky (display)))))
>       (replace-match strg))))
> --------------------------------
 
> Replace `@@@@@' in `foo's definition by a real image-file absolute file
> name, and then evaluate the definition.  Then `M-x foo RET'.
 
> I would expect the text `tata' to be replaced by the propertized string,
> whose text is `AAAAAAA' and whose properties are as indicated.  IOW, I
> would expect to see the image displayed in place of `tata'.

First things first: (ignoring the lack of check that re-search-forward
indeed succeeded) the only things allowed between the string match and
the use of the match-data are a few Emacs primitives known to leave the
match-data untouched.  image-dired-get-thumbnail-image is not one of
those primitives.


        Stefan





  parent reply	other threads:[~2011-03-05  4:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 22:16 bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text Drew Adams
2011-03-04 22:42 ` Drew Adams
2011-03-05  0:01   ` Drew Adams
2011-03-05  4:18 ` Stefan Monnier [this message]
2011-03-05  5:05   ` Drew Adams

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlj0uursa.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=8174@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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.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).