Search code examples
emacscompletionminibuffer

Removing extra messages in completion minibuffer in emacs


when I type in emacs shell and tab to complete, a completion minibuffer shows up and list the possible completions like this:

Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
CLUTTER_IM_MODULE   DBUS_SESSION_BUS_ADDRESS    DEFAULTS_PATH

I was able to remove first two lines by setting (setq completion-show-help nil). but is it possible to get rid of possible completions are:? I just want a little bit of cleanness.


Solution

  • One simple hack around that message not being customizable is to just erase that line from the output buffer after display-completion-list runs (assuming you have already set completion-show-help to nil),

    (define-advice display-completion-list (:after (&rest r) "remove-msg")
      (with-current-buffer standard-output
        (goto-char (point-min))
        (when (looking-at-p "Possible completions.*")
          (delete-region (line-beginning-position) (line-beginning-position 2)))))