Emacs中出现模式挂钩的奇怪行为 [英] Strange behavior in occur-mode hook in Emacs
问题描述
我正在尝试调整发生模式
缓冲区窗口的大小以适应其缓冲区的内容。
有关详细信息,请参阅调整Emacs中的发生窗口大小。
我添加了以下钩子:
(add-hook'occur-mode-hook
(lambda()
(save-selected-window
(pop-to-buffer* Occur *)
(message-boxok)
-window-to-buffer nil 10))))
然后我有以下缓冲区窗口: / p>
我现在执行(发生测试)
这让我第一个
,然后按ok按钮我得到
请注意,发生的窗口已缩小到单个在框架底部的高度线。这显然不是我想要的..
我现在进入(发生test)
t.txt缓冲区,并且在消息框中按确定后,我得到以下内容:
所以现在突然完成了。为什么这不是第一次工作?
这样做:
(defadvice occurred(after occurrence-advice activate)
调整大小窗口
(save-selected-window
(pop-to-buffer * Occur *)
(fit-window-to-buffer nil 10))
I am trying to resize the occur-mode
buffer window to fit the contents of its buffer.
See Resize occur window in Emacs for more information.
I have added the following hook:
(add-hook 'occur-mode-hook
(lambda ()
(save-selected-window
(pop-to-buffer "*Occur*")
(message-box "ok")
(fit-window-to-buffer nil 10))))
Then I have the following buffer window:
and I now execute (occur "test")
which gives me first
and after pressing the "ok" button I get
Notice that the occur window has shrunk to a single line in height at the bottom of the frame. This was obviously not what I wanted..
I now enter (occur "test")
once more in the "t.txt" buffer, and after pressing "ok" to the message-box I get the following:
So now it suddenly works perfectly. Why is this not working the first time?
This works:
(defadvice occur (after occur-advice activate)
"Resize window."
(save-selected-window
(pop-to-buffer "*Occur*")
(fit-window-to-buffer nil 10)))
这篇关于Emacs中出现模式挂钩的奇怪行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!