From: "Drew Adams" <drew.adams@oracle.com>
To: 8174@debbugs.gnu.org
Subject: bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text
Date: Fri, 4 Mar 2011 14:16:06 -0800 [thread overview]
Message-ID: <3DD5910E07E34DD4B7A6E4B75B340674@us.oracle.com> (raw)
C-x C-f foo.txt
Type this text (between the lines) into buffer foo.txt:
--------------------------------
toto
titi
tata
tutu
tete
(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'.
Instead, the image is displayed at a different location: in place of the
"ursi" in `save-excursion'.
If you put the cursor at the beginning of the displayed image (just
after the `c' of `save-excursion') and hit `C-u C-x =', you'll see
something like this in *Help*, with the image appearing after
`character: ' in *Help* (i.e. in place of `A'):
character: A (65, #o101, #x41)
preferred charset: ascii (ASCII (ISO646 IRV))
code point: 0x41
syntax: w which means: word
category: .:Base, a:ASCII, l:Latin, r:Roman
buffer code: #x41
file code: #x41 (encoded by coding system iso-latin-1-dos)
display: by this font (glyph code)
uniscribe:-outline-Courier
New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1 (#x24)
Character code properties: customize what to show
name: LATIN CAPITAL LETTER A
general-category: Lu (Letter, Uppercase)
There are text properties here:
display [Show]
fontified t
rear-nonsticky (display)
[back]
If you click the `Show' button for property `display' then you see,
correctly, the image spec for the thumbnail image - e.g.,
(image :type jpeg
:file "c:/.emacs.d/image-dired/abc_33e34a7116fe5da6ff6a9103c8774f02.thumb.jpg")
Similarly for each of the `A's that replaced `ursi'. IOW, each
character `A' of the replacement has the proper `display' property. But
the the image position is incorrect. The wrong text seems to have been
replaced by `replace-match'.
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
of 2011-02-28 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
next reply other threads:[~2011-03-04 22:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 22:16 Drew Adams [this message]
2011-03-04 22:42 ` bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text Drew Adams
2011-03-05 0:01 ` Drew Adams
2011-03-05 4:18 ` Stefan Monnier
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=3DD5910E07E34DD4B7A6E4B75B340674@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=8174@debbugs.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.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).