From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel 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 Message-ID: <20100219143513.GC918@muc.de> References: <20100218202902.GE2671@muc.de> <838wapy3yo.fsf@gnu.org> <20100219122419.GA918@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1266589690 8323 80.91.229.12 (19 Feb 2010 14:28:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2010 14:28:10 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 19 15:28:08 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NiTpv-0006Wu-RZ for ged-emacs-devel@m.gmane.org; Fri, 19 Feb 2010 15:28:08 +0100 Original-Received: from localhost ([127.0.0.1]:39640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiTpv-0004Zx-1P for ged-emacs-devel@m.gmane.org; Fri, 19 Feb 2010 09:28:07 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NiTpp-0004Zo-Je for emacs-devel@gnu.org; Fri, 19 Feb 2010 09:28:01 -0500 Original-Received: from [140.186.70.92] (port=42034 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiTpo-0004ZN-Q0 for emacs-devel@gnu.org; Fri, 19 Feb 2010 09:28:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NiTpo-00061A-8L for emacs-devel@gnu.org; Fri, 19 Feb 2010 09:28:00 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:3535 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiTpn-00060r-F9 for emacs-devel@gnu.org; Fri, 19 Feb 2010 09:28:00 -0500 Original-Received: (qmail 14655 invoked by uid 3782); 19 Feb 2010 14:27:58 -0000 Original-Received: from acm.muc.de (pD9E51B9F.dip.t-dialin.net [217.229.27.159]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Fri, 19 Feb 2010 15:27:54 +0100 Original-Received: (qmail 2070 invoked by uid 1000); 19 Feb 2010 14:35:13 -0000 Content-Disposition: inline In-Reply-To: <20100219122419.GA918@muc.de> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:121228 Archived-At: 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- 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).