]> code.delx.au - gnu-emacs/commitdiff
Fix byte-compiler warnings about looking-back.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 21 Apr 2015 01:55:00 +0000 (21:55 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 21 Apr 2015 01:55:00 +0000 (21:55 -0400)
* lisp/vc/log-view.el (log-view-end-of-defun-1):
* lisp/textmodes/tex-mode.el (latex-forward-sexp-1):
* lisp/textmodes/reftex-ref.el (reftex-goto-label):
* lisp/textmodes/bibtex.el (bibtex-insert-kill):
* lisp/progmodes/sh-script.el (sh--maybe-here-document):
* lisp/progmodes/ruby-mode.el (ruby-end-of-defun):
* lisp/progmodes/ada-mode.el (ada-in-numeric-literal-p):
* lisp/org/org.el (org-insert-heading, org-sort-entries):
* lisp/org/org-mouse.el (org-mouse-end-headline)
(org-mouse-context-menu):
* lisp/org/org-clock.el (org-clock-cancel):
* lisp/man.el (Man-default-man-entry):
* lisp/mail/rmail.el (rmail-get-new-mail, rmail-insert-inbox-text)
(rmail-ensure-blank-line):
* lisp/mail/footnote.el (Footnote-delete-footnote):
* lisp/mail/emacsbug.el (report-emacs-bug):
* lisp/info.el (Info-follow-reference, Info-fontify-node):
* lisp/info-look.el (info-lookup-guess-custom-symbol):
* lisp/help-fns.el (help-fns--key-bindings):
* lisp/files.el (hack-local-variables):
* lisp/emulation/viper-ex.el (viper-get-ex-token, ex-cmd-complete)
(viper-get-ex-pat, ex-expand-filsyms, viper-get-ex-file)
(viper-complete-filename-or-exit):
* lisp/emulation/viper-cmd.el (viper-backward-indent):
* lisp/emacs-lisp/lisp-mode.el (calculate-lisp-indent):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/cus-edit.el (custom-face-edit-value-create):
* lisp/calendar/todo-mode.el (todo-set-item-priority)
(todo-filter-items-1, todo-convert-legacy-files)
(todo-prefix-overlays): Add explicit second arg to looking-back.

26 files changed:
etc/NEWS
lisp/calendar/todo-mode.el
lisp/cus-edit.el
lisp/emacs-lisp/elint.el
lisp/emacs-lisp/lisp-mnt.el
lisp/emacs-lisp/lisp-mode.el
lisp/emulation/viper-cmd.el
lisp/emulation/viper-ex.el
lisp/files.el
lisp/help-fns.el
lisp/info-look.el
lisp/info.el
lisp/mail/emacsbug.el
lisp/mail/footnote.el
lisp/mail/rmail.el
lisp/man.el
lisp/org/org-clock.el
lisp/org/org-mouse.el
lisp/org/org.el
lisp/progmodes/ada-mode.el
lisp/progmodes/ruby-mode.el
lisp/progmodes/sh-script.el
lisp/textmodes/bibtex.el
lisp/textmodes/reftex-ref.el
lisp/textmodes/tex-mode.el
lisp/vc/log-view.el

index 9dd0e1512cc18694e5226c043e4d32c68c290d58..804b819a8bee7eebe0745bd17b38019ff3b1fa5f 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -233,7 +233,9 @@ Unicode standards.
 \f
 * Changes in Specialized Modes and Packages in Emacs 25.1
 ** In xterms, killing text now also sets the CLIPBOARD/PRIMARY selection
-in the surrounding GUI (using the OSC-52 escape sequence).
+in the surrounding GUI (using the OSC-52 escape sequence).  This only works
+if your xterm supports it and enables the `allowWindowOps' options (disabled
+by default at least in Debian, for security reasons).
 
 ** xterm-mouse-mode now supports mouse-tracking (if your xterm supports it).
 
index dcc960fb9bfa81a6aa1737218cb12a6886198476..bb9316c81d76333a42efa3fc5f1337941abc9a48 100644 (file)
@@ -2606,7 +2606,8 @@ meaning to raise or lower the item's priority by one."
            ;; separator.
            (when (looking-back (concat "^"
                                        (regexp-quote todo-category-done)
-                                       "\n"))
+                                       "\n")
+                                (line-beginning-position 0))
              (todo-backward-item))))
        (todo-insert-with-overlays item)
        ;; If item was marked, restore the mark.
@@ -4231,7 +4232,8 @@ the values of FILTER and FILE-LIST."
                           (if (and (eobp)
                                    (looking-back
                                     (concat (regexp-quote todo-done-string)
-                                            "\n")))
+                                            "\n")
+                                     (line-beginning-position 0)))
                               (delete-region (point) (progn
                                                        (forward-line -2)
                                                        (point))))))
@@ -4648,7 +4650,7 @@ name in `todo-directory'.  See also the documentation string of
                ;; If the item ends with a non-comment parenthesis not
                ;; followed by a period, we lose (but we inherit that
                ;; problem from the legacy code).
-               (when (looking-back "(\\(.*\\)) ")
+               (when (looking-back "(\\(.*\\)) " (line-beginning-position))
                  (setq comment (match-string 1))
                  (replace-match "")
                  (insert "[" todo-comment-string ": " comment "]"))
@@ -5342,7 +5344,8 @@ of each other."
                     (looking-at todo-done-string-start)
                     (looking-back (concat "^"
                                           (regexp-quote todo-category-done)
-                                          "\n")))
+                                          "\n")
+                                   (line-beginning-position 0)))
            (setq num 1
                  done t))
          (setq prefix (concat (propertize
index 9cc2fa81d075c551196f0cef39be7aeb5156d94e..cd894f47263b1f6f7ed818a77640a71385e57fb6 100644 (file)
@@ -3115,7 +3115,7 @@ face attributes (as specified by a `default' defface entry)."
                    widget
                    (widget-get widget :default-face-attributes)))
         entry)
-    (unless (looking-back "^ *")
+    (unless (looking-back "^ *" (line-beginning-position))
       (insert ?\n))
     (insert-char ?\s (widget-get widget :extra-offset))
     (if (or alist defaults show-all)
index 136467046b4638e0c79d5ba7c2136566dafc975d..317e5a6fd3f58645e3c9f679ec43abdb28c03466 100644 (file)
@@ -374,7 +374,7 @@ Returns the forms."
        (let ((elint-current-pos (point)))
          ;; non-list check could be here too. errors may be out of seq.
          ;; quoted check cannot be elsewhere, since quotes skipped.
-         (if (looking-back "'")
+         (if (looking-back "'" (1- (point)))
              ;; Eg cust-print.el uses ' as a comment syntax.
              (elint-warning "Skipping quoted form `'%.20s...'"
                           (read (current-buffer)))
index fec172d05ca7a8bf0b6c56a731af520fb93f6836..104c23c210236e098e09ca403267bf7208d5ca7d 100644 (file)
@@ -437,9 +437,9 @@ This can be found in an RCS or SCCS header."
           ((re-search-forward
             (concat
              "@(#)"
-             (if buffer-file-name
+              (if buffer-file-name
                   (regexp-quote (file-name-nondirectory buffer-file-name))
-                "[^\t\n]*")
+                "[^\t\n]+")
              "\t\\([012345679.]*\\)")
             header-max t)
            (match-string-no-properties 1)))))))
