Вопрос

Is there a way I can turn on whitespace-mode in a minibuffer? I'm not sure I'll stick to it - but sometimes I need it. I tried to add-hook all the M-x apropos RET minibuffer hook RET:

(mapc
 (lambda (language-mode-hook)
   (add-hook language-mode-hook
             (lambda () (interactive) (whitespace-mode 1))))
 '(minibuffer-setup-hook
   icicle-minibuffer-setup-hook
   icomplete-minibuffer-setup-hook
   ido-minibuffer-setup-hook
   minibuffer-inactive-mode-hook))

but it doesn't work.

Это было полезно?

Решение

It looks like you've got something that should work, this worked for me:

(defun enable-ws-mode ()
  (whitespace-mode 1))
(add-hook 'minibuffer-inactive-mode-hook 'enable-ws-mode)

as did the code you posted. Have you tried running Emacs without your initialization files?

emacs -q
emacs -q --no-site-init

and evaluating the code you had?

Другие советы

Perhaps this is only because it's been six years, but . . . with Emacs 26.3 I was able to add the regular whitespace mode command to the hook with no intermediating function:

(add-hook 'minibuffer-inactive-mode-hook 'whitespace-mode)

No fuss, no muss, works here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top