muffinmad/emacs-mini-frame

Unable to ignore y-or-n-p, yes-or-no-p

indigoviolet opened this issue · 6 comments

I have:

  (setq mini-frame-ignore-commands '(eval-expression
                                     "edebug-eval-expression"
                                     debugger-eval-expression
                                     y-or-n-p
                                     yes-or-no-p
                                     "ctrlf-.*"
                                     ))

But evaluating (y-or-n-p "test") still pops up the mini-frame. What am I doing wrong?

The variable this-command is used to find out what command is running now. My guess is that the this-command variable is set by the commands (interactive functions) but not by the simple functions. And y-or-n-p is not a command.

thanks for the explanation. would it be possible to advice those functions in a way that mini-frame can ignore them, no?

Something like this may help:

(defun my/y-or-n-p (fn &rest args)
  (let ((this-command 'y-or-n-p))
    (apply fn args)))

(advice-add 'y-or-n-p :around #'my/y-or-n-p)

Ya, that makes sense, but I wonder if that will break other things that rely on this-command. I was imagining some way of advice that would be specific to mini-frame. For example,

(setq mini-frame-ignore-functions '(y-or-n-p))

which would cause mini-frame to advice-add with mini-frame-this-command for example, and mini-frame would check both this-command and mini-frame-this-command.

Anyway, I understand this is a bigger change, so if it's not a common feature request it can wait. Thanks.

Ya, that makes sense, but I wonder if that will break other things that rely on this-command. I was imagining some way of advice that would be specific to mini-frame. For example,

(setq mini-frame-ignore-functions '(y-or-n-p))

Done.

Thanks for suggestion!

Wow, thanks for the super quick fix!