unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text
@ 2011-03-04 22:16 Drew Adams
  2011-03-04 22:42 ` Drew Adams
  2011-03-05  4:18 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Drew Adams @ 2011-03-04 22:16 UTC (permalink / raw)
  To: 8174

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'
 






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

end of thread, other threads:[~2011-03-05  5:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-03-05  5:05   ` Drew Adams

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