5
votes
completing-read, search also in annotations
It looks like this can be done via a completing-read collection function,
https://www.gnu.org/software/emacs/manual/html_node/elisp/Programmed-Completion.html
Some basic, dirty experimentation got me ...
4
votes
Accepted
How can I ask a user to choose from a list of options, while showing her a long list with extra metadata?
What @JohnKitchin shows is a typical way to return something different from (but associated with) the candidate string that is chosen by the user.
In your case, it sounds like you might want the ...
4
votes
Accepted
How can I create custom menu prompts in elisp?
A much simpler way, using a hydra, is
(require 'hydra)
(defhydra my-info (nil nil :foreign-keys nil :hint nil :exit t)
"
Press key for command:
----------------------
_n_ Get user's name
_d_ Get ...
3
votes
completing-read, search also in annotations
EDIT
Although this answer, almost achieves what you want (it shows completions when string is empty, and it lets you complete on breed and annotations), it unfortunately errors in some/many cases ...
3
votes
Accepted
How to tell Ivy to use completing-read-default for specific command? (org-tags-view, in particular)
Are you sure you executed the code? I just tried:
(push '(org-tags-view . completing-read-default)
ivy-completing-read-handlers-alist)
and it worked as expected.
Responding to the comment:
...
3
votes
Accepted
How can I exit completing-read with the current string instead of a completion with fido?
You have to use icomplete-fido-exit. It's by default bound to M-j.
(icomplete-fido-exit FORCE)
Attempt to exit minibuffer immediately with current input.
3
votes
Selecting a directory like counsel-find-file
I just figured this out myself (using counsel-dired as a model):
(defun my-counsel-find-directory (&optional start-dir)
"Return a directory chosen by the user.
The user is prompted to ...
3
votes
Accepted
How to prompt user for tags and use the result in a org-ql-search function?
You can get all the buffer tags by calling org-get-buffer-tags. You can then combine that with completing-read whose doc string reads as follows:
completing-read is a built-in function in ‘C source ...
2
votes
Using ido completion for selecting a repository for magit
Finally, I found the solution to my problem. magit-status ultimately calls read-file-name. The read-file-name function uses read-file-name-function variable to find the function that it can call for ...
2
votes
Using ido completion for selecting a repository for magit
Magit only used magit-completing-read when reading "magit-specific" things. When reading things that other packages also need to read, then it uses the specialized functions provided by Emacs instead. ...
2
votes
How can I modify the prompt of another command?
If the interactive form is smaller, I can copy and paste the form, and then call the original function.
2
votes
How can I ask a user to choose from a list of options, while showing her a long list with extra metadata?
I usually do something like this:
(defun player-choice ()
(let* ((choices '(("player 1" . 1440)
("player 2" . 4400)))
(candidates (mapcar (lambda (cell)
(...
2
votes
Accepted
How to use ivy to navigate named locations of a buffer?
I have code which uses completing-read to do this
Ivy's analogue to completing-read is the function ivy-read, whose operation is described in its docstring and the Ivy User Manual under (info "(ivy) ...
2
votes
Accepted
User input - How to use predefined list
This sounds like completing-read, maybe via ivy. Here's a quick snippet that reuses calendar-day-name-array to get the usual names, but you can use your usual service days instead:
(require 'calendar) ...
2
votes
Accepted
Find-file, but instead of showing file-names to select, show file content (html tag)
I would use an alist: ( (title . filename) ...). You can construct it to begin with something like this:
(defun construct-abstract-file-alist ()
(let ((files (directory-files conference-dir t &...
1
vote
Is it possible to automate completions?
[I made my comment into an answer and supplied an implementation of longest common prefix as well].
The first TAB typed in completing-read's prompt fills in the longest common prefix of the ...
1
vote
Is it possible to automate completions?
Apart from @NickD's helpful comment that you can calculate the common prefix yourself (maybe it should be an answer instead of just a comment):
No, as far as I know, vanilla Emacs doesn't show ...
1
vote
Completion to set style
Your code has a couple of problems.
Option show-paren-style expects a symbol, not a string.
So (a) change your defcustom to use symbols, and (b) use intern on the value returned by completing-read (...
1
vote
Accepted
Using function both as interactive command and in elisp code
(intern "bracemk") returns the canonical symbol bracemk the same as you would get from using 'bracemk.
Hence: (richerenkov-view-parens 'bracemk)
Note also the docstring: "STYLE must be ...
1
vote
Accepted
Initial input for completing-read
If you really mean use Convert as the initial input then this is how:
(let* ((opts '("Convert" "Split"))
(sel (completing-read "Subset: " opts nil t "...
1
vote
Find-file, but instead of showing file-names to select, show file content (html tag)
Based on NickD's answer, the complete minimal working solution:
(defun construct-abstract-file-alist ()
(let ((files (directory-files conference-dir t ".*\\.html$")))
(-zip (mapcar ...
1
vote
Accepted
Getting text input into ivy completing read
I think the variable ivy-text has what you are looking for in it.
1
vote
Accepted
Use completing-read to call arbitrary function
Remove the quote in front of each function symbol. You've already quoted the alist.
Just look up the choice in the alist to get the function, then call it.
(defun find/buffer ()
(interactive)
(...
1
vote
Accepted
Completing read with must-match and cannot be null
I'd do this (similar to @lawlist's answer):
(let ((completion-ignore-case t)
(client ""))
(while (equal client "")
(setq client (completing-read "CLIENT: " '...
1
vote
Accepted
Close completing-read dialog before continuing
One option you have is to use
the
sit-for function
after you get the user's response, but before you take the actual screenshot.
Dan♦
- 33.4k
1
vote
Read a sentence with completion for words from a collection
Here is a complete solution based on this discussion:
(require 'company)
(require 'cl-lib)
(defconst sample-completions
'("procedural" "functional" "high-level" "low-level" "statically-scoped" "...
1
vote
Accepted
Accept unmatched input in completing-read when using helm
EDIT: This issue was fixed in helm on June 6th, 2017.
See commit 09b6fcd.
After hours spent on searching it seems to me that helm forces matching input with completing-read, so I wrote my own command ...
1
vote
How can I create custom menu prompts in elisp?
The function choices is a variation of org-capture and the variable choices-template is a variation of org-capture-templates.
USAGE: M-x choices
(require 'cl)
(defcustom choices-template
'(("1"...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
completing-read × 37completion × 12
helm × 4
ivy × 4
interactive × 3
ido × 3
org-mode × 2
string × 2
icomplete × 2
fido × 2
magit × 1
regular-expressions × 1
company-mode × 1
minibuffer × 1
variables × 1
region × 1
auto-complete-mode × 1
find-file × 1
sorting × 1
bookmarks × 1
characters × 1
table × 1
counsel × 1
directories × 1
let-binding × 1