EMACS: Toggle header and source
Wrote a function to toggle views between a header and source file in c-mode and locally bound this to F11.
This commit is contained in:
parent
79563a6264
commit
4344bbeeda
2 changed files with 11 additions and 0 deletions
|
@ -26,3 +26,11 @@
|
|||
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
|
||||
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
||||
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
|
||||
|
||||
(defun c-toggle-header-source ()
|
||||
(interactive)
|
||||
(let ((ext (file-name-extension (buffer-file-name)))
|
||||
(noext (file-name-sans-extension (buffer-file-name))))
|
||||
(if (string= (substring ext 0 1) "c")
|
||||
(find-file (concat noext ".h"))
|
||||
(find-file (concat noext ".c")))))
|
||||
|
|
3
emacs.d/20-c-mode.el
Normal file
3
emacs.d/20-c-mode.el
Normal file
|
@ -0,0 +1,3 @@
|
|||
(add-hook 'c-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key [f11] 'c-toggle-header-source)))
|
Loading…
Reference in a new issue