emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with org-yank and delete-selection-mode
@ 2009-01-25 17:00 Steven E. Harris
  2009-01-25 17:38 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Steven E. Harris @ 2009-01-25 17:00 UTC (permalink / raw)
  To: emacs-orgmode

It's taken my a couple of months of running into this flaw to finally
stop and figure out what's wrong. I use either pending-delete-mode or
delete-selection-mode, depending on Emacs flavor, such that the
selected region gets deleted or replaced by a subsequent kill or yank
command. There's a strange interaction with yanking in org-mode, though,
where the yanked text gets inserted /before/ the delimited region
(assuming the point is before the mark) and the delimited text just gets
pushed out past the yanked text, as opposed to being /replaced/ by it.

Reading the header for delsel.el, I found documentation that requires
functions that delete, kill, or yank to exhibit a property
(`delete-selection') in order to work correctly with
delete-selection-mode. I found the following did the trick to get
org-yank to behave as expected:

,----
| (put 'org-yank 'delete-selection 'yank)
`----

It's not clear where such a definition belongs; delete-selection-mode
doesn't know about org-mode, and org-mode may not known about
delete-selection-mode. Should this fall to user-level customization?

-- 
Steven E. Harris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with org-yank and delete-selection-mode
  2009-01-25 17:00 Problem with org-yank and delete-selection-mode Steven E. Harris
@ 2009-01-25 17:38 ` Carsten Dominik
  2009-01-25 17:44   ` Steven E. Harris
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2009-01-25 17:38 UTC (permalink / raw)
  To: Steven E. Harris; +Cc: emacs-orgmode

Hi Steven,

this code belongs into org.el, where similar statements are
already present for a couple of other functions:

;; Make `delete-selection-mode' work with org-mode and orgtbl-mode
(put 'org-self-insert-command 'delete-selection t)
(put 'orgtbl-self-insert-command 'delete-selection t)
(put 'org-delete-char 'delete-selection 'supersede)
(put 'org-delete-backward-char 'delete-selection 'supersede)

I have added your line, thanks.

- Carsten

On Jan 25, 2009, at 6:00 PM, Steven E. Harris wrote:

> It's taken my a couple of months of running into this flaw to finally
> stop and figure out what's wrong. I use either pending-delete-mode or
> delete-selection-mode, depending on Emacs flavor, such that the
> selected region gets deleted or replaced by a subsequent kill or yank
> command. There's a strange interaction with yanking in org-mode,  
> though,
> where the yanked text gets inserted /before/ the delimited region
> (assuming the point is before the mark) and the delimited text just  
> gets
> pushed out past the yanked text, as opposed to being /replaced/ by it.
>
> Reading the header for delsel.el, I found documentation that requires
> functions that delete, kill, or yank to exhibit a property
> (`delete-selection') in order to work correctly with
> delete-selection-mode. I found the following did the trick to get
> org-yank to behave as expected:
>
> ,----
> | (put 'org-yank 'delete-selection 'yank)
> `----
>
> It's not clear where such a definition belongs; delete-selection-mode
> doesn't know about org-mode, and org-mode may not known about
> delete-selection-mode. Should this fall to user-level customization?
>
> -- 
> Steven E. Harris
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with org-yank and delete-selection-mode
  2009-01-25 17:38 ` Carsten Dominik
@ 2009-01-25 17:44   ` Steven E. Harris
  0 siblings, 0 replies; 3+ messages in thread
From: Steven E. Harris @ 2009-01-25 17:44 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:

> I have added your line, thanks.

Great. Thanks for the fast response.

-- 
Steven E. Harris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-25 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-25 17:00 Problem with org-yank and delete-selection-mode Steven E. Harris
2009-01-25 17:38 ` Carsten Dominik
2009-01-25 17:44   ` Steven E. Harris

Code repositories for project(s) associated with this 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 NNTP newsgroup(s).