From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: [Orgmode] Weird behaviour with org-yank and org-startup-indented Date: Wed, 20 Oct 2010 11:33:31 -0400 Message-ID: <87wrpcdgl0.fsf@stupidchicken.com> References: <87bp6vpks7.fsf@keller.adm.naquadah.org> <3B1391C6-72E9-4BAA-9197-7B27B26249BC@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1287588829 9929 80.91.229.12 (20 Oct 2010 15:33:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Oct 2010 15:33:49 +0000 (UTC) Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Carsten Dominik Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 20 17:33:48 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 1P8afi-0003mO-I5 for ged-emacs-devel@m.gmane.org; Wed, 20 Oct 2010 17:33:46 +0200 Original-Received: from localhost ([127.0.0.1]:48010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8afi-0002jR-19 for ged-emacs-devel@m.gmane.org; Wed, 20 Oct 2010 11:33:46 -0400 Original-Received: from [140.186.70.92] (port=38359 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8afb-0002jC-JY for emacs-devel@gnu.org; Wed, 20 Oct 2010 11:33:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8afZ-0004Fb-Ff for emacs-devel@gnu.org; Wed, 20 Oct 2010 11:33:39 -0400 Original-Received: from pantheon-po42.its.yale.edu ([130.132.50.101]:42486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8afU-0004DU-M1; Wed, 20 Oct 2010 11:33:32 -0400 Original-Received: from furry (dhcp128036014158.central.yale.edu [128.36.14.158]) (authenticated bits=0) by pantheon-po42.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o9KFXVOe016952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 20 Oct 2010 11:33:31 -0400 Original-Received: by furry (Postfix, from userid 1000) id 4AD25C018; Wed, 20 Oct 2010 11:33:31 -0400 (EDT) In-Reply-To: (Julien Danjou's message of "Wed, 20 Oct 2010 14:31:09 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 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:131891 gmane.emacs.orgmode:32161 Archived-At: Julien Danjou writes: > In a Org buffer with org-startup-indented set to t, type: > > ** TODO abcdefgh > > Go on `c', activate mark press C-e, press M-w (kill-ring-save). > [Wrong primary selection appears] The problem is in org-indent-refresh-section, which is run from a timer. This function first moves point and then calls remove-text-properties, which is considered a buffer change. Since the mark is active, the selection code saves the region to saved-region-selection, from which it is later saved to the primary selection. There are a few possible fixes, but I am yet not sure which is best. One is to avoid setting saved-region-selection inside a timer. Another is for save-excursion to inhibit writing to saved-region-selection; a third is not to treat remove-text-properties as a trigger for saving the primary selection.