unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* emacs coding modes need 'Suspend Disbelief' button
@ 2017-05-19 10:54 Jason Vas Dias
  2017-05-19 11:22 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Jason Vas Dias @ 2017-05-19 10:54 UTC (permalink / raw)
  To: emacs-devel, help-gnu-emacs

Hi Emacs wizards -

I just thought I should let you know,
being an emacs user of over 20 years,
that I think the fact that it is possible
to core-dump emacs by simply adding
some text to a shell script is bad , and
that I think modern emacs is going too
far in continuously syntax-checking
and parsing code.

In general, when using programming modes
such as c-mode / cc-mode / shell-script-mode ,
I wish, when typing, I could just turn all syntax
checking off by clicking on a 'Suspend Disbelief'
or 'Syntax Check Off' button  / checkbox -
then, when I  enter '"' or "'", the rest of the text
would not be colored - this is really annoying and greatly
slows down editing of large files - I don't want
the cursor to jump to the previous open bracket,
and I want the current indent to be preserved, until
I un-check 'Syntax Check' or press 'Syntax Check On' .

The insistence of modern emacs on always unconditionally
syntax checking everything greatly slows down typing and
is a major inhibition to quick editing of large source files .

And in some modes, such as shell script mode, and also
cc-mode, it is still possible to core-dump Emacs (latest 25.2 version)
simply by entering partial source code too slow or too fast , because of this
continuous syntax-checking .
I have core-dumped emacs several times recently by doing this -
one example that works pretty reliably is to start defining a
function within a function in shell-script - there is a timing
related bug , if you don't enter the opening '{' fast enough,
emacs will core-dump .

Emacs is regressing back towards 1990s levels of reliability
because of its insistence on continuous syntax checking .

Is there any way to globally turn off continuous syntax checking
for all modes ?

If not, I'm going to develop one.

Thanks & Regards,
Jason



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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 10:54 emacs coding modes need 'Suspend Disbelief' button Jason Vas Dias
@ 2017-05-19 11:22 ` Eli Zaretskii
  2017-05-19 11:43   ` Jason Vas Dias
       [not found] ` <20170519112004.GA31732@tuxteam.de>
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2017-05-19 11:22 UTC (permalink / raw)
  To: Jason Vas Dias; +Cc: emacs-devel

> From: Jason Vas Dias <jason.vas.dias@gmail.com>
> Date: Fri, 19 May 2017 10:54:28 +0000
> 
> I just thought I should let you know,
> being an emacs user of over 20 years,
> that I think the fact that it is possible
> to core-dump emacs by simply adding
> some text to a shell script is bad

I agree, and I urge you to report this as bugs, with all the details
required to reproduce the problem.



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

* Fwd: emacs coding modes need 'Suspend Disbelief' button
       [not found]   ` <CALyZvKzvUBe1-+yTnpK97MA=Dh5q89RmTugG3CJ0bcrbqnd2Eg@mail.gmail.com>
@ 2017-05-19 11:37     ` Jason Vas Dias
  2017-05-20  7:47       ` Robert Thorpe
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Vas Dias @ 2017-05-19 11:37 UTC (permalink / raw)
  To: emacs-devel, help-gnu-emacs

---------- Forwarded message ----------
From: Jason Vas Dias <jason.vas.dias@gmail.com>
Date: Fri, 19 May 2017 11:36:17 +0000
Subject: Re: emacs coding modes need 'Suspend Disbelief' button
To: tomas@tuxteam.de

RE:
> Not a button, but perhaps the start of one: does
> "M-x fundamental-mode <RET>" float your boat?

No, sorry, I don't want to re-color the whole document or load another mode
or type anything long - that would be too clumsy.
I want a tiny checkbox in the tool bar, or a right-click menu option , or a
<control>+<single-letter> keystroke, meaning
'freeze current indent & coloring, suspend syntax checking here' ,
and then unchecking / pressing keystroke again resumes syntax
checking from the point where you disabled it.
Sorry for not making this clear.
Thanks for your response.

On 19/05/2017, tomas@tuxteam.de <tomas@tuxteam.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Fri, May 19, 2017 at 10:54:28AM +0000, Jason Vas Dias wrote:
>> Hi Emacs wizards -
>
> [...]
>
>> In general, when using programming modes
>> such as c-mode / cc-mode / shell-script-mode ,
>> I wish, when typing, I could just turn all syntax
>> checking off by clicking on a 'Suspend Disbelief'
>> or 'Syntax Check Off' button [...]
>
> Not a button, but perhaps the start of one: does
> "M-x fundamental-mode <RET>" float your boat?
>
> cheers
> - -- tomás
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
>
> iEYEARECAAYFAlke1OQACgkQBcgs9XrR2kYP8wCfTm7mgSiLJkj+c0Cn/RA4qeWN
> RO0An004YYtgyvmmfDZL38MTGhbW1FUb
> =p/Ei
> -----END PGP SIGNATURE-----
>
>



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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 10:54 emacs coding modes need 'Suspend Disbelief' button Jason Vas Dias
  2017-05-19 11:22 ` Eli Zaretskii
       [not found] ` <20170519112004.GA31732@tuxteam.de>
@ 2017-05-19 11:42 ` Óscar Fuentes
  2017-05-19 13:35 ` Drew Adams
  2017-05-19 16:23 ` Stefan Monnier
  4 siblings, 0 replies; 11+ messages in thread
From: Óscar Fuentes @ 2017-05-19 11:42 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-devel

Jason Vas Dias <jason.vas.dias@gmail.com> writes:

> And in some modes, such as shell script mode, and also
> cc-mode, it is still possible to core-dump Emacs (latest 25.2 version)
> simply by entering partial source code too slow or too fast , because of this
> continuous syntax-checking .
> I have core-dumped emacs several times recently by doing this -
> one example that works pretty reliably is to start defining a
> function within a function in shell-script - there is a timing
> related bug , if you don't enter the opening '{' fast enough,
> emacs will core-dump .

Please use M-x report-emacs-bug and provide the exact details for
reproducing the bug, preferably starting with `emacs -Q'.

> Is there any way to globally turn off continuous syntax checking
> for all modes ?

Try putting

(global-font-lock-mode -1)

in your .emacs.




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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 11:22 ` Eli Zaretskii
@ 2017-05-19 11:43   ` Jason Vas Dias
  2017-05-26 13:32     ` Thien-Thi Nguyen
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Vas Dias @ 2017-05-19 11:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

The problem is, it is a transient and timing related bug - I cannot
reproduce it at will . But it has happened several times over the
last month . Fortunately, emacs has always saved a '#<file name>#'
crash file and I've been able to recover what I was typing.

The last exact difference that caused a core dump was :


$ diff -U0 sets.sh \#sets.sh#
--- sets.sh	2017-05-19 09:40:20.150752587 +0000
+++ #sets.sh#	2017-05-19 09:48:20.160120576 +0000
@@ -9,0 +10 @@
+_r='';
@@ -36,0 +38,3 @@
+  function needle_cmp()
+  {
+
@@ -65,3 +68,0 @@
-             if ! IN $x $needle; then
-                return 1;
-             fi


Now, that's not much to go on, and I can't reproduce it by typing:
    function f()
    {
         function fsub()
         {
         }
         if ! f $x; then
            return 1;
        fi
   }

Nor can I reproduce it by making same edits in clean emacs .

But leaving the core dumps aside, continuous syntax checking
and document re-coloring is just plain annoying, when typing,
but is nice when reading  - I wish I could turn it off & on quickly
& easily .




On 19/05/2017, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Jason Vas Dias <jason.vas.dias@gmail.com>
>> Date: Fri, 19 May 2017 10:54:28 +0000
>>
>> I just thought I should let you know,
>> being an emacs user of over 20 years,
>> that I think the fact that it is possible
>> to core-dump emacs by simply adding
>> some text to a shell script is bad
>
> I agree, and I urge you to report this as bugs, with all the details
> required to reproduce the problem.
>



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

* RE: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 10:54 emacs coding modes need 'Suspend Disbelief' button Jason Vas Dias
                   ` (2 preceding siblings ...)
  2017-05-19 11:42 ` Óscar Fuentes
@ 2017-05-19 13:35 ` Drew Adams
  2017-05-19 16:23 ` Stefan Monnier
  4 siblings, 0 replies; 11+ messages in thread
From: Drew Adams @ 2017-05-19 13:35 UTC (permalink / raw)
  To: Jason Vas Dias, emacs-devel, help-gnu-emacs

Please don't cross-post to emacs-devel and help-gnu-emacs.
Pick one.



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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 10:54 emacs coding modes need 'Suspend Disbelief' button Jason Vas Dias
                   ` (3 preceding siblings ...)
  2017-05-19 13:35 ` Drew Adams
@ 2017-05-19 16:23 ` Stefan Monnier
  4 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2017-05-19 16:23 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-devel

> then, when I  enter '"' or "'", the rest of the text
> would not be colored - this is really annoying and greatly
> slows down editing of large files -

Normally when you insert " only the current line gets "colored"
immediately, and the rest of the buffer is only re-"colored" by
jit-lock's contextual highlighting, i.e. after jit-lock-context-time of
idle time.  So if keep Emacs busy enough until you hit the closing " the
rest of the buffer should not be re-"colored" incorrectly even temporarily.

This said, even if it is re-"colored", that shouldn't slow anything down
(IOW if there's a noticeable slowdown, please report it so we can try
and fix it).

> The insistence of modern emacs on always unconditionally
> syntax checking everything greatly slows down typing and
> is a major inhibition to quick editing of large source files.

IIUC you're bumping into some performance problems.
If so, please report them (with M-x report-emacs-bug and enough details
that we can try and reproduce them) so we can try to fix them.

> And in some modes, such as shell script mode, and also
> cc-mode, it is still possible to core-dump Emacs (latest 25.2 version)

Core dumps are serious bugs, so please M-x report-emacs-bug.
We try pretty hard to fix those promptly.
If they're difficult to reproduce, the best is for you to run Emacs
within GDB and then send us the output of "bt" when it crashes.

> I have core-dumped emacs several times recently by doing this -
> one example that works pretty reliably is to start defining a
> function within a function in shell-script - there is a timing
> related bug , if you don't enter the opening '{' fast enough,
> emacs will core-dump .

My best guess here is that maybe your system has a stack-space limit
that's lower than what Emacs expects for some reason, so that the code
we have to try and check that we don't overflow the stack (e.g. in the
regexp matcher) doesn't do its job.


        Stefan




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

* Re: Fwd: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 11:37     ` Fwd: " Jason Vas Dias
@ 2017-05-20  7:47       ` Robert Thorpe
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Thorpe @ 2017-05-20  7:47 UTC (permalink / raw)
  To: Jason Vas Dias; +Cc: help-gnu-emacs, emacs-devel

Jason Vas Dias <jason.vas.dias@gmail.com> writes:

> ---------- Forwarded message ----------
> From: Jason Vas Dias <jason.vas.dias@gmail.com>
> Date: Fri, 19 May 2017 11:36:17 +0000
> Subject: Re: emacs coding modes need 'Suspend Disbelief' button
> To: tomas@tuxteam.de
>
> RE:
>> Not a button, but perhaps the start of one: does
>> "M-x fundamental-mode <RET>" float your boat?
>
> No, sorry, I don't want to re-color the whole document or load another mode
> or type anything long - that would be too clumsy.
> I want a tiny checkbox in the tool bar, or a right-click menu option , or a
> <control>+<single-letter> keystroke, meaning
> 'freeze current indent & coloring, suspend syntax checking here' ,
> and then unchecking / pressing keystroke again resumes syntax
> checking from the point where you disabled it.
> Sorry for not making this clear.
> Thanks for your response.

I think font-lock-mode is what you want.  Something like this:

(global-set-key (kbd "C-1") 'font-lock-mode)

As others have pointed out, it is probably a misconfigured build and/or
a bug.

BR,
Robert Thorpe



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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-05-19 11:43   ` Jason Vas Dias
@ 2017-05-26 13:32     ` Thien-Thi Nguyen
  2017-06-21 18:38       ` Jason Vas Dias
  0 siblings, 1 reply; 11+ messages in thread
From: Thien-Thi Nguyen @ 2017-05-26 13:32 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]


() Jason Vas Dias <jason.vas.dias@gmail.com>
() Fri, 19 May 2017 11:43:53 +0000

   But leaving the core dumps aside, continuous syntax checking
   and document re-coloring is just plain annoying, when typing,
   but is nice when reading - I wish I could turn it off & on
   quickly & easily .

Have you explored reducing the intrusiveness of this checking?
On my (old, slow) system given my (old, slow) typing speed,
Emacs seems responsive enough w/ only:

 (setq jit-lock-context-time 1.5)

I see there are other vars (e.g., ‘jit-lock-contextually’), too.
       
-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-05-26 13:32     ` Thien-Thi Nguyen
@ 2017-06-21 18:38       ` Jason Vas Dias
  2017-06-23 21:11         ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Vas Dias @ 2017-06-21 18:38 UTC (permalink / raw)
  To: emacs-devel

Many thanks for useful responses to those that replied -
to answer some of the questions -

A way to reproduce fairly reliably :

In C++ mode, edit some deeply nested set of parens like:


((argc > 2) && (argv[3]!=NULL) &&
(argv[3][0]=='u'))?U::RTNL::RT::Type_t::RT_UNICAST:(
       ((argc > 2) && (argv[3]!=NULL) &&
(argv[3][0]=='l'))?U::RTNL::RT::Type_t::RT_LOCAL:(
       ((argc > 2) && (argv[3]!=NULL) &&
(argv[3][0]=='b'))?U::RTNL::RT::Type_t::RT_BROADCAST:(
       ((argc > 2) && (argv[3]!=NULL) &&
(argv[3][0]=='a'))?U::RTNL::RT::Type_t::RT_ANYCAST:(
                                     ((argc > 2) && (argv[3]!=NULL) &&
(argv[3][0]=='a'))?U::RTNL::RT::Type_t::RT_ANYCAST:(

An attempt to add another clause with Emacs c++-mode enabled
fairly reliably results in a core dump.

But I will try playing around with those settings and see if that helps ...

Thanks,
Jason

On 26/05/2017, Thien-Thi Nguyen <ttn@gnu.org> wrote:
>
> () Jason Vas Dias <jason.vas.dias@gmail.com>
> () Fri, 19 May 2017 11:43:53 +0000
>
>    But leaving the core dumps aside, continuous syntax checking
>    and document re-coloring is just plain annoying, when typing,
>    but is nice when reading - I wish I could turn it off & on
>    quickly & easily .
>
> Have you explored reducing the intrusiveness of this checking?
> On my (old, slow) system given my (old, slow) typing speed,
> Emacs seems responsive enough w/ only:
>
>  (setq jit-lock-context-time 1.5)
>
> I see there are other vars (e.g., ‘jit-lock-contextually’), too.
>
> --
> Thien-Thi Nguyen -----------------------------------------------
>  (defun responsep (query)
>    (pcase (context query)
>      (`(technical ,ml) (correctp ml))
>      ...))                              748E A0E8 1CB8 A748 9BFA
> --------------------------------------- 6CE4 6703 2224 4C80 7502
>



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

