unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9860: 24.0.90; no auto-fill in c-mode when line begins with #
@ 2011-10-24 19:33 Peter Münster
  2023-10-15 11:11 ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Münster @ 2011-10-24 19:33 UTC (permalink / raw)
  To: 9860

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





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

* 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

* bug#9860: 24.0.90; no auto-fill in c-mode when line begins with #
  2023-10-15 11:11 ` Alan Mackenzie
@ 2023-10-16 10:33   ` Peter Münster
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Münster @ 2023-10-16 10:33 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 9860-done, Stefan Kangas

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

On Sun, Oct 15 2023, Alan Mackenzie wrote:

> I have now fixed this in the Emacs master branch,

Thanks, it works well for me.

Kind regards,
-- 
           Peter

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

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

end of thread, other threads:[~2023-10-16 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).