unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16985: indent-for-tab-command error messages could mention line numbers
@ 2014-03-10 18:36 積丹尼 Dan Jacobson
  2014-03-12 13:43 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2014-03-10 18:36 UTC (permalink / raw)
  To: 16985

TAB (translated from <tab>) runs the command indent-for-tab-command,

Its messages,
forward-sexp: Scan error: "Unbalanced parentheses", 1970, 1
would be improved if they could also mention line numbers and not just
apparently byte numbers. E.g.,
Unbalanced parentheses at line 34 column 33.





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

* bug#16985: indent-for-tab-command error messages could mention line numbers
  2014-03-10 18:36 bug#16985: indent-for-tab-command error messages could mention line numbers 積丹尼 Dan Jacobson
@ 2014-03-12 13:43 ` Stefan Monnier
  2014-03-12 18:25 ` 積丹尼 Dan Jacobson
  2014-03-13  1:46 ` 積丹尼 Dan Jacobson
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-03-12 13:43 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 16985

> TAB (translated from <tab>) runs the command indent-for-tab-command,
> Its messages,
> forward-sexp: Scan error: "Unbalanced parentheses", 1970, 1
> would be improved if they could also mention line numbers and not just
> apparently byte numbers. E.g.,
> Unbalanced parentheses at line 34 column 33.

Traditionally TAB does not signal an error for unbalanced parentheses.
It may indirectly signal such a problem by indenting to "a weird place".

IOW, please tell us in which case you got the above error, so we can
catch it and turn it into a non-error.


        Stefan





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

* bug#16985: indent-for-tab-command error messages could mention line numbers
  2014-03-10 18:36 bug#16985: indent-for-tab-command error messages could mention line numbers 積丹尼 Dan Jacobson
  2014-03-12 13:43 ` Stefan Monnier
@ 2014-03-12 18:25 ` 積丹尼 Dan Jacobson
  2014-03-12 23:27   ` Stefan Monnier
  2014-03-13  1:46 ` 積丹尼 Dan Jacobson
  2 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2014-03-12 18:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16985

>>>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
SM> IOW, please tell us in which case you got the above error, so we can
SM> catch it and turn it into a non-error.

I recall it was when I was editing a perl program, so try with perl
mode... But anyway I think it would be better to catch such errors.





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

* bug#16985: indent-for-tab-command error messages could mention line numbers
  2014-03-12 18:25 ` 積丹尼 Dan Jacobson
@ 2014-03-12 23:27   ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-03-12 23:27 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 16985

SM> IOW, please tell us in which case you got the above error, so we can
SM> catch it and turn it into a non-error.
> I recall it was when I was editing a perl program, so try with perl
> mode... But anyway I think it would be better to catch such errors.

Hmm... catch them and do what?  Such a signal means that's a coding
error somewhere in the indentation code, so hiding the signal is not
a good idea.


        Stefan





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

* bug#16985: indent-for-tab-command error messages could mention line numbers
  2014-03-10 18:36 bug#16985: indent-for-tab-command error messages could mention line numbers 積丹尼 Dan Jacobson
  2014-03-12 13:43 ` Stefan Monnier
  2014-03-12 18:25 ` 積丹尼 Dan Jacobson
@ 2014-03-13  1:46 ` 積丹尼 Dan Jacobson
  2014-04-02 19:49   ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2014-03-13  1:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16985

>>>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
SM> IOW, please tell us in which case you got the above error, so we can
SM> catch it and turn it into a non-error.
>> I recall it was when I was editing a perl program, so try with perl
>> mode... But anyway I think it would be better to catch such errors.

SM> Hmm... catch them and do what?  Such a signal means that's a coding
SM> error somewhere in the indentation code, so hiding the signal is not
SM> a good idea.


SM>         Stefan

OK, this file.pl
{}}
}(
}
triggers the bug. Do C-x h TAB.

Also the message should say "Help report this bug in xxx.el!" else people
will think it is an error in their perl file.





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

* bug#16985: indent-for-tab-command error messages could mention line numbers
  2014-03-13  1:46 ` 積丹尼 Dan Jacobson
@ 2014-04-02 19:49   ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-04-02 19:49 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 16985-done

>>>>> "積丹尼" == 積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

>>>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
SM> IOW, please tell us in which case you got the above error, so we can
SM> catch it and turn it into a non-error.
>>> I recall it was when I was editing a perl program, so try with perl
>>> mode... But anyway I think it would be better to catch such errors.

SM> Hmm... catch them and do what?  Such a signal means that's a coding
SM> error somewhere in the indentation code, so hiding the signal is not
SM> a good idea.


SM> Stefan

> OK, this file.pl
> {}}
> }(
> }
> triggers the bug. Do C-x h TAB.

> Also the message should say "Help report this bug in xxx.el!" else people
> will think it is an error in their perl file.

Thanks for the simple test case.  I installed the patch below which
should fix those problems.


        Stefan


=== modified file 'lisp/progmodes/perl-mode.el'
--- lisp/progmodes/perl-mode.el	2014-02-10 01:34:22 +0000
+++ lisp/progmodes/perl-mode.el	2014-04-02 19:46:36 +0000
@@ -854,11 +854,12 @@
    (and (= (char-syntax (following-char)) ?\))
 	(save-excursion
 	  (forward-char 1)
-	  (forward-sexp -1)
+          (when (condition-case nil (progn (forward-sexp -1) t)
+                  (scan-error nil))
 	  (perl-indent-new-calculate
            ;; Recalculate the parsing-start, since we may have jumped
            ;; dangerously close (typically in the case of nested functions).
-           'virtual nil (save-excursion (perl-beginning-of-function)))))
+             'virtual nil (save-excursion (perl-beginning-of-function))))))
    (and (and (= (following-char) ?{)
 	     (save-excursion (forward-char) (perl-hanging-paren-p)))
 	(+ (or default (perl-calculate-indent parse-start))






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

end of thread, other threads:[~2014-04-02 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 18:36 bug#16985: indent-for-tab-command error messages could mention line numbers 積丹尼 Dan Jacobson
2014-03-12 13:43 ` Stefan Monnier
2014-03-12 18:25 ` 積丹尼 Dan Jacobson
2014-03-12 23:27   ` Stefan Monnier
2014-03-13  1:46 ` 積丹尼 Dan Jacobson
2014-04-02 19:49   ` Stefan Monnier

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).