* bug#12274: 24.2; awk-mode indentation failure
@ 2012-08-25 5:59 Leo
0 siblings, 0 replies; 5+ messages in thread
From: Leo @ 2012-08-25 5:59 UTC (permalink / raw)
To: 12274; +Cc: bug-cc-mode
1. Emacs -q and change to a new buffer
2. M-x awk-mode
3. Type: NR >= 3
4. Type return and then tab to indent
The newline is indented.
AWK mode fails to recognise NR >= 3 as a pattern-action pair where
action is omitted. Statements in awk need no ; to terminate.
Leo
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#12274: 24.2; awk-mode indentation failure
2013-01-25 1:20 ` Leo Liu
@ 2013-01-25 8:44 ` Alan Mackenzie
2013-01-25 12:58 ` Stefan Monnier
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alan Mackenzie @ 2013-01-25 8:44 UTC (permalink / raw)
To: Leo Liu; +Cc: 12274
Hello, Leo.
On Fri, Jan 25, 2013 at 09:20:19AM +0800, Leo Liu wrote:
[ .... ]
> Alan, I also have another seemingly buglet about indentation.
As Glenn remarked, this is bug #12274.
> Every line after a pattern-action pair like the following one (where
> action is omitted) is indented to column 4, i.e. it doesn't recognise a
> newline terminates a pattern.
> $0 == "Emacs"
> |
> all following lines indented here
> (this might be regression, I seem to recall reporting something along
> these lines some while ago.)
No, not a regression, rather a bug which has been there since 4004 BC.
It's actually the "=" sign which triggers it, confusing the parsing
algortihm into thinking it's a C initialisation statement.
The solution is to move the pertinent AWK parsing clause earlier on in
the enclosing cond form.
Glenn, this is not a regression. Should I nevertheless commit it to the
emacs-24 branch?
Here's the patch:
diff -r 0d641a4d3e7c cc-engine.el
--- a/cc-engine.el Wed Jan 23 18:17:40 2013 +0000
+++ b/cc-engine.el Fri Jan 25 08:27:12 2013 +0000
@@ -9880,6 +9880,18 @@
;; contains any class offset
)))
+ ;; CASE 5P: AWK pattern or function or continuation
+ ;; thereof.
+ ((c-major-mode-is 'awk-mode)
+ (setq placeholder (point))
+ (c-add-stmt-syntax
+ (if (and (eq (c-beginning-of-statement-1) 'same)
+ (/= (point) placeholder))
+ 'topmost-intro-cont
+ 'topmost-intro)
+ nil nil
+ containing-sexp paren-state))
+
;; CASE 5D: this could be a top-level initialization, a
;; member init list continuation, or a template argument
;; list continuation.
@@ -10039,18 +10051,6 @@
(goto-char (point-min)))
(c-add-syntax 'objc-method-intro (c-point 'boi)))
- ;; CASE 5P: AWK pattern or function or continuation
- ;; thereof.
- ((c-major-mode-is 'awk-mode)
- (setq placeholder (point))
- (c-add-stmt-syntax
- (if (and (eq (c-beginning-of-statement-1) 'same)
- (/= (point) placeholder))
- 'topmost-intro-cont
- 'topmost-intro)
- nil nil
- containing-sexp paren-state))
-
;; CASE 5N: At a variable declaration that follows a class
;; definition or some other block declaration that doesn't
;; end at the closing '}'. C.f. case 5D.5.
> Leo
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#12274: 24.2; awk-mode indentation failure
2013-01-25 8:44 ` bug#12274: 24.2; awk-mode indentation failure Alan Mackenzie
@ 2013-01-25 12:58 ` Stefan Monnier
2013-01-25 17:33 ` Glenn Morris
2013-01-25 19:17 ` Alan Mackenzie
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-01-25 12:58 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: Leo Liu, 12274
> Glenn, this is not a regression. Should I nevertheless commit it to the
> emacs-24 branch?
No, this should go to trunk,
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#12274: 24.2; awk-mode indentation failure
2013-01-25 8:44 ` bug#12274: 24.2; awk-mode indentation failure Alan Mackenzie
2013-01-25 12:58 ` Stefan Monnier
@ 2013-01-25 17:33 ` Glenn Morris
2013-01-25 19:17 ` Alan Mackenzie
2 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2013-01-25 17:33 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: Leo Liu, 12274
Alan Mackenzie wrote:
> Glenn, this is not a regression. Should I nevertheless commit it to the
> emacs-24 branch?
No, trunk please.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#12274: 24.2; awk-mode indentation failure
2013-01-25 8:44 ` bug#12274: 24.2; awk-mode indentation failure Alan Mackenzie
2013-01-25 12:58 ` Stefan Monnier
2013-01-25 17:33 ` Glenn Morris
@ 2013-01-25 19:17 ` Alan Mackenzie
2 siblings, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2013-01-25 19:17 UTC (permalink / raw)
To: 12274-done
Bug fixed.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-25 19:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-25 5:59 bug#12274: 24.2; awk-mode indentation failure Leo
-- strict thread matches above, loose matches on Subject: below --
2013-01-24 11:43 bug#13541: 24.2.92; awk-mode: wrong font locking regexp literals Leo Liu
[not found] ` <b5ehhajuzy.fsf@fencepost.gnu.org>
2013-01-24 22:16 ` Alan Mackenzie
2013-01-25 1:20 ` Leo Liu
2013-01-25 8:44 ` bug#12274: 24.2; awk-mode indentation failure Alan Mackenzie
2013-01-25 12:58 ` Stefan Monnier
2013-01-25 17:33 ` Glenn Morris
2013-01-25 19:17 ` Alan Mackenzie
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).