[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8174: 24.0.50; `replace-match' doesn't work right with propertized t
From: |
Drew Adams |
Subject: |
bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text |
Date: |
Fri, 4 Mar 2011 14:16:06 -0800 |
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'
- bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text,
Drew Adams <=