rejeep / drag-stuff.el

Drag stuff around in Emacs
233 stars 12 forks source link

(feature requirement) org-mode heading issue #6

Closed llcc closed 7 years ago

llcc commented 10 years ago

Hi rejeep,

thanks for your neat scripts, I use it everyday.

However, when i use it in org-mode, there is some kind of bother sometimes. Maybe you know that, I can use Alt left and Alt right to promote and demote the heading, or use Alt up and Alt down to move the headings. They are all conflicted with drag-stuff mode.

So I come here to require a feature that can inhibit the drag-stuff-mode temporarily when the cursor is in heading and subheading in org-mode, and I think it will be a good feature because we almost put our cursor in the contents but the headings.

Thanks in advance. Best regard. llcc

rejeep commented 10 years ago

Hi.

Does the variable drag-stuff-except-modes help you?

llcc commented 10 years ago

Hi, I am not sure if org-mode has a org-heading-mode to let me use that drag-stuff-except-modes variable. I definitely do not want to inhibit whole drag-stuff in org-mode.

rejeep commented 10 years ago

Ok, I see. Let me think about a good solution for this.

rejeep commented 10 years ago

Just got back from my vacation and started looking at this. Not sure when I'm done with it, had some issues with creating good tests for this. Will let you know!

pseudomyne commented 8 years ago

Hey i'm curious about this topic. Compatibility with org-mode would be so great...

kaliif commented 8 years ago

Same here. Would very much like to use drag-stuff in org buffers also.

EDIT: Actually, nvm, i don't think it's possible. I'd still like to be able to use both functions at org headings. I simply remapped the default key to someting else.

rejeep commented 8 years ago

I don't remember any of this, since it was two years ago and apparently I forgot about it.

I also don't remember what I was working on regarding this, because when I think about it now I don't see any obvious solution.

Can you please explain in more detail what you want to achieve here. Why not just simply disable drag-stuff in org-mode completely?

ivanbrennan commented 7 years ago

The Org mode section of the Emacs manual describes reordering/promoting bindings that are available when the cursor is on a heading:

You can move an entire entry up or down in the buffer, including its body lines and subtree (if any), by typing M-<up> (org-metaup) or M-<down> (org-metadown) on the heading line. Similarly, you can promote or demote a heading line with M-<left> (org-metaleft) and M-<right> (org-metaright).

But when the cursor is not on a heading, it says:

These commands execute their global bindings if invoked on a body line.

I think this is what @llcc was asking about. Is there a way to respect the org bindings when the cursor is on a heading, and continue to use drag-stuff bindings when the cursor is on a body line?

rejeep commented 7 years ago

Drag stuff will not support specific modes like that. Seems like that could be done with some simple key bindings, for example (not tested):

(define-key org-mode-map (kbd "<M-up>")
  (lambda ()
    (interactive)
    (call-interactively
     (if (org-at-heading-p)
         'org-metaup
       'drag-stuff-up))))

(define-key org-mode-map (kbd "<M-down>")
  (lambda ()
    (interactive)
    (call-interactively
     (if (org-at-heading-p)
         'org-metadown
       'drag-stuff-down))))