From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spyros Roum Newsgroups: gmane.emacs.devel Subject: Re: Add completion to compilation-read-command Date: Thu, 26 Dec 2024 13:13:30 +0000 Message-ID: <25958644-5b99-4611-b6ae-ce8448fb662f@posteo.net> References: <87ttatb9g0.fsf@posteo.net> <87a5clm3p5.fsf@mail.linkov.net> <8734icaegs.fsf@posteo.net> <9a4bb215-561c-468f-97de-7d84fe7adc43@posteo.net> <87ttas80au.fsf@posteo.net> <962064f8-fab7-4867-af04-135e48a9dd15@posteo.net> <87ldw390ql.fsf@posteo.net> <4a27c5d7-b207-4bf1-a01b-552bf88a6347@posteo.net> <877c7m8ygh.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------KevOZERjvn1Bg14ka3zDW1MV" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37854"; mail-complaints-to="usenet@ciao.gmane.io" Cc: juri@linkov.net, emacs-devel@gnu.org To: philipk@posteo.net Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 26 14:14:25 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tQnh1-0009fe-8D for ged-emacs-devel@m.gmane-mx.org; Thu, 26 Dec 2024 14:14:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQngE-0002nY-IQ; Thu, 26 Dec 2024 08:13:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQng8-0002n1-EN for emacs-devel@gnu.org; Thu, 26 Dec 2024 08:13:29 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQng5-0003Yi-SK for emacs-devel@gnu.org; Thu, 26 Dec 2024 08:13:28 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 0F555240027 for ; Thu, 26 Dec 2024 14:13:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1735218802; bh=KJmUlQO7vmk48YTJez3j+2APbSTNcBDUVWhhpPIBG+k=; h=Content-Type:Message-ID:Date:MIME-Version:Subject:To:Cc:From: From; b=lm83Ltv4Wgs0Q17/LSxTXrpSMMlg0QScUvXKtiMdY/lPVYYkfMNliJ3AGFPS5HjKb g0hwjXdpyA3VkV43qZRaeQUa6PVVhcXXQjur7h/WfYoOricxT2MTz1TVe53TYVavrI f8IaM3GlWF0852eh8xAxzYzaU/OB8JL/ETs6IEkQaqkwYhJNzYocgXtRVth/wsGylo bJ9DH24SbZx7iYMlwM4jpevJ8kFv/tZebLnd/dnVzL2RKOwCBWLK5Vnz49j/U14p5+ tCm/jZZnvrqZD3BdlvBV7Y2IRPlDJ8h5NVkYKjwJ8yDYbv1ovTrExKPo5uYIMyj0Un u475dWFu62+1A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YJpwH5MpDz9rxL; Thu, 26 Dec 2024 14:13:19 +0100 (CET) Content-Language: en-US, el, el-en In-Reply-To: <877c7m8ygh.fsf@posteo.net> Received-SPF: pass client-ip=185.67.36.65; envelope-from=spyros.roum@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327148 Archived-At: This is a multi-part message in MIME format. --------------KevOZERjvn1Bg14ka3zDW1MV Content-Type: multipart/alternative; boundary="------------ETo4Qn0q1xhbUIiRGcH60Gwr" --------------ETo4Qn0q1xhbUIiRGcH60Gwr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Philip Kaludercic wrote: >> From 7e140c1ab5bfc7440753ab3aff2c3ce7eb38414e Mon Sep 17 00:00:00 2001 >> From: Spyros Roum >> Date: Wed, 25 Dec 2024 17:32:31 +0200 >> Subject: [PATCH] Add option for making compilation-read-command use >> completing-read >> >> * etc/NEWS: Add to NEWS >> * lisp/progmodes/compile.el (compilation-read-command): >> Call function based on `compilation-read-command-function`. >> >> (compilation-prompt-read-shell-command): The existing >> functionality from compilation-read-command extracted to >> a function. >> >> (compilation-prompt-read-with-history-completion): A >> function that uses completing-read to read the command. >> >> (compilation-read-command-function): The new option that >> controlls which function is used. > The detail seems fine, the formatting is just unusual but that can be > fixed when applying the patch. Oops... I looked into the ChangeLog to find similar examples and if I understand correctly, the major difference is that I have blank lines between changes that happened in the same file, so I removed those. Like I read somewhere: it can be fixed at apply time, but it's best to get it right the first time. >> --- >> etc/NEWS | 8 ++++++++ >> lisp/progmodes/compile.el | 28 +++++++++++++++++++++++++++- >> 2 files changed, 35 insertions(+), 1 deletion(-) >> >> diff --git a/etc/NEWS b/etc/NEWS >> index ca107bb4938..cfb137c2399 100644 >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -147,6 +147,14 @@ will still be on that candidate after "*Completions*" is updated with a >> new list of completions. The candidate is automatically deselected when >> the "*Completions*" buffer is hidden. >> >> +--- >> +*** New user option 'compilation-read-command-function'. >> +This option controls what function is used to read user input for >> +'compilation-read-command'. >> +It defaults to 'compilation-prompt-read-shell-command', which preserves >> +existing behavior. When set to 'compilation-prompt-read-with-history-completion', >> +'completing-read' is used allowing autocomplete based on past runs of 'compile'. > I am not sure if we need to go into the options here. 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). --------------ETo4Qn0q1xhbUIiRGcH60Gwr Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Philip Kaludercic wrote:
From 7e140c1ab5bfc7440753ab3aff2c3ce7eb38414e 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

