* bug#9860: 24.0.90; no auto-fill in c-mode when line begins with #
2011-10-24 19:33 bug#9860: 24.0.90; no auto-fill in c-mode when line begins with # Peter Münster
@ 2023-10-15 11:11 ` Alan Mackenzie
2023-10-16 10:33 ` Peter Münster
0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2023-10-15 11:11 UTC (permalink / raw)
To: Peter Münster; +Cc: 9860-done, Stefan Kangas, acm
Hello, Peter.
Thank you for taking the trouble to submit this bug report all these
years ago, and sorry it's taken so long to attend to it.
The problem was a simple coding error, checking for a macro before
checking whether or not we were in a comment. Your line of "#bla bla
...." was thus handled as a macro, and by the default setting of
`c-ignore-auto-file' didn't get filled.
I have now fixed this in the Emacs master branch, which will be getting
released as Emacs-30.1 maybe in a year's time. I'm closing the bug with
this post.
If you would like to try out the fix yourself, here is the patch, which
needs to be applied in directory lisp/progmodes in the Emacs source
tree.
diff -r 0e6ebd732cbe cc-cmds.el
--- a/cc-cmds.el Sat Oct 14 18:56:50 2023 +0000
+++ b/cc-cmds.el Sun Oct 15 10:41:42 2023 +0000
@@ -4887,7 +4887,8 @@
(setq c-lit-limits (c-literal-limits nil nil t)))
(unless c-lit-type
(setq c-lit-type (c-literal-type c-lit-limits)))
- (if (memq (cond ((c-query-and-set-macro-start) 'cpp)
+ (if (memq (cond ((memq c-lit-type '(c c++ string)) c-lit-type)
+ ((c-query-and-set-macro-start) 'cpp)
((null c-lit-type) 'code)
(t c-lit-type))
c-ignore-auto-fill)
On Mon, Oct 24, 2011 at 21:33:08 +0200, Peter Münster wrote:
> Hello,
> With latest bzr-emacs:
> - emacs -Q
> - open "foo.c"
> - turn on auto-fill (M-x auto-fill-mode)
> - write the following comment:
> --8<---------------cut here---------------start------------->8---
> /*
> #bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
> --8<---------------cut here---------------end--------------->8---
> - result: auto-fill does not work here
> In GNU Emacs 24.0.90.2 (x86_64-suse-linux-gnu, GTK+ Version 2.22.1)
> of 2011-10-23 on micropit
> Windowing system distributor `The X.Org Foundation', version 11.0.10903000
> configured using `configure '--without-toolkit-scroll-bars''
> Important settings:
> value of $LC_ALL: nil
> value of $LC_COLLATE: nil
> value of $LC_CTYPE: en_GB.utf8
> value of $LC_MESSAGES: nil
> value of $LC_MONETARY: nil
> value of $LC_NUMERIC: nil
> value of $LC_TIME: nil
> value of $LANG: nil
> value of $XMODIFIERS: @im=local
> locale-coding-system: utf-8-unix
> default enable-multibyte-characters: t
> --
> Peter
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 3+ messages in thread