zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Move _history_modifiers call to _parameter
@ 2023-09-14 12:10 Mikael Magnusson
  2023-09-15  4:05 ` Sebastian Gniazdowski
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2023-09-14 12:10 UTC (permalink / raw)
  To: zsh-workers

_parameters is used in many contexts, like assignments in command
position, assignment after typeset, etc, where history modifiers are not
valid. _brace_parameter already calls _history_modifiers explicitly so
this seems more in line with that.
---
 Completion/Zsh/Context/_parameter | 5 +++++
 Completion/Zsh/Type/_parameters   | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Completion/Zsh/Context/_parameter b/Completion/Zsh/Context/_parameter
index 7e7788535c..b08d665f58 100644
--- a/Completion/Zsh/Context/_parameter
+++ b/Completion/Zsh/Context/_parameter
@@ -1,3 +1,8 @@
 #compdef -parameter-
 
+if compset -P '*:'; then
+  _history_modifiers p
+  return
+fi
+
 _parameters -e
diff --git a/Completion/Zsh/Type/_parameters b/Completion/Zsh/Type/_parameters
index 7f6f33e0ee..7b7692a3c7 100644
--- a/Completion/Zsh/Type/_parameters
+++ b/Completion/Zsh/Type/_parameters
@@ -6,11 +6,6 @@
 # If you specify a -g option with a pattern, the pattern will be used to
 # restrict the type of parameters matched.
 
-if compset -P '*:'; then
-  _history_modifiers p
-  return
-fi
-
 local i pfilt
 local -i nm=$compstate[nmatches]
 local -a expl pattern=( -g \* ) normal described verbose faked fakes tmp
-- 
2.38.1



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

* Re: PATCH: Move _history_modifiers call to _parameter
  2023-09-15  4:05 ` Sebastian Gniazdowski
@ 2023-09-14 23:39   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2023-09-14 23:39 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: zsh-workers

On Thu, Sep 14, 2023 at 2:04 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> I created a mew function with [Mikael's] patch applied. Advice on changing from _pa…terrs to the new function, when at: $ ::<TAB>?

Actually you should be able to do this with zstyle without needing the
new function.

zstyle -e ':completion:*:complete:-command-:*:*' tag-order \
              'if [[ $words[CURRENT] = :* ]]; then \
              reply=("commands builtins functions suffix-aliases
reserved-words jobs aliases") \
              else
              reply=("commands builtins functions suffix-aliases
reserved-words jobs parameters aliases modifiers") \
             fi'

Rearrange the order as you see fit, I preserved the default.


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

* Re: PATCH: Move _history_modifiers call to _parameter
  2023-09-14 12:10 PATCH: Move _history_modifiers call to _parameter Mikael Magnusson
@ 2023-09-15  4:05 ` Sebastian Gniazdowski
  2023-09-14 23:39   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2023-09-15  4:05 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-workers

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

I created a mew function with your patch applied. Advice on changing from
_pa…terrs to the new function, when at: $ ::<TAB>?

On Thu, 14 Sept 2023 at 07:10, Mikael Magnusson <mikachu@gmail.com> wrote:

> _parameters is used in many contexts, like assignments in command
> position, assignment after typeset, etc, where history modifiers are not
> valid. _brace_parameter already calls _history_modifiers explicitly so
> this seems more in line with that.
> ---
>  Completion/Zsh/Context/_parameter | 5 +++++
>  Completion/Zsh/Type/_parameters   | 5 -----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Completion/Zsh/Context/_parameter
> b/Completion/Zsh/Context/_parameter
> index 7e7788535c..b08d665f58 100644
> --- a/Completion/Zsh/Context/_parameter
> +++ b/Completion/Zsh/Context/_parameter
> @@ -1,3 +1,8 @@
>  #compdef -parameter-
>
> +if compset -P '*:'; then
> +  _history_modifiers p
> +  return
> +fi
> +
>  _parameters -e
> diff --git a/Completion/Zsh/Type/_parameters
> b/Completion/Zsh/Type/_parameters
> index 7f6f33e0ee..7b7692a3c7 100644
> --- a/Completion/Zsh/Type/_parameters
> +++ b/Completion/Zsh/Type/_parameters
> @@ -6,11 +6,6 @@
>  # If you specify a -g option with a pattern, the pattern will be used to
>  # restrict the type of parameters matched.
>
> -if compset -P '*:'; then
> -  _history_modifiers p
> -  return
> -fi
> -
>  local i pfilt
>  local -i nm=$compstate[nmatches]
>  local -a expl pattern=( -g \* ) normal described verbose faked fakes tmp
> --
> 2.38.1
>
>
>

-- 
Best regards,
Sebastian Gniazdowski

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

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

end of thread, other threads:[~2023-09-14 23:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 12:10 PATCH: Move _history_modifiers call to _parameter Mikael Magnusson
2023-09-15  4:05 ` Sebastian Gniazdowski
2023-09-14 23:39   ` Bart Schaefer

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