emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] How to copy an agenda buffer into another buffer for editi


From: Carsten Dominik
Subject: Re: [Orgmode] How to copy an agenda buffer into another buffer for editing
Date: Tue, 16 Jan 2007 23:52:13 +0100

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





reply via email to

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