unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6688: 23.2; Auto-fill broken in C/C++ modes.
@ 2010-07-21 13:33 Matthieu Moy
       [not found] ` <handler.6688.B.127972470023881.ack@debbugs.gnu.org>
  2010-08-04 20:19 ` bug#6688: bug #6688 fixed Alan Mackenzie
  0 siblings, 2 replies; 12+ messages in thread
From: Matthieu Moy @ 2010-07-21 13:33 UTC (permalink / raw)
  To: 6688

Hi,

I've had problems with auto-fill-mode in C and C++ comments for a while,
I finally managed to find a small test-case: let this be a C program.

/*
  Test

*/
#include <foo>
#include <bar>

If I put my cursor on the blank line below "Test", activate
M-x auto-fill-mode RET (other than that, it's a plain "emacs -Q")
and type SPC, I get this:

/*
  Test
*include <foo>
#include <bar>

with my cursor in the middle of the "*include".

I can't reproduce on Emacs 22.

Thanks,



In GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.12.12)
 of 2010-05-10 on thabor
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--prefix=/usr/local/soft/emacs23/23.2' 'LDFLAGS=-L/local/berthier/usr/lib -L/usr/lib' 'CPPFLAGS=-I/local/berthier/usr/include -I/usr/include ''

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: C/l

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
M-x a u t o - c i <tab> <backspace> <backspace> f i 
<tab> <return> C-n C-n SPC C-_ M-x r e p o r t <tab> 
<return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Undo!

Load-path shadows:
None found.

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 wid-edit mailheader canlock sha1
hex-util hashcash mail-utils emacsbug cc-mode cc-fonts easymenu cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt 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 font-render-setting gtk x-toolkit x
multi-tty emacs)

-- 
Matthieu





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
       [not found] ` <handler.6688.B.127972470023881.ack@debbugs.gnu.org>
@ 2010-07-21 17:27   ` Matthieu Moy
  2010-07-24 20:26     ` Alan Mackenzie
       [not found]     ` <20100725130939.GA1141@muc.de>
  0 siblings, 2 replies; 12+ messages in thread
From: Matthieu Moy @ 2010-07-21 17:27 UTC (permalink / raw)
  To: 6688

Digging a bit further, I found out in this example:

/*
  Test

*/

* The problems seems to be that the last */ is at the beginning of
  line. If I add a space before, the problem disapears. It seems to be
  a problem with `c-mask-paragraph', around this

		(let* ((ender-start (save-excursion
				      (goto-char (cdr c-lit-limits))
				      (skip-syntax-backward "^w ")
				      (point)))

  since the skip-syntax-backward will skip the newline and move out of
  the line of the */.

* If I download version 5.31.3 of cc-mode and install it, the problem
  goes away.

Hope this helps,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
  2010-07-21 17:27   ` bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.) Matthieu Moy
@ 2010-07-24 20:26     ` Alan Mackenzie
  2010-07-25  9:50       ` martin rudalics
       [not found]     ` <20100725130939.GA1141@muc.de>
  1 sibling, 1 reply; 12+ messages in thread
From: Alan Mackenzie @ 2010-07-24 20:26 UTC (permalink / raw)
  To: Matthieu Moy, martin rudalics; +Cc: 6688

Hi, Matthieu,

thanks for such a wonderfully helpful bug report!

On Wed, Jul 21, 2010 at 07:27:37PM +0200, Matthieu Moy wrote:
> Digging a bit further, I found out in this example:

> /*
>   Test

> */

> * The problems seems to be that the last */ is at the beginning of
>   line. If I add a space before, the problem disapears. It seems to be
>   a problem with `c-mask-paragraph', around this

