Package: emacs;
Reported by: Dima Kogan <dkogan <at> cds.caltech.edu>
Date: Wed, 2 Mar 2011 08:53:01 UTC
Severity: minor
Found in version 23.2
Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8150 in the body.
You can then email your comments to 8150 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#8150
; Package emacs
.
(Wed, 02 Mar 2011 08:53:01 GMT) Full text and rfc822 format available.Dima Kogan <dkogan <at> cds.caltech.edu>
:bug-gnu-emacs <at> gnu.org
.
(Wed, 02 Mar 2011 08:53:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Dima Kogan <dkogan <at> cds.caltech.edu> To: bug-gnu-emacs <at> gnu.org Subject: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region Date: Wed, 02 Mar 2011 00:52:24 -0800
If I have a buffer in CPerl mode containing #!/usr/bin/perl use strict; use warnings; cperl-comment-region on the whole buffer makes # #!/usr/bin/perl # use strict; # use warnings; cperl-uncomment-region makes #!/usr/bin/perl use strict; use warnings; There's now an extra space at the start of the line. cperl-uncomment-region is essentially the same as (comment-region beg end -1) This produces the erroneous behavior. (uncomment-region beg end) does work, though. Thus, there may be a bug in (comment-region) In GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-12-11 on brahms, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10707000 configured using `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: global-subword-mode: t subword-mode: t show-paren-mode: t shell-dirtrack-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-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t hs-minor-mode: t Recent input: M-x r e p o r t SPC b u <return> Recent messages: Loading /etc/emacs/site-start.d/51semi.el (source)...done Loading /etc/emacs/site-start.d/51speedbar.el (source)...done Loading /etc/emacs/site-start.d/65wl-beta.el (source)...done Loading /usr/share/emacs/23.2/lisp/progmodes/hideshow.el.gz... uncompressing hideshow.el.gz...done Loading /usr/share/emacs/23.2/lisp/progmodes/hideshow.el.gz...done Loading shell...done Loading paren...done Loading `~/.emacs': old-style backquotes detected! For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: /usr/share/emacs/23.2/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar /usr/share/emacs/23.2/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl /usr/share/emacs/23.2/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf /usr/share/emacs/23.2/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp /usr/share/emacs/23.2/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex /usr/share/emacs/23.2/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik /usr/share/emacs/23.2/site-lisp/auctex/tex-fptex hides /usr/share/emacs/site-lisp/auctex/tex-fptex /usr/share/emacs/23.2/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite /usr/share/emacs/23.2/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info /usr/share/emacs/23.2/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp /usr/share/emacs/23.2/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font /usr/share/emacs/23.2/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x /usr/share/emacs/23.2/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex /usr/share/emacs/23.2/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex /usr/share/emacs/23.2/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold /usr/share/emacs/23.2/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context /usr/share/emacs/23.2/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en /usr/share/emacs/23.2/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt /usr/share/emacs/23.2/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style /usr/local/share/emacs/site-lisp/imaxima-autoconf-variables hides /usr/share/emacs/23.2/site-lisp/maxima/imaxima-autoconf-variables /usr/local/share/emacs/site-lisp/imaxima hides /usr/share/emacs/23.2/site-lisp/maxima/imaxima /usr/local/share/emacs/site-lisp/imath hides /usr/share/emacs/23.2/site-lisp/maxima/imath /usr/share/emacs/site-lisp/autoconf/autotest-mode hides /usr/share/emacs/site-lisp/autotest-mode /usr/share/emacs/23.2/site-lisp/magit hides /usr/share/emacs/site-lisp/magit /usr/share/emacs/23.2/site-lisp/cscope/xcscope hides /usr/share/emacs/site-lisp/xcscope /usr/share/emacs/23.2/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs/23.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs23/site-lisp/semi/pgg-pgp5 hides /usr/share/emacs/23.2/lisp/pgg-pgp5 /usr/share/emacs23/site-lisp/speedbar/sb-image hides /usr/share/emacs/23.2/lisp/sb-image /usr/share/emacs23/site-lisp/semi/pgg hides /usr/share/emacs/23.2/lisp/pgg /usr/share/emacs23/site-lisp/semi/pgg-parse hides /usr/share/emacs/23.2/lisp/pgg-parse /usr/share/emacs23/site-lisp/cedet-common/ezimage hides /usr/share/emacs/23.2/lisp/ezimage /usr/share/emacs23/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4 /usr/share/emacs23/site-lisp/semi/pgg-gpg hides /usr/share/emacs/23.2/lisp/pgg-gpg /usr/share/emacs23/site-lisp/speedbar/speedbar hides /usr/share/emacs/23.2/lisp/speedbar /usr/share/emacs23/site-lisp/flim/sha1 hides /usr/share/emacs/23.2/lisp/sha1 /usr/share/emacs23/site-lisp/semi/pgg-pgp hides /usr/share/emacs/23.2/lisp/pgg-pgp /usr/share/emacs23/site-lisp/flim/hex-util hides /usr/share/emacs/23.2/lisp/hex-util /usr/share/emacs23/site-lisp/speedbar/dframe hides /usr/share/emacs/23.2/lisp/dframe /usr/share/emacs23/site-lisp/semi/pgg-def hides /usr/share/emacs/23.2/lisp/pgg-def /usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.2/lisp/textmodes/flyspell /usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.2/lisp/textmodes/ispell /usr/share/emacs/23.2/site-lisp/octave3.1-emacsen/octave-inf hides /usr/share/emacs/23.2/lisp/progmodes/octave-inf /usr/share/emacs/23.2/site-lisp/octave3.1-emacsen/octave-mod hides /usr/share/emacs/23.2/lisp/progmodes/octave-mod /usr/share/emacs23/site-lisp/org-mode/org-archive hides /usr/share/emacs/23.2/lisp/org/org-archive /usr/share/emacs23/site-lisp/org-mode/org-mobile hides /usr/share/emacs/23.2/lisp/org/org-mobile /usr/share/emacs23/site-lisp/org-mode/org-ascii hides /usr/share/emacs/23.2/lisp/org/org-ascii /usr/share/emacs23/site-lisp/org-mode/org-clock hides /usr/share/emacs/23.2/lisp/org/org-clock /usr/share/emacs23/site-lisp/org-mode/org-gnus hides /usr/share/emacs/23.2/lisp/org/org-gnus /usr/share/emacs23/site-lisp/org-mode/org-indent hides /usr/share/emacs/23.2/lisp/org/org-indent /usr/share/emacs23/site-lisp/org-mode/org-wl hides /usr/share/emacs/23.2/lisp/org/org-wl /usr/share/emacs23/site-lisp/org-mode/org-exp-blocks hides /usr/share/emacs/23.2/lisp/org/org-exp-blocks /usr/share/emacs23/site-lisp/org-mode/org-list hides /usr/share/emacs/23.2/lisp/org/org-list /usr/share/emacs23/site-lisp/org-mode/org-w3m hides /usr/share/emacs/23.2/lisp/org/org-w3m /usr/share/emacs23/site-lisp/org-mode/org-colview hides /usr/share/emacs/23.2/lisp/org/org-colview /usr/share/emacs23/site-lisp/org-mode/org-freemind hides /usr/share/emacs/23.2/lisp/org/org-freemind /usr/share/emacs23/site-lisp/org-mode/org-macs hides /usr/share/emacs/23.2/lisp/org/org-macs /usr/share/emacs23/site-lisp/org-mode/org-crypt hides /usr/share/emacs/23.2/lisp/org/org-crypt /usr/share/emacs23/site-lisp/org-mode/org-mhe hides /usr/share/emacs/23.2/lisp/org/org-mhe /usr/share/emacs23/site-lisp/org-mode/org-table hides /usr/share/emacs/23.2/lisp/org/org-table /usr/share/emacs23/site-lisp/org-mode/org hides /usr/share/emacs/23.2/lisp/org/org /usr/share/emacs23/site-lisp/org-mode/org-bibtex hides /usr/share/emacs/23.2/lisp/org/org-bibtex /usr/share/emacs23/site-lisp/org-mode/org-src hides /usr/share/emacs/23.2/lisp/org/org-src /usr/share/emacs23/site-lisp/org-mode/org-compat hides /usr/share/emacs/23.2/lisp/org/org-compat /usr/share/emacs23/site-lisp/org-mode/org-publish hides /usr/share/emacs/23.2/lisp/org/org-publish /usr/share/emacs23/site-lisp/org-mode/org-id hides /usr/share/emacs/23.2/lisp/org/org-id /usr/share/emacs23/site-lisp/org-mode/org-feed hides /usr/share/emacs/23.2/lisp/org/org-feed /usr/share/emacs23/site-lisp/org-mode/org-habit hides /usr/share/emacs/23.2/lisp/org/org-habit /usr/share/emacs23/site-lisp/org-mode/org-rmail hides /usr/share/emacs/23.2/lisp/org/org-rmail /usr/share/emacs23/site-lisp/org-mode/org-plot hides /usr/share/emacs/23.2/lisp/org/org-plot /usr/share/emacs23/site-lisp/org-mode/org-protocol hides /usr/share/emacs/23.2/lisp/org/org-protocol /usr/share/emacs23/site-lisp/org-mode/org-faces hides /usr/share/emacs/23.2/lisp/org/org-faces /usr/share/emacs23/site-lisp/org-mode/org-latex hides /usr/share/emacs/23.2/lisp/org/org-latex /usr/share/emacs23/site-lisp/org-mode/org-jsinfo hides /usr/share/emacs/23.2/lisp/org/org-jsinfo /usr/share/emacs23/site-lisp/org-mode/org-xoxo hides /usr/share/emacs/23.2/lisp/org/org-xoxo /usr/share/emacs23/site-lisp/org-mode/org-vm hides /usr/share/emacs/23.2/lisp/org/org-vm /usr/share/emacs23/site-lisp/org-mode/org-mouse hides /usr/share/emacs/23.2/lisp/org/org-mouse /usr/share/emacs23/site-lisp/org-mode/org-timer hides /usr/share/emacs/23.2/lisp/org/org-timer /usr/share/emacs23/site-lisp/org-mode/org-footnote hides /usr/share/emacs/23.2/lisp/org/org-footnote /usr/share/emacs23/site-lisp/org-mode/org-html hides /usr/share/emacs/23.2/lisp/org/org-html /usr/share/emacs23/site-lisp/org-mode/org-inlinetask hides /usr/share/emacs/23.2/lisp/org/org-inlinetask /usr/share/emacs23/site-lisp/org-mode/org-attach hides /usr/share/emacs/23.2/lisp/org/org-attach /usr/share/emacs23/site-lisp/org-mode/org-agenda hides /usr/share/emacs/23.2/lisp/org/org-agenda /usr/share/emacs23/site-lisp/org-mode/org-datetree hides /usr/share/emacs/23.2/lisp/org/org-datetree /usr/share/emacs23/site-lisp/org-mode/org-bbdb hides /usr/share/emacs/23.2/lisp/org/org-bbdb /usr/share/emacs23/site-lisp/org-mode/org-irc hides /usr/share/emacs/23.2/lisp/org/org-irc /usr/share/emacs23/site-lisp/org-mode/org-mew hides /usr/share/emacs/23.2/lisp/org/org-mew /usr/share/emacs23/site-lisp/org-mode/org-mac-message hides /usr/share/emacs/23.2/lisp/org/org-mac-message /usr/share/emacs23/site-lisp/org-mode/org-docbook hides /usr/share/emacs/23.2/lisp/org/org-docbook /usr/share/emacs23/site-lisp/org-mode/org-info hides /usr/share/emacs/23.2/lisp/org/org-info /usr/share/emacs23/site-lisp/org-mode/org-exp hides /usr/share/emacs/23.2/lisp/org/org-exp /usr/share/emacs23/site-lisp/org-mode/org-install hides /usr/share/emacs/23.2/lisp/org/org-install /usr/share/emacs23/site-lisp/org-mode/org-icalendar hides /usr/share/emacs/23.2/lisp/org/org-icalendar /usr/share/emacs23/site-lisp/org-mode/org-remember hides /usr/share/emacs/23.2/lisp/org/org-remember /usr/share/emacs23/site-lisp/flim/hmac-def hides /usr/share/emacs/23.2/lisp/net/hmac-def /usr/share/emacs23/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/23.2/lisp/net/sasl-ntlm /usr/share/emacs23/site-lisp/flim/sasl hides /usr/share/emacs/23.2/lisp/net/sasl /usr/share/emacs23/site-lisp/flim/sasl-digest hides /usr/share/emacs/23.2/lisp/net/sasl-digest /usr/share/emacs23/site-lisp/flim/hmac-md5 hides /usr/share/emacs/23.2/lisp/net/hmac-md5 /usr/share/emacs23/site-lisp/flim/ntlm hides /usr/share/emacs/23.2/lisp/net/ntlm /usr/share/emacs23/site-lisp/flim/sasl-cram hides /usr/share/emacs/23.2/lisp/net/sasl-cram /usr/share/emacs23/site-lisp/wl/rfc2368 hides /usr/share/emacs/23.2/lisp/mail/rfc2368 /usr/share/emacs23/site-lisp/cedet-common/cedet-files hides /usr/share/emacs/23.2/lisp/cedet/cedet-files /usr/share/emacs23/site-lisp/cedet-common/mode-local hides /usr/share/emacs/23.2/lisp/cedet/mode-local /usr/share/emacs23/site-lisp/cedet-common/inversion hides /usr/share/emacs/23.2/lisp/cedet/inversion /usr/share/emacs23/site-lisp/cedet-common/cedet hides /usr/share/emacs/23.2/lisp/cedet/cedet Features: (shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1 sha1-el hex-util hashcash mail-utils home-end emacsbug commit-patch-amend-buffer commit-patch-buffer log-edit pcvs-util add-log vc vc-dispatcher cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt cus-edit wid-edit subword paren cus-start cus-load shell comint hideshow jka-compr edmacro kmacro rect cperl-mode shell-command xcscope ring easymenu iswitchb w3m-load org-install muse-autoloads emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode cedet-autogen advice advice-preload autoload help-fns preview-latex tex-site auto-loads tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#8150
; Package emacs
.
(Wed, 02 Mar 2011 17:31:02 GMT) Full text and rfc822 format available.Message #8 received at 8150 <at> debbugs.gnu.org (full text, mbox):
From: Glenn Morris <rgm <at> gnu.org> To: Dima Kogan <dkogan <at> cds.caltech.edu> Cc: 8150 <at> debbugs.gnu.org Subject: Re: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region Date: Wed, 02 Mar 2011 12:30:48 -0500
Dima Kogan wrote: > cperl-comment-region on the whole buffer makes [...] > cperl-uncomment-region makes The standard commands comment-region and uncomment-region seem to work fine; can you use those instead?
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#8150
; Package emacs
.
(Thu, 03 Mar 2011 04:39:01 GMT) Full text and rfc822 format available.Message #11 received at 8150 <at> debbugs.gnu.org (full text, mbox):
From: Dima Kogan <dkogan <at> cds.caltech.edu> To: 8150 <at> debbugs.gnu.org Subject: Re: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region Date: Wed, 2 Mar 2011 20:38:16 -0800
I can and I do, but the current behavior seems wrong. If (comment-region beg end -1) is no longer supported, it should generate an error instead of succeeding badly. Should we simply call (uncomment-region beg end 1) in that case? I can make the patch, but would need to know what the current plan is.
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#8150
; Package emacs
.
(Thu, 03 Mar 2011 10:08:01 GMT) Full text and rfc822 format available.Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Lawrence Mitchell <wence <at> gmx.li> To: bug-gnu-emacs <at> gnu.org Subject: Re: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region Date: Thu, 03 Mar 2011 10:06:53 +0000
Dima Kogan wrote: > I can and I do, but the current behavior seems wrong. If > (comment-region beg end -1) is no longer supported, it should generate > an error instead of succeeding badly. Should we simply call > (uncomment-region beg end 1) in that case? I can make the patch, but > would need to know what the current plan is. Note that the problem is that (uncomment-region A B 1) is not the inverse of (comment-region A B 1). Irrespective of the major mode in effect: emacs -Q C-x h C-1 M-x comment-region RET C-x h C-1 M-x uncomment-region RET Note how there is now a space at the beginning of every line in the *scratch* buffer. This is due to the following code in uncomment-region-default: | (if (null arg) (delete-region (point-min) (point)) | (skip-syntax-backward " ") | (delete-char (- numarg)) # foo bar ^ point is here when the above code is called. If an argument is supplied, arg is non-nil and so to delete the comment we first move backwards over whitespace and then delete as many comment characters as specified by the argument (1 in this case). This patch appears to do the right thing from my minimal testing, but I don't know if it will have any unfortunate side-effects: 2011-03-03 Lawrence Mitchell <wence <at> gmx.li> Make uncomment-region the inverse of comment-region. * newcomment.el (uncomment-region-default): Delete skipped-over whitespace if all comment characters have been removed. This makes M-1 M-x uncomment-region RET the inverse of M-1 M-x comment-region RET. Previously, commenting and then uncommenting a region with an argument would leave a space at the beginning of each line. diff --git a/lisp/newcomment.el b/lisp/newcomment.el index d88b76a..bcdc1e6 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -871,15 +871,20 @@ comment markers." (when (and sre (looking-at (concat "\\s-*\n\\s-*" srei))) (goto-char (match-end 0))) (if (null arg) (delete-region (point-min) (point)) - (skip-syntax-backward " ") - (delete-char (- numarg)) - (unless (or (bobp) - (save-excursion (goto-char (point-min)) - (looking-at comment-start-skip))) - ;; If there's something left but it doesn't look like - ;; a comment-start any more, just remove it. - (delete-region (point-min) (point)))) - + (let* ((opoint (point-marker)) + (nchar (skip-syntax-backward " "))) + (delete-char (- numarg)) + (unless (or (bobp) + (save-excursion (goto-char (point-min)) + (looking-at comment-start-skip))) + ;; If there's something left but it doesn't look like + ;; a comment-start any more, just remove it. + (delete-region (point-min) (point))) + (save-excursion + (goto-char (point-min)) + (unless (looking-at comment-start-skip) + (goto-char opoint) + (delete-char nchar))))) ;; Remove the end-comment (and leading padding and such). (goto-char (point-max)) (comment-enter-backward) ;; Check for special `=' used sometimes in comment-box. -- Lawrence Mitchell <wence <at> gmx.li>
bug-gnu-emacs <at> gnu.org
:bug#8150
; Package emacs
.
(Fri, 17 Feb 2012 12:50:01 GMT) Full text and rfc822 format available.Message #17 received at 8150 <at> debbugs.gnu.org (full text, mbox):
From: Lawrence Mitchell <wence <at> gmx.li> To: 8150 <at> debbugs.gnu.org Subject: Re: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region Date: Fri, 17 Feb 2012 12:47:10 +0000
I'm chasing up open bugs I've participated in, probably too late for 24.1, but just to see if anything's doing. Is there any objection to applying the patch in this bug report? Lawrence Mitchell wrote: [...] > Note that the problem is that (uncomment-region A B 1) is not the > inverse of (comment-region A B 1). Irrespective of the major > mode in effect: > emacs -Q > C-x h > C-1 M-x comment-region RET > C-x h > C-1 M-x uncomment-region RET > Note how there is now a space at the beginning of every line in > the *scratch* buffer. > This is due to the following code in uncomment-region-default: > | (if (null arg) (delete-region (point-min) (point)) > | (skip-syntax-backward " ") > | (delete-char (- numarg)) > # foo bar > ^ point is here when the above code is called. > If an argument is supplied, arg is non-nil and so to delete the > comment we first move backwards over whitespace and then delete > as many comment characters as specified by the argument (1 in > this case).
Stefan Monnier <monnier <at> IRO.UMontreal.CA>
:Dima Kogan <dkogan <at> cds.caltech.edu>
:Message #22 received at 8150-done <at> debbugs.gnu.org (full text, mbox):
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA> To: Lawrence Mitchell <wence <at> gmx.li> Cc: 8150-done <at> debbugs.gnu.org Subject: Re: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region Date: Fri, 17 Feb 2012 10:45:23 -0500
> I'm chasing up open bugs I've participated in, probably too late > for 24.1, but just to see if anything's doing. Is there any > objection to applying the patch in this bug report? I've simplified the patch and installed it (see below), Stefan --- lisp/newcomment.el 2012-01-19 07:21:25 +0000 +++ lisp/newcomment.el 2012-02-17 15:41:15 +0000 @@ -872,14 +872,15 @@ (when (and sre (looking-at (concat "\\s-*\n\\s-*" srei))) (goto-char (match-end 0))) (if (null arg) (delete-region (point-min) (point)) - (skip-syntax-backward " ") + (let* ((opoint (point-marker)) + (nchar (skip-syntax-backward " "))) (delete-char (- numarg)) - (unless (or (bobp) + (unless (and (not (bobp)) (save-excursion (goto-char (point-min)) (looking-at comment-start-skip))) ;; If there's something left but it doesn't look like ;; a comment-start any more, just remove it. - (delete-region (point-min) (point)))) + (delete-region (point-min) opoint)))) ;; Remove the end-comment (and leading padding and such). (goto-char (point-max)) (comment-enter-backward)
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sat, 17 Mar 2012 11:24:03 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.