Mercurial > emacs
changeset 44478:2539a7fea37f
(fill-context-prefix): Match the two prefixes
differently to avoid pathological exponential-time case.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 10 Apr 2002 18:19:44 +0000 |
parents | 5bcb255d9dc5 |
children | 5eb5e6c99de4 |
files | lisp/textmodes/fill.el |
diffstat | 1 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/fill.el Wed Apr 10 15:19:11 2002 +0000 +++ b/lisp/textmodes/fill.el Wed Apr 10 18:19:44 2002 +0000 @@ -237,18 +237,14 @@ ;; just use it (this subsumes the 2 previous checks). ;; Used when first line is `/* ...' and second-line is ;; ` * ...'. - (save-excursion - (goto-char firstline) - (looking-at - (apply 'concat - (mapcar (lambda (c) - (if (memq c '(?\t ?\ )) - ;; The number of chars might not - ;; match up if there's a mix of - ;; tabs and spaces. - "\\([ \t]*\\|.\\)" - (regexp-quote (string c)))) - second-line-prefix)))) + (string-match + (concat "\\`" + (mapconcat + (lambda (c) (regexp-quote (string c))) + (replace-regexp-in-string "[ \t]+" "" first-line-prefix) + "?") + "?\\'") + (replace-regexp-in-string "[ \t]+" "" second-line-prefix)) second-line-prefix ;; Use the longest common substring of both prefixes,