0

I tried to advice read-from-minibuffer and read-string but nothing worked.

For example, when I called yes-or-no-p, no advice handlers were called.

Is there general way how to detect that user is interacting with minibuffer? I need it because I have some package which in idle time print some data into minibuffer, problem is, when I interact somehow with minibuffer and wait here for a while, that package will simply print some garbage into it when I need it for something completely different.

EDIT: Currently I use following solution, but its kinda bad, I want something generic.

(advice-add #'yes-or-no-p
            :around
            (lambda (oldfun &rest args)
              ;; eat all messages
              (setq eldoc-message-function
                    (lambda (&rest args) nil))
              (prog1
                  (apply oldfun args)
                (setq eldoc-message-function
                      #'eldoc-minibuffer-message))))
0

There are hooks for that, so you shouldn't need to resort to advice.

  • minibuffer-setup-hook
  • minibuffer-exit-hook

However you could possibly just use the minibuffer-line package from GNU ELPA?

This package lets you display various status information in the minibuffer window instead of the mode-line. Of course, this is only displayed when the minibuffer window is not already used for other things (e.g. a minibuffer or an each area message).

That package doesn't actually use the hooks either, but rather a trick of using *Minibuf-0* (which under normal circumstances is always empty, and which by my reading the redisplay loop uses to display 'nothing' in that window when nothing else should be displayed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_4_0": ["-item\"><a href=\"https://twitter.com/stackoverflow\" class=\"-link js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 32 })\">Twitter</a></li>\r\n                    <li class=\"-item\"><a href=\"https://linkedin.com/company/stack-overflow\" class=\"-link js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 33 })\">LinkedIn</a></li>\r\n                </ul>\r\n\r\n                <p class=\"mt-auto mb24\">\r\nsite design / logo &#169; 2019 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/4.0/\" class=\"js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 34 })\" rel=\"license\">cc by-sa 4.0</a>\r\n                            with <a href=\"https://stackoverflow.blog/2009/06/25/attribution-required/\"  class=\"js-gps-track\" data-gps-track=\"footer.click({ location: 2, link:35 })\" rel=\"license\">attribution required</a>.\r\n                    <span id=\"svnrev\">rev&nbsp;2019.9.16.34922</span>\r\n                </p>\r\n            </div>\r\n        </div>\r\n\r\n            </footer>\r\n            <script>StackExchange.ready(function () { StackExchange.responsiveness.addSwitcher(); })</scri"], "copyright__copyright__copyright": [" or an each area message).\n\nThat package doesn't actually use the hooks either, but rather a trick of using *Minibuf-0* (which under normal circumstances is always empty, and which by my reading the redisplay loop uses to display 'nothing' in that window when nothing else should be displayed).\n\nYour Answer\n\nBy clicking \u201cPost Your Answer\u201d, you agree to our terms of service, privacy policy and cookie policy\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}