unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Invalid read syntax: ")"
@ 2018-05-06  4:09 Jean-Christophe Helary
  2018-05-06  4:15 ` Eric Abrahamsen
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Jean-Christophe Helary @ 2018-05-06  4:09 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

I have an Invalid read syntax: ")" when I start emacs.

When I do emacs -q and eval-buffer on .emacs.el I get the error again but check-parens does not give me anything there, which is the only file that I use for customizations.

...

Any idea how to diagnose that ?

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





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

* Re: Invalid read syntax: ")"
  2018-05-06  4:09 Invalid read syntax: ")" Jean-Christophe Helary
@ 2018-05-06  4:15 ` Eric Abrahamsen
  2018-05-06  4:46   ` Eric Abrahamsen
  2018-05-06 15:32   ` Jean-Christophe Helary
  2018-05-06  4:28 ` Óscar Fuentes
  2018-05-06 18:36 ` Joost Kremers
  2 siblings, 2 replies; 16+ messages in thread
From: Eric Abrahamsen @ 2018-05-06  4:15 UTC (permalink / raw)
  To: help-gnu-emacs

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

> I have an Invalid read syntax: ")" when I start emacs.
>
> When I do emacs -q and eval-buffer on .emacs.el I get the error again
> but check-parens does not give me anything there, which is the only
> file that I use for customizations.
>
> ...
>
> Any idea how to diagnose that ?

"emacs --debug-init"

That will at least show you which file the problem is in. I get this all
the time (despite using paredit).




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

* Re: Invalid read syntax: ")"
  2018-05-06  4:09 Invalid read syntax: ")" Jean-Christophe Helary
  2018-05-06  4:15 ` Eric Abrahamsen
@ 2018-05-06  4:28 ` Óscar Fuentes
  2018-05-06 18:36 ` Joost Kremers
  2 siblings, 0 replies; 16+ messages in thread
From: Óscar Fuentes @ 2018-05-06  4:28 UTC (permalink / raw)
  To: help-gnu-emacs

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

> I have an Invalid read syntax: ")" when I start emacs.
>
> When I do emacs -q and eval-buffer on .emacs.el I get the error again
> but check-parens does not give me anything there, which is the only
> file that I use for customizations.
>
> ...
>
> Any idea how to diagnose that ?

Comment out the last half of your .emacs. If the problem still happens,
comment the last half of the first half, etc. If the the problem does
not happen, un-comment the firt half of the code you just commented-out,
etc.

At the end, you end with an expression that causes the problem.

This is known as a bisection.




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

* Re: Invalid read syntax: ")"
  2018-05-06  4:15 ` Eric Abrahamsen
@ 2018-05-06  4:46   ` Eric Abrahamsen
  2018-05-06  8:26     ` Noam Postavsky
  2018-05-06 15:32   ` Jean-Christophe Helary
  1 sibling, 1 reply; 16+ messages in thread
From: Eric Abrahamsen @ 2018-05-06  4:46 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
>
>> I have an Invalid read syntax: ")" when I start emacs.
>>
>> When I do emacs -q and eval-buffer on .emacs.el I get the error again
>> but check-parens does not give me anything there, which is the only
>> file that I use for customizations.
>>
>> ...
>>
>> Any idea how to diagnose that ?
>
> "emacs --debug-init"

Oops, I didn't notice that you'd already found the file. Ignore me!




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

* Re: Invalid read syntax: ")"
  2018-05-06  4:46   ` Eric Abrahamsen
