* How to copy an agenda buffer into another buffer for editing @ 2007-01-16 15:55 Pete Phillips 2007-01-16 22:52 ` Carsten Dominik 0 siblings, 1 reply; 4+ messages in thread From: Pete Phillips @ 2007-01-16 15:55 UTC (permalink / raw) To: emacs-orgmode Hmmmm I am trying to send a list of appointments to someone, but I need to edit the list to remove my personal agenda items first. If I go into the Agenda buffer and sweep the weeks list of days and apoointments, I can, of course paste it into my MH-Letter draft. 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. This is *not* an org or agenda buffer. Same thing happens if I copy it into *scratch*. Any idea what is happening, and a way around this ? Cheers Pete ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to copy an agenda buffer into another buffer for editing 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 2007-01-17 12:04 ` Pete Phillips 0 siblings, 1 reply; 4+ messages in thread From: Carsten Dominik @ 2007-01-16 22:52 UTC (permalink / raw) To: Pete Phillips; +Cc: emacs-orgmode 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to copy an agenda buffer into another buffer for editing 2007-01-16 22:52 ` Carsten Dominik @ 2007-01-17 12:04 ` Pete Phillips 2007-01-17 12:13 ` Carsten Dominik 0 siblings, 1 reply; 4+ messages in thread From: Pete Phillips @ 2007-01-17 12:04 UTC (permalink / raw) To: Carsten Dominik; +Cc: emacs-orgmode Hi Carsten >>>>> "Carsten" == Carsten Dominik <dominik@science.uva.nl> writes: Carsten> Now that is an interesting bug, and it is actually Carsten> dangerous. :-) Carsten> This is, in fact, a dangerous bug, because if, for example, Carsten> you press C-k on one of those lines, the corresponding Carsten> entry in the org-mode file or in the diary will be Carsten> *removed*. So don't do that, and I hope you have not Carsten> destroyed something already. Nearly. Thank goodness for undo eh ? Carsten> A work-around is to use the following function to copy the Carsten> region from the agenda buffer. It does the same thing as Carsten> M-w, but does not take along any text properties. I haven't tried that because I tried: Carsten> Hmmmmm, I am just thinking, that a general solution for Carsten> this might instead be: Carsten> (add-hook 'org-agenda-mode-hook (lambda () Carsten> (make-local-variable 'buffer-substring-filters) (setq Carsten> buffer-substring-filters (cons (lambda (x) Carsten> (set-text-properties 0 (length x) nil x) x) Carsten> buffer-substring-filters)))) and this works (once I killed the *Org Agenda* buffer off and regenerated it). Superb. Thanks. Pete ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to copy an agenda buffer into another buffer for editing 2007-01-17 12:04 ` Pete Phillips @ 2007-01-17 12:13 ` Carsten Dominik 0 siblings, 0 replies; 4+ messages in thread From: Carsten Dominik @ 2007-01-17 12:13 UTC (permalink / raw) To: Pete Phillips; +Cc: emacs-orgmode Great. Please remove this from your setup when you get 4.62, because it will be built-in then. - Carsten On Jan 17, 2007, at 13:04, Pete Phillips wrote: > Hi Carsten > >>>>>> "Carsten" == Carsten Dominik <dominik@science.uva.nl> writes: > > Carsten> Now that is an interesting bug, and it is actually > Carsten> dangerous. > > :-) > > Carsten> This is, in fact, a dangerous bug, because if, for > example, > Carsten> you press C-k on one of those lines, the corresponding > Carsten> entry in the org-mode file or in the diary will be > Carsten> *removed*. So don't do that, and I hope you have not > Carsten> destroyed something already. > > Nearly. Thank goodness for undo eh ? > > Carsten> A work-around is to use the following function to copy the > Carsten> region from the agenda buffer. It does the same thing as > Carsten> M-w, but does not take along any text properties. > > I haven't tried that because I tried: > > Carsten> Hmmmmm, I am just thinking, that a general solution for > Carsten> this might instead be: > > Carsten> (add-hook 'org-agenda-mode-hook (lambda () > Carsten> (make-local-variable 'buffer-substring-filters) (setq > Carsten> buffer-substring-filters (cons (lambda (x) > Carsten> (set-text-properties 0 (length x) nil x) x) > Carsten> buffer-substring-filters)))) > > and this works (once I killed the *Org Agenda* buffer off and > regenerated it). > > Superb. Thanks. > Pete > > -- Carsten Dominik Sterrenkundig Instituut "Anton Pannekoek" Universiteit van Amsterdam Kruislaan 403 NL-1098SJ Amsterdam phone: +31 20 525 7477 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-17 12:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2007-01-17 12:04 ` Pete Phillips 2007-01-17 12:13 ` Carsten Dominik
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).