Browse Source

Pass LIMIT argument to org-looking-back

* lisp/org-mouse.el (org-mouse-insert-item):
(org-mouse-context-menu):
* lisp/org-pcomplete.el (org-thing-at-point):
* lisp/org.el (org-read-date-minibuffer-local-map):
(org-timestamp-change): Provide LIMIT argument to org-looking-back.
* lisp/org.el (org-read-date-minibuffer-local-map):
(org-insert-heading): Replace looking-back with org-looking-back.

As of Emacs 25, the LIMIT argument to looking-back is advertised as a
required argument.
Kyle Meyer 4 years ago
parent
commit
e802936f4b
3 changed files with 11 additions and 7 deletions
  1. 3 2
      lisp/org-mouse.el
  2. 4 2
      lisp/org-pcomplete.el
  3. 4 3
      lisp/org.el

+ 3 - 2
lisp/org-mouse.el

@@ -586,7 +586,7 @@ This means, between the beginning of line and the point."
     (:end				; insert text here
      (skip-chars-backward " \t")
      (kill-region (point) (point-at-eol))
-     (unless (org-looking-back org-mouse-punctuation)
+     (unless (org-looking-back org-mouse-punctuation (line-beginning-position))
        (insert (concat org-mouse-punctuation " ")))))
   (insert text)
   (beginning-of-line))
@@ -644,7 +644,8 @@ 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" (- (point) 2))))
+	       (org-looking-back "  \\|\t" (- (point) 2)
+				 (line-beginning-position))))
       (org-mouse-popup-global-menu))
      ((funcall get-context :checkbox)
       (popup-menu

+ 4 - 2
lisp/org-pcomplete.el

@@ -93,8 +93,10 @@ The return value is a string naming the thing at point."
 	     (skip-chars-backward "[ \t\n]")
 	     ;; org-drawer-regexp matches a whole line but while
 	     ;; looking-back, we just ignore trailing whitespaces
-	     (or (org-looking-back (substring org-drawer-regexp 0 -1))
-		 (org-looking-back org-property-re))))
+	     (or (org-looking-back (substring org-drawer-regexp 0 -1)
+				   (line-beginning-position))
+		 (org-looking-back org-property-re
+				   (line-beginning-position)))))
       (cons "prop" nil))
      ((and (equal (char-before beg1) ?:)
 	   (not (equal (char-after (point-at-bol)) ?*)))

+ 4 - 3
lisp/org.el

@@ -7844,7 +7844,7 @@ heading, unconditionally."
 	      (re-search-forward org-outline-regexp-bol)
 	      (beginning-of-line 0))
 	    (skip-chars-backward " \r\t\n")
-	    (and (not (looking-back "^\\*+" (line-beginning-position)))
+	    (and (not (org-looking-back "^\\*+" (line-beginning-position)))
 		 (looking-at "[ \t]+") (replace-match ""))
 	    (unless (eobp) (forward-char 1))
 	    (when (looking-at "^\\*")
@@ -16770,7 +16770,7 @@ So these are more for recording a certain time/date."
     (org-defkey map (kbd ".")
                 (lambda () (interactive)
 		  ;; Are we at the beginning of the prompt?
-		  (if (looking-back "^[^:]+: ")
+		  (if (org-looking-back "^[^:]+: " (line-beginning-position))
 		      (org-eval-in-calendar '(calendar-goto-today))
 		    (insert "."))))
     (org-defkey map (kbd "C-.")
@@ -18063,7 +18063,8 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"."
 	    (message "No clock to adjust")
 	  (cond ((save-excursion ; fix previous clock?
 		   (re-search-backward org-ts-regexp0 nil t)
-		   (org-looking-back (concat org-clock-string " \\[")))
+		   (org-looking-back (concat org-clock-string " \\[")
+				     (line-beginning-position)))
 		 (setq fixnext 1 clrgx (concat org-ts-regexp0 "\\] =>.*$")))
 		((save-excursion ; fix next clock?
 		   (re-search-backward org-ts-regexp0 nil t)