引脚Emacs缓冲到窗口(对于cscope) [英] Pin Emacs buffers to windows (for cscope)

查看:145
本文介绍了引脚Emacs缓冲到窗口(对于cscope)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的日常工作,我住在Emacs。完全。我也变得非常依赖CScope来帮助我找到代码中的东西。



通常,我有两个窗口在一个拆分(Cx 3):
替代文字http://bitthicket.com/files/emacs-2split.JPG



我使用正确的窗口代码缓冲区和左窗口CScope搜索缓冲区。当您执行CScope搜索并选择一个结果时,它将自动更新右侧窗口以显示结果所引用的缓冲区。这一切都很好,除了它让我在我正在学习的其他缓冲区中失去我的位置。有时候这不是大笨蛋,因为[Csü]让我回到我的地方。



然而,最好是有3个这样的分割窗口[Cx 2]):
alt text http://bitthicket.com/files/emacs- 3split.jpg



并且左下角的窗口包含CScope搜索缓冲区,左上角的窗口是CScope更新的唯一缓冲区。这样,我可以看到我的CScope搜索,并绕过代码,而不会丢失我专注的缓冲区。



任何人都知道我该怎么做?

解决方案

将其放在.emacs文件中:

  ;;切换窗口奉献

(defun toggle-window-dedicated()

切换当前活动窗口是否专用



(消息

(if(let(window(get-buffer-window(current-buffer)))

(set-window -nticated-p窗口

(not(window-dedicated-p window))))​​

窗口'%s'是专用的

窗口'%s'正常)

(当前缓冲区)))

然后绑定到一些键 - 我使用暂停键:

 (global-set-key [pause ]'toggle-window-dedicated)

然后使用它来奉献你想要锁定的窗口。那么cscope只能在其他窗口的结果窗口中打开文件。有魅力。我专门使用它,正是这个目的 - 保持一个源文件总是在屏幕上,而在第二个缓冲区/窗口中使用cscope,并在第三个视图中查看cscope结果。


For my day job, I live in Emacs. Utterly. I also have become pretty dependent on CScope to help me find things in the code.

Normally, I have 2 windows in a split (C-x 3): alt text http://bitthicket.com/files/emacs-2split.JPG

And I use the right window for code buffers and the left window for the CScope search buffer. When you do a CScope search and select a result, it automatically updates the right-side window to show the buffer referred to by the result. This is all well and good, except that it causes me to lose my place in some other buffer that I was studying. Sometimes this is no biggie, because [C-s u] gets me back to where I was.

What would be better, though, is to have 3 split windows like this ([C-x 2] in the left window): alt text http://bitthicket.com/files/emacs-3split.jpg

And have the bottom left window contain the CScope search buffer, and the top left window be the only buffer that CScope ever updates. That way, I can see my CScope searches and navigate around the code without losing the buffer I'm focused on.

Anyone know how I can do that?

解决方案

Put this in your .emacs file:

;; Toggle window dedication

(defun toggle-window-dedicated ()

"Toggle whether the current active window is dedicated or not"

(interactive)

(message 

 (if (let (window (get-buffer-window (current-buffer)))

       (set-window-dedicated-p window 

        (not (window-dedicated-p window))))

    "Window '%s' is dedicated"

    "Window '%s' is normal")

 (current-buffer)))

Then bind it to some key - I use the Pause key:

(global-set-key [pause] 'toggle-window-dedicated)

And then use it to "dedicate" the window you want locked. then cscope can only open files from its result window in some OTHER window. Works a charm. I specifically use it for exactly this purpose - keeping one source file always on screen, while using cscope in a second buffer/window, and looking at cscope results in a third.

这篇关于引脚Emacs缓冲到窗口(对于cscope)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