emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2a9d739 1/2: Fix infloop in uncomment-region-defaul


From: Noam Postavsky
Subject: [Emacs-diffs] master 2a9d739 1/2: Fix infloop in uncomment-region-default (Bug#27112)
Date: Tue, 4 Jul 2017 20:05:06 -0400 (EDT)

branch: master
commit 2a9d7394e36524c84fcbd61e4058b9fb89e3cc2b
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Fix infloop in uncomment-region-default (Bug#27112)
    
    When `comment-continue' has only blanks, `comment-padright' produces a
    regexp that matches the empty string, so `uncomment-region-default'
    will loop infinitely.
    * lisp/newcomment.el (comment-padright): Only return a regexp if STR
    has nonblank characters.
---
 lisp/newcomment.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 4b261c3..118549f 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -815,7 +815,7 @@ N defaults to 0.
 If N is `re', a regexp is returned instead, that would match
 the string for any N."
   (setq n (or n 0))
-  (when (and (stringp str) (not (string= "" str)))
+  (when (and (stringp str) (string-match "\\S-" str))
     ;; Separate the actual string from any leading/trailing padding
     (string-match "\\`\\s-*\\(.*?\\)\\s-*\\'" str)
     (let ((s (match-string 1 str))     ;actual string



reply via email to

[Prev in Thread] Current Thread [Next in Thread]