From: Gabriel <gabriel376@hotmail.com>
To: 49321@debbugs.gnu.org
Subject: bug#49321: 28.0.50; [PATCH] Add option icomplete-matches-format
Date: Thu, 01 Jul 2021 16:39:45 -0300 [thread overview]
Message-ID: <CH2PR01MB5879955A37D448FFC47380988B009@CH2PR01MB5879.prod.exchangelabs.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 130 bytes --]
This patch adds a new user option to lisp/icomplete.el called
'icomplete-matches-format', similar to 'lazy-count-prefix-format'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-option-icomplete-matches-format.patch --]
[-- Type: text/x-patch, Size: 1881 bytes --]
From 47fbdb57abb38972f2b0929760e4043583ba16a8 Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
Date: Thu, 1 Jul 2021 16:29:24 -0300
Subject: [PATCH 1/1] Add option icomplete-matches-format
* lisp/icomplete.el (icomplete-matches-format): New user option.
---
lisp/icomplete.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 26698c43cf..67bae49b9e 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -97,6 +97,12 @@ icomplete-with-completion-tables
:type '(choice (const :tag "All" t)
(repeat function)))
+(defcustom icomplete-matches-format "%s/%s "
+ "Format of the current/total number of matches for the prompt prefix."
+ :version "28.1"
+ :type '(choice (const :tag "No prefix" nil)
+ (string :tag "Prefix format string" "%s/%s ")))
+
(defface icomplete-first-match '((t :weight bold))
"Face used by Icomplete for highlighting first match."
:version "24.4")
@@ -696,12 +702,10 @@ icomplete-exhibit
(overlay-put
icomplete-overlay 'before-string
(and icomplete-scroll
- (let ((past (length icomplete--scrolled-past)))
- (format
- "%s/%s "
- (1+ past)
- (+ past
- (safe-length completion-all-sorted-completions))))))
+ (let* ((past (length icomplete--scrolled-past))
+ (current (1+ past))
+ (total (+ past (safe-length completion-all-sorted-completions))))
+ (format (or icomplete-matches-format "") current total))))
(overlay-put icomplete-overlay 'after-string text))))))))
(defun icomplete--affixate (md prospects)
--
2.32.0
next reply other threads:[~2021-07-01 19:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 19:39 Gabriel [this message]
2021-07-04 14:05 ` bug#49321: 28.0.50; [PATCH] Add option icomplete-matches-format Lars Ingebrigtsen
2021-07-04 15:00 ` João Távora
2021-07-04 15:33 ` Gabriel
2021-07-04 15:49 ` Gabriel
2021-07-19 16:04 ` Lars Ingebrigtsen
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=CH2PR01MB5879955A37D448FFC47380988B009@CH2PR01MB5879.prod.exchangelabs.com \
--to=gabriel376@hotmail.com \
--cc=49321@debbugs.gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.