From f3b5524a2e02b0353724e1150096d4dfd34caa58 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 13 May 2010 08:59:39 +0200 Subject: [PATCH] Make C-M-a and C-M-e do the right thing in Org-mode The commands now move back to the heading, and to the end of the subtree, respectively. Proposed by Lennard Borgmann. --- lisp/ChangeLog | 5 +++++ lisp/org.el | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 04c9ecb0e..3772a0b7c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2010-05-13 Carsten Dominik + * org.el (org-beginning-of-defun, org-end-of-defun): New + functions. + (org-mode): Install the `org-beginning-of-defun' and + `org-end-of-defun' functions. + * org-latex.el (org-export-latex-keywords-maybe): Protect the TODO markup. diff --git a/lisp/org.el b/lisp/org.el index 18fbc57f9..06daa9c7e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4465,6 +4465,9 @@ The following commands are available: (org-set-autofill-regexps) (setq indent-line-function 'org-indent-line-function) (org-update-radio-target-regexp) + ;; Beginning/end of defun + (org-set-local 'beginning-of-defun-function 'org-beginning-of-defun) + (org-set-local 'end-of-defun-function 'org-end-of-defun) ;; Make sure dependence stuff works reliably, even for users who set it ;; too late :-( (if org-enforce-todo-dependencies @@ -18349,6 +18352,13 @@ interactive command with similar behavior." (error (error "Before first headline at position %d in buffer %s" (point) (current-buffer))))) +(defun org-beginning-of-defun () + "Go to the beginning of the subtree, i.e. back to the heading." + (org-back-to-heading)) +(defun org-end-of-defun () + "Go to the end of the subtree." + (org-end-of-subtree nil t)) + (defun org-before-first-heading-p () "Before first heading?" (save-excursion