Add standard unmatchable regexp

Add `regexp-unmatchable' as a standard unmatchable regexp, defined as
"\\`a\\`".  Use it where such a regexp is needed, replacing slower
expressions in several places.
From a suggestion by Philippe Schnoebelen.

* lisp/subr.el (regexp-unmatchable): New defconst.
* etc/NEWS (Lisp Changes): Mention `regexp-unmatchable'.
* doc/lispref/searching.texi (Regexp Functions): Document it.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt)
* lisp/progmodes/cc-defs.el (cc-conditional-require-after-load)
(c-make-keywords-re)
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1)
(c-forward-<>-arglist-recur, c-forward-decl-or-cast-1)
(c-looking-at-decl-block)
* lisp/progmodes/cc-fonts.el (c-doc-line-join-re)
(c-doc-bright-comment-start-re)
* lisp/progmodes/cc-langs.el (c-populate-syntax-table)
(c-assignment-op-regexp)
(c-block-comment-ender-regexp, c-font-lock-comment-end-skip)
(c-block-comment-start-regexp, c-line-comment-start-regexp)
(c-doc-comment-start-regexp, c-decl-start-colon-kwd-re)
(c-type-decl-prefix-key, c-type-decl-operator-prefix-key)
(c-pre-id-bracelist-key, c-enum-clause-introduction-re)
(c-nonlabel-token-2-key)
* lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end)
* lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re)
(c-noise-macro-name-re, c-make-noise-macro-regexps)
* lisp/progmodes/octave.el (octave-help-mode)
* lisp/vc/vc-bzr.el (vc-bzr-log-view-mode, vc-bzr-revision-completion-table)
* lisp/vc/vc-git.el (vc-git-log-view-mode)
* lisp/vc/vc-hg.el (vc-hg-log-view-mode)
* lisp/vc/vc-mtn.el (vc-mtn-log-view-mode):
Use `regexp-unmatchable'.
* lisp/textmodes/ispell.el (ispell-non-empty-string):
Use `regexp-unmatchable', fixing a broken never-match regexp.
This commit is contained in:
Mattias Engdegård 2019-05-14 11:43:49 +02:00
parent d0ebc389eb
commit 26f735ff19
18 changed files with 58 additions and 39 deletions

View file

@ -1070,6 +1070,13 @@ list of characters @var{chars}.
@c Internal functions: regexp-opt-group @c Internal functions: regexp-opt-group
@defvar regexp-unmatchable
This variable contains a regexp that is guaranteed not to match any
string at all. It is particularly useful as default value for
variables that may be set to a pattern that actually matches
something.
@end defvar
@node Regexp Search @node Regexp Search
@section Regular Expression Searching @section Regular Expression Searching
@cindex regular expression searching @cindex regular expression searching

View file

@ -1990,6 +1990,10 @@ returns a regexp that never matches anything, which is an identity for
this operation. Previously, the empty string was returned in this this operation. Previously, the empty string was returned in this
case. case.
** New constant 'regexp-unmatchable' contains a never-matching regexp.
It is a convenient and readable way to specify a regexp that should
not match anything, and is as fast as any such regexp can be.
* Changes in Emacs 27.1 on Non-Free Operating Systems * Changes in Emacs 27.1 on Non-Free Operating Systems

View file