@ 2018-05-06  8:26     ` Noam Postavsky
  0 siblings, 0 replies; 16+ messages in thread
From: Noam Postavsky @ 2018-05-06  8:26 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: help-gnu-emacs

On 6 May 2018 at 00:46, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
>>
>>> I have an Invalid read syntax: ")" when I start emacs.
>>>
>>> When I do emacs -q and eval-buffer on .emacs.el I get the error again
>>> but check-parens does not give me anything there, which is the only
>>> file that I use for customizations.
>>>
>>> ...
>>>
>>> Any idea how to diagnose that ?
>>
>> "emacs --debug-init"
>
> Oops, I didn't notice that you'd already found the file. Ignore me!

The debugger backtrace should still give you useful info, there should
be a line like

  eval-buffer(#<buffer  *load*> ...)  ; Reading at buffer position xxxx

Where xxxx should be the buffer position of the offending ")".



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

* Re: Invalid read syntax: ")"
  2018-05-06  4:15 ` Eric Abrahamsen
  2018-05-06  4:46   ` Eric Abrahamsen
@ 2018-05-06 15:32   ` Jean-Christophe Helary
  2018-05-06 16:03     ` Drew Adams
  1 sibling, 1 reply; 16+ messages in thread
From: Jean-Christophe Helary @ 2018-05-06 15:32 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list



> On May 6, 2018, at 13:15, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
> 
> Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
> 
>> I have an Invalid read syntax: ")" when I start emacs.
>> 
>> When I do emacs -q and eval-buffer on .emacs.el I get the error again
>> but check-parens does not give me anything there, which is the only
>> file that I use for customizations.
>> 
>> ...
>> 
>> Any idea how to diagnose that ?
> 
> "emacs --debug-init"
> 
> That will at least show you which file the problem is in. I get this all
> the time (despite using paredit).

Thank you Eric.

But what I get is:

$ emacs --debug-init
Invalid read syntax: ")"

and that's it...


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune




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

* RE: Invalid read syntax: ")"
  2018-05-06 15:32   ` Jean-Christophe Helary
@ 2018-05-06 16:03     ` Drew Adams
  2018-05-07  0:14       ` Jean-Christophe Helary
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2018-05-06 16:03 UTC (permalink / raw)
  To: Jean-Christophe Helary, Help Gnu Emacs mailing list

> >> I have an Invalid read syntax: ")" when I start emacs.
> >> Any idea how to diagnose that ?
> >
> > "emacs --debug-init"
> > That will at least show you which file the problem is in
>
> But what I get is:
> $ emacs --debug-init
> Invalid read syntax: ")"

As Oscar suggested, _bisect your init file_ to find the
culprit.  This a binary search, so it is quick, even if
it does not seem so at first.

You can comment out selected text (the active region)
using command `comment-region'. (I bind it to `C-x C-;'.)
With `C-u', it removes a level of commenting.  (So if
there are no nested comments then it uncomments.)

Some people use `comment-dwim' (`M-;') or `comment-line'
(the default binding for `C-x C-;'), instead of
`comment-region'.  It's all good.

---

Actually, I bind `C-x C-;' to `comment-region-lines',
from `misc-cmds.el', and I use that.  It's kind of
like `comment-region' combined with `comment-line'.

https://www.emacswiki.org/emacs/download/misc-cmds.el



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

* Re: Invalid read syntax: ")"
  2018-05-06  4:09 Invalid read syntax: ")" Jean-Christophe Helary
  2018-05-06  4:15 ` Eric Abrahamsen
  2018-05-06  4:28 ` Óscar Fuentes
@ 2018-05-06 18:36 ` Joost Kremers
  2 siblings, 0 replies; 16+ messages in thread
From: Joost Kremers @ 2018-05-06 18:36 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Help Gnu Emacs mailing list


On Sun, May 06 2018, Jean-Christophe Helary wrote:
> I have an Invalid read syntax: ")" when I start emacs.
>
> When I do emacs -q and eval-buffer on .emacs.el I get the error 
> again but check-parens does not give me anything there, which is 
> the only file that I use for customizations.
>
> ...
>
> Any idea how to diagnose that ?

When I get this sort of thing, I find it helpful, to use 
`backward-sexp` (bound to `C-M-b') at the end of some random 
defuns or other top-level declarations. At some point I'll run 
into a declaration where `C-M-b' doesn't take me to the expected 
position. Looking at indentation also helps, sometimes.

-- 
Joost Kremers
Life has its moments



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

* Re: Invalid read syntax: ")"
  2018-05-06 16:03     ` Drew Adams
