From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: How to copy an agenda buffer into another buffer for editing Date: Tue, 16 Jan 2007 23:52:13 +0100 Message-ID: <04281800b8c6d767df83d777695c7b2d@science.uva.nl> References: <19307.1168962923@lap1.smtl.co.uk> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H76aW-0008Ba-FQ for emacs-orgmode@gnu.org; Wed, 17 Jan 2007 03:56:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H76aU-0008BD-IO for emacs-orgmode@gnu.org; Wed, 17 Jan 2007 03:56:08 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H76aU-0008BA-Bp for emacs-orgmode@gnu.org; Wed, 17 Jan 2007 03:56:06 -0500 Received: from [149.217.40.2] (helo=mailer.mpia-hd.mpg.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H76aT-0006BT-Nn for emacs-orgmode@gnu.org; Wed, 17 Jan 2007 03:56:06 -0500 In-Reply-To: <19307.1168962923@lap1.smtl.co.uk> 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: Pete Phillips Cc: emacs-orgmode@gnu.org On Jan 16, 2007, at 16:55, Pete Phillips wrote: > > However, if I try to edit the list of dates in the MHE draft buffer, it > won't allow me - the *Messages buffer states: > > remove-yank-excluded-properties: Wrong type argument: symbolp, "" > > and I can't use ^K to kill the line with the appointment. Now that is an interesting bug, and it is actually dangerous. Entries in the agenda buffer have a large number of text properties that store all kinds of information, for example where the original entry is located, what the category is, the priority and much more. These properties get copied and pasted along with the text. One of the properties I use is `category' which seems to have some special meaning in Emacs. This is what is causing the bug you describe. However, the problem is bigger because agenda lines also have a property specifying an overriding keymap, so org-mode commands will *still* be called, even if you have pasted the text into the scratch buffer and are working on it there. This is, in fact, a dangerous bug, because if, for example, you press C-k on one of those lines, the corresponding entry in the org-mode file or in the diary will be *removed*. So don't do that, and I hope you have not destroyed something already. A work-around is to use the following function to copy the region from the agenda buffer. It does the same thing as M-w, but does not take along any text properties. (defun copy-region-no-properites (beg end) "Copy the region into the kill ring, but remove all text properties." (interactive "r") (kill-new (buffer-substring-no-properties beg end))) Hmmmmm, I am just thinking, that a general solution for this might instead be: (add-hook 'org-agenda-mode-hook (lambda () (make-local-variable 'buffer-substring-filters) (setq buffer-substring-filters (cons (lambda (x) (set-text-properties 0 (length x) nil x) x) buffer-substring-filters)))) Let me know if this does the trick, and I am putting it into the next version. - Carsten