Browse Source

Backport commit c9a75a4 from Emacs master branch

* lisp/org.el (org-insert-heading, org-sort-entries):
* lisp/org-mouse.el (org-mouse-end-headline)
(org-mouse-context-menu):
* lisp/org-clock.el (org-clock-cancel):
Add explicit second arg to looking-back.

Fix byte-compiler warnings about looking-back.
c9a75a4030a556d700fd95222ec0bf4c1a9f67b5
Stefan Monnier
Mon Apr 20 21:55:00 2015 -0400
Stefan Monnier 4 years ago
parent
commit
c6164293fc
3 changed files with 7 additions and 5 deletions
  1. 2 1
      lisp/org-clock.el
  2. 2 2
      lisp/org-mouse.el
  3. 3 2
      lisp/org.el

+ 2 - 1
lisp/org-clock.el

@@ -1656,7 +1656,8 @@ Optional argument N tells to change by that many units."
   (save-excursion ; Do not replace this with `with-current-buffer'.
     (org-no-warnings (set-buffer (org-clocking-buffer)))
     (goto-char org-clock-marker)
-    (if (org-looking-back (concat "^[ \t]*" org-clock-string ".*"))
+    (if (org-looking-back (concat "^[ \t]*" org-clock-string ".*")
+                          (line-beginning-position))
 	(progn (delete-region (1- (point-at-bol)) (point-at-eol))
 	       (org-remove-empty-drawer-at "LOGBOOK" (point)))
       (message "Clock gone, cancel the timer anyway")

+ 2 - 2
lisp/org-mouse.el

@@ -191,7 +191,7 @@ Changing this variable requires a restart of Emacs to get activated."
   (interactive)
   (end-of-line)
   (skip-chars-backward "\t ")
-  (when (org-looking-back ":[A-Za-z]+:")
+  (when (org-looking-back ":[A-Za-z]+:" (line-beginning-position))
     (skip-chars-backward ":A-Za-z")
     (skip-chars-backward "\t ")))
 
@@ -645,7 +645,7 @@ This means, between the beginning of line and the point."
 					'org-mode-restart))))
      ((or (eolp)
 	  (and (looking-at "\\(  \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\(  \\|\t\\)+$")
-	       (org-looking-back "  \\|\t")))
+	       (org-looking-back "  \\|\t" (- (point) 2))))
       (org-mouse-popup-global-menu))
      ((funcall get-context :checkbox)
       (popup-menu

+ 3 - 2
lisp/org.el

@@ -7683,7 +7683,7 @@ command."
 	      (re-search-forward org-outline-regexp-bol)
 	      (beginning-of-line 0))
 	    (skip-chars-backward " \r\n")
-	    (and (not (looking-back "^\*+"))
+	    (and (not (looking-back "^\*+" (line-beginning-position)))
 		 (looking-at "[ \t]+") (replace-match ""))
 	    (unless (eobp) (forward-char 1))
 	    (when (looking-at "^\\*")
@@ -8662,7 +8662,8 @@ links."
 	 (when (equal (marker-buffer org-clock-marker) (current-buffer))
 	   (save-excursion
 	     (goto-char org-clock-marker)
-	     (looking-back "^.*") (match-string-no-properties 0))))
+             (buffer-substring-no-properties (line-beginning-position)
+                                             (point)))))
         start beg end stars re re2
         txt what tmp)
     ;; Find beginning and end of region to sort