From: npostavs@users.sourceforge.net
To: "Clément Pit--Claudel" <clement.pitclaudel@live.com>
Cc: 27112@debbugs.gnu.org
Subject: bug#27112: Setting comment-continue to " " causes uncomment-region-default to infloop
Date: Thu, 01 Jun 2017 23:18:22 -0400 [thread overview]
Message-ID: <877f0v2i2p.fsf@users.sourceforge.net> (raw)
In-Reply-To: <0908e61a-6aab-13f9-5938-a6c02ff7f1ea@live.com> ("Clément Pit--Claudel"'s message of "Tue, 30 May 2017 19:02:03 -0400")
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
tags 27112 patch
quit
Clément Pit--Claudel <clement.pitclaudel@live.com> writes:
>> Can you give a full recipe?
>
> Sure thing:
>
> emacs -Q --eval '(setq comment-continue " ")' --eval '(save-excursion (insert ";; AAA\n"))' --eval '(comment-line 1)'
Oh it triggers in lisp mode, I somehow got the idea that it needed a
mode with C like comments from initial report. How about this patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1149 bytes --]
From d7030832e1aecbb04affe52453fa32ea19ed7ded Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 1 Jun 2017 23:09:36 -0400
Subject: [PATCH v1] Fix infloop in uncomment-region-default (Bug#27112)
When `comment-continue' has only blank lines, `comment-padright'
produces a regexp that matches the empty string, so
`uncomment-region-default' will loop infinitely.
* lisp/newcomment.el (comment-padright): Check for non-padding
characters in STR.
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/lisp/newcomment.el b/lisp/newcomment.el
index 4b261c34c6..118549f421 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -815,7 +815,7 @@ (defun comment-padright (str &optional n)
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
--
2.11.1
next prev parent reply other threads:[~2017-06-02 3:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-28 6:27 bug#27112: Setting comment-continue to " " causes uncomment-region-default to infloop Clément Pit--Claudel
2017-05-30 22:23 ` npostavs
2017-05-30 23:02 ` Clément Pit--Claudel
2017-06-02 3:18 ` npostavs [this message]
2017-06-10 2:15 ` npostavs
2017-07-03 15:36 ` npostavs
2017-07-03 15:41 ` Clément Pit--Claudel
2017-07-05 0:08 ` npostavs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877f0v2i2p.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=27112@debbugs.gnu.org \
--cc=clement.pitclaudel@live.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.