bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#50226: 27.1; Fix uncomment-region with space-only comment-continue


From: Christophe Troestler
Subject: bug#50226: 27.1; Fix uncomment-region with space-only comment-continue
Date: Fri, 27 Aug 2021 16:22:40 +0200
User-agent: mu4e 1.6.3; emacs 27.1

In the Emacs development branch, `comment-region-default-1' has been fixed to 
handle the case 'comment-continue' is entirely made of whitespace (commit 
5c93063129).  However, `uncomment-region-default-1' did not receive an 
appropriate fix as the following test shows: 

--8<---------------cut here---------------start------------->8---
(let ((comment-style 'multi-line)
      (comment-continue "   ")
      (text "  a\n  b"))
  (equal text
         (with-temp-buffer
           (c-mode)
           (insert text)
           (comment-region (point-min) (point-max))
           (uncomment-region (point-min) (point-max))
           (buffer-string))))
--8<---------------cut here---------------end--------------->8---

The attached patch fixes that.

Best,
C.



In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo 
version 1.16.0)
 of 2021-03-28, modified by Debian built on x86-conova-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Recent messages:
Checking 71 files in /usr/share/emacs/27.1/lisp/erc...
Checking 34 files in /usr/share/emacs/27.1/lisp/emulation...
Checking 180 files in /usr/share/emacs/27.1/lisp/emacs-lisp...
Checking 24 files in /usr/share/emacs/27.1/lisp/cedet...
Checking 59 files in /usr/share/emacs/27.1/lisp/calendar...
Checking 87 files in /usr/share/emacs/27.1/lisp/calc...
Checking 113 files in /usr/share/emacs/27.1/lisp/obsolete...
Checking for load-path shadows...done
Org-Msg mode disabled
Mark set

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-cairo
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-LlFm6W/emacs-27.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD
JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: OrgMsg

Minor modes in effect:
  visual-fill-column-mode: t
  flyspell-mode: t
  desktop-save-mode: t
  TeX-PDF-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  global-edit-server-edit-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  visual-line-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
~/software/OCaml/dune/editor-integration/emacs/dune-flymake hides 
/home/trch/.opam/4.11.2+flambda+no-flat-float-array/share/emacs/site-lisp/dune-flymake
~/software/OCaml/dune/editor-integration/emacs/dune hides 
/home/trch/.opam/4.11.2+flambda+no-flat-float-array/share/emacs/site-lisp/dune
/home/trch/software/org-msg/org-msg hides 
/home/trch/.emacs.d/elpa/org-msg-20210716.2237/org-msg
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/deb-view hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/deb-view
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-bug hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/debian-bug
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/apt-utils hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/apt-utils
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/preseed hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/preseed
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/apt-sources hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/apt-sources
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-autoloads hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/debian-autoloads
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-el hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/debian-el
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-el-autoloads hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/debian-el-autoloads
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/gnus-BTS hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/gnus-BTS
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-el-pkg hides 
/usr/share/emacs/site-lisp/elpa/debian-el-37/debian-el-pkg
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/deb-view hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/deb-view
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/apt-utils hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/apt-utils
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/preseed hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/preseed
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-bug hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-bug
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/apt-sources hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/apt-sources
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-autoloads hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-autoloads
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-el hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-el
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-el-autoloads hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-el-autoloads
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/gnus-BTS hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/gnus-BTS
/home/trch/.emacs.d/elpa/debian-el-20201011.1543/debian-el-pkg hides 
/usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-el-pkg

Features:
(shadow emacsbug cl-print debug backtrace eieio-opt help-fns radix-tree
magit-gitignore git-rebase goto-addr magit-extras misearch multi-isearch
cal-china lunar solar cal-dst cal-islam holidays hol-loaddefs cal-move
rect mhtml-mode css-mode eww mm-url js sgml-mode dabbrev image-file
url-http url-gw url-auth url-queue gnutls network-stream nsm mailalias
visual-fill-column face-remap url-cache sort smiley shr-color mm-archive
mail-extr qp latexenc auto-complete popup reftex-auc preview tex-buf
reftex-dcr reftex reftex-loaddefs reftex-vars latex latex-flymake
tex-ispell tex-style tex-mode ol-eww ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnir ol-docview ol-bibtex ol-bbdb ol-w3m tuareg tuareg-compat
tuareg-opam caml-help view find-file bug-reference sh-script executable
flyspell ispell markdown-mode fortran cus-edit cus-start cus-load vc-git
flycheck matlab matlab-scan matlab-syntax matlab-compat pulse desktop
frameset php-mode mode-local speedbar sb-image ezimage dframe cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs php-face php php-project tlc font-latex tex dbus texmathp bibtex
julia-repl s term disp-table ehelp dune-flymake flymake-proc flymake
compile warnings dune skeleton smie merlin-xref xref project merlin-cap
merlin pcase caml-types magit-bookmark magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode
diff diff-mode git-commit log-edit pcvs-util add-log magit-core
magit-autorevert magit-margin magit-transient magit-process with-editor
shell magit-mode transient cl-extra magit-git magit-section magit-utils
crm dash erc-goodies erc erc-backend erc-compat erc-loaddefs
twittering-mode org-msg let-alist color ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox
org-element avl-tree generator htmlize gnus-msg org-agenda
mu4e-icalendar gnus-icalendar org-capture gnus-cite mu4e-contrib eshell
esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups
esh-util bookmark pp mu4e mu4e-org mu4e-main mu4e-view mu4e-view-gnus
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum url
url-proxy url-privacy url-expand url-methods url-history gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc
nnoo parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus
nnheader wid-edit mu4e-view-common thingatpt mu4e-headers mu4e-compose
mu4e-context mu4e-draft mu4e-actions ido rfc2368 smtpmail sendmail
mu4e-mark mu4e-proc mu4e-utils doc-view jka-compr image-mode exif
mu4e-lists mu4e-message shr url-cookie url-domsuf url-util svg xml dom
flow-fill mule-util mailcap hl-line mu4e-vars message rmc puny dired
dired-loaddefs rfc822 mml mml-sec gnus-util rmail rmail-loaddefs
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader mu4e-meta adoc-mode tempo cl markup-faces org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities time-date noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs format-spec find-func timeclock epa-file epa derived epg
epg-config quail help-mode autorevert filenotify edmacro kmacro paren
icalendar diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
edit-server advice server finder-inf tex-site debian-el proof-site
proof-autoloads rx info package easymenu browse-url url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 914242 120046)
 (symbols 48 60873 94)
 (strings 32 287523 30289)
 (string-bytes 1 8844929)
 (vectors 16 105104)
 (vector-slots 8 2202885 188808)
 (floats 8 1241 492)
 (intervals 56 17150 2164)
 (buffers 1000 150))


>From c0d9a34a7f0a5955002429da0480aaf3913cd061 Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Fri, 27 Aug 2021 16:14:08 +0200
Subject: [PATCH] lisp/newcomment.el: Uncommenting with whitespace
 `comment-continue'
Content-Type: text/plain; charset="utf-8"

---
 lisp/newcomment.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 57a52effd1..b458f0356d 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -932,7 +932,8 @@ uncomment-region-default-1
   (setq end (copy-marker end))
   (let* ((numarg (prefix-numeric-value arg))
         (ccs comment-continue)
-        (srei (comment-padright ccs 're))
+        (srei (or (comment-padright ccs 're)
+                  (and (stringp comment-continue) comment-continue)))
         (csre (comment-padright comment-start 're))
         (sre (and srei (concat "^\\s-*?\\(" srei "\\)")))
         spt)
-- 
2.32.0


reply via email to

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