index 26a21d52370db574abe154ecd0b4558f0d243b58..108d5ccb0e300f6a9b4b427bb23216fa52691029 100644 (file)
@@ -855,9 +855,10 @@ is the buffer position of the start of the containing expression."
                       ;; Handle prefix characters and whitespace
                       ;; following an open paren.  (Bug#1012)
                        (backward-prefix-chars)
-                       (while (and (not (looking-back "^[ \t]*\\|([ \t]+"))
-                                   (or (not containing-sexp)
-                                       (< (1+ containing-sexp) (point))))
+                       (while (not (or (looking-back "^[ \t]*\\|([ \t]+"
+                                                      (line-beginning-position))
+                                       (and containing-sexp
+                                            (>= (1+ containing-sexp) (point)))))
                          (forward-sexp -1)
                          (backward-prefix-chars))
                        (setq calculate-lisp-indent-last-sexp (point)))
index bd03a870fdb3f811e8ca479df19d2ddc5375cc56..5c91df9016687226dcbc4db59794820bfdd7a9dd 100644 (file)
@@ -4533,7 +4533,7 @@ One can use `` and '' to temporarily jump 1 step back."
   (interactive)
   (if viper-cted
       (let ((p (point)) (c (current-column)) bol (indent t))
-       (if (looking-back "[0^]")
+       (if (looking-back "[0^]" (1- (point)))
            (progn
              (if (eq ?^ (preceding-char))
                  (setq viper-preserve-indent t))
@@ -4545,7 +4545,7 @@ One can use `` and '' to temporarily jump 1 step back."
        (delete-region (point) p)
        (if indent
            (indent-to (- c viper-shift-width)))
-       (if (or (bolp) (looking-back "[^ \t]"))
+       (if (or (bolp) (looking-back "[^ \t]" (1- (point))))
            (setq viper-cted nil)))))
 
 ;; do smart indent
index 212f0533b8fa9c881cfa5b7c554625d5aa413904..e6bcf8f89a49e0d20c03f0f69052ee4e6943ec0c 100644 (file)
@@ -455,7 +455,8 @@ reversed."
               (while (and (not (eolp)) cont)
                 ;;(re-search-forward "[^/]*/")
                 (re-search-forward "[^/]*\\(/\\|\n\\)")
-                (if (not (looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
+                (if (not (looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"
+                                        (line-beginning-position 0)))
                     (setq cont nil))))
             (backward-char 1)
             (setq ex-token (buffer-substring (point) (mark t)))
@@ -468,7 +469,8 @@ reversed."
               (while (and (not (eolp)) cont)
                 ;;(re-search-forward "[^\\?]*\\?")
                 (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
-                (if (not (looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"))
+                (if (not (looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"
+                                        (line-beginning-position 0)))
                     (setq cont nil))
                 (backward-char 1)
                 (if (not (looking-at "\n")) (forward-char 1))))
@@ -563,14 +565,18 @@ reversed."
            save-pos (point)))
 
     (if (or (= dist 0)
-           (looking-back "\\([ \t]*['`][ \t]*[a-z]*\\)")
+           (looking-back "\\([ \t]*['`][ \t]*[a-z]*\\)"
+                          (line-beginning-position))
            (looking-back
-            "^[ \t]*[a-zA-Z!=>&~][ \t]*[/?]*[ \t]+[a-zA-Z!=>&~]+"))
+            "^[ \t]*[a-zA-Z!=>&~][ \t]*[/?]*[ \t]+[a-zA-Z!=>&~]+"
+             (line-beginning-position)))
        ;; Preceding characters are not the ones allowed in an Ex command
        ;; or we have typed past command name.
        ;; Note: we didn't do parsing, so there can be surprises.
-       (if (or (looking-back "[a-zA-Z!=>&~][ \t]*[/?]*[ \t]*")
-               (looking-back "\\([ \t]*['`][ \t]*[a-z]*\\)")
+       (if (or (looking-back "[a-zA-Z!=>&~][ \t]*[/?]*[ \t]*"
+                              (line-beginning-position))
+               (looking-back "\\([ \t]*['`][ \t]*[a-z]*\\)"
+                              (line-beginning-position))
                (looking-at "[^ \t\n\C-m]"))
            nil
          (with-output-to-temp-buffer "*Completions*"
@@ -747,7 +753,8 @@ reversed."
                        (error "Missing closing delimiter for global regexp")
                      (goto-char (point-max))))
                (if (not (looking-back
-                         (format "[^\\\\]\\(\\\\\\\\\\)*\\\\%c" c)))
+                         (format "[^\\\\]\\(\\\\\\\\\\)*\\\\%c" c)
+                          (line-beginning-position 0)))
                    (setq cont nil)
                  ;; we are at an escaped delimiter: unescape it and continue
                  (delete-char -2)
@@ -963,7 +970,7 @@ reversed."
       (while (re-search-forward "%\\|#" nil t)
        (let ((data (match-data))
              (char (buffer-substring (match-beginning 0) (match-end 0))))
-         (if (looking-back (concat "\\\\" char))
+         (if (looking-back "\\\\." (- (point) 2))
              (replace-match char)
            (store-match-data data)
            (if (string= char "%")
@@ -989,7 +996,7 @@ reversed."
                                  (get-buffer-create viper-ex-work-buf-name))
        (skip-chars-forward " \t")
        (if (looking-at "!")
-           (if (and (not (looking-back "[ \t]"))
+           (if (and (not (looking-back "[ \t]" (1- (point))))
                     ;; read doesn't have a corresponding :r! form, so ! is
                     ;; immediately interpreted as a shell command.
                     (not (string= ex-token "read")))
@@ -1066,7 +1073,7 @@ reversed."
   (cond ((ex-cmd-accepts-multiple-files-p ex-token) (exit-minibuffer))
        ;; apparently the argument to an Ex command is
        ;; supposed to be a shell command
-       ((looking-back "^[ \t]*!.*")
+       ((looking-back "^[ \t]*!.*" (line-beginning-position))
         (setq ex-cmdfile t)
         (insert " "))
        (t
index 0b011f4c363852fd8dfdbe91ba95cbac7074e31a..152f15542799cadb155586a9147e1e3eb9ecbe63 100644 (file)
@@ -3375,7 +3375,7 @@ local variables, but directory-local variables may still be applied."
                      (error "Local variables entry is missing the prefix"))
                    (end-of-line)
                    ;; Discard the suffix.
-                   (if (looking-back suffix)
+                   (if (looking-back suffix (line-beginning-position))
                        (delete-region (match-beginning 0) (point))
                      (error "Local variables entry is missing the suffix"))
                    (forward-line 1))
index 7ecd271d0c8e9f4c0fe8c87c11a2494498f18b28..53f4b38b9ecb1557d47115a500b0726017f92994 100644 (file)
@@ -329,7 +329,7 @@ suitable file is found, return nil."
 
       (with-current-buffer standard-output
         (fill-region-as-paragraph pt2 (point))
-        (unless (looking-back "\n\n")
+        (unless (looking-back "\n\n" (- (point) 2))
           (terpri))))))
 
 (defun help-fns--compiler-macro (function)
index 9cf185edf573d70e0ed3e7635da28dd4639b1f32..8a86dc816870c41838701d6b638cafc968f38202 100644 (file)
@@ -634,7 +634,8 @@ Return nil if there is nothing appropriate in the buffer near point."
                     (setq end (point))
                     (> end beg))
                (and (looking-at "[ \t\n]")
-                    (looking-back (concat "[" significant-chars "]"))
+                    (looking-back (concat "[" significant-chars "]")
+                                   (1- (point)))
                     (setq end (point))
                     (skip-chars-backward significant-chars)
                     (setq beg (point))
index 01596619476c3af8271eeef1219e9e881ed1c983..057bd77ba164ae8f36241577d2ad2315258cdd7b 100644 (file)
@@ -2577,7 +2577,9 @@ new buffer."
     (save-excursion
       ;; Move point to the beginning of reference if point is on reference
       (or (looking-at "\\*note[ \n\t]+")
-          (and (looking-back "\\*note[ \n\t]+")
+          (and (looking-back "\\*note[ \n\t]+"
+                             (save-excursion (skip-chars-backward " \n\t")
+                                             (line-beginning-position)))
                (goto-char (match-beginning 0)))
           (if (and (save-excursion
                      (goto-char (+ (point) 5)) ; skip a possible *note
@@ -4738,9 +4740,11 @@ first line or header line, and for breadcrumb links.")
                    ;; an end of sentence
                    (skip-syntax-backward " ("))
                   (setq other-tag
-                       (cond ((save-match-data (looking-back "\\<see"))
+                       (cond ((save-match-data (looking-back "\\<see"
+                                                              (- (point) 3)))
                               "")
-                             ((save-match-data (looking-back "\\<in"))
+                             ((save-match-data (looking-back "\\<in"
+                                                              (- (point) 2)))
                               "")
                              ((memq (char-before) '(nil ?\. ?! ??))
                                "See ")
index 8cd59006d8d29964ece0ac759d1ea36efc41c08f..f4ba2264dc89968b334b939d5e7ef980e630c94f 100644 (file)
@@ -295,7 +295,7 @@ usually do not have translators for other languages.\n\n")))
            (insert-buffer-substring message-buf beg-pos end-pos))))
     ;; After Recent messages, to avoid the messages produced by
     ;; list-load-path-shadows.
-    (unless (looking-back "\n")
+    (unless (looking-back "\n" (1- (point)))
       (insert "\n"))
     (insert "\n")
     (insert "Load-path shadows:\n")
index ea674434a2fbfc5bfcd05fd205d1fcdc9f357f12..86bb9e89618219808da7d0168c4f5c1c0deb6f61 100644 (file)
@@ -718,7 +718,7 @@ delete the footnote with that number."
                                         end
                                       (point-max))))
            (Footnote-goto-char-point-max)
-           (when (looking-back "\n\n")
+           (when (looking-back "\n\n" (- (point) 2))
              (kill-line -1))))))))
 
 (defun Footnote-renumber-footnotes (&optional arg)
index d150324fc79676c6a6125fe2729d6a296f2b83a3..74533f88fdf8a20273fe33ca01756e811667b85c 100644 (file)
@@ -1787,7 +1787,7 @@ not be a new one).  It returns non-nil if it got any new messages."
              ;; Make sure we end with a blank line unless there are
              ;; no messages, as required by mbox format (Bug#9974).
              (unless (bobp)
-               (while (not (looking-back "\n\n"))
+               (while (not (looking-back "\n\n" (- (point) 2)))
                  (insert "\n")))
              (setq found (or
                           (rmail-get-new-mail-1 file-name files delete-files)
@@ -2092,7 +2092,7 @@ Value is the size of the newly read mail after conversion."
            ;; Make sure the read-in mbox data properly ends with a
            ;; blank line unless it is of size 0.
            (unless (zerop size)
-             (while (not (looking-back "\n\n"))
+             (while (not (looking-back "\n\n" (- (point) 2)))
                (insert "\n")))
            (if (not (and rmail-preserve-inbox (string= file tofile)))
                (setq delete-files (cons tofile delete-files)))))
@@ -2127,7 +2127,7 @@ Value is the size of the newly read mail after conversion."
 Call with point at the end of the message."
   (unless (bolp)
     (insert "\n"))
-  (unless (looking-back "\n\n")
+  (unless (looking-back "\n\n" (- (point 2)))
     (insert "\n")))
 
 (defun rmail-add-mbox-headers ()
index d9124c24e00b20909bda6bab79f99f2339bae7e5..c5dbcba83a1c73933774f630f18f1618b18891f1 100644 (file)
@@ -747,7 +747,8 @@ POS defaults to `point'."
          ;; Record the distance traveled.
          (setq distance (- column (current-column)))
          (when (looking-back
-                (concat "([ \t]*\\(?:" Man-section-regexp "\\)[ \t]*)"))
+                (concat "([ \t]*\\(?:" Man-section-regexp "\\)[ \t]*)")
+                 (line-beginning-position))
            ;; Skip section number backwards.
            (goto-char (match-beginning 0))
            (skip-chars-backward " \t"))
index 41e799f9898a94b97c7aaa565aff7d58d2013a5b..c0a45b3ad13bab5b547c9763686f2024aebb13de 100644 (file)
@@ -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")
index 160099ff055cc38c4dd4f144287186f4d8abaa96..9b218147b6537576fdd0ee7bc29c3b9a007e675f 100644 (file)
@@ -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
index 3e032d4664667a6d98d83c33fc13eeb6d78f30da..54924a9964a5f1e0036f4a683621ade57ee02b2a 100644 (file)
@@ -7679,7 +7679,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 "^\\*")
@@ -8658,7 +8658,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
index 8afb92f2c90de783fe867508a3b6928bd8a2c597..c1bc79c599c7ea3092f2bc459cd66fd7c997069f 100644 (file)
@@ -1013,7 +1013,7 @@ If PARSE-RESULT is non-nil, use it instead of calling `parse-partial-sexp'."
 
 (defsubst ada-in-numeric-literal-p ()
   "Return t if point is after a prefix of a numeric literal."
-  (looking-back "\\([0-9]+#[0-9a-fA-F_]+\\)"))
+  (looking-back "\\([0-9]+#[0-9a-fA-F_]+\\)" (line-beginning-position)))
 
 ;;------------------------------------------------------------------
 ;; Contextual menus
index f2fb95ce59a86ce4d0feb453e9dd209793329aa7..0e2f66e5bc577b1be5a5f90c177981382a1c8a0d 100644 (file)
@@ -1392,7 +1392,8 @@ by `end-of-defun'."
   (interactive "p")
   (ruby-forward-sexp)
   (let (case-fold-search)
-    (when (looking-back (concat "^\\s *" ruby-block-end-re))
+    (when (looking-back (concat "^\\s *" ruby-block-end-re)
+                        (line-beginning-position))
       (forward-line 1))))
 
 (defun ruby-beginning-of-indent ()
index 135f945dbb9f19bda60e2b3005cb0ce2f0d37154..e4d16eb0ab624e66a96032aa8ab42c7b8baae79b 100644 (file)
@@ -4344,7 +4344,7 @@ The document is bounded by `sh-here-document-word'."
   (or arg (sh--maybe-here-document)))
 
 (defun sh--maybe-here-document ()
-  (or (not (looking-back "[^<]<<"))
+  (or (not (looking-back "[^<]<<" (line-beginning-position)))
       (save-excursion
        (backward-char 2)
         (or (sh-quoted-p)
index 5933559b37c216bba7279359f67e9ea6a1243801..8a018520f5ff5f8dde13da2644da330b9ffd9bdf 100644 (file)
@@ -2229,7 +2229,7 @@ Optional arg COMMA is as in `bibtex-enclosing-field'."
                        bibtex-entry-kill-ring))
       ;; If we copied an entry from a buffer containing only this one entry,
       ;; it can be missing the second "\n".
-      (unless (looking-back "\n\n") (insert "\n"))
+      (unless (looking-back "\n\n" (- (point 2))) (insert "\n"))
       (unless (functionp bibtex-reference-keys)
         ;; update `bibtex-reference-keys'
         (save-excursion
index be119d9db58682ba15714cd4ad27be431f6babc5..d0e09bff88051179c7ff52f71b3af2834c34e346 100644 (file)
@@ -857,7 +857,8 @@ Optional prefix argument OTHER-WINDOW goes to the label in another window."
          (docstruct (symbol-value reftex-docstruct-symbol))
         ;; If point is inside a \ref{} or \pageref{}, use that as
         ;; default value.
-        (default (when (looking-back "\\\\\\(?:page\\)?ref{[-a-zA-Z0-9_*.:]*")
+        (default (when (looking-back "\\\\\\(?:page\\)?ref{[-a-zA-Z0-9_*.:]*"
+                                      (line-beginning-position))
                    (reftex-this-word "-a-zA-Z0-9_*.:")))
          (label (completing-read (if default
                                     (format "Label (default %s): " default)
index e9c7e2f114e315ec54449579fd67082427dc0bdd..c26c6098364e1632e46d4c2de13d2c440ba0048d 100644 (file)
@@ -1761,13 +1761,13 @@ Mark is left at original location."
        ;; A better way to handle this, \( .. \) etc, is probably to
        ;; temporarily change the syntax of the \ in \( to punctuation.
        ((and latex-handle-escaped-parens
-            (looking-back "\\\\[])}]"))
+            (looking-back "\\\\[])}]" (- (point) 2)))
        (signal 'scan-error
                (list "Containing expression ends prematurely"
                      (- (point) 2) (prog1 (point)
                                      (goto-char pos)))))
        ((and latex-handle-escaped-parens
-            (looking-back "\\\\\\([({[]\\)"))
+            (looking-back "\\\\\\([({[]\\)" (- (point) 2)))
        (tex-next-unmatched-eparen (match-string 1)))
        (t (goto-char newpos))))))
 
index 98e935722063abb19f444e881cd9a66ce246d78f..042ea131a97b0eefad2b8a702c747740dcf8802b 100644 (file)
@@ -466,7 +466,8 @@ It assumes that a log entry starts with a line matching
          (goto-char (match-beginning 0))))
        ;; Don't advance past the end buttons inserted by
        ;; `vc-print-log-setup-buttons'.
-       ((looking-back "Show 2X entries    Show unlimited entries")
+       ((looking-back "Show 2X entries    Show unlimited entries"
+                      (line-beginning-position))
        (setq looping nil)
        (forward-line -1))))))