* etc/NEWS: Add to NEWS
* lisp/progmodes/compile.el (compilation-read-command):
Call function based on `compilation-read-command-function`.

(compilation-prompt-read-shell-command): The existing
functionality from compilation-read-command extracted to
a function.

(compilation-prompt-read-with-history-completion): A
function that uses completing-read to read the command.

(compilation-read-command-function): The new option that
controlls which function is used.
The detail seems fine, the formatting is just unusual but that can be
fixed when applying the patch.
Oops... I looked into the ChangeLog to find similar examples and
if I understand correctly, the major difference is that I have blank lines between
changes that happened in the same file, so I removed those.

Like I read somewhere: it can be fixed at apply time, but it's best to get it right the first time.

---
 etc/NEWS                  |  8 ++++++++
 lisp/progmodes/compile.el | 28 +++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index ca107bb4938..cfb137c2399 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -147,6 +147,14 @@ will still be on that candidate after "*Completions*" is updated with a
 new list of completions.  The candidate is automatically deselected when
 the "*Completions*" buffer is hidden.
 
+---
+*** New user option 'compilation-read-command-function'.
+This option controls what function is used to read user input for
+'compilation-read-command'.
+It defaults to 'compilation-prompt-read-shell-command', which preserves
+existing behavior.  When set to 'compilation-prompt-read-with-history-completion',
+'completing-read' is used allowing autocomplete based on past runs of 'compile'.
I am not sure if we need to go into the options here.

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

--------------ETo4Qn0q1xhbUIiRGcH60Gwr-- --------------KevOZERjvn1Bg14ka3zDW1MV Content-Type: text/x-patch; charset=UTF-8; name="0001-Add-option-for-making-compilation-read-command-use-c.patch" Content-Disposition: attachment; filename*0="0001-Add-option-for-making-compilation-read-command-use-c.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSBmYTE3NzE0ZmNiMTIwNzliYzM3ZTViZTU0ZmU2YjJhNjhiY2QzNGZmIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBTcHlyb3MgUm91bSA8c3B5cm9zLnJvdW1AcG9zdGVv Lm5ldD4KRGF0ZTogV2VkLCAyNSBEZWMgMjAyNCAxNzozMjozMSArMDIwMApTdWJqZWN0OiBb UEFUQ0hdIEFkZCBvcHR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tZm9udC1sb2NrLWtleXdvcmRzCiAgICAnKChjb21waWxhdGlvbi0t ZW5zdXJlLXBhcnNlKSkKICAgIGNvbXBpbGF0aW9uLW1vZGUtZm9udC1sb2NrLWtleXdvcmRz KSkKIAotKGRlZnVuIGNvbXBpbGF0aW9uLXJlYWQtY29tbWFuZCAoY29tbWFuZCkKKyhkZWZ1 biBjb21waWxhdGlvbi1wcm9tcHQtcmVhZC1zaGVsbC1jb21tYW5kIChjb21tYW5kKQogICAo cmVhZC1zaGVsbC1jb21tYW5kICJDb21waWxlIGNvbW1hbmQ6ICIgY29tbWFuZAogICAgICAg ICAgICAgICAgICAgICAgIChpZiAoZXF1YWwgKGNhciBjb21waWxlLWhpc3RvcnkpIGNvbW1h bmQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICcoY29tcGlsZS1oaXN0b3J5IC4gMSkK ICAgICAgICAgICAgICAgICAgICAgICAgICdjb21waWxlLWhpc3RvcnkpKSkKIAorKGRlZnVu IGNvbXBpbGF0aW9uLXByb21wdC1yZWFkLXdpdGgtaGlzdG9yeS1jb21wbGV0aW9uIChjb21t YW5kKQorICAoY29tcGxldGluZy1yZWFkICJDb21waWxlIGNvbW1hbmQ6ICIgY29tcGlsZS1o aXN0b3J5CisgICAgICAgICAgICAgICAgICAgbmlsIG5pbCBjb21tYW5kCisgICAgICAgICAg ICAgICAgICAgKGlmIChlcXVhbCAoY2FyIGNvbXBpbGUtaGlzdG9yeSkgY29tbWFuZCkKKyAg ICAgICAgICAgICAgICAgICAgICAgJyhjb21waWxlLWhpc3RvcnkgLiAxKQorICAgICAgICAg ICAgICAgICAgICAgJ2NvbXBpbGUtaGlzdG9yeSkpKQorCisoZGVmY3VzdG9tIGNvbXBpbGF0 aW9uLXJlYWQtY29tbWFuZC1mdW5jdGlvbgorICAjJ2NvbXBpbGF0aW9uLXByb21wdC1yZWFk LXNoZWxsLWNvbW1hbmQKKyAgImBjb21waWxhdGlvbi1yZWFkLWNvbW1hbmQnIHVzZXM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