From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Gregory Heytings <gregory@heytings.org>
Cc: Philip Kaludercic <philipk@posteo.net>,
Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org
Subject: Re: [PATCH] icomplete-vertical
Date: Tue, 06 Apr 2021 09:20:53 -0400 [thread overview]
Message-ID: <jwvsg43h839.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <acf6f0cd7ec190e11e1c@heytings.org> (Gregory Heytings's message of "Tue, 06 Apr 2021 10:20:02 +0000")
> As I said, it's meant to be a derived minor mode, much like lisp-data-mode
> is derived from prog-mode.
FWIW, we don't have a notion of "derived minor-mode" yet.
> A similar example (in the same file) is
> fido-mode which is derived from icomplete-mode, and (in another file)
> whitespace-newline-mode which is derived from whitespace-mode.
The example of `fido-mode` is actually the one I would put forward to
argue that icomplete-vertical should not itself activate
`icomplete-mode` but should just change the way completion are
displayed, so it can be combined wither with `fido-mode` or with the
normal `icomplete-mode`.
> Moreover, I think that in general local changes to code are better than
> global ones whenever that is feasible. Using a user option would do the
> same thing as the minor mode, except that the changes would be scattered
> through the existing code.
I don't see how. I'd imagine a code like:
;;;###autoload
(define-minor-mode icomplete-vertical-mode
"Toggle the use of vertical display in `icomplete-mode`.
As many completion candidates as possible are displayed, depending on
the value of `max-mini-window-height', and the way the mini-window is
resized depends on `resize-mini-windows'."
:global t
(remove-hook 'icomplete-minibuffer-setup-hook
#'icomplete-vertical-minibuffer-setup)
(remove-hook 'icomplete-completions-filter-hook
#'icomplete-vertical-reformat-completions)
(when icomplete-vertical-mode
(setq icomplete-separator "\n")
(setq icomplete-hide-common-prefix nil)
;; ask `icomplete-completions' to return enough completions candidates
(setq icomplete-prospects-height 25)
(add-hook 'icomplete-minibuffer-setup-hook
#'icomplete-vertical-minibuffer-setup)
(add-hook 'icomplete-completions-filter-hook
#'icomplete-vertical-reformat-completions)))
[ BTW, in the above code (which I basically copy/pasted from your
patch), we should save&restore the values of `icomplete-separator`,
`icomplete-hide-common-prefix`, and `icomplete-prospects-height`.
Also, I'd recommend to use "--" in the names of the new hook
functions. And while I'm nitpicking I might as well mention that
comments should be capitalized and punctuated. ]
Stefan
next prev parent reply other threads:[~2021-04-06 13:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 22:23 [PATCH] icomplete-vertical Gregory Heytings
2021-04-05 23:04 ` Philip Kaludercic
2021-04-05 23:09 ` Gregory Heytings
2021-04-06 1:08 ` Stefan Kangas
2021-04-06 2:31 ` Eli Zaretskii
2021-04-06 7:44 ` Gregory Heytings
2021-04-06 8:54 ` Philip Kaludercic
2021-04-06 9:10 ` Gregory Heytings
2021-04-06 9:30 ` Philip Kaludercic
2021-04-06 10:20 ` Gregory Heytings
2021-04-06 13:20 ` Stefan Monnier [this message]
2021-04-06 13:50 ` Gregory Heytings
2021-04-06 14:11 ` Stefan Monnier
2021-04-06 14:19 ` Gregory Heytings
2021-04-06 14:26 ` Stefan Monnier
2021-04-06 14:46 ` Gregory Heytings
2021-04-06 18:49 ` Juri Linkov
2021-04-06 20:09 ` Gregory Heytings
2021-04-10 20:56 ` Juri Linkov
2021-04-10 22:01 ` João Távora
2021-04-10 22:39 ` Juri Linkov
2021-04-10 22:56 ` João Távora
2021-04-10 23:00 ` Gregory Heytings
2021-04-10 23:05 ` João Távora
2021-04-11 7:14 ` Eli Zaretskii
2021-05-13 10:01 ` João Távora
2021-04-11 7:12 ` Eli Zaretskii
2021-04-10 22:23 ` Gregory Heytings
2021-04-06 14:25 ` Ergus
2021-04-06 15:17 ` Philip Kaludercic
2021-04-06 16:18 ` Ergus
2021-04-06 11:33 ` Dmitry Gutov
2021-04-06 11:52 ` Gregory Heytings
2021-04-06 12:21 ` Eli Zaretskii
2021-04-06 12:48 ` Gregory Heytings
2021-04-06 13:48 ` Eli Zaretskii
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=jwvsg43h839.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=gregory@heytings.org \
--cc=philipk@posteo.net \
/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.