zsh-workers
 help / color / mirror / code / Atom feed
* quick bugfix for sticky-note
       [not found] <1177177665.5499794.1605395141729.ref@mail.yahoo.com>
@ 2020-11-14 23:05 ` vapnik spaknik
  2020-11-15 19:44   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: vapnik spaknik @ 2020-11-14 23:05 UTC (permalink / raw)
  To: Zsh Hackers List

Hi,
    I don't know if this is the correct mailing list to use, but I noticed that I was unable to use the ctrl+s in any keybindings for sticky-note (in functions/Misc/). I like to bind ctrl+x ctrl+s (^X^S) to accept-line to stay consistent with emacs. 
The problem is that sticky-note resets all options which means that flowcontrol is enabled and so pressing ctrl+s overrides any keybindings and stops output. I can't see any reason for needing this behaviour, so a quick fix would be to just add 'noflowcontrol' to the 'setopt' line near the start of the function.

Cheers,
Joe.


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

* Re: quick bugfix for sticky-note
  2020-11-14 23:05 ` quick bugfix for sticky-note vapnik spaknik
@ 2020-11-15 19:44   ` Bart Schaefer
  2020-11-15 20:29     ` Peter Stephenson
  2020-11-16 13:06     ` vapnik spaknik
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 2020-11-15 19:44 UTC (permalink / raw)
  To: vapnik spaknik; +Cc: Zsh Hackers List

On Sat, Nov 14, 2020 at 3:06 PM vapnik spaknik <vapniks@yahoo.com> wrote:
>
> The problem is that sticky-note resets all options which means that flowcontrol is enabled and so pressing ctrl+s overrides any keybindings and stops output. I can't see any reason for needing this behaviour, so a quick fix would be to just add 'noflowcontrol' to the 'setopt' line near the start of the function.

Hm.  The problem with that is that people who want flow control
suddenly lose it.

The doc for "emulate" says:
     If the -R switch is given, all settable options are reset to their
     default value corresponding to the specified emulation mode, except
     for certain options describing the interactive environment;

I wonder if flowcontrol should be considered an option "describing the
interactive environment" and therefore should not be reset by "emulate
-R".  That would be a change to long-standing behavior, of course, but
is there an obvious case where it would really matter?

In the meantime, this (apologies for any gmail word-wrapping):

diff --git a/Functions/Misc/sticky-note b/Functions/Misc/sticky-note
index efe5ec1eb..dd31eb81f 100644
--- a/Functions/Misc/sticky-note
+++ b/Functions/Misc/sticky-note
@@ -48,7 +48,7 @@

 # I encourage all you creative people to contribute enhancements ...

-emulate -LR zsh
+emulate -LR zsh -o ${${options[flowcontrol]/off/no}/on/}flowcontrol
 setopt nobanghist extendedhistory histignoredups

 local STICKYFILE=${STICKYFILE:-$HOME/.zsticky}


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

* Re: quick bugfix for sticky-note
  2020-11-15 19:44   ` Bart Schaefer
@ 2020-11-15 20:29     ` Peter Stephenson
  2020-11-16 13:06     ` vapnik spaknik
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2020-11-15 20:29 UTC (permalink / raw)
  To: zsh-workers

On Sun, 2020-11-15 at 11:44 -0800, Bart Schaefer wrote:
> I wonder if flowcontrol should be considered an option "describing the
> interactive environment" and therefore should not be reset by "emulate
> -R".  That would be a change to long-standing behavior, of course, but
> is there an obvious case where it would really matter?

That does make a lot of sense.  It's definitely not syntactic or
emulation, so it's hard to see why messing it about here is a good idea.
Unless there's a counterexample (which there usually is), this could
be considered a bug.

pws




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

* Re: quick bugfix for sticky-note
  2020-11-15 19:44   ` Bart Schaefer
  2020-11-15 20:29     ` Peter Stephenson
@ 2020-11-16 13:06     ` vapnik spaknik
  2020-11-16 16:07       ` Mikael Magnusson
  1 sibling, 1 reply; 5+ messages in thread
From: vapnik spaknik @ 2020-11-16 13:06 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Hackers List

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

 

>On Sunday, November 15, 2020, 07:45:06 PM GMT, Bart Schaefer <schaefer@brasslantern.com> wrote:

>>On Sat, Nov 14, 2020 at 3:06 PM vapnik spaknik <vapniks@yahoo.com> wrote:
>>> a quick fix would be to just add 'noflowcontrol' to the 'setopt' line near the start of the function.

>Hm.  The problem with that is that people who want flow control suddenly lose it.

Are you sure about that? In the documentation for emulate it says: "If the -L switch is given, the options LOCAL_OPTIONS, LOCAL_PATTERNS and LOCAL_TRAPS will be set as well, causing the effects of the emulate command and any setopt, disable -p or enable -p, and trap commands to be local to the immediately surrounding shell function, if any"



  

[-- Attachment #2: Type: text/html, Size: 863 bytes --]

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

* Re: quick bugfix for sticky-note
  2020-11-16 13:06     ` vapnik spaknik
@ 2020-11-16 16:07       ` Mikael Magnusson
  0 siblings, 0 replies; 5+ messages in thread
From: Mikael Magnusson @ 2020-11-16 16:07 UTC (permalink / raw)
  To: vapnik spaknik; +Cc: Bart Schaefer, Zsh Hackers List

On 11/16/20, vapnik spaknik <vapniks@yahoo.com> wrote:
>
>
>>On Sunday, November 15, 2020, 07:45:06 PM GMT, Bart Schaefer
>> <schaefer@brasslantern.com> wrote:
>
>>>On Sat, Nov 14, 2020 at 3:06 PM vapnik spaknik <vapniks@yahoo.com> wrote:
>>>> a quick fix would be to just add 'noflowcontrol' to the 'setopt' line
>>>> near the start of the function.
>
>>Hm.  The problem with that is that people who want flow control suddenly
>> lose it.
>
> Are you sure about that? In the documentation for emulate it says: "If the
> -L switch is given, the options LOCAL_OPTIONS, LOCAL_PATTERNS and
> LOCAL_TRAPS will be set as well, causing the effects of the emulate command
> and any setopt, disable -p or enable -p, and trap commands to be local to
> the immediately surrounding shell function, if any"

They would lose it while using this function.

-- 
Mikael Magnusson


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

end of thread, other threads:[~2020-11-16 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1177177665.5499794.1605395141729.ref@mail.yahoo.com>
2020-11-14 23:05 ` quick bugfix for sticky-note vapnik spaknik
2020-11-15 19:44   ` Bart Schaefer
2020-11-15 20:29     ` Peter Stephenson
2020-11-16 13:06     ` vapnik spaknik
2020-11-16 16:07       ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).