فهرست منبع

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.
Carsten Dominik 15 سال پیش
والد
کامیت
f3b5524a2e
2فایلهای تغییر یافته به همراه15 افزوده شده و 0 حذف شده
  1. 5 0
      lisp/ChangeLog
  2. 10 0
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2010-05-13  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* 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.
 

+ 10 - 0
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