[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comment-dwim and uncommenting
From: |
Stefan Monnier |
Subject: |
Re: comment-dwim and uncommenting |
Date: |
Mon, 02 Jun 2003 13:39:29 -0400 |
> > > Hi Stefan,
> > > I tried it also with emacs -q --no-site-file and it worked for me.
> > >
> > > However I found out, that I have the following statement in my
> > > .emacs: (setq comment-padding 0)
> > >
> > > When use this, I get the behaviour I described above.
> >
> > I still can't reproduce it with
> >
> > emacs -q --no-site-file \
> > --eval '(setq comment-add 0)' \
> > --eval '(transient-mark-mode 1)' \
> > ~/tmp/foo.cc
> >
> > I tried it with Emacs-21.3 and Emacs-CVS.
> >
> >
> > Stefan
>
> I use comment-padding, not comment-add in my setup.
> I tried it with the latest emacs from debian and with cvs on
> windows. Both show the described bug.
Duh!! Sorry for being such an idiot!
It's kind of a nasty problem.
I believe the patch below fixes it.
Thank you for your patience,
Stefan
--- newcomment.el.~1.66.~ Fri May 30 16:05:42 2003
+++ newcomment.el Mon Jun 2 13:34:29 2003
@@ -669,6 +669,7 @@
(let* ((numarg (prefix-numeric-value arg))
(ccs comment-continue)
(srei (comment-padright ccs 're))
+ (csre (comment-padright comment-start 're))
(sre (and srei (concat "^\\s-*?\\(" srei "\\)")))
spt)
(while (and (< (point) end)
@@ -697,7 +698,10 @@
(> (- (point) (point-min) (length comment-start)) 7))
(> (count-lines (point-min) (point-max)) 2))
(setq box t))
- (when (looking-at (regexp-quote comment-padding))
+ ;; Skip the padding. Padding can come from comment-padding and/or
+ ;; from comment-start, so we first check comment-start.
+ (if (or (save-excursion (goto-char (point-min)) (looking-at csre))
+ (looking-at (regexp-quote comment-padding)))
(goto-char (match-end 0)))
(when (and sre (looking-at (concat "\\s-*\n\\s-*" srei)))
(goto-char (match-end 0)))