From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Weird behaviour with org-yank and org-startup-indented Date: Thu, 21 Oct 2010 19:38:23 +0200 Message-ID: <9948E9DE-A91D-41D8-A480-0C292B1199A3@gmail.com> References: <87bp6vpks7.fsf@keller.adm.naquadah.org> <3B1391C6-72E9-4BAA-9197-7B27B26249BC@gmail.com> <87wrpcdgl0.fsf@stupidchicken.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=43031 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8z65-0000oy-Q7 for emacs-orgmode@gnu.org; Thu, 21 Oct 2010 13:38:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8z63-00069V-FO for emacs-orgmode@gnu.org; Thu, 21 Oct 2010 13:38:37 -0400 In-Reply-To: <87wrpcdgl0.fsf@stupidchicken.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Chong Yidong Cc: Julien Danjou , Org Mode , Stefan Monnier , Emacs developers On Oct 20, 2010, at 5:33 PM, Chong Yidong wrote: > 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. Ah, this is interesting, thank you very much! > > 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. I'll go with Stefan's solution, using with-silent-modifications. I had already code that would restore buffer-modified-flag, but apparently this was not enough. Thanks! - Carsten