I use GNU Emacs 26.1 and want to remove the following enormous message

Press ‘M-x org-agenda-manipulate-query-add’, ‘M-x org-agenda-manipulate-query-subtract’ to add/sub word, ‘M-x org-agenda-manipulate-query-add-re’, ‘M-x org-agenda-manipulate-query-subtract-re’ to add/sub regexp, ‘C-u r’ to edit

from the *Org Agenda* buffer, which appears after org-search-view command.

  • I'm guessing that those commands are normally bound to keys in the usual context where that msg is shown, in which case the msg would not be so "enormous". Do you not want those commands bound to keys in your environment, i.e., did you intentionally remove those bindings (e.g. to bind other commands instead)? If not then maybe see why the commands are not bound in this case. (E.g., do you see the same thing if you start Emacs with emacs -Q?) – Drew Apr 10 '19 at 15:09
  • (In any case, hopefully someone will answer your question of how to prevent that message.) – Drew Apr 10 '19 at 15:10
  • Hi, regarding 'emacs -Q' command for some reason it's broken on my machine (I installed emacs via brew cask install emacs) – Illia Danko Apr 11 '19 at 9:18
  • if emacs -Q is broken on your system, that suggests something is wrong with your installation. The easiest way to fix something at that level is probably to re-install. – Tyler Sep 9 '19 at 15:24

Short Summary

You can't turn off the message itself without changing the code that produces it. You can shorten it by binding the commands commands mentioned to other keys, the default bindings being ‘[’, ‘]’, ‘{’, ‘}’ and ‘C-u r’ respectively. In your case, all but the last one seem to be unbound for some reason, you may want to inspect the reason why.

Long Version

Inspection of the source code of org-search-view reveals

(unless org-agenda-multi
      (insert (substitute-command-keys "\
Press `\\[org-agenda-manipulate-query-add]', \
`\\[org-agenda-manipulate-query-subtract]' to add/sub word, \
`\\[org-agenda-manipulate-query-add-re]', \
`\\[org-agenda-manipulate-query-subtract-re]' to add/sub regexp, \
`\\[universal-argument] \\[org-agenda-redo]' to edit\n"))
      (add-text-properties pos (1- (point))
                   (list 'face 'org-agenda-structure)))

The only way to turn of the message once this function is invoked, is therefore to bind org-agenda-multi to some truthy value before invoking it. This happens in org-agenda-append-agenda and org-agenda-run-series. The former appears to be triggered by pressing "A" in the agenda buffer, whereas the latter seems to be run somewhere by org-agenda. However, simply doing that leads to even worse consequences than inserting the string, as it also affects behaviour elsewhere in org-agenda.el, therefore I can't really recommend that.

Knowing this, you might want to bind the functions mentioned to other keys, so as to shorten the message. Just for reference, the default keybindings lead to the message

Press ‘[’, ‘]’ to add/sub word, ‘{’, ‘}’ to add/sub regexp, ‘C-u r’ to edit

so it is likely, that something went wrong somewhere else in your setup. Have a look at the variable org-agenda-keymap and where it might be modified by one of your scripts.
Assuming you don't want to change these bindings, you will have to redefine org-search-view, replacing org-agenda-multi by an expression allowing customization like (or org-agenda-multi some-fresh-variable), or wrapping just the insert or something like that. It would be best to do so in your init file in an (eval-after-load "org-agenda" ...) form and using an override advice to achieve this.

  • @Lord Yuuma, thank you for your research, I've tried to set (setq-default org-agenda-multi t) to my init.el, but as you mentioned it leads to undesired consequences: jump into the search result doesn't work, the fullscreen frame appears instead of half bottom. – Illia Danko Apr 11 '19 at 9:01
  • @Drew I've added a summary now. Maybe that helps? – Lord Yuuma Apr 12 '19 at 6:02
  • @IlliaDanko I think within org-agenda org-agenda-multi is only ever bound to t once the buffer is already set up. It is not a variable meant for customization and you should revert that change to your init file. As I said in my answer, try binding these keys in org-agenda-keymap or removing the insert from the code. – Lord Yuuma Apr 12 '19 at 6:09

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.