@ -144,9 +144,9 @@ usually more efficient than that of a simplified version:
(sort (copy-sequence strings) 'string-lessp))) (sort (copy-sequence strings) 'string-lessp)))
(re (re
(cond (cond
;; No strings: return a\` which cannot match anything. ;; No strings: return an unmatchable regexp.
((null strings) ((null strings)
(concat (or open "\\(?:") "a\\`\\)")) (concat (or open "\\(?:") regexp-unmatchable "\\)"))
;; If we cannot reorder, give up all attempts at ;; If we cannot reorder, give up all attempts at
;; optimisation. There is room for improvement (Bug#34641). ;; optimisation. There is room for improvement (Bug#34641).
((and keep-order (regexp-opt--contains-prefix sorted-strings)) ((and keep-order (regexp-opt--contains-prefix sorted-strings))

View file

@ -1989,7 +1989,7 @@ on the gateway machine to do the FTP instead."
(make-local-variable 'comint-password-prompt-regexp) (make-local-variable 'comint-password-prompt-regexp)
;; This is a regexp that can't match anything. ;; This is a regexp that can't match anything.
;; ange-ftp has its own ways of handling passwords. ;; ange-ftp has its own ways of handling passwords.
(setq comint-password-prompt-regexp "\\`a\\`") (setq comint-password-prompt-regexp regexp-unmatchable)
(make-local-variable 'paragraph-start) (make-local-variable 'paragraph-start)
(setq paragraph-start comint-prompt-regexp)) (setq paragraph-start comint-prompt-regexp))

View file

@ -81,7 +81,7 @@
(progn (progn
(require 'font-lock) (require 'font-lock)
(let (font-lock-keywords) (let (font-lock-keywords)
(font-lock-compile-keywords '("a\\`")) ; doesn't match anything. (font-lock-compile-keywords (list regexp-unmatchable))
font-lock-keywords)))) font-lock-keywords))))
@ -1890,8 +1890,8 @@ when it's needed. The default is the current language taken from
;; Produce a regexp that doesn't match anything. ;; Produce a regexp that doesn't match anything.
(if adorn (if adorn
"\\(a\\`\\)" (concat "\\(" regexp-unmatchable "\\)")
"a\\`"))) regexp-unmatchable)))
(put 'c-make-keywords-re 'lisp-indent-function 1) (put 'c-make-keywords-re 'lisp-indent-function 1)

View file

