[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Arrow + RET navigation in org
From: |
Samuel Wales |
Subject: |
[Orgmode] Arrow + RET navigation in org |
Date: |
Fri, 7 Aug 2009 12:11:05 -0700 |
(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?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] Arrow + RET navigation in org,
Samuel Wales <=