emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9860: closed (24.0.90; no auto-fill in c-mode when line begins with


From: GNU bug Tracking System
Subject: bug#9860: closed (24.0.90; no auto-fill in c-mode when line begins with #)
Date: Sun, 15 Oct 2023 11:12:02 +0000

Your message dated Sun, 15 Oct 2023 11:11:17 +0000
with message-id <ZSvI1aXdfpI04B83@ACM>
and subject line Re: bug#9860: 24.0.90; no auto-fill in c-mode when line begins 
with #
has caused the debbugs.gnu.org bug report #9860,
regarding 24.0.90; no auto-fill in c-mode when line begins with #
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
9860: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9860
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- 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



--- End Message ---
--- Begin Message --- 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).


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]