unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Peter Münster" <pmlists@free.fr>
Cc: 9860-done@debbugs.gnu.org, Stefan Kangas <stefan@marxist.se>, acm@muc.de
Subject: bug#9860: 24.0.90; no auto-fill in c-mode when line begins with #
Date: Sun, 15 Oct 2023 11:11:17 +0000	[thread overview]
Message-ID: <ZSvI1aXdfpI04B83@ACM> (raw)
In-Reply-To: <871uu2b2x7.fsf@micropit.couberia.bzh>

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





  reply	other threads:[~2023-10-15 11:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-10-16 10:33   ` Peter Münster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZSvI1aXdfpI04B83@ACM \
    --to=acm@muc.de \
    --cc=9860-done@debbugs.gnu.org \
    --cc=pmlists@free.fr \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).