From: Samuel Wales <samologist@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Geralt <usr.gentoo@googlemail.com>, emacs-orgmode@gnu.org
Subject: Arrow + RET navigation in org
Date: Fri, 7 Aug 2009 12:11:05 -0700 [thread overview]
Message-ID: <20524da70908071211y4aeb4c0se9a465e2ebe27a8f@mail.gmail.com> (raw)
(Continuing from a previous thread about navigation to the top node.)
Another option is this. The relevant part is alpha-org-up.
The OP in the top node thread would use c-m-RET repeat. I use my own
(arrow key + RET) navigation scheme. I do the same for Lisp using
forward-sexp, forward-symbol, and backward-up-list.
Here is part of an incomplete table:
|---------------------+---------+--------+---------+------+--------+-----------|
| object | move | shift | mark | copy | kill | notes |
| | point | object | | | or del | |
|---------------------+---------+--------+---------+------+--------+-----------|
| sexp gnu same level | c-m-lr | c-m-t | c-m-SPC | | | mark-sexp |
| sexp gnu up/first | c-m-ud | | c-m-SPC | | | |
| defun gnu | c-m-ae | nyi | c-m-h | | | mark-defu |
| defun gnu | c-m-HE | nyi | c-m-h | | | home/end |
|---------------------+---------+--------+---------+------+--------+-----------|
| sexp my same level | c-m-lr | h- | c-m-SPC | | | |
| sexp my = symbol? | c-m-ud | h- | c-m-SPC | | | |
| sexp my up | c-m-RET | h- | c-m-SPC | | | |
| defun my | s-lr? | h-s-lr | c-m-h | | | |
|---------------------+---------+--------+---------+------+--------+-----------|
| org subtree | moot | m-s-ud | c-c @ | | | -> c-m-h |
| org headline | c-m-ud | m-ud | c-m-SPC | | | nyi mark |
| org head same level | c-m-lr | moot | c-m-SPC | | | |
| org head up | c-m-RET | moot | c-m-SPC | | | |
|---------------------+---------+--------+---------+------+--------+-----------|
Note that sometimes you want Lisp navigation in org mode buffers. I
have kludged this by looking for parentheses near point, but perhaps a
better job could be done by looking until the next/previous item or
headline for parentheses. If anybody implements that, please post or
send to me and I will post.
myc is just a macro that does (function (lambda () (interactive) ...)
for brevity.
(define-key org-mode-map [(control meta left)]
(myc (if (looking-back "[]()<>{}]")
(backward-sexp)
(outline-backward-same-level 1))))
(define-key org-mode-map [(control meta right)]
(myc (if (looking-at "[]()<>{}]")
(forward-sexp)
(outline-forward-same-level 1))))
(define-key org-mode-map [(control meta up)]
'outline-previous-visible-heading)
(define-key org-mode-map [(control meta down)]
'outline-next-visible-heading)
;;in gnu lisp, there is no separate up as i have. ud change level. lr go
;;back and forward at the same level. sounds simple in principle.
;;however, that makes it hard to go to the previous visible heading (or
;;last element of prev list in lisp): you have to do up, left, down, right
;;repeat.
;;
;;upshot: my way is more intuitive. ud goes ud, lr goes same level, ret
;;goes up.
(define-key org-mode-map [(control meta return)]
'alpha-org-up)
(defun alpha-org-up ()
"Go up by moving point to the next-highest
item or headline in the following sequence:
- the item
- the parent item
- the headline
- the parent headline
"
(interactive)
;;'invisible-ok
(cond
((org-at-item-p)
(org-beginning-of-item-list)
(backward-char 1)
(if (org-in-item-p)
(org-beginning-of-item)
(beginning-of-line)))
((org-in-item-p) (org-beginning-of-item))
((org-at-heading-p) (call-interactively 'outline-up-heading))
(t (outline-back-to-heading))))
I would like for the other 4 commands (udlr) to be modified to work
with lists then headlines just as alpha-org-up does. I have not been
able to do so. Anybody game?
reply other threads:[~2009-08-07 19:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20524da70908071211y4aeb4c0se9a465e2ebe27a8f@mail.gmail.com \
--to=samologist@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
--cc=usr.gentoo@googlemail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.