> 		(let* ((ender-start (save-excursion
> 				      (goto-char (cdr c-lit-limits))
> 				      (skip-syntax-backward "^w ")
> 				      (point)))

The problem is indeed nearby, in c-mask-paragraph.  Would you please try
out the patch below, indeed please test it as intensively as possible
and let me know if there are any remaining problems.  The code here is
complicated enough for me not to be totally confident about the patch.

>   since the skip-syntax-backward will skip the newline and move out of
>   the line of the */.

> * If I download version 5.31.3 of cc-mode and install it, the problem
>   goes away.

> Hope this helps,

Very much so!

#########################################################################

Hi, Martin,

would you please try this patch out on the test case for which you
committed change 83096, and let me know if that bug remains fixed.
83096 is this one:

------------------------------------------------------------
revno: 83096
committer: Martin Rudalics <rudalics@gmx.at>
timestamp: Sat 2007-12-08 09:55:18 +0000
message:
  (c-mask-paragraph): Avoid invalid search
    bound error in block comment branch.
    
Thanks!

#########################################################################

> -- 
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/

-- 
Alan Mackenzie (Nuremberg, Germany).






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
  2010-07-24 20:26     ` Alan Mackenzie
@ 2010-07-25  9:50       ` martin rudalics
  0 siblings, 0 replies; 12+ messages in thread
From: martin rudalics @ 2010-07-25  9:50 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 6688, Matthieu Moy

Hi, Alan!

 > Hi, Martin,
 >
 > would you please try this patch out on the test case for which you
 > committed change 83096, and let me know if that bug remains fixed.
 > 83096 is this one:

What is "this patch"?  I didn't receive any attachment and I see no
patch of you in rev 100893.

martin





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
       [not found]     ` <20100725130939.GA1141@muc.de>
@ 2010-07-25 13:35       ` martin rudalics
  2010-07-25 16:18         ` Alan Mackenzie
  2010-07-26  8:27       ` Matthieu Moy
  2010-07-31  9:49       ` Alan Mackenzie
  2 siblings, 1 reply; 12+ messages in thread
From: martin rudalics @ 2010-07-25 13:35 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 6688, Matthieu Moy

 > Apologies for omitting the patch.  Here it is:

Thank you, applied.  Is it sufficient to just recompile cc-cmds.el or do
we have to recompile all cc-*.el files?

martin





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
  2010-07-25 13:35       ` martin rudalics
@ 2010-07-25 16:18         ` Alan Mackenzie
  2010-07-26  5:50           ` martin rudalics
  0 siblings, 1 reply; 12+ messages in thread
From: Alan Mackenzie @ 2010-07-25 16:18 UTC (permalink / raw)
  To: martin rudalics; +Cc: 6688, Matthieu Moy

Hi, Martin,

On Sun, Jul 25, 2010 at 03:35:10PM +0200, martin rudalics wrote:
> > Apologies for omitting the patch.  Here it is:

> Thank you, applied.  Is it sufficient to just recompile cc-cmds.el or
> do we have to recompile all cc-*.el files?

No, just compiling cc-cmds.el should do, since it's a "top level" file
which doesn't suply macros etc. to the rest of cc-*.el.  

> martin

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
  2010-07-25 16:18         ` Alan Mackenzie
@ 2010-07-26  5:50           ` martin rudalics
  2010-07-26 19:34             ` Alan Mackenzie
  0 siblings, 1 reply; 12+ messages in thread
From: martin rudalics @ 2010-07-26  5:50 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 6688, Matthieu Moy

Morning, Alan

 > No, just compiling cc-cmds.el should do, since it's a "top level" file
 > which doesn't suply macros etc. to the rest of cc-*.el.

OK.  So the warnings ...

In toplevel form:
C:/emacs/trunk/lisp/progmodes/cc-langs.el:135:1:Warning: cl package required
     at runtime

In c-before-change-check-<>-operators:
C:/emacs/trunk/lisp/progmodes/cc-engine.el:5076:25:Warning: reference to free
     variable `c-new-BEG'
C:/emacs/trunk/lisp/progmodes/cc-engine.el:5076:42:Warning: assignment to free
     variable `c-new-BEG'
C:/emacs/trunk/lisp/progmodes/cc-engine.el:5079:42:Warning: reference to free
     variable `c-new-END'
C:/emacs/trunk/lisp/progmodes/cc-engine.el:5079:42:Warning: assignment to free
     variable `c-new-END'

In c-common-init:
C:/emacs/trunk/lisp/progmodes/cc-mode.el:643:11:Warning: assignment to free
     variable `c-new-BEG'
C:/emacs/trunk/lisp/progmodes/cc-mode.el:644:11:Warning: assignment to free
     variable `c-new-END'

... I currently see are due to something else.  How can I get rid of
them?

martin





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
       [not found]     ` <20100725130939.GA1141@muc.de>
  2010-07-25 13:35       ` martin rudalics
@ 2010-07-26  8:27       ` Matthieu Moy
  2010-07-31  9:49       ` Alan Mackenzie
  2 siblings, 0 replies; 12+ messages in thread
From: Matthieu Moy @ 2010-07-26  8:27 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 6688

Alan Mackenzie <acm@muc.de> writes:

> Hi, M & M,
>
> Apologies for omitting the patch.  Here it is:

That works for me, yes.

Thanks,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
  2010-07-26  5:50           ` martin rudalics
@ 2010-07-26 19:34             ` Alan Mackenzie
  2010-07-27  7:23               ` martin rudalics
  0 siblings, 1 reply; 12+ messages in thread
From: Alan Mackenzie @ 2010-07-26 19:34 UTC (permalink / raw)
  To: martin rudalics; +Cc: 6688, Matthieu Moy

And a jolly evening to you too, Martin!

On Mon, Jul 26, 2010 at 07:50:58AM +0200, martin rudalics wrote:
> Morning, Alan

> > No, just compiling cc-cmds.el should do, since it's a "top level" file
> > which doesn't suply macros etc. to the rest of cc-*.el.

> OK.  So the warnings ...

Hey, stop turning up the guilt machine!  They suddenly "appeared" with
either Emacs 22 or Emacs 23 (I can't remember any more) because of more
rigorous checking by the byte compiler.

> In toplevel form:
> C:/emacs/trunk/lisp/progmodes/cc-langs.el:135:1:Warning: cl package required
>     at runtime

That's an awkward one.  I'm not sure I quite believe it, but I'm almost
sure.

> In c-before-change-check-<>-operators:
> C:/emacs/trunk/lisp/progmodes/cc-engine.el:5076:25:Warning: reference to 
> free
>     variable `c-new-BEG'
> C:/emacs/trunk/lisp/progmodes/cc-engine.el:5076:42:Warning: assignment to 
> free
>     variable `c-new-BEG'
> C:/emacs/trunk/lisp/progmodes/cc-engine.el:5079:42:Warning: reference to 
> free
>     variable `c-new-END'
> C:/emacs/trunk/lisp/progmodes/cc-engine.el:5079:42:Warning: assignment to 
> free
>     variable `c-new-END'

> In c-common-init:
> C:/emacs/trunk/lisp/progmodes/cc-mode.el:643:11:Warning: assignment to free
>     variable `c-new-BEG'
> C:/emacs/trunk/lisp/progmodes/cc-mode.el:644:11:Warning: assignment to free
>     variable `c-new-END'

These are working variables, properly declared "in the right place",
until I found I needed to use them in initialisation routines too.
There're quite a few variables like this.

> ... I currently see are due to something else.  How can I get rid of
> them?

Ask me nicely?  ;-)  They're the sort of problem which never seems high
priority to fix, yet definitely needs doing.  All together there are
about 55 warning messages to fix.  It would probably take an evening to
do so.  Give me a few days!

> martin

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
  2010-07-26 19:34             ` Alan Mackenzie
@ 2010-07-27  7:23               ` martin rudalics
  0 siblings, 0 replies; 12+ messages in thread
From: martin rudalics @ 2010-07-27  7:23 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 6688, Matthieu Moy

 >> OK.  So the warnings ...
 >
 > Hey, stop turning up the guilt machine!  They suddenly "appeared" with
 > either Emacs 22 or Emacs 23 (I can't remember any more) because of more
 > rigorous checking by the byte compiler.
[...]
 > Ask me nicely?  ;-)  They're the sort of problem which never seems high
 > priority to fix, yet definitely needs doing.  All together there are
 > about 55 warning messages to fix.  It would probably take an evening to
 > do so.  Give me a few days!

Sorry.  It's the first time I had a closer look into compiler warnings
for some time and I thought they might be related to the change at hand.
Looking at compile logs is currently much too confusing for me with all
the save-excursion/set-buffer warnings.

The only thing about cc-* that really annoys me is an "old-style
backquotes detected!" warning I get when I load cc-menus.el (don't ask
me why I load it, I need the functionality somewhere).

In any case I think you can check in the fix for 6688 now ;-)

