New answers tagged

1

If you want to type in fewer characters, Emacs has built in completion. You can type a few letters and then hit TAB to complete the input, or to see a list of matching inputs. This can save you a huge amount of time in the long run, and is usually faster than glob or regex matching. However, it is possible to improve things further. Add this to your init ...


3

Use of * in a file or directory name is a wildcard for glob matching. (It is unrelated to regular-expression matching, by the way). Buffer names are not necessarily file names. There are many buffers that are not visiting files. Buffer names sometimes (even often) contain * characters. Commands that prompt for a buffer name do not do any glob-pattern ...


0

Assuming that you want the constant input to be optional, you can declare the function as taking an optional argument and then check if the argument is actually passed: if it is, go ahead and use it; if it isn't, then call completing-read. Something like this: (defun X (&optional foo) (when (null foo) (setq foo (completing-read "Enter a value ...


2

You should read the documentation before complaining about it. See the list of pluggable back ends that it supports? Those are different sources it can use for completion results. It can pull from your Emacs environment (elisp), C and C++ compilers (clang, lsp, semantic), many other language compilers (lsp, etags, gtags, semantic, completion-at-point), your ...


1

@NickD's comment above lead me to this snippet: (let ((selected (condition-case err (completing-read "choose project:" projectile-known-projects) (quit "nothing")))) (message "selection: %s " selected)) And that's exactly what I needed. Pressing Escape or C-g sets the value to "...


Top 50 recent answers are included