\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).
;; 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.
(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))))))
;; 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 "]"))
(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
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)
(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)))
((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)))))))
;; 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)))
(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))
(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
(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)))
(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))))
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*"
(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)
(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 "%")
(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")))
(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
(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))
(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)
(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))
(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
;; 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 ")
(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")
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)
;; 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)
;; 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)))))
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 ()
;; 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"))
(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")
(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 ")))
'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
(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 "^\\*")
(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
(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
(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 ()
(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)
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
(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)
;; 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))))))
(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))))))