emacs-devel
[Top][All Lists]
Advanced

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

Re: M-w, then C-y. C-y inserts text properties that aren't on original.


From: Alan Mackenzie
Subject: Re: M-w, then C-y. C-y inserts text properties that aren't on original.
Date: Fri, 19 Feb 2010 14:35:13 +0000
User-agent: Mutt/1.5.9i

On Fri, Feb 19, 2010 at 12:24:19PM +0000, Alan Mackenzie wrote:

> On Fri, Feb 19, 2010 at 11:22:55AM +0200, Eli Zaretskii wrote:

> > Can you please give a precise recipe, starting with "emacs -Q", for
> > reproducing the problem?  I don't know enough about C++ Mode internals
> > to understand what you say.

> #########################################################################
> emacs -Q
> (defvar propp-var nil)
> (put 'propp-var 'foo t)

> Create buffer "foo" and put a line of text (including NL) into it.

> (with-current-buffer "foo" (put-text-property 1 2 'category 'propp-var))

> In foo:
> M-<                                     ; goto BOB
> C-<space> C-n M-w                       ; Copy L1 into the kill ring
> C-y                                     ; Yank it as L2

> M-<   C-u C-x =                         ; Get details of char at BOB
>     There are text properties here:
>       category             propp-var    ; <==============================
>       fontified            t

> C-n   C-u C-x =                         ; Get details of char at BOL 2
>     There are text properties here:
>       fontified            t
>       foo                  t            ; <==============================
> #########################################################################

> Note that where the original "had" a 'foo property by indirection through
> the 'category, the copy has spuriously short-circuited the 'category
> indirection.

I've found it.

`yank' calls `insert-for-yank' calls `insert', which inserts the top of
the kill ring correctly into the buffer.  Then...

`insert-for-yank' carries on, and calls `remove-yank-excluded-properties'
which deliberately changes 'category properties into other properties.

Presumably there was some special case in the distant past which required
this transformation.  It is surely wrong in the general case - yanking
into a buffer shouldn't add text properties which weren't in the
original - surely?

I'm going to try and track down that special case.  It looks like I'll
have to fix the inserted string in CC Mode by hand.

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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