在 emacs 中删除完成迷你缓冲区中的额外消息

Removing extra messages in completion minibuffer in emacs

当我输入 emacs shell 并按 Tab 键完成时,会出现一个完成迷你缓冲区并列出可能的完成,如下所示:

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

我可以通过设置 (setq completion-show-help nil) 删除前两行。但有可能摆脱 possible completions are: 吗?我只是想要一点清洁。

绕过无法自定义的消息的一个简单技巧是在 display-completion-list 运行后从输出缓冲区中删除该行(假设您已经将 completion-show-help 设置为 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)))))