From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: Arrow + RET navigation in org Date: Fri, 7 Aug 2009 12:11:05 -0700 Message-ID: <20524da70908071211y4aeb4c0se9a465e2ebe27a8f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZUqN-0000Hc-Ni for emacs-orgmode@gnu.org; Fri, 07 Aug 2009 15:11:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZUqJ-0000HI-Gk for emacs-orgmode@gnu.org; Fri, 07 Aug 2009 15:11:11 -0400 Received: from [199.232.76.173] (port=58940 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZUqJ-0000HF-CA for emacs-orgmode@gnu.org; Fri, 07 Aug 2009 15:11:07 -0400 Received: from mail-gx0-f219.google.com ([209.85.217.219]:33854) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MZUqJ-000300-1y for emacs-orgmode@gnu.org; Fri, 07 Aug 2009 15:11:07 -0400 Received: by gxk19 with SMTP id 19so2298120gxk.18 for ; Fri, 07 Aug 2009 12:11:06 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Geralt , emacs-orgmode@gnu.org (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?