<p>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.</p>

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

<p>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.</p>

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

<p>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.</p>

<p>Anyone know how I can do that?</p>

[{'answer_id': 44562, 'author': 'Ben Collins', 'author_id': 3279, 'author_profile': 'https://Stackoverflow.com/users/3279', 'pm_score': 0, 'selected': False, 'text': "<p>Well, I decided to not be a reputation-whore and find the answer myself.  I looked in cscope.el as shown on the Emacs wiki, as well as the xcscope.el that comes with the cscope RPM package on RHEL.</p>\n\n<p>Neither appear to give a way to do what I'm wanting.  The way is probably to edit the ELisp by adding a package variable like <code>*browse-buffer*</code> or something and just initialize that variable if not already initialized the first time the user does <code>[C-c C-s g]</code> or whatever, and always have the resulting code shown in <code>*browse-buffer*</code>.  Then the user can put the <code>*browse-buffer*</code> wherever he wants it.</p>\n"}, {'answer_id': 65992, 'author': 'Frank Klotz', 'author_id': 9668, 'author_profile': 'https://Stackoverflow.com/users/9668', 'pm_score': 6, 'selected': True, 'text': '<p>Put this in your .emacs file:</p>\n\n<pre><code>;; Toggle window dedication\n\n(defun toggle-window-dedicated ()\n\n"Toggle whether the current active window is dedicated or not"\n\n(interactive)\n\n(message \n\n (if (let (window (get-buffer-window (current-buffer)))\n\n       (set-window-dedicated-p window \n\n        (not (window-dedicated-p window))))\n\n    "Window \'%s\' is dedicated"\n\n    "Window \'%s\' is normal")\n\n (current-buffer)))\n</code></pre>\n\n<p>Then bind it to some key - I use the Pause key:</p>\n\n<pre><code>(global-set-key [pause] \'toggle-window-dedicated)\n</code></pre>\n\n<p>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.</p>\n'}]
['https://Stackoverflow.com/questions/43765', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3279/']