* Re: emacs coding modes need 'Suspend Disbelief' button
  2017-06-21 18:38       ` Jason Vas Dias
@ 2017-06-23 21:11         ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2017-06-23 21:11 UTC (permalink / raw)
  To: emacs-devel

> ((argc > 2) && (argv[3]!=NULL) &&
> (argv[3][0]=='u'))?U::RTNL::RT::Type_t::RT_UNICAST:(
>        ((argc > 2) && (argv[3]!=NULL) &&
> (argv[3][0]=='l'))?U::RTNL::RT::Type_t::RT_LOCAL:(
>        ((argc > 2) && (argv[3]!=NULL) &&
> (argv[3][0]=='b'))?U::RTNL::RT::Type_t::RT_BROADCAST:(
>        ((argc > 2) && (argv[3]!=NULL) &&
> (argv[3][0]=='a'))?U::RTNL::RT::Type_t::RT_ANYCAST:(
>                                      ((argc > 2) && (argv[3]!=NULL) &&
> (argv[3][0]=='a'))?U::RTNL::RT::Type_t::RT_ANYCAST:(

> An attempt to add another clause with Emacs c++-mode enabled
> fairly reliably results in a core dump.

Sorry, no core dump here.  But that code sure looks hideous.
Is that machine-generated code, maybe?

I'd be strongly tempted to rewrite along the lines of

   if ((argc <= 2) || (argv[3] == NULL))
      <blabla>
   else
     switch (argv[3][0]) {
     case 'u': return U::RTNL::RT::Type_t::RT_UNICAST;
     case 'l': return U::RTNL::RT::Type_t::RT_LOCAL;
     ...
     }


-- Stefan




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

end of thread, other threads:[~2017-06-23 21:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-19 10:54 emacs coding modes need 'Suspend Disbelief' button Jason Vas Dias
2017-05-19 11:22 ` Eli Zaretskii
2017-05-19 11:43   ` Jason Vas Dias
2017-05-26 13:32     ` Thien-Thi Nguyen
2017-06-21 18:38       ` Jason Vas Dias
2017-06-23 21:11         ` Stefan Monnier
     [not found] ` <20170519112004.GA31732@tuxteam.de>
     [not found]   ` <CALyZvKzvUBe1-+yTnpK97MA=Dh5q89RmTugG3CJ0bcrbqnd2Eg@mail.gmail.com>
2017-05-19 11:37     ` Fwd: " Jason Vas Dias
2017-05-20  7:47       ` Robert Thorpe
2017-05-19 11:42 ` Óscar Fuentes
2017-05-19 13:35 ` Drew Adams
2017-05-19 16:23 ` 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).