Browse Source

Merge branch 'maint'

Bastien Guerry 11 years ago
parent
commit
7384c96954
2 changed files with 12 additions and 15 deletions
  1. 8 5
      lisp/org-mouse.el
  2. 4 10
      lisp/org.el

+ 8 - 5
lisp/org-mouse.el

@@ -953,20 +953,23 @@ This means, between the beginning of line and the point."
 		       (point)
 		       (point)
 		       (save-excursion (goto-char start)
 		       (save-excursion (goto-char start)
 				       (org-back-to-heading) (point))))
 				       (org-back-to-heading) (point))))
-	    (outline-end-of-subtree)
+	    (progn (org-end-of-subtree nil t)
+		   (unless (eobp) (backward-char)))
 	    (end-of-line)
 	    (end-of-line)
 	    (if (eobp) (newline) (forward-char)))
 	    (if (eobp) (newline) (forward-char)))
 
 
 	  (when (looking-at org-outline-regexp)
 	  (when (looking-at org-outline-regexp)
 	    (let ((level (- (match-end 0) (match-beginning 0))))
 	    (let ((level (- (match-end 0) (match-beginning 0))))
 	      (when (> end (match-end 0))
 	      (when (> end (match-end 0))
-		(outline-end-of-subtree)
+		(progn (org-end-of-subtree nil t)
+		       (unless (eobp) (backward-char)))
 		(end-of-line)
 		(end-of-line)
 		(if (eobp) (newline) (forward-char))
 		(if (eobp) (newline) (forward-char))
 		(setq level (1+ level)))
 		(setq level (1+ level)))
 	      (org-paste-subtree level)
 	      (org-paste-subtree level)
 	      (save-excursion
 	      (save-excursion
-		(outline-end-of-subtree)
+		(progn (org-end-of-subtree nil t)
+		       (unless (eobp) (backward-char)))
 		(when (bolp) (delete-char -1))))))))))
 		(when (bolp) (delete-char -1))))))))))
 
 
 
 
@@ -1003,8 +1006,8 @@ This means, between the beginning of line and the point."
 	   (org-mouse-main-buffer (current-buffer)))
 	   (org-mouse-main-buffer (current-buffer)))
       (when (eq (with-current-buffer buffer major-mode) 'org-mode)
       (when (eq (with-current-buffer buffer major-mode) 'org-mode)
 	(let ((endmarker (with-current-buffer buffer
 	(let ((endmarker (with-current-buffer buffer
-			   (outline-end-of-subtree)
-			   (forward-char 1)
+			   (org-end-of-subtree nil t)
+			   (unless (eobp) (forward-char 1))
 			   (copy-marker (point)))))
 			   (copy-marker (point)))))
 	  (org-with-remote-undo buffer
 	  (org-with-remote-undo buffer
 	    (with-current-buffer buffer
 	    (with-current-buffer buffer

+ 4 - 10
lisp/org.el

@@ -6822,7 +6822,8 @@ in special contexts.
 	    (setq has-children (org-list-has-child-p (point) struct)))
 	    (setq has-children (org-list-has-child-p (point) struct)))
 	(org-back-to-heading)
 	(org-back-to-heading)
 	(setq eoh (save-excursion (outline-end-of-heading) (point)))
 	(setq eoh (save-excursion (outline-end-of-heading) (point)))
-	(setq eos (save-excursion (1- (org-end-of-subtree t t))))
+	(setq eos (save-excursion (org-end-of-subtree t t)
+				  (when (bolp) (backward-char)) (point)))
 	(setq has-children
 	(setq has-children
 	      (or (save-excursion
 	      (or (save-excursion
 		    (let ((level (funcall outline-level)))
 		    (let ((level (funcall outline-level)))
@@ -8271,7 +8272,8 @@ case."
     (save-match-data
     (save-match-data
       (save-excursion (outline-end-of-heading)
       (save-excursion (outline-end-of-heading)
 		      (setq folded (outline-invisible-p)))
 		      (setq folded (outline-invisible-p)))
-      (outline-end-of-subtree))
+      (progn (org-end-of-subtree nil t)
+	     (unless (eobp) (backward-char))))
     (outline-next-heading)
     (outline-next-heading)
     (setq ne-end (org-back-over-empty-lines))
     (setq ne-end (org-back-over-empty-lines))
     (setq end (point))
     (setq end (point))
@@ -23735,14 +23737,6 @@ If there is no such heading, return nil."
     		(forward-char -1))))))
     		(forward-char -1))))))
   (point))
   (point))
 
 
-(defadvice outline-end-of-subtree (around prefer-org-version activate compile)
-  "Use Org version in org-mode, for dramatic speed-up."
-  (if (derived-mode-p 'org-mode)
-      (progn
-	(org-end-of-subtree nil t)
-	(unless (eobp) (backward-char 1)))
-    ad-do-it))
-
 (defun org-end-of-meta-data-and-drawers ()
 (defun org-end-of-meta-data-and-drawers ()
   "Jump to the first text after meta data and drawers in the current entry.
   "Jump to the first text after meta data and drawers in the current entry.
 This will move over empty lines, lines with planning time stamps,
 This will move over empty lines, lines with planning time stamps,