浏览代码

org.el: New function `org-at-drawer-p'.

* org.el (org-at-drawer-p): New function.
(org-end-of-line): Use it.

This function make the behavior of C-e in folded drawers consistent
with C-e in folded subtrees: in this case, point moves to the last
invisible characters of the line, not to the last character.
Bastien Guerry 13 年之前
父节点
当前提交
356611bf07
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      lisp/org.el

+ 10 - 1
lisp/org.el

@@ -20426,7 +20426,7 @@ beyond the end of the headline."
 		   org-special-ctrl-a/e)))
     (cond
      ((or (not special) arg
-	  (not (or (org-on-heading-p) (org-at-item-p))))
+	  (not (or (org-on-heading-p) (org-at-item-p) (org-at-drawer-p))))
       (call-interactively
        (cond ((org-bound-and-true-p line-move-visual) 'end-of-visual-line)
 	     ((fboundp 'move-end-of-line) 'move-end-of-line)
@@ -20446,6 +20446,9 @@ beyond the end of the headline."
 	  (call-interactively (if (fboundp 'move-end-of-line)
 				  'move-end-of-line
 				'end-of-line)))))
+     ((org-at-drawer-p)
+      (move-end-of-line 1)
+      (when (overlays-at (1- (point))) (backward-char 1)))
      ;; At an item: Move before any hidden text.
      (t (call-interactively 'end-of-line)))
     (org-no-warnings
@@ -20641,6 +20644,12 @@ This version does not only check the character property, but also
 (defun org-at-heading-p (&optional ignored)
   (outline-on-heading-p t))
 
+(defun org-at-drawer-p nil
+  "Whether point is at a drawer."
+  (save-excursion
+    (move-beginning-of-line 1)
+    (looking-at org-drawer-regexp)))
+
 (defun org-point-at-end-of-empty-headline ()
   "If point is at the end of an empty headline, return t, else nil.
 If the heading only contains a TODO keyword, it is still still considered