GNU bug report logs - #9860
24.0.90; no auto-fill in c-mode when line begins with #

Previous Next

Packages: emacs, cc-mode;

Reported by: pmlists <at> free.fr (Peter Münster)

Date: Mon, 24 Oct 2011 19:35:01 UTC

Severity: minor

Tags: confirmed

Found in versions 27.0.50, 24.0.90

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9860 in the body.
You can then email your comments to 9860 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9860; Package emacs. (Mon, 24 Oct 2011 19:35:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to pmlists <at> free.fr (Peter Münster):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 24 Oct 2011 19:35:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: pmlists <at> free.fr (Peter Münster)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.90; no auto-fill in c-mode when line begins with #
Date: Mon, 24 Oct 2011 21:33:08 +0200
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




bug Marked as found in versions 27.0.50. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 03 Oct 2019 04:02:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 03 Oct 2019 04:02:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 03 Oct 2019 04:02:02 GMT) Full text and rfc822 format available.

Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Sun, 15 Oct 2023 11:12:02 GMT) Full text and rfc822 format available.

Notification sent to pmlists <at> free.fr (Peter Münster):
bug acknowledged by developer. (Sun, 15 Oct 2023 11:12:02 GMT) Full text and rfc822 format available.

Message #16 received at 9860-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Peter Münster <pmlists <at> free.fr>
Cc: 9860-done <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>, acm <at> muc.de
Subject: Re: bug#9860: 24.0.90; no auto-fill in c-mode when line begins with #
Date: Sun, 15 Oct 2023 11:11:17 +0000
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).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#9860; Package emacs,cc-mode. (Mon, 16 Oct 2023 10:34:02 GMT) Full text and rfc822 format available.

Message #19 received at 9860-done <at> debbugs.gnu.org (full text, mbox):

From: Peter Münster <pm <at> a16n.net>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 9860-done <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#9860: 24.0.90; no auto-fill in c-mode when line begins with #
Date: Mon, 16 Oct 2023 12:33:18 +0200
[Message part 1 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Nov 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.