emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matti De Craene <mattidecraene@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [Patch] M-Right and M-Left behave differently on headings and list items
Date: Mon, 19 Apr 2010 15:29:02 -0700	[thread overview]
Message-ID: <l2me4f0b2511004191529s16b84452kb4feea51f06353d4@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

Hello all,

When operating on a heading, M-Right/M-Left promotes or demotes one
heading only, and M-S-Right/M-S-Left promotes or demotes an entire
subtree.

When operating on list items however, there is no distinction between
M-Right/M-Left and M-S-Right/M-S-Left. Both key combinations operate
on the current item and on all subitems

Example: No difference between M-Right and M-S-Right on item 1 below:
- item 1
    - item 2
    - item 3

I find this behaviour somewhat confusing.

Attached patch seems to fix that for me.

Kind Regards,

Matti

[-- Attachment #2: M-right-M-left-on-list-items.patch --]
[-- Type: text/x-patch, Size: 970 bytes --]

diff --git a/lisp/org-list.el b/lisp/org-list.el
index d3bfb6b..05793e7 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -975,12 +975,15 @@ I.e. to the text after the last item."
     (setq firstp (org-first-list-item-p))
     (save-excursion
       (setq end (and (org-region-active-p) (region-end)))
-      (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
+      (if (and (memq last-command '(org-shiftmetaright org-shiftmetaleft))
+	        (memq this-command '(org-shiftmetaright org-shiftmetaleft)))
 	  (setq beg org-last-indent-begin-marker
 		end org-last-indent-end-marker)
 	(org-beginning-of-item)
 	(setq beg (move-marker org-last-indent-begin-marker (point)))
-	(org-end-of-item)
+	(if (memq this-command '(org-shiftmetaright org-shiftmetaleft))
+	  (org-end-of-item)
+	  (org-end-of-line))
 	(setq end (move-marker org-last-indent-end-marker (or end (point)))))
       (goto-char beg)
       (setq ind-bul (org-item-indent-positions)

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-04-19 22:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-19 22:29 Matti De Craene [this message]
2010-04-21 12:53 ` [Patch] M-Right and M-Left behave differently on headings and list items Carsten Dominik
2010-04-21 13:19   ` Sébastien Vauban
2010-04-21 13:27   ` Anthony Lander
2010-04-21 13:32   ` Bastien
2010-04-21 13:54     ` Carsten Dominik
2010-04-21 14:04       ` Bernt Hansen
2010-04-21 14:44       ` Dan Davison
2010-04-22 16:02         ` Carsten Dominik
2010-04-23  8:26           ` Carsten Dominik
2010-04-21 20:27       ` Matti De Craene
2010-04-21 21:07         ` Carsten Dominik
2010-04-22 10:15           ` Bastien
2010-04-22 20:37             ` Matti De Craene
2010-04-23  8:26             ` Carsten Dominik
2010-04-26 22:07               ` Matti De Craene
2010-04-27  5:57                 ` 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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=l2me4f0b2511004191529s16b84452kb4feea51f06353d4@mail.gmail.com \
    --to=mattidecraene@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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 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).