@ 2018-05-07  0:14       ` Jean-Christophe Helary
  2018-05-07  0:33         ` Noam Postavsky
  2018-05-07  0:33         ` Óscar Fuentes
  0 siblings, 2 replies; 16+ messages in thread
From: Jean-Christophe Helary @ 2018-05-07  0:14 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list



> On May 7, 2018, at 1:03, Drew Adams <drew.adams@oracle.com <mailto:drew.adams@oracle.com>> wrote:
> 
>>>> I have an Invalid read syntax: ")" when I start emacs.
>>>> Any idea how to diagnose that ?
>>> 
>>> "emacs --debug-init"
>>> That will at least show you which file the problem is in
>> 
>> But what I get is:
>> $ emacs --debug-init
>> Invalid read syntax: ")"
> 
> As Oscar suggested, _bisect your init file_ to find the
> culprit.  This a binary search, so it is quick, even if
> it does not seem so at first.

I understand what a binary search is, but I was first wondering if among the hundreds of thousands of functions in emacs, there would not be one that does the trick. Like actually giving the expression that is not properly closed. If a manual binary search can do it, surely an automatic binary search (if one ought to exist) can...

Also, the man page says about emacs --debug-init:

      -debug-init
               Enable Emacs Lisp debugger during the processing  of  the  user
               init  file  ~/.emacs.  This is useful for debugging problems in
               the init file.

If the only information it gives in that case is the same as when running "emacs", I don't find that particularly useful.

Ok, so on with the binary search.


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com <http://mac4translators.blogspot.com/> @brandelune




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

* Re: Invalid read syntax: ")"
  2018-05-07  0:14       ` Jean-Christophe Helary
@ 2018-05-07  0:33         ` Noam Postavsky
  2018-05-07  3:54           ` Jean-Christophe Helary
  2018-05-07  0:33         ` Óscar Fuentes
  1 sibling, 1 reply; 16+ messages in thread
From: Noam Postavsky @ 2018-05-07  0:33 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Help Gnu Emacs mailing list

On 6 May 2018 at 20:14, Jean-Christophe Helary
<jean.christophe.helary@gmail.com> wrote:

>>> But what I get is:
>>> $ emacs --debug-init
>>> Invalid read syntax: ")"

Perhaps it happens after init time?

> I understand what a binary search is, but I was first wondering if among the hundreds of thousands of functions in emacs, there would not be one that does the trick. Like actually giving the expression that is not properly closed. If a manual binary search can do it, surely an automatic binary search (if one ought to exist) can...

You said you could get the error with M-x eval-buffer, right? Perhaps
just doing M-x toggle-debug-on-error before that will get the
backtrace (which should include the buffer position of the offending
")").



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

* Re: Invalid read syntax: ")"
  2018-05-07  0:14       ` Jean-Christophe Helary
  2018-05-07  0:33         ` Noam Postavsky
@ 2018-05-07  0:33         ` Óscar Fuentes
  2018-05-07  1:13           ` Óscar Fuentes
  1 sibling, 1 reply; 16+ messages in thread
From: Óscar Fuentes @ 2018-05-07  0:33 UTC (permalink / raw)
  To: help-gnu-emacs

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

> I understand what a binary search is, but I was first wondering if
> among the hundreds of thousands of functions in emacs, there would not
> be one that does the trick. Like actually giving the expression that
> is not properly closed.

In general, this is not possible.

> If a manual binary search can do it, surely an
> automatic binary search (if one ought to exist) can...

Take a look at

https://github.com/Malabarba/elisp-bug-hunter

I never used it.

> Also, the man page says about emacs --debug-init:
>
>       -debug-init
>                Enable Emacs Lisp debugger during the processing  of  the  user
>                init  file  ~/.emacs.  This is useful for debugging problems in
>                the init file.
>
> If the only information it gives in that case is the same as when
> running "emacs", I don't find that particularly useful.

For most types of errors, --debug-init is really useful.

> Ok, so on with the binary search.

Good look.




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

* Re: Invalid read syntax: ")"
  2018-05-07  0:33         ` Óscar Fuentes
@ 2018-05-07  1:13           ` Óscar Fuentes
  0 siblings, 0 replies; 16+ messages in thread
From: Óscar Fuentes @ 2018-05-07  1:13 UTC (permalink / raw)
  To: help-gnu-emacs

Óscar Fuentes <ofv@wanadoo.es> writes:

>> Ok, so on with the binary search.
>
> Good look.

s/look/luck

(although `taking a good look' here is a also a good thing :-)

BTW, please report your findings.




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

* Re: Invalid read syntax: ")"
  2018-05-07  0:33         ` Noam Postavsky
@ 2018-05-07  3:54           ` Jean-Christophe Helary
  2018-05-07  4:05             ` Jean-Christophe Helary
  2018-05-07 17:55             ` Eli Zaretskii
  0 siblings, 2 replies; 16+ messages in thread
From: Jean-Christophe Helary @ 2018-05-07  3:54 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list


