Skip to main content
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 ...
iLemming's user avatar
  • 1,313
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 ...
Drew's user avatar
  • 79.1k
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 ...
justbur's user avatar
  • 1,510
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 ...
dalanicolai's user avatar
  • 7,985
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: ...
clemera's user avatar
  • 3,476
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.
Zeta's user avatar
  • 1,113
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 ...
izkon's user avatar
  • 1,918
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 ...
NickD's user avatar
  • 33.6k
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 ...
narendraj9's user avatar
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. ...
tarsius's user avatar
  • 26.3k
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.
Joelmob's user avatar
  • 231
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) (...
John Kitchin's user avatar
  • 12.1k
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) ...
Basil's user avatar
  • 12.6k
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) ...
Zeta's user avatar
  • 1,113
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 &...
NickD's user avatar
  • 33.6k
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 ...
NickD's user avatar
  • 33.6k
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 ...
Drew's user avatar
  • 79.1k
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 (...
Drew's user avatar
  • 79.1k
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 ...
phils's user avatar
  • 53k
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 "...
Drew's user avatar
  • 79.1k
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 ...
Daniel's user avatar
  • 3,683
1 vote
Accepted

Getting text input into ivy completing read

I think the variable ivy-text has what you are looking for in it.
John Kitchin's user avatar
  • 12.1k
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) (...
Drew's user avatar
  • 79.1k
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: " '...
Drew's user avatar
  • 79.1k
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's user avatar
  • 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" "...
AlwaysLearning's user avatar
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 ...
mkcms's user avatar
  • 1,400
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"...
lawlist's user avatar
  • 19.5k

Only top scored, non community-wiki answers of a minimum length are eligible