martin





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.)
       [not found]     ` <20100725130939.GA1141@muc.de>
  2010-07-25 13:35       ` martin rudalics
  2010-07-26  8:27       ` Matthieu Moy
@ 2010-07-31  9:49       ` Alan Mackenzie
  2 siblings, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2010-07-31  9:49 UTC (permalink / raw)
  To: Matthieu Moy, martin rudalics; +Cc: 6688

Hi, Matthieu and Martin,

I've applied this patch to the Bazaar head at savannah.  That should fix
the bug.

Thanks once again for such a high quality bug report.

On Sun, Jul 25, 2010 at 01:09:39PM +0000, Alan Mackenzie wrote:

> === modified file 'lisp/progmodes/cc-cmds.el'
> *** lisp/progmodes/cc-cmds.el	2010-05-12 11:06:12 +0000
> --- lisp/progmodes/cc-cmds.el	2010-07-23 21:27:24 +0000
> ***************
> *** 3974,3989 ****
>   		    ;; "Invalid search bound (wrong side of point)"
>   		    ;; error in the subsequent re-search.  Maybe
>   		    ;; another fix would be needed (2007-12-08).
> ! 		    (and (> (- (cdr c-lit-limits) 2) (point))
>   			 (search-forward-regexp
>   			  (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
>   			  (- (cdr c-lit-limits) 2) t)
>   			 (not (search-forward-regexp
>   			       "\\(\\s \\|\\sw\\)"
>   			       (- (cdr c-lit-limits) 2) 'limit))
> ! 			     ;; The comment ender IS on its own line.  Exclude
> ! 			     ;; this line from the filling.
> ! 			 (set-marker end (c-point 'bol))))
>   
>   		;; The comment ender is hanging.  Replace all space between it
>   		;; and the last word either by one or two 'x's (when
> --- 3974,3990 ----
>   		    ;; "Invalid search bound (wrong side of point)"
>   		    ;; error in the subsequent re-search.  Maybe
>   		    ;; another fix would be needed (2007-12-08).
> ! 		    (or (<= (- (cdr c-lit-limits) 2) (point))
> ! 			(and 
>   			 (search-forward-regexp
>   			  (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
>   			  (- (cdr c-lit-limits) 2) t)
>   			 (not (search-forward-regexp
>   			       "\\(\\s \\|\\sw\\)"
>   			       (- (cdr c-lit-limits) 2) 'limit))
> ! 			 ;; The comment ender IS on its own line.  Exclude
> ! 			 ;; this line from the filling.
> ! 			 (set-marker end (c-point 'bol)))))
>   
>   		;; The comment ender is hanging.  Replace all space between it
>   		;; and the last word either by one or two 'x's (when
> 
> #########################################################################
> > http://www-verimag.imag.fr/~moy/

-- 
Alan Mackenzie (Nuremberg, Germany).
 





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6688: bug #6688 fixed
  2010-07-21 13:33 bug#6688: 23.2; Auto-fill broken in C/C++ modes Matthieu Moy
       [not found] ` <handler.6688.B.127972470023881.ack@debbugs.gnu.org>
@ 2010-08-04 20:19 ` Alan Mackenzie
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2010-08-04 20:19 UTC (permalink / raw)
  To: 6688-done

Bug fixed.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-08-04 20:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 13:33 bug#6688: 23.2; Auto-fill broken in C/C++ modes Matthieu Moy
     [not found] ` <handler.6688.B.127972470023881.ack@debbugs.gnu.org>
2010-07-21 17:27   ` bug#6688: Acknowledgement (23.2; Auto-fill broken in C/C++ modes.) Matthieu Moy
2010-07-24 20:26     ` Alan Mackenzie
2010-07-25  9:50       ` martin rudalics
     [not found]     ` <20100725130939.GA1141@muc.de>
2010-07-25 13:35       ` martin rudalics
2010-07-25 16:18         ` Alan Mackenzie
2010-07-26  5:50           ` martin rudalics
2010-07-26 19:34             ` Alan Mackenzie
2010-07-27  7:23               ` martin rudalics
2010-07-26  8:27       ` Matthieu Moy
2010-07-31  9:49       ` Alan Mackenzie
2010-08-04 20:19 ` bug#6688: bug #6688 fixed Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).