2011-04-02 12:41:14 +02:00
|
|
|
(defun what-face (pos)
|
|
|
|
"Find out which face the current position uses"
|
|
|
|
(interactive "d")
|
|
|
|
(let ((face (or (get-char-property (point) 'read-face-name)
|
|
|
|
(get-char-property (point) 'face))))
|
|
|
|
(if face
|
|
|
|
(message "Face: %s" face)
|
|
|
|
(message "No face at %d" pos))))
|
|
|
|
|
|
|
|
(defun my-comp-finish-function (buf str)
|
|
|
|
"Don't show compilation window if everything went ok"
|
|
|
|
(if (string-match "exited abnormally" str)
|
|
|
|
;; there were errors
|
|
|
|
(message "compilation errors, press C-x ` to visit")
|
|
|
|
;; no errors, make the compilation window go away in 0.5 seconds
|
|
|
|
(run-at-time 0.5 nil 'delete-windows-on buf)
|
|
|
|
(message "NO COMPILATION ERRORS!")))
|
|
|
|
|
|
|
|
(defun show-whitespace ()
|
|
|
|
(interactive)
|
|
|
|
(whitespace-mode t))
|
2011-04-12 12:59:51 +02:00
|
|
|
|
|
|
|
(defun fullscreen ()
|
|
|
|
(interactive)
|
|
|
|
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
|
|
|
'(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)))
|
2011-04-23 00:29:34 +02:00
|
|
|
|
|
|
|
(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")))))
|
2011-05-28 15:25:58 +02:00
|
|
|
|
|
|
|
(defun browse-to-current-file ()
|
|
|
|
(interactive)
|
|
|
|
(browse-url buffer-file-name))
|