* Arrow + RET navigation in org
@ 2009-08-07 19:11 Samuel Wales
0 siblings, 0 replies; only message in thread
From: Samuel Wales @ 2009-08-07 19:11 UTC (permalink / raw)
To: Eric Schulte; +Cc: Geralt, emacs-orgmode
(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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-07 19:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 19:11 Arrow + RET navigation in org Samuel Wales
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.