From mboxrd@z Thu Jan 1 00:00:00 1970 From: 42 147 Subject: Re: org-meta-return Date: Wed, 20 Feb 2013 18:28:00 -0500 Message-ID: References: <5387.1361401155@alphaville> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec517acd21c841904d6304f35 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8J59-0002Gc-2P for emacs-orgmode@gnu.org; Wed, 20 Feb 2013 18:28:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8J4z-0004mL-RM for emacs-orgmode@gnu.org; Wed, 20 Feb 2013 18:28:10 -0500 Received: from mail-ve0-f174.google.com ([209.85.128.174]:40009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8J4z-0004m6-I7 for emacs-orgmode@gnu.org; Wed, 20 Feb 2013 18:28:01 -0500 Received: by mail-ve0-f174.google.com with SMTP id pb11so7503208veb.33 for ; Wed, 20 Feb 2013 15:28:00 -0800 (PST) In-Reply-To: <5387.1361401155@alphaville> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Org Mode --bcaec517acd21c841904d6304f35 Content-Type: text/plain; charset=ISO-8859-1 > You can also use on an empty headline to cycle through the various > levels: +1 level, -1 level, -2..n levels (until it reaches the top level > "*"), and then back to the level it was created at. Good to know, but I ended up with a simple defun and org-mode-hook. Will probably add what you said to my arsenal, however. My hands might be smaller than average, or, at least, smaller than yours. To reach I must shift my entire arm to the right and downward. To reach no such movement is necessary. Maybe a slight turn of the wrist to the right. > Of course, these things are *highly* personal preferences, and you might > have a lower tolerance for pain than I have, but I have to ask: where > exactly is your key relative to ? Warning, digression: I'm ultra cautious about finger / wrist strain. Even if I feel slight discomfort from a keybinding, I will change it to be more ergonomic and strain-free. Practically every basic Emacs movement command has been rebound for optimum comfort as a QWERTY typist. Many of the default Emacs keybindings are notational, not positional. For example, C-p and C-n. I've made them all positional. C-p / C-] are now paired together for previous-line / next-line. C-q / C-e for beginning-of-line / end-of-line. From a positional standpoint, C-p / C-n makes absolutely no sense. 2013/2/20 Nick Dokos > 42 147 wrote: > > > > M-RET M- > > > > Appreciate the reply, but that's worse than what I was doing. M- > > is not anywhere close to my high frequency areas of finger activity > > I've changed all such keybindings. > > > > In all three keyboards I use regularly, is fairly close to > (and to the right Control key): I can reach it fairly easily with my > right pinky, same as with - it does require a bigger stretch for > the full-size keyboards than it does on the laptop keyboard - although > I'm a sufficiently bad typist that I often have to resort to looking at > the keyboard in such situations, in which case I use my right index > finger (for as well as or other arrow key). > > That's not too bad because it's not as if this is a frequent activity > for me. Org's standard keymaps also use arrow keys fairly heavily, so > changing all of them sounds like a lot of work: I've tried swimming > against such tides before, but invariably I have given up exhausted, > gone back to the standard keymap and lived a much happier life. > > Of course, these things are *highly* personal preferences, and you might > have a lower tolerance for pain than I have, but I have to ask: where > exactly is your key relative to ? How far > > > I notice that C-M-RET is undefined. If anyone wants to add the > > functionality as described in my original post, and bind it to that key > > chord, I would be grateful; in the meantime, I'll create a macro / > > interactive defun to do the same. > > > > If, despite my warnings, you still want to proceed, you can do something > like this (lightly tested) - add it to the end of your .emacs: > > --8<---------------cut here---------------start------------->8--- > (defun my-org-control-meta-return () > "Assume we are in headline context: open a new headline one level > below the current one." > (interactive) > (org-insert-heading) > (org-metaright)) > > (defun my-org-mode-hook () > (define-key org-mode-map (org-key [(control meta return)]) > 'my-org-control-meta-return)) > > (add-hook 'org-mode-hook (function my-org-mode-hook)) > --8<---------------cut here---------------end--------------->8--- > > Although I use some org facilities above (org-key in particular), this > is a general process which you might want to add to your arsenal of > emacs techniques: > > o Define a hook (a function of no arguments) and add it to the mode's > hook. When the mode is loaded, it runs its mode hook as the last thing > it does. > > o The hook (re)defines a key in some keymap (org-mode-map above), > binding a function of your choosing to the key. It can of course do > other things as well (or in place of redefining keys). > > o Finally, write the function that's to be bound to the key. This is > absolutely at your discretion: make it do whatever you want it to do > when you press that key. > > Note however that org-meta-return checks the context that it is called > from and does the Right Thing (tm). my-org-control-meta-return just > assumes it's at a headline context and proceeds blindly, e.g. if you do > C-M-RET in a table, you'll probably mess up the table. Making it > bullet-proof is left as an exercise for the interested reader. > > Read more about hooks at > > (info "(emacs) Hooks") > > Nick > --bcaec517acd21c841904d6304f35 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > You can also use <TAB> on an empty headline to cycle through the= various
> levels: +1 level, -1 level, -2..n levels (until it reaches= the top level
> "*"), and then back to the level it was cr= eated at.

Good to know, but I ended up with a simple defun and org-mode-hook. Wil= l
probably add what you said to my arsenal, however.

My hands mig= ht be smaller than average, or, at least, smaller than yours.
To reach &= lt;right> I must shift my entire arm to the right and
downward. To reach <RET> no such movement is necessary. Maybe a sligh= t
turn of the wrist to the right.

> Of course, these things ar= e *highly* personal preferences, and you might
> have a lower toleran= ce for pain than I have, but I have to ask: where
> exactly is your <right> key relative to <RET>?

Warn= ing, digression:

I'm ultra cautious about finger / wrist strain.= Even if I feel slight
discomfort from a keybinding, I will change it to= be more ergonomic and
strain-free. Practically every basic Emacs movement command has been
reb= ound for optimum comfort as a QWERTY typist.

Many of the default Ema= cs keybindings are notational, not positional. For
example, C-p and C-n.= I've made them all positional. C-p / C-] are now
paired together for previous-line / next-line. C-q / C-e for
beginning-o= f-line / end-of-line. From a positional standpoint, C-p / C-n
makes abso= lutely no sense.


2013/2/20 Nick Dokos= <nicholas.dokos@hp.com>
42 147 <aeuster@gmail.com> wrote:

> > M-RET M-<right>
>
> Appreciate the reply, but that's worse than what I was doing. M-&l= t;right>
> is not anywhere close to my high frequency areas of finger activity
> I've changed all such keybindings.
>

In all three keyboards I use regularly, <right> is fairly close= to <RET>
(and to the right Control key): I can reach it fairly easily with my
right pinky, same as with <RET> - it does require a bigger stretch fo= r
the full-size keyboards than it does on the laptop keyboard - although
I'm a sufficiently bad typist that I often have to resort to looking at=
the keyboard in such situations, in which case I use my right index
finger (for <RET> as well as <right> or other arrow key).

That's not too bad because it's not as if this is a frequent activi= ty
for me. Org's standard keymaps also use arrow keys fairly heavily, so changing all of them sounds like a lot of work: I've tried swimming
against such tides before, but invariably I have given up exhausted,
gone back to the standard keymap and lived a much happier life.

Of course, these things are *highly* personal preferences, and you might have a lower tolerance for pain than I have, but I have to ask: where
exactly is your <right> key relative to <RET>? How far

> I notice that C-M-RET is undefined. If anyone wants to add the
> functionality as described in my original post, and bind it to that ke= y
> chord, I would be grateful; in the meantime, I'll create a macro /=
> interactive defun to do the same.
>

If, despite my warnings, you still want to proceed, you can do someth= ing
like this (lightly tested) - add it to the end of your .emacs:

--8<---------------cut here---------------start------------->8---
(defun my-org-control-meta-return ()
=A0 =A0 =A0 =A0"Assume we are in headline context: open a new headline= one level
=A0 =A0 =A0 =A0below the current one."
=A0 =A0 =A0 =A0(interactive)
=A0 =A0 =A0 =A0(org-insert-heading)
=A0 =A0 =A0 =A0(org-metaright))

(defun my-org-mode-hook ()
=A0 =A0 =A0 =A0(define-key org-mode-map (org-key [(control meta return)]) &= #39;my-org-control-meta-return))

(add-hook 'org-mode-hook (function my-org-mode-hook))
--8<---------------cut here---------------end--------------->8---

Although I use some org facilities above (org-key in particular), this
is a general process which you might want to add to your arsenal of
emacs techniques:

o Define a hook (a function of no arguments) and add it to the mode's =A0 hook. When the mode is loaded, it runs its mode hook as the last thing<= br> =A0 it does.

o The hook (re)defines a key in some keymap (org-mode-map above),
=A0 binding a function of your choosing to the key. It can of course do
=A0 other things as well (or in place of redefining keys).

o Finally, write the function that's to be bound to the key. This is =A0 absolutely at your discretion: make it do whatever you want it to do =A0 when you press that key.

Note however that org-meta-return checks the context that it is called
from and does the Right Thing (tm). my-org-control-meta-return just
assumes it's at a headline context and proceeds blindly, e.g. if you do=
C-M-RET in a table, you'll probably mess up the table. =A0Making it
bullet-proof is left as an exercise for the interested reader.

Read more about hooks at

=A0 =A0 =A0(info "(emacs) Hooks")

Nick

--bcaec517acd21c841904d6304f35--