all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5033: 23.1; antlr-mode: antlr-indent-command broken for long grammars
@ 2009-11-24 14:58 Mr Kludge
  2019-10-01  1:16 ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Mr Kludge @ 2009-11-24 14:58 UTC (permalink / raw)
  To: bug-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 1054 bytes --]

Hello,

I am running into an antlr-mode bug when indenting long grammars.
Specifically, when the point in the grammar is higher than
antlr-slow-cache-diff-threshold indenting a grammar rule fails in
calling c-where-wrt-brace-construct through beginning-of-defun.

To trigger:
Write a longinsh grammar (more than 5k chars with the default setting)
or simply set antlr-slow-cache-diff-threshold to 0 and then try to
indent in a grammar rule.
See attached silly.g for an example.

Indentation breaks, with the following error:
c-where-wrt-brace-construct: c-beginning-of-decl-1 returned label

Backtrace:
  c-where-wrt-brace-construct()
  c-beginning-of-defun(1)
  funcall(c-beginning-of-defun 1)
  beginning-of-defun-raw(nil)
  ad-Orig-beginning-of-defun(nil)
  beginning-of-defun()
  antlr-syntactic-context()
  antlr-indent-line()
  antlr-indent-command(nil)
  call-interactively(antlr-indent-command nil nil)

Solution:
A simple solution (kludge) is to modify antlr-syntactic-context to not call
beginning-of-defun in antlr-mode.el.
See attached patch.

[-- Attachment #1.2: Type: text/html, Size: 1170 bytes --]

[-- Attachment #2: antlr-mode.el.patch --]
[-- Type: application/octet-stream, Size: 616 bytes --]

--- lisp/progmodes/antlr-mode.el.old	2009-11-24 09:50:22.000000000 -0500
+++ lisp/progmodes/antlr-mode.el	2009-11-24 09:51:24.000000000 -0500
@@ -1111,9 +1111,7 @@
 	(setq state (parse-partial-sexp (cadr antlr-slow-context-cache) orig
 					nil nil
 					(cddr antlr-slow-context-cache)))
-      (if (>= orig antlr-slow-cache-diff-threshold)
-	  (beginning-of-defun)
-	(goto-char (point-min)))
+    (goto-char (point-min))
 ;;;      (cond ((and diff (< diff 0)) (incf antlr-statistics-full-neg))
 ;;;	    ((and diff (>= diff 3000)) (incf antlr-statistics-full-diff))
 ;;;	    (t (incf antlr-statistics-full-other)))

[-- Attachment #3: silly.g --]
[-- Type: application/octet-stream, Size: 294 bytes --]

// antlr-mode indentation bug
// to trigger:
// (setq antlr-slow-cache-diff-threshold 0)
// indent anywhere in a rule
// errors [emacs 23.1] with
//  c-where-wrt-brace-construct: c-where-wrt-brace-construct: c-beginning-of-decl-1 returned label
grammar silly;
foo
    : (bar)
    | (baz)
    ;

^ permalink raw reply	[flat|nested] 4+ messages in thread
* bug#5033: 23.1; antlr-mode: antlr-indent-command broken for long grammars
@ 2010-01-01 17:42 Chong Yidong
  2016-03-28  2:35 ` Andrew Hyatt
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2010-01-01 17:42 UTC (permalink / raw)
  To: Mr Kludge; +Cc: Christoph.Wedler, 5033

> I am running into an antlr-mode bug when indenting long grammars.
> Specifically, when the point in the grammar is higher than
> antlr-slow-cache-diff-threshold indenting a grammar rule fails in
> calling c-where-wrt-brace-construct through beginning-of-defun.

> Solution:
> A simple solution (kludge) is to modify antlr-syntactic-context to not
> call beginning-of-defun in antlr-mode.el.  See attached patch.

I am not able to test this solution, because I don't work with antlr
files (and I doubt any of the other core Emacs maintainers do either).
I'm CC'ing the author of antlr-mode, Christoph Wedler, though we haven't
heard from him in a while.

In the meantime, could you try to explain what removing the
beginning-of-defun call in antlr-syntactic-context might break?  (Surely
that call is there for a reason.)






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-01  1:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 14:58 bug#5033: 23.1; antlr-mode: antlr-indent-command broken for long grammars Mr Kludge
2019-10-01  1:16 ` Stefan Kangas
  -- strict thread matches above, loose matches on Subject: below --
2010-01-01 17:42 Chong Yidong
2016-03-28  2:35 ` Andrew Hyatt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.