> On May 7, 2018, at 9:33, Noam Postavsky <npostavs@gmail.com> wrote:
> 
> You said you could get the error with M-x eval-buffer, right? Perhaps
> just doing M-x toggle-debug-on-error before that will get the
> backtrace (which should include the buffer position of the offending
> ")").


The problematic "region" is:

(require 'package)

Weird, right ?


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune




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

* Re: Invalid read syntax: ")"
  2018-05-07  3:54           ` Jean-Christophe Helary
@ 2018-05-07  4:05             ` Jean-Christophe Helary
  2018-05-07 17:55             ` Eli Zaretskii
  1 sibling, 0 replies; 16+ messages in thread
From: Jean-Christophe Helary @ 2018-05-07  4:05 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list



> On May 7, 2018, at 12:54, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:
> 
> 
>> On May 7, 2018, at 9:33, Noam Postavsky <npostavs@gmail.com <mailto:npostavs@gmail.com>> wrote:
>> 
>> You said you could get the error with M-x eval-buffer, right? Perhaps
>> just doing M-x toggle-debug-on-error before that will get the
>> backtrace (which should include the buffer position of the offending
>> ")").
> 
> 
> The problematic "region" is:
> 
> (require 'package)
> 
> Weird, right ?

And when I open package.el, eval-buffer it and return to that expression for evaluation, I get an expected "package" as a result...


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune




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

* Re: Invalid read syntax: ")"
  2018-05-07  3:54           ` Jean-Christophe Helary
  2018-05-07  4:05             ` Jean-Christophe Helary
@ 2018-05-07 17:55             ` Eli Zaretskii
  2018-05-08  0:43               ` Jean-Christophe Helary
  1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2018-05-07 17:55 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
> Date: Mon, 7 May 2018 12:54:11 +0900
> 
> > You said you could get the error with M-x eval-buffer, right? Perhaps
> > just doing M-x toggle-debug-on-error before that will get the
> > backtrace (which should include the buffer position of the offending
> > ")").
> 
> 
> The problematic "region" is:
> 
> (require 'package)
> 
> Weird, right ?

Crystal ball says that you are using a fontconfig version that resets
LC_NUMERIC when Emacs doesn't expect.  See bug#30788.

You didn't say what version of Emacs are you using, but if it doesn't
include the fix for that problem, that's the most probable reason.



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

* Re: Invalid read syntax: ")"
  2018-05-07 17:55             ` Eli Zaretskii
@ 2018-05-08  0:43               ` Jean-Christophe Helary
  0 siblings, 0 replies; 16+ messages in thread
From: Jean-Christophe Helary @ 2018-05-08  0:43 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list



> On May 8, 2018, at 2:55, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
>> Date: Mon, 7 May 2018 12:54:11 +0900
>> 
>>> You said you could get the error with M-x eval-buffer, right? Perhaps
>>> just doing M-x toggle-debug-on-error before that will get the
>>> backtrace (which should include the buffer position of the offending
>>> ")").
>> 
>> 
>> The problematic "region" is:
>> 
>> (require 'package)
>> 
>> Weird, right ?
> 
> Crystal ball says that you are using a fontconfig version that resets
> LC_NUMERIC when Emacs doesn't expect.  See bug#30788.
> 
> You didn't say what version of Emacs are you using, but if it doesn't
> include the fix for that problem, that's the most probable reason.

I'm using master that I regularly build.


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune




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

end of thread, other threads:[~2018-05-08  0:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-06  4:09 Invalid read syntax: ")" Jean-Christophe Helary
2018-05-06  4:15 ` Eric Abrahamsen
2018-05-06  4:46   ` Eric Abrahamsen
2018-05-06  8:26     ` Noam Postavsky
2018-05-06 15:32   ` Jean-Christophe Helary
2018-05-06 16:03     ` Drew Adams
2018-05-07  0:14       ` Jean-Christophe Helary
2018-05-07  0:33         ` Noam Postavsky
2018-05-07  3:54           ` Jean-Christophe Helary
2018-05-07  4:05             ` Jean-Christophe Helary
2018-05-07 17:55             ` Eli Zaretskii
2018-05-08  0:43               ` Jean-Christophe Helary
2018-05-07  0:33         ` Óscar Fuentes
2018-05-07  1:13           ` Óscar Fuentes
2018-05-06  4:28 ` Óscar Fuentes
2018-05-06 18:36 ` Joost Kremers

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