在不活动期间隐藏 Emacs 回显区域

发布于 2024-10-18 17:21:37 字数 1117 浏览 3 评论 0原文

回显区域是 Emacs 底部模式线下方的线:

                     ~                       ~
                     |                       |
                     +-----------------------+
                     |-U:--- mode-line       |
                     +-----------------------+
                     | M-x echo-area         |
                     +-----------------------+

现在模式线是高度可定制的,而回显区域则更加严格(并且很多时候未使用)。问题非常简单:是否可以在不活动期间隐藏回显区域,并在需要您注意时重新显示它:

  ~                       ~             ~                       ~
  |                       |             |                       |
  |                       |             +-----------------------+
  |                       |             |-U:--- mode-line       |
  +-----------------------+             +-----------------------+
  |-U:--- mode-line       |             | M-x echo-area         |
  +-----------------------+             +-----------------------+

          Inactive                                Active

这类似于当您将鼠标悬停在链接上时 Google Chrome 显示 URL 的方式以及 Firefox 插件 Pentadactyl,其中命令行默认是隐藏的。

The echo area is the line at the bottom of Emacs below the mode line:

                     ~                       ~
                     |                       |
                     +-----------------------+
                     |-U:--- mode-line       |
                     +-----------------------+
                     | M-x echo-area         |
                     +-----------------------+

Now the mode line is highly customizable while the echo area is more rigid (and unused a lot of the time). The question is pretty simple: is it possible to hide the echo area during inactivity and redisplay it once it needs your attention:

  ~                       ~             ~                       ~
  |                       |             |                       |
  |                       |             +-----------------------+
  |                       |             |-U:--- mode-line       |
  +-----------------------+             +-----------------------+
  |-U:--- mode-line       |             | M-x echo-area         |
  +-----------------------+             +-----------------------+

          Inactive                                Active

This is similar to the way Google Chrome displays URLs when you hover your mose over a link and the Firefox addon Pentadactyl where the command-line is hidden by default.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

呆萌少年 2024-10-25 17:21:37

这不是您所问问题的答案,它不会为您提供迷你缓冲区,但会回收一些屏幕空间

