zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH v2 (complete): Implement zle -P
Date: Tue, 1 Sep 2015 16:32:18 -0700	[thread overview]
Message-ID: <150901163218.ZM2455@torch.brasslantern.com> (raw)
In-Reply-To: <23177.1441101027@thecus.kiddle.eu>

On Sep 1, 11:50am, Oliver Kiddle wrote:
} 
} As Bart mentions in 28560, the auto-suffix-retain precedent would
} suggest that we should perhaps consider another yank-pop-enable widget
} (or perhaps hold-yank-state given that this now affects highlighting and
} not just yank-pop). An advantage of that approach over the flags is that
} the full implementation of the widget is contained within the function
} definition file.

Another possibility is that "zle -f" or whatever letter we assign is
one of those special variants like "zle -R" / "zle -I" which only
have an effect when run from inside another widget.  This hypothetical
zle-switch could set the flags that are to be in effect at the time
the widget completes.

This would make "zle auto-suffix-retain" equivalent to (for example)
"zle -f auto-suffix-retain" and then we just add other strings for
the other flags, rather than adding more special widgets (which
clutter the namespace and can be uselessly overridden with "zle -N").

} With the flags, we might end up needing something like
} #compdef so you can put #zledef -f yank as the first line of the
} function definition.

Agreed that this is less good than being able to control the effect
from inside the widget implementation.

} Another possibility would be to try to make something like
} hold-yank-state automatic - assuming that hypothetical widget was
} called after every yank/yank-pop/vi-put-* in a user-defined widget.

I'm not sure I understand this one.  Do you mean that any time one
of the yank-related widgets is called, its flags would "stick" to the
calling widget (at least until there was another later yank call)?

Still, it'd be nice if one could do e.g.

    LBUFFER+=$SOMENEWTEXT
    zle -f yank

to indicate that the insertion into LBUFFER should be treated like a
yank even though it wasn't actually using the kill ring.  Maybe there
is no valid reason for that.

} Either way, how can we be sure that yankb/yanke are even vaguely
} sensible after the user-defined widget has finished?

Yes, that is an issue.  Probably I'd say than any future changes to
the content of BUFFER invalidate the whole yank state.  But that may
be an awful lot of new record-keeping.


  parent reply	other threads:[~2015-09-01 23:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  6:07 Mikael Magnusson
2015-09-01  6:53 ` Bart Schaefer
2015-09-01  9:50 ` Oliver Kiddle
2015-09-01 10:03   ` Peter Stephenson
2015-09-06  9:50     ` Daniel Shahaf
2015-09-06 11:51       ` Mikael Magnusson
2015-09-01 23:32   ` Bart Schaefer [this message]
2015-09-03 10:38     ` PATCH: zle -f from inside widget to set flags Mikael Magnusson
2015-09-03 10:40       ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150901163218.ZM2455@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).