GNU bug report logs -
#12188
24.1; awk-mode eletric { incorrectly inserts newline
Previous Next
Reported by: Leo <sdl.web <at> gmail.com>
Date: Mon, 13 Aug 2012 00:42:01 UTC
Severity: minor
Found in version 24.1
Done: Leo <sdl.web <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello, Leo.
On Thu, Aug 16, 2012 at 06:44:27AM +0800, Leo wrote:
> On 2012-08-15 22:42 +0800, Alan Mackenzie wrote:
> > The current assumption is that the "{" starts the action for the pattern
> > "NR==3".
> syntax after NR==3 is not recognised as `defun-open' which causes { to
> be inserted in a new line. I think there is a bug somewhere (probably
> c-guess-basic-syntax) regarding this.
It wasn't as bad as I thought. Other patterns (not involving "==")
correctly insert a newline _after_ (not before) a "{" is typed.
c-guess-basic-syntax was mis-parsing the "==" as an equals sign, hence
parsed the "{" as a brace-block opener rather than defun-open.
This patch should fix it. Would you try it out, please, and report back.
Thanks!
diff -r 1adcc48506f9 cc-cmds.el
--- a/cc-cmds.el Sun Apr 22 09:42:29 2012 +0000
+++ b/cc-cmds.el Sat Aug 18 19:41:01 2012 +0000
@@ -495,13 +495,16 @@
(insert-char ?\n 1)
;; In AWK (etc.) or in a macro, make sure this CR hasn't changed
;; the syntax. (There might already be an escaped NL there.)
- (when (or (c-at-vsemi-p (1- (point)))
- (let ((pt (point)))
- (save-excursion
- (backward-char)
- (and (c-beginning-of-macro)
- (progn (c-end-of-macro)
- (< (point) pt))))))
+ (when (or
+ (save-excursion
+ (c-skip-ws-backward (c-point 'bopl))
+ (c-at-vsemi-p))
+ (let ((pt (point)))
+ (save-excursion
+ (backward-char)
+ (and (c-beginning-of-macro)
+ (progn (c-end-of-macro)
+ (< (point) pt))))))
(backward-char)
(insert-char ?\\ 1)
(forward-char))
diff -r 1adcc48506f9 cc-engine.el
--- a/cc-engine.el Sun Apr 22 09:42:29 2012 +0000
+++ b/cc-engine.el Sat Aug 18 19:41:01 2012 +0000
@@ -9606,12 +9606,12 @@
(setq tmpsymbol nil)
(while (and (> (point) placeholder)
(zerop (c-backward-token-2 1 t))
- (/= (char-after) ?=))
+ (not (looking-at "=\\([^=]\\|$\\)")))
(and c-opt-inexpr-brace-list-key
(not tmpsymbol)
(looking-at c-opt-inexpr-brace-list-key)
(setq tmpsymbol 'topmost-intro-cont)))
- (eq (char-after) ?=))
+ (looking-at "=\\([^=]\\|$\\)"))
(looking-at c-brace-list-key))
(save-excursion
(while (and (< (point) indent-point)
> Leo
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 12 years and 307 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.