summaryrefslogtreecommitdiffstats
path: root/emacs.d
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2011-04-02 12:41:14 +0200
committerGravatar Tom Willemsen2011-04-02 12:41:14 +0200
commitda3357de4c0cf49657fc6374213e934d3ca1b1bb (patch)
tree50e88c7253162d25d8e27fdf0c902876dce77c63 /emacs.d
parent8a637b9d4d3a092ccdb231a7141c75924e474e85 (diff)
downloaddotfiles-da3357de4c0cf49657fc6374213e934d3ca1b1bb.tar.gz
dotfiles-da3357de4c0cf49657fc6374213e934d3ca1b1bb.zip
Added functions and supercharged my fontlocking for C and PHP
Diffstat (limited to 'emacs.d')
-rw-r--r--emacs.d/.gitignore1
-rw-r--r--emacs.d/00-functions.el21
-rw-r--r--emacs.d/10-font-lock.el21
3 files changed, 35 insertions, 8 deletions
diff --git a/emacs.d/.gitignore b/emacs.d/.gitignore
index c3659e1..e2ef80f 100644
--- a/emacs.d/.gitignore
+++ b/emacs.d/.gitignore
@@ -1,3 +1,4 @@
tramp
elpa
bookmarks
+abbrev_defs
diff --git a/emacs.d/00-functions.el b/emacs.d/00-functions.el
new file mode 100644
index 0000000..3e429ec
--- /dev/null
+++ b/emacs.d/00-functions.el
@@ -0,0 +1,21 @@
+(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))
diff --git a/emacs.d/10-font-lock.el b/emacs.d/10-font-lock.el
index 026099d..a98566c 100644
--- a/emacs.d/10-font-lock.el
+++ b/emacs.d/10-font-lock.el
@@ -1,16 +1,21 @@
-(defun add-my-php-keywords (mode)
+;; Currently support for [ ] | & ! . + = - / % * , ( ) < > { } ? : ->
+(defun add-my-c-keywords (mode)
+ ;; Add ! at the beginning of font lock
+ (font-lock-add-keywords
+ mode
+ '(("\\([!()]\\)" 1 font-lock-operator-face)))
+ ;; Add the rest at the end of font lock
(font-lock-add-keywords
mode
- ;; Currently support for [ ] | & ! . + = - / % * , ( ) < > { } ? : => ->
- '(("\\([\\[|.!+=&/%*,(){}:-]\\|\\]\\|\\ [><]\\ \\|[^<]\\?[^>]\\|\\=>\\)" 1 font-lock-operator-face)
- ("\\(;\\)" 1 font-lock-end-statement))))
+ '(("\\(->\\|[\\[|.+=&/%*,{}:?<>-]\\|\\]\\)" 1 font-lock-operator-face)
+ ("\\(;\\)" 1 font-lock-end-statement)) 1))
-(defun add-my-c-keywords (mode)
+(defun add-my-php-keywords (mode)
+ (add-my-c-keywords mode)
(font-lock-add-keywords
mode
- ;; Currently support for [ ] | & ! . + = - / % * , ( ) < > { } ? : => ->
- '(("\\([\\[|!+=&%*,(){}:-]\\|\\]\\|\\ [><]\\ \\|[^<]\\?[^>]\\|\\=>\\|[^<].*[./].*[^>]\\)" 1 font-lock-operator-face)
- ("\\(;\\)" 1 font-lock-end-statement))))
+ ;; Currently support for =>
+ '(("\\(\\=>\\)" 1 font-lock-operator-face))))
(add-my-c-keywords 'c-mode)
(add-my-php-keywords 'php-mode)