emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add completion to compilation-read-command


From: Visuwesh
Subject: Re: Add completion to compilation-read-command
Date: Thu, 26 Dec 2024 18:48:13 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[வியாழன் டிசம்பர் 26, 2024] Spyros Roum wrote:

I don't really have much to say about the change but:

> [...]
> I based the entry on a similar entry from a few lines up:
>
>   > *** New user option 'completion-pcm-leading-wildcard'.
>   > This option configures how the partial-completion style does
> completion.
>   > It defaults to nil, which preserves the existing behavior. When it
> is set
>   > to t, the partial-completion style behaves more like the substring
>   > style, in that a string being completed can match against a candidate
>   > anywhere in the candidate string.
>
> If you think however that the options are not necessary, I can keep
> the first sentence only.
>
> Patch attached has the corrected `:version` and ChangeLog, no other
> changes (also rebased to master).
> From fa17714fcb12079bc37e5be54fe6b2a68bcd34ff Mon Sep 17 00:00:00 2001
> From: Spyros Roum <spyros.roum@posteo.net>
> Date: Wed, 25 Dec 2024 17:32:31 +0200
> Subject: [PATCH] Add option for making compilation-read-command use
>  completing-read
> [...]
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index 6784a12fd63..d0da96069af 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -1797,12 +1797,38 @@ compilation-mode-font-lock-keywords
>     '((compilation--ensure-parse))
>     compilation-mode-font-lock-keywords))
>  
> -(defun compilation-read-command (command)
> +(defun compilation-prompt-read-shell-command (command)
>    (read-shell-command "Compile command: " command
>                        (if (equal (car compile-history) command)
>                            '(compile-history . 1)
>                          'compile-history)))
>  
> +(defun compilation-prompt-read-with-history-completion (command)
> +  (completing-read "Compile command: " compile-history
> +                   nil nil command
> +                   (if (equal (car compile-history) command)
> +                       '(compile-history . 1)
> +                     'compile-history)))
> +
> +(defcustom compilation-read-command-function
> +  #'compilation-prompt-read-shell-command
> +  "`compilation-read-command' uses this function to get user's input.
> +Defaults to `compilation-prompt-read-shell-command',
> +but 'compilation-prompt-read-with-history-completion' can be used instead for
> +a completing version based on past runs."
> +  :version "31.1"
> +  :type 'function
> +  :options
> +  (list
> +    #'compilation-prompt-read-shell-command
> +    #'compilation-prompt-read-with-history-completion))

It would be nice to say what these options mean in plain English (with
:tag IIRC).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]