From: Nick Dokos <nicholas.dokos@hp.com>
To: 42 147 <aeuster@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: org-meta-return
Date: Wed, 20 Feb 2013 17:59:15 -0500 [thread overview]
Message-ID: <5387.1361401155@alphaville> (raw)
In-Reply-To: Message from 42 147 <aeuster@gmail.com> of "Wed, 20 Feb 2013 16:17:48 EST." <CAMgvimHoHsk56soZNS8oj1KHUxeuaSYtqMy+Lj+K3Cc76ogk6w@mail.gmail.com>
42 147 <aeuster@gmail.com> wrote:
> > M-RET M-<right>
>
> Appreciate the reply, but that's worse than what I was doing. M-<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 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 <RET> as well as <right> 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 <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 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
next prev parent reply other threads:[~2013-02-20 22:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 19:32 org-meta-return 42 147
2013-02-20 19:40 ` org-meta-return Suvayu Ali
2013-02-20 21:17 ` org-meta-return 42 147
2013-02-20 21:57 ` org-meta-return Jonathan Leech-Pepin
2013-02-20 22:33 ` org-meta-return Suvayu Ali
2013-02-20 22:59 ` Nick Dokos [this message]
2013-02-20 23:25 ` org-meta-return W. Greenhouse
2013-02-20 23:28 ` org-meta-return 42 147
2013-02-21 0:11 ` org-meta-return Nick Dokos
2013-02-21 0:43 ` org-meta-return Suvayu Ali
2013-02-21 1:10 ` org-meta-return Nick Dokos
2013-02-26 9:03 ` org-meta-return Eric S Fraga
2013-02-26 11:10 ` org-meta-return Sebastien Vauban
2013-02-26 13:16 ` org-meta-return Suvayu Ali
2013-02-26 15:54 ` org-meta-return Eric S Fraga
2013-02-21 21:16 ` org-meta-return 42 147
2013-02-23 3:30 ` org-meta-return James Harkins
2013-03-02 20:43 ` org-meta-return Michael Brand
2013-03-02 23:59 ` org-meta-return 42 147
2013-03-03 10:08 ` org-meta-return Michael Brand
2013-03-03 10:44 ` org-meta-return Eric Abrahamsen
-- strict thread matches above, loose matches on Subject: below --
2016-10-31 0:16 org-meta-return 42 147
2016-10-31 11:10 ` org-meta-return Nicolas Goaziou
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=5387.1361401155@alphaville \
--to=nicholas.dokos@hp.com \
--cc=aeuster@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).