The context
I've defined a big set of yasnippet
snippets and sometimes I forget
the shortcut for those snippets. I've found out recently that
the function yas-insert-snippet
can be used to insert a snippet by
writing its name and the completion list of the function lists all the
existing snippets.
I would like to use helm
only for selecting an item from the
completion list shown by yas-insert-snippet
. However, I don't want
helm-mode
to be enabled because that would change the behavior of
all functions that show a completion list (e.g. switch-to-buffer
,
bookmark-jump
, kill-buffer
, etc.).
I just want helm-mode
to be enabled when executing the function
yas-insert-snippet
.
I've found that the variable helm-completing-read-handlers-alist
can
only be used to turn off helm-mode
for specific functions but I
would need to add all the functions to
helm-completing-read-handlers-alist
using cons of the form
(FUNCTION . nil)
if I want helm-mode
to be disabled when executing
FUNCTION.
The question
How can I toggle helm-mode
for an specific function? I assume that
helm-mode
is disabled by default since helm
is not used for all
functions.
Additional context
I've tried the following but it doesn't work. I wrote it
because I noticed that helm-mode
is a variable.
(let ((previous-helm-mode helm-mode))
(helm-mode 1)
(call-interactively 'yas-insert-snippet)
(helm-mode previous-helm-mode))
(or helm-mode 0)
.