From: Jean Louis <bugs@gnu.support>
To: arvid-harnack@lavache.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Changing completion-style using the minibuffer
Date: Sat, 12 Jun 2021 05:49:38 +0300 [thread overview]
Message-ID: <YMQgwpRugqA+ziVC@protected.localdomain> (raw)
In-Reply-To: <ea-mime-60c3c13d-e0d-6172dea0@www-7.mailo.com>
* arvid-harnack@lavache.com <arvid-harnack@lavache.com> [2021-06-11 23:03]:
> I have the following code to change completion-styles by calling "M-x minibufrp-complt-style".
>
>
>
> But would like to change it so that I can go through the four selections using the minibuffer.
>
> What would I need to add exactly to be able to do so ?
(defvar k 1)
In itself the below function is just looking to variable `k' and
makes changes based on its value. If you wish to change the
variable `completion-styles' you need not have any other
variable.
(defun minibufrp-complt-style ()
(interactive)
(pcase k
(1
(setq completion-styles '(basic substring))
(setq k 2))
(2
(setq completion-styles '(partial-completion))
(setq k 3))
(3
(setq completion-styles '(initials))
(setq k 4))
(4
(setq completion-styles '(orderless))
(setq k 1)) ))
Following could be solution for multiple choice:
(defun minibufrp-complt-style ()
(interactive)
(let* ((collection '((?b '(basic substring) "Basic Substring")
(?p '(partial-completion) "Partial Completion")
(?i '(initials) "Initials")
(?o '(orderless) "Orderless")))
(style (read-multiple-choice "Style: " collection)))
(setq completion-styles (nth 1 style))))
Overall that does not nicely solve the problem as you may wish to
have multiple completion styles in the variable
`completion-styles' and you may get in trouble doing it that way.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
next prev parent reply other threads:[~2021-06-12 2:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-11 20:02 Changing completion-style using the minibuffer arvid-harnack
2021-06-12 2:49 ` Jean Louis [this message]
2021-06-12 14:27 ` arvid-harnack
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YMQgwpRugqA+ziVC@protected.localdomain \
--to=bugs@gnu.support \
--cc=arvid-harnack@lavache.com \
--cc=help-gnu-emacs@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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).