From: Alan Mackenzie Date: Sun, 31 Oct 2010 11:54:02 +0000 (+0000) Subject: progmodes/cc-cmds.el (c-mask-paragraph): Fix an off-by-1 error. Fixes X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~422^2~43 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e6ef5dd9ce13d346c7bbdcd6794b29045b4e0e63;p=emacs.git progmodes/cc-cmds.el (c-mask-paragraph): Fix an off-by-1 error. Fixes bug #7185. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a37ae0c7a47..4a49b8d4880 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-10-31 Alan Mackenzie + + * progmodes/cc-cmds.el (c-mask-paragraph): Fix an off-by-1 error. + This fixes bug #7185. + 2010-10-30 Chong Yidong * startup.el (command-line): Search for package directories, and diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index b17703b0305..112fa50ce8f 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -3974,17 +3974,19 @@ command to conveniently insert and align the necessary backslashes." ;; "Invalid search bound (wrong side of point)" ;; error in the subsequent re-search. Maybe ;; another fix would be needed (2007-12-08). - (or (<= (- (cdr c-lit-limits) 2) (point)) - (and - (search-forward-regexp - (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)") - (- (cdr c-lit-limits) 2) t) - (not (search-forward-regexp - "\\(\\s \\|\\sw\\)" - (- (cdr c-lit-limits) 2) 'limit)) - ;; The comment ender IS on its own line. Exclude - ;; this line from the filling. - (set-marker end (c-point 'bol))))) +; (or (<= (- (cdr c-lit-limits) 2) (point)) +; 2010-10-17 Construct removed. +; (or (< (- (cdr c-lit-limits) 2) (point)) + (and + (search-forward-regexp + (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)") + (- (cdr c-lit-limits) 2) t) + (not (search-forward-regexp + "\\(\\s \\|\\sw\\)" + (- (cdr c-lit-limits) 2) 'limit)) + ;; The comment ender IS on its own line. Exclude this + ;; line from the filling. + (set-marker end (c-point 'bol))));) ;; The comment ender is hanging. Replace all space between it ;; and the last word either by one or two 'x's (when