GNU bug report logs -
#57042
28.1.91; c-mode autoindents cweb style lines
Previous Next
Reported by: Van Ly <van.ly <at> sdf.org>
Date: Sun, 7 Aug 2022 16:19:02 UTC
Severity: normal
Tags: notabug
Found in version 28.1.91
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
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 57042 in the body.
You can then email your comments to 57042 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57042
; Package
emacs
.
(Sun, 07 Aug 2022 16:19:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Van Ly <van.ly <at> sdf.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 07 Aug 2022 16:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
C Mode autoindents CWEB style lines undesirably.
Steps to reproduce
. starting from 'emacs -Q'
. open new file 'C-x f /dev/shm/explain.w'
. enable mode for C 'M-x c-mode'
. enter the C CWEB style source text below
. Explanation}
the last two lines autoindent but I expect them to be without
. at line 6 below at # position c-set-offset reports 'cpp-macro'
. at line 0 below at # position c-set-offset reports 'cpp-macro'
Expected result is for lines 6, F and 0 below to be without indent.
```
1 @** Convert 511 decimal to octal.
2 @d _x_number_x_ 511
3 @d _x_banner_x_ "What is the value of %d in octal?"
4 @c
5 #include <stdio.h>
6 #include "u.h"
7 int@/
8 main(void)@/
9 {
A int n = _x_number_x_;
B printf (_x_banner_x_, n);
C printf ("%s! %d decimal is %o octal\n", "Right", n, n);
D }
E @ @(u.h@>=
F @h
0 #include <stdlib.h>
```
--
vl
[bug-gnu-emacs-28-1-91.text (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57042
; Package
emacs
.
(Sun, 07 Aug 2022 16:32:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 57042 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 7 Aug 2022 16:16:31 +0000 (UTC)
> From: Van Ly <van.ly <at> sdf.org>
>
> C Mode autoindents CWEB style lines undesirably.
>
> Steps to reproduce
> . starting from 'emacs -Q'
> . open new file 'C-x f /dev/shm/explain.w'
> . enable mode for C 'M-x c-mode'
> . enter the C CWEB style source text below
> . Explanation}
> the last two lines autoindent but I expect them to be without
> . at line 6 below at # position c-set-offset reports 'cpp-macro'
> . at line 0 below at # position c-set-offset reports 'cpp-macro'
>
> Expected result is for lines 6, F and 0 below to be without indent.
>
> ```
> 1 @** Convert 511 decimal to octal.
> 2 @d _x_number_x_ 511
> 3 @d _x_banner_x_ "What is the value of %d in octal?"
> 4 @c
> 5 #include <stdio.h>
> 6 #include "u.h"
> 7 int@/
> 8 main(void)@/
> 9 {
> A int n = _x_number_x_;
> B printf (_x_banner_x_, n);
> C printf ("%s! %d decimal is %o octal\n", "Right", n, n);
> D }
> E @ @(u.h@>=
> F @h
> 0 #include <stdlib.h>
> ```
Sorry, I don't understand: why do you expect C Mode to DTRT for CWEB
files? The above is not valid C code, it's a different language that
needs a dedicated major mode.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57042
; Package
emacs
.
(Sun, 07 Aug 2022 18:13:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 57042 <at> debbugs.gnu.org (full text, mbox):
On Sun, 7 Aug 2022, Eli Zaretskii wrote:
>
> Sorry, I don't understand: why do you expect C Mode to DTRT for CWEB
> files? The above is not valid C code, it's a different language that
> needs a dedicated major mode.
>
Yes, there is a dedicated mode for cweb by dek. I guess it is out of
date in relation to modern Emacs. I'm expecting c mode might have
enough fuzzy heuristic to play well with cweb. For example, skip the
lines beginning with @ when autoindenting. C code validity is a
moving target.
--
vl
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57042
; Package
emacs
.
(Sun, 07 Aug 2022 21:59:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 57042 <at> debbugs.gnu.org (full text, mbox):
Van Ly <van.ly <at> sdf.org> writes:
> Yes, there is a dedicated mode for cweb by dek. I guess it is out of
> date in relation to modern Emacs. I'm expecting c mode might have
> enough fuzzy heuristic to play well with cweb. For example, skip the
> lines beginning with @ when autoindenting. C code validity is a
> moving target.
c-mode doesn't support the cweb language, and won't do that, either.
It might make sense to add a package for doing that to ELPA, but I
haven't seen anybody request that either, so it seems like there's not
really much demand for it.
In any case, I don't think there's anything actionable here on the
Emacs side, so I'm closing this bug report.
Added tag(s) notabug.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 07 Aug 2022 21:59:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
57042 <at> debbugs.gnu.org and Van Ly <van.ly <at> sdf.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 07 Aug 2022 21:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57042
; Package
emacs
.
(Mon, 08 Aug 2022 03:51:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 57042 <at> debbugs.gnu.org (full text, mbox):
On Sun, 7 Aug 2022, Lars Ingebrigtsen wrote:
>
> c-mode doesn't support the cweb language, and won't do that, either.
>
> It might make sense to add a package for doing that to ELPA, but I
> haven't seen anybody request that either, so it seems like there's not
> really much demand for it.
>
But I did when I discovered cweb is out there and working. I posted a
bug report with a link to the cweb mode el file. I guess ownership
and licensing bureaucratic complication make it less available and to
keep current. Finding that file wasn't easy. Anyway, cweb has
intrinsic value in as much Emacs has. Prog mode doesn't indent the
second brace right at all which was why I tried the c mode next.
'C-c C-o' can tell c mode to override the autoindent to offset 0.
--
vl
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 05 Sep 2022 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 288 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.