@ -907,7 +907,7 @@ comment at the start of cc-engine.el for more info."
stack stack
;; Regexp which matches "for", "if", etc. ;; Regexp which matches "for", "if", etc.
(cond-key (or c-opt-block-stmt-key (cond-key (or c-opt-block-stmt-key
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
;; Return value. ;; Return value.
(ret 'same) (ret 'same)
;; Positions of the last three sexps or bounds we've stopped at. ;; Positions of the last three sexps or bounds we've stopped at.
@ -7646,7 +7646,9 @@ comment at the start of cc-engine.el for more info."
(progn (progn
(c-forward-syntactic-ws) (c-forward-syntactic-ws)
(when (or (and c-record-type-identifiers all-types) (when (or (and c-record-type-identifiers all-types)
(not (equal c-inside-<>-type-key "\\(a\\`\\)"))) (not (equal c-inside-<>-type-key
(concat
"\\(" regexp-unmatchable "\\)"))))
(c-forward-syntactic-ws) (c-forward-syntactic-ws)
(cond (cond
((eq (char-after) ??) ((eq (char-after) ??)
@ -9253,7 +9255,7 @@ This function might do hidden buffer changes."
;; Skip over type decl prefix operators. (Note similar code in ;; Skip over type decl prefix operators. (Note similar code in
;; `c-forward-declarator'.) ;; `c-forward-declarator'.)
(if (and c-recognize-typeless-decls (if (and c-recognize-typeless-decls
(equal c-type-decl-prefix-key "a\\`")) ; Regexp which doesn't match (equal c-type-decl-prefix-key regexp-unmatchable))
(when (eq (char-after) ?\() (when (eq (char-after) ?\()
(progn (progn
(setq paren-depth (1+ paren-depth)) (setq paren-depth (1+ paren-depth))
@ -10886,7 +10888,7 @@ comment at the start of cc-engine.el for more info."
;; legal because it's part of a "compound keyword" like ;; legal because it's part of a "compound keyword" like
;; "enum class". Of course, if c-after-brace-list-key ;; "enum class". Of course, if c-after-brace-list-key
;; is nil, we can skip the test. ;; is nil, we can skip the test.
(or (equal c-after-brace-list-key "a\\`") ; Regexp which doesn't match (or (equal c-after-brace-list-key regexp-unmatchable)
(save-match-data (save-match-data
(save-excursion (save-excursion
(not (not

View file

@ -2580,14 +2580,14 @@ need for `pike-font-lock-extra-types'.")
;;; Doc comments. ;;; Doc comments.
(defvar c-doc-line-join-re "a\\`") (defvar c-doc-line-join-re regexp-unmatchable)
;; Matches a join of two lines in a doc comment. ;; Matches a join of two lines in a doc comment.
;; This should not be changed directly, but instead set by ;; This should not be changed directly, but instead set by
;; `c-setup-doc-comment-style'. This variable is used in `c-find-decl-spots' ;; `c-setup-doc-comment-style'. This variable is used in `c-find-decl-spots'
;; in (e.g.) autodoc style comments to bridge the gap between a "@\n" at an ;; in (e.g.) autodoc style comments to bridge the gap between a "@\n" at an
;; EOL and the token following "//!" on the next line. ;; EOL and the token following "//!" on the next line.
(defvar c-doc-bright-comment-start-re "a\\`") (defvar c-doc-bright-comment-start-re regexp-unmatchable)
;; Matches the start of a "bright" comment, one whose contents may be ;; Matches the start of a "bright" comment, one whose contents may be
;; fontified by, e.g., `c-font-lock-declarations'. ;; fontified by, e.g., `c-font-lock-declarations'.

View file

@ -945,7 +945,7 @@ file name in angle brackets or quotes."
(c-make-keywords-re 'appendable (c-make-keywords-re 'appendable
(c-lang-const c-cpp-include-directives)) (c-lang-const c-cpp-include-directives))
"[ \t]*") "[ \t]*")
"a\\`")) ; Doesn't match anything regexp-unmatchable))
(c-lang-defvar c-cpp-include-key (c-lang-const c-cpp-include-key)) (c-lang-defvar c-cpp-include-key (c-lang-const c-cpp-include-key))
(c-lang-defconst c-opt-cpp-macro-define (c-lang-defconst c-opt-cpp-macro-define
@ -1331,7 +1331,7 @@ operators."
(c--set-difference (c-lang-const c-assignment-operators) (c--set-difference (c-lang-const c-assignment-operators)
'("=") '("=")
:test 'string-equal))) :test 'string-equal)))
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
(c-lang-defvar c-assignment-op-regexp (c-lang-defvar c-assignment-op-regexp
(c-lang-const c-assignment-op-regexp)) (c-lang-const c-assignment-op-regexp))
@ -1554,7 +1554,7 @@ properly."
;; language) ;; language)
t (if (c-lang-const c-block-comment-ender) t (if (c-lang-const c-block-comment-ender)
(regexp-quote (c-lang-const c-block-comment-ender)) (regexp-quote (c-lang-const c-block-comment-ender))
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
(c-lang-defvar c-block-comment-ender-regexp (c-lang-defvar c-block-comment-ender-regexp
(c-lang-const c-block-comment-ender-regexp)) (c-lang-const c-block-comment-ender-regexp))
@ -1565,7 +1565,7 @@ properly."
;; `font-lock-comment-delimiter-face'. ;; `font-lock-comment-delimiter-face'.
t (if (c-lang-const c-block-comment-ender) t (if (c-lang-const c-block-comment-ender)
(concat "[ \t]*" (c-lang-const c-block-comment-ender-regexp)) (concat "[ \t]*" (c-lang-const c-block-comment-ender-regexp))
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
(c-lang-setvar font-lock-comment-end-skip (c-lang-setvar font-lock-comment-end-skip
(c-lang-const c-font-lock-comment-end-skip)) (c-lang-const c-font-lock-comment-end-skip))
@ -1584,7 +1584,7 @@ properly."
;; language) ;; language)
t (if (c-lang-const c-block-comment-starter) t (if (c-lang-const c-block-comment-starter)
(regexp-quote (c-lang-const c-block-comment-starter)) (regexp-quote (c-lang-const c-block-comment-starter))
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
(c-lang-defvar c-block-comment-start-regexp (c-lang-defvar c-block-comment-start-regexp
(c-lang-const c-block-comment-start-regexp)) (c-lang-const c-block-comment-start-regexp))
@ -1593,7 +1593,7 @@ properly."
;; language; it does in all 7 CC Mode languages). ;; language; it does in all 7 CC Mode languages).
t (if (c-lang-const c-line-comment-starter) t (if (c-lang-const c-line-comment-starter)
(regexp-quote (c-lang-const c-line-comment-starter)) (regexp-quote (c-lang-const c-line-comment-starter))
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
(c-lang-defvar c-line-comment-start-regexp (c-lang-defvar c-line-comment-start-regexp
(c-lang-const c-line-comment-start-regexp)) (c-lang-const c-line-comment-start-regexp))
@ -1628,7 +1628,7 @@ starter."
(c-lang-defconst c-doc-comment-start-regexp (c-lang-defconst c-doc-comment-start-regexp
"Regexp to match the start of documentation comments." "Regexp to match the start of documentation comments."
t "a\\`" ; Doesn't match anything. t regexp-unmatchable
;; From font-lock.el: `doxygen' uses /*! while others use /**. ;; From font-lock.el: `doxygen' uses /*! while others use /**.
(c c++ objc) "/\\*[*!]" (c c++ objc) "/\\*[*!]"
java "/\\*\\*" java "/\\*\\*"
@ -3112,7 +3112,7 @@ Note that Java specific rules are currently applied to tell this from
"Regexp matching a keyword that is followed by a colon, where "Regexp matching a keyword that is followed by a colon, where
the whole construct can precede a declaration. the whole construct can precede a declaration.
E.g. \"public:\" in C++." E.g. \"public:\" in C++."
t "a\\`" ; Doesn't match anything. t regexp-unmatchable
c++ (c-make-keywords-re t (c-lang-const c-protection-kwds))) c++ (c-make-keywords-re t (c-lang-const c-protection-kwds)))
(c-lang-defvar c-decl-start-colon-kwd-re (c-lang-defvar c-decl-start-colon-kwd-re
(c-lang-const c-decl-start-colon-kwd-re)) (c-lang-const c-decl-start-colon-kwd-re))
@ -3309,7 +3309,7 @@ Identifier syntax is in effect when this is matched \(see
t (if (c-lang-const c-type-modifier-kwds) t (if (c-lang-const c-type-modifier-kwds)
(concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>") (concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>")
;; Default to a regexp that never matches. ;; Default to a regexp that never matches.
"a\\`") regexp-unmatchable)
;; Check that there's no "=" afterwards to avoid matching tokens ;; Check that there's no "=" afterwards to avoid matching tokens
;; like "*=". ;; like "*=".
(c objc) (concat "\\(" (c objc) (concat "\\("
@ -3347,7 +3347,7 @@ that might precede the identifier in a declaration, e.g. the
as the end of the operator. Identifier syntax is in effect when as the end of the operator. Identifier syntax is in effect when
this is matched \(see `c-identifier-syntax-table')." this is matched \(see `c-identifier-syntax-table')."
t ;; Default to a regexp that never matches. t ;; Default to a regexp that never matches.
"a\\`" regexp-unmatchable
;; Check that there's no "=" afterwards to avoid matching tokens ;; Check that there's no "=" afterwards to avoid matching tokens
;; like "*=". ;; like "*=".
(c objc) (concat "\\(\\*\\)" (c objc) (concat "\\(\\*\\)"
@ -3506,7 +3506,7 @@ list."
(c-lang-defconst c-pre-id-bracelist-key (c-lang-defconst c-pre-id-bracelist-key
"A regexp matching tokens which, preceding an identifier, signify a bracelist. "A regexp matching tokens which, preceding an identifier, signify a bracelist.
" "
t "a\\`" ; Doesn't match anything. t regexp-unmatchable
c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)") c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)")
(c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key)) (c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key))
@ -3562,7 +3562,7 @@ the invalidity of the putative template construct."
;; before the '{' of the enum list, to avoid searching too far. ;; before the '{' of the enum list, to avoid searching too far.
"[^][{};/#=]*" "[^][{};/#=]*"
"{") "{")
"a\\`")) ; Doesn't match anything. regexp-unmatchable))
(c-lang-defvar c-enum-clause-introduction-re (c-lang-defvar c-enum-clause-introduction-re
(c-lang-const c-enum-clause-introduction-re)) (c-lang-const c-enum-clause-introduction-re))
@ -3703,7 +3703,7 @@ Only used if `c-recognize-colon-labels' is set."
"Regexp matching things that can't occur two symbols before a colon in "Regexp matching things that can't occur two symbols before a colon in
a label construct. This catches C++'s inheritance construct \"class foo a label construct. This catches C++'s inheritance construct \"class foo
: bar\". Only used if `c-recognize-colon-labels' is set." : bar\". Only used if `c-recognize-colon-labels' is set."
t "a\\`" ; Doesn't match anything. t regexp-unmatchable
c++ (c-make-keywords-re t '("class"))) c++ (c-make-keywords-re t '("class")))
(c-lang-defvar c-nonlabel-token-2-key (c-lang-const c-nonlabel-token-2-key)) (c-lang-defvar c-nonlabel-token-2-key (c-lang-const c-nonlabel-token-2-key))

View file

@ -1825,7 +1825,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
;; by `c-doc-line-join-re'), return the position of the first line of the ;; by `c-doc-line-join-re'), return the position of the first line of the
;; sequence. Otherwise, return nil. Point has no significance at entry to ;; sequence. Otherwise, return nil. Point has no significance at entry to
;; and exit from this function. ;; and exit from this function.
(when (not (equal c-doc-line-join-re "a\\`")) (when (not (equal c-doc-line-join-re regexp-unmatchable))
(goto-char pos) (goto-char pos)
(back-to-indentation) (back-to-indentation)
(and (or (looking-at c-comment-start-regexp) (and (or (looking-at c-comment-start-regexp)
@ -1842,7 +1842,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
;; marker (as defined by `c-doc-line-join-re), return the position of ;; marker (as defined by `c-doc-line-join-re), return the position of
;; the BOL at the end of the sequence. Otherwise, return nil. Point has no ;; the BOL at the end of the sequence. Otherwise, return nil. Point has no
;; significance at entry to and exit from this function. ;; significance at entry to and exit from this function.
(when (not (equal c-doc-line-join-re "a\\`")) (when (not (equal c-doc-line-join-re regexp-unmatchable))
(goto-char pos) (goto-char pos)
(back-to-indentation) (back-to-indentation)
(let ((here (point))) (let ((here (point)))

View file

@ -1648,9 +1648,9 @@ white space either before or after the operator, but not both."
:group 'c) :group 'c)
;; Initialize the next two to a regexp which never matches. ;; Initialize the next two to a regexp which never matches.
(defvar c-noise-macro-with-parens-name-re "a\\`") (defvar c-noise-macro-with-parens-name-re regexp-unmatchable)
(make-variable-buffer-local 'c-noise-macro-with-parens-name-re) (make-variable-buffer-local 'c-noise-macro-with-parens-name-re)
(defvar c-noise-macro-name-re "a\\`") (defvar c-noise-macro-name-re regexp-unmatchable)
(make-variable-buffer-local 'c-noise-macro-name-re) (make-variable-buffer-local 'c-noise-macro-name-re)
(defcustom c-noise-macro-names nil (defcustom c-noise-macro-names nil
@ -1682,7 +1682,7 @@ These are recognized by CC Mode only in declarations."
;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into
;; `c-noise-macro-name-re' and `c-noise-macro-with-parens-name-re'. ;; `c-noise-macro-name-re' and `c-noise-macro-with-parens-name-re'.
(setq c-noise-macro-with-parens-name-re (setq c-noise-macro-with-parens-name-re
(cond ((null c-noise-macro-with-parens-names) "a\\`") ; Never matches. (cond ((null c-noise-macro-with-parens-names) regexp-unmatchable)
((consp c-noise-macro-with-parens-names) ((consp c-noise-macro-with-parens-names)
(concat (regexp-opt c-noise-macro-with-parens-names t) (concat (regexp-opt c-noise-macro-with-parens-names t)
"\\([^[:alnum:]_$]\\|$\\)")) "\\([^[:alnum:]_$]\\|$\\)"))
@ -1691,7 +1691,7 @@ These are recognized by CC Mode only in declarations."
(t (error "c-make-noise-macro-regexps: \ (t (error "c-make-noise-macro-regexps: \
c-noise-macro-with-parens-names is invalid: %s" c-noise-macro-with-parens-names)))) c-noise-macro-with-parens-names is invalid: %s" c-noise-macro-with-parens-names))))
(setq c-noise-macro-name-re (setq c-noise-macro-name-re
(cond ((null c-noise-macro-names) "a\\`") ; Never matches anything. (cond ((null c-noise-macro-names) regexp-unmatchable)
((consp c-noise-macro-names) ((consp c-noise-macro-names)
(concat (regexp-opt c-noise-macro-names t) (concat (regexp-opt c-noise-macro-names t)
"\\([^[:alnum:]_$]\\|$\\)")) "\\([^[:alnum:]_$]\\|$\\)"))

View file

@ -837,7 +837,8 @@ This function is called from `compilation-filter-hook'."
grep-mode-line-matches) grep-mode-line-matches)
;; compilation-directory-matcher can't be nil, so we set it to a regexp that ;; compilation-directory-matcher can't be nil, so we set it to a regexp that
;; can never match. ;; can never match.
(set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`")) (set (make-local-variable 'compilation-directory-matcher)
(list regexp-unmatchable))
(set (make-local-variable 'compilation-process-setup-function) (set (make-local-variable 'compilation-process-setup-function)
'grep-process-setup) 'grep-process-setup)
(set (make-local-variable 'compilation-disable-input) t) (set (make-local-variable 'compilation-disable-input) t)

View file

@ -1691,7 +1691,7 @@ code line."
(eval-and-compile (require 'help-mode)) (eval-and-compile (require 'help-mode))
;; Don't highlight `EXAMPLE' as elisp symbols by using a regexp that ;; Don't highlight `EXAMPLE' as elisp symbols by using a regexp that
;; can never match. ;; can never match.
(setq-local help-xref-symbol-regexp "x\\`")) (setq-local help-xref-symbol-regexp regexp-unmatchable))
(defun octave-help (fn) (defun octave-help (fn)
"Display the documentation of FN." "Display the documentation of FN."

View file

@ -5544,4 +5544,8 @@ returned list are in the same order as in TREE.
;; for discoverability: ;; for discoverability:
(defalias 'flatten-list 'flatten-tree) (defalias 'flatten-list 'flatten-tree)
;; The initial anchoring is for better performance in searching matches.
(defconst regexp-unmatchable "\\`a\\`"
"Standard regexp guaranteed not to match any string at all.")
;;; subr.el ends here ;;; subr.el ends here

View file

@ -4016,7 +4016,7 @@ You can bind this to the key C-c i in GNUS or mail by adding to
(defun ispell-non-empty-string (string) (defun ispell-non-empty-string (string)
(if (or (not string) (string-equal string "")) (if (or (not string) (string-equal string ""))
"\\'\\`" ; An unmatchable string if string is null. regexp-unmatchable
(regexp-quote string))) (regexp-quote string)))

View file

@ -702,7 +702,7 @@ or a superior directory.")
(remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
(require 'add-log) (require 'add-log)
(set (make-local-variable 'log-view-per-file-logs) nil) (set (make-local-variable 'log-view-per-file-logs) nil)
(set (make-local-variable 'log-view-file-re) "\\`a\\`") (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
(set (make-local-variable 'log-view-message-re) (set (make-local-variable 'log-view-message-re)
(if (eq vc-log-view-type 'short) (if (eq vc-log-view-type 'short)
"^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?" "^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
@ -1319,7 +1319,8 @@ stream. Standard error output is discarded."
((string-match "\\`annotate:" string) ((string-match "\\`annotate:" string)
(completion-table-with-context (completion-table-with-context
(substring string 0 (match-end 0)) (substring string 0 (match-end 0))
(apply-partially #'completion-table-with-terminator '(":" . "\\`a\\`") (apply-partially #'completion-table-with-terminator
(cons ":" regexp-unmatchable)
#'completion-file-name-table) #'completion-file-name-table)
(substring string (match-end 0)) pred action)) (substring string (match-end 0)) pred action))

View file

@ -1087,7 +1087,7 @@ If LIMIT is a revision string, use it as an end-revision."
(define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View" (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
(require 'add-log) ;; We need the faces add-log. (require 'add-log) ;; We need the faces add-log.
;; Don't have file markers, so use impossible regexp. ;; Don't have file markers, so use impossible regexp.
(set (make-local-variable 'log-view-file-re) "\\`a\\`") (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
(set (make-local-variable 'log-view-per-file-logs) nil) (set (make-local-variable 'log-view-per-file-logs) nil)
(set (make-local-variable 'log-view-message-re) (set (make-local-variable 'log-view-message-re)
(if (not (eq vc-log-view-type 'long)) (if (not (eq vc-log-view-type 'long))

View file

@ -444,7 +444,7 @@ If LIMIT is non-nil, show no more than this many entries."
(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
(require 'add-log) ;; we need the add-log faces (require 'add-log) ;; we need the add-log faces
(set (make-local-variable 'log-view-file-re) "\\`a\\`") (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
(set (make-local-variable 'log-view-per-file-logs) nil) (set (make-local-variable 'log-view-per-file-logs) nil)
(set (make-local-variable 'log-view-message-re) (set (make-local-variable 'log-view-message-re)
(if (eq vc-log-view-type 'short) (if (eq vc-log-view-type 'short)

View file

@ -240,7 +240,7 @@ If LIMIT is non-nil, show no more than this many entries."
(define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View" (define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View"
;; Don't match anything. ;; Don't match anything.
(set (make-local-variable 'log-view-file-re) "\\`a\\`") (set (make-local-variable 'log-view-file-re) regexp-unmatchable)
(set (make-local-variable 'log-view-per-file-logs) nil) (set (make-local-variable 'log-view-per-file-logs) nil)
;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives ;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives
;; in the ChangeLog text. ;; in the ChangeLog text.