(defun toggle-mode-line () "toggles the modeline on and off"
  (interactive) 
  (setq mode-line-format
    (if (equal mode-line-format nil)
        (default-value 'mode-line-format)) )
  (redraw-display))

(global-set-key [M-f12] 'toggle-mode-line)

luddite-mode 的标志

(global-set-key [f12] '(lambda () (interactive) (menu-bar-mode nil) (scroll-bar-mode nil)))

并且为了完整起见,这 当然,最好从这个开始:

(cond ((> emacs-major-version 20)
       (tool-bar-mode -1) ; introduced in emacs 21
       (menu-bar-mode -1)
       (scroll-bar-mode -1)
       (menu-bar-showhide-fringe-menu-customize-disable)
       (blink-cursor-mode -1)
       (windmove-default-keybindings 'meta)))

我将热切地等待这个问题的答案并将其纳入luddite-mode

This is NOT the answer to what you are asking, it will not give you the mini-buffer, but it will reclaim a bit of screen real estate

(defun toggle-mode-line () "toggles the modeline on and off"
  (interactive) 
  (setq mode-line-format
    (if (equal mode-line-format nil)
        (default-value 'mode-line-format)) )
  (redraw-display))

(global-set-key [M-f12] 'toggle-mode-line)

And for completeness sake, the hallmark of luddite-mode

(global-set-key [f12] '(lambda () (interactive) (menu-bar-mode nil) (scroll-bar-mode nil)))

Of course, it is desirable to start out with this:

(cond ((> emacs-major-version 20)
       (tool-bar-mode -1) ; introduced in emacs 21
       (menu-bar-mode -1)
       (scroll-bar-mode -1)
       (menu-bar-showhide-fringe-menu-customize-disable)
       (blink-cursor-mode -1)
       (windmove-default-keybindings 'meta)))

I will eagerly be awaiting the answer to this question and incorporate it in luddite-mode

怪我入戏太深 2024-10-25 17:21:37

您可以做的一件事是将迷你缓冲区分割成自己的框架,然后根据需要隐藏和显示它。

(setq minibuffer-frame-alist (append '((auto-raise . t) (auto-lower . t)) minibuffer-frame-alist))
(setq initial-frame-alist (append '((minibuffer . nil)) initial-frame-alist))

您将丢失回声区域消息,但我猜您已经不关心这一点了。


编辑:以上未经测试,且不完整。这似乎在这里工作:

(setq initial-frame-alist (append '((minibuffer . nil)) initial-frame-alist))
(setq default-frame-alist (append '((minibuffer . nil)) default-frame-alist))
(setq minibuffer-auto-raise t)
(setq minibuffer-exit-hook '(lambda () (lower-frame)))

One thing you could do is split the minibuffer into its own frame, then hide and show it as needed.

(setq minibuffer-frame-alist (append '((auto-raise . t) (auto-lower . t)) minibuffer-frame-alist))
(setq initial-frame-alist (append '((minibuffer . nil)) initial-frame-alist))

You will lose echo area messages, but I gather you already don't care about that.


EDIT: the above was untested, and incomplete. This appears to work here:

(setq initial-frame-alist (append '((minibuffer . nil)) initial-frame-alist))
(setq default-frame-alist (append '((minibuffer . nil)) default-frame-alist))
(setq minibuffer-auto-raise t)
(setq minibuffer-exit-hook '(lambda () (lower-frame)))
混浊又暗下来 2024-10-25 17:21:37

代码来获得无迷你缓冲区的帧

(setq default-minibuffer-frame
      (make-frame
       '((name . "minibuffer")
         (width . 0)
         (height . 0)
         (minibuffer . only)
         (top . 0)
         (left . 0)
         )))
(setq new-frame
      (make-frame
       '((name . "editor")
         (width . 80)
         (height . 30)
         (minibuffer . nil)
         (top . 50)
         (left . 0)
         )))

您可以使用我从 这里就这样。

虽然它可以创建无迷你缓冲区的帧,但似乎不可能摆脱迷你缓冲区并使其仅在需要时才出现,正如您在 Google Chrome 状态栏示例中所描述的那样。

You could get a minibuffer-less frame by using this code

(setq default-minibuffer-frame
      (make-frame
       '((name . "minibuffer")
         (width . 0)
         (height . 0)
         (minibuffer . only)
         (top . 0)
         (left . 0)
         )))
(setq new-frame
      (make-frame
       '((name . "editor")
         (width . 80)
         (height . 30)
         (minibuffer . nil)
         (top . 50)
         (left . 0)
         )))

that I took and modified from here on SO.

Though it can create minibuffer-less frames, it appears impossible to get rid of minibuffer and make it appear only when needed as you describe with the Google Chrome's status bar example.

梦行七里 2024-10-25 17:21:37

从技术上讲,隐藏回声区域是不可能的。但是,假设您在全屏环境中使用 Emacs,我有一个想法可能会给出相同的外观。在这种情况下,工具可以调整 emacs 窗口(emacs-speak 中的“框架”)的大小,以便它可以填充显示器或延伸到显示器的底部之外,具体取决于回显区域是否可见。

不幸的是,我自己没有时间来实现这一点,所以我将其留给其他人来执行此操作并领取赏金。

第一个挑战是找到一个合适的位置来调整大小,其中一个位置可能是post-command-hook。其他地方可能是 minibuffer-setup-hookminibuffer-setup-hook 第二个挑战是决定回声区域是否应该可见,我认为你可以使用current-message检查是否正在显示消息。

Technically, it's not possible to hide the echo area. However, I have an idea might might give the same appearance, under the assumption that you work with Emacs in a full-screen environment. In that case, a tool could resize the emacs window (the "frame" in emacs-speak) so that it would either fill the display or extend beyond the bottom of the display, depending on if the echo area should be visible or not.

Unfortunately, I don't have the time myself to implement this, so I leave it to somebody else to do this and to claim the bounty.

The first challenge is to find a good spot to make the resizing, one such place could be the post-command-hook. Other places might be minibuffer-setup-hook and minibuffer-setup-hook The second challenge is to decide if the echo area should be visible or not, I think that you can use current-message to check if a message is being displayed.

情深已缘浅 2024-10-25 17:21:37

据我所知,不可能隐藏

我可以理解,在小型显示器上,例如上网本等,需要节省屏幕空间。但我认为,编辑文件时使用回显区域的次数比查看网页时使用网络浏览器地址栏的次数要多得多。它是 Emacs 的一个组成部分。

As far as I know it's not possible to hide the echo area, and I would not agree with you that it is unused a lot of time. From buffer switching over M-x commands to minibuffer output, a lot of different stuff goes on in the echo area.

I can understand that on small displays, e.g., on netbooks etc. it is desirable to save screen estate. But I would argue that the echo area is used much more when you edit a file than the address bar of a web browser is used when you look at a web page. It's an integral part of Emacs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文