While there is some interest in cmake-mode.el I have another useful thing to share.<br><br>I&#39;ve been long irritated with having to deal with multiple buffers all name CMakeLists.txt.  Emacs by default will call them CMakeLists.txt, CMakeLists.txt&lt;2&gt;, CMakeLists.txt&lt;3&gt;, etc..  This is really hard to switch back and forth when the buffer names are difficult to associate with location.<br>

<br>I&#39;ve found a couple of solutions to this problem.<br><br>1. Use uniquify emacs package.  This gives several options to automatically rename buffers based on their location on disk.<br><br><span style="font-family: courier new,monospace;">;; uniquify.el is a helper routine to help give buffer names a better unique name.</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">(when (load &quot;uniquify&quot; &#39;NOERROR)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  (require &#39;uniquify)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  (setq uniquify-buffer-name-style &#39;forward)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  ;(setq uniquify-buffer-name-style &#39;post-forward)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  )</span><br style="font-family: courier new,monospace;"><br>2. Rename the buffer as part of the cmake-mode<br><br><span style="font-family: courier new,monospace;">(defun cmake-rename-buffer ()</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  &quot;Renames a CMakeLists.txt buffer to cmake-&lt;directory name&gt;.&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  (interactive)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  ;(print (concat &quot;buffer-filename = &quot; (buffer-file-name)))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  ;(print (concat &quot;buffer-name     = &quot; (buffer-name)))</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  (when (and (buffer-file-name) (string-match &quot;CMakeLists.txt&quot; (buffer-name)))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      ;(setq file-name (file-name-nondirectory (buffer-file-name)))</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      (setq parent-dir (file-name-nondirectory (directory-file-name (file-name-directory (buffer-file-name)))))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      ;(print (concat &quot;parent-dir = &quot; parent-dir))</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      (setq new-buffer-name (concat &quot;cmake-&quot; parent-dir))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      ;(print (concat &quot;new-buffer-name= &quot; new-buffer-name))</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      (rename-buffer new-buffer-name t)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      )</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  )</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(add-hook &#39;cmake-mode-hook (function cmake-rename-buffer))</span><br style="font-family: courier new,monospace;">

<br>I actually prefer renaming my buffers with my cmake-rename-buffer function, because the buffer names start with a lower case letter. ;)<br><br>I added this to the wiki:<br><a href="http://www.vtk.org/Wiki/CMake_Editors_Support#CMake_Editor_Modes">http://www.vtk.org/Wiki/CMake_Editors_Support#CMake_Editor_Modes</a><br>

<br>James<br>