bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: buffer-substring vs. buffer-substring-no-properties


From: Kevin Layer
Subject: Re: buffer-substring vs. buffer-substring-no-properties
Date: 14 Nov 2001 21:22:36 -0800
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

"Eli Zaretskii" <address@hidden> writes:

> > From: Kevin Layer <address@hidden>
> > Newsgroups: gnu.emacs.bug
> > Date: 14 Nov 2001 08:34:01 -0800
> > 
> > (format "%s" ...) in emacs 20.7 removes font info.  In 21.1 it does
> > not.  This, not buffer-substring, is hosing me.
> > 
> > Given that I have lots and lots of calls to buffer-substring that I
> > don't want to change to buffer-substring-no-properties, how do I
> > defontify a string?
> 
> It's in NEWS: either use `copy-sequence' or `set-text-properties'.

Even though this is documented as an incompatible change, I don't
think it was a good decision.  The way I see format used seems more
geared toward making human readable output, and printing the
representation of a string with properties doesn't seem the right
thing.  I have a solution, so I'm just going on record to voice my
opinion.

Also, note I couldn't get copy-sequence to remove properties.  It
always preserves them for me:

x
#("(defun fo" 0 1 (fontified t) 1 6 (face font-lock-keyword-face fontified t) 6 
7 (fontified t) 7 9 (face font-lock-function-name-face fontified t))
(copy-sequence x)
#("(defun fo" 0 1 (fontified t) 1 6 (fontified t face font-lock-keyword-face) 6 
7 (fontified t) 7 9 (fontified t face font-lock-function-name-face))

I don't see any argument that will do it either:

    copy-sequence is a built-in function.
    (copy-sequence ARG)

    Return a copy of a list, vector or string.
    The elements of a list or vector are not copied; they are shared
    with the original.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]