all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Pete Phillips <pete@smtl.co.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to copy an agenda buffer into another buffer for editing
Date: Tue, 16 Jan 2007 23:52:13 +0100	[thread overview]
Message-ID: <04281800b8c6d767df83d777695c7b2d@science.uva.nl> (raw)
In-Reply-To: <19307.1168962923@lap1.smtl.co.uk>

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	other threads:[~2007-01-17  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16 15:55 How to copy an agenda buffer into another buffer for editing Pete Phillips
2007-01-16 22:52 ` Carsten Dominik [this message]
2007-01-17 12:04   ` Pete Phillips
2007-01-17 12:13     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04281800b8c6d767df83d777695c7b2d@science.uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=pete@smtl.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.