summaryrefslogtreecommitdiffstats
path: root/emacs.d/functions.el
blob: 6472c82513ce1d26540a2e1a58063d11018907f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(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 bu)
    (message "NO COMPILATION ERRORS!")))

(defun bh/hide-other ()
  (interactive)
  (save-excursion
    (org-back-to-heading)
    (org-shifttab)
    (org-reveal)
    (org-cycle)))

(defun bh/go-to-scratch ()
  (interactive)
  (switch-to-buffer "*scratch*")
  (delete-other-windows))

(defun bh/untabify ()
  (interactive)
  (untabify (point-min) (point-max)))

(defun bh/killframe ()
  (interactive)
  (unless (buffer-modified-p)
    (kill-buffer (current-buffer)))
  (delete-frame))

(defun show-whitespace ()
  (whitespace-mode t))

(provide 'functions)