diff options
author | Tom Willemsen | 2013-04-03 01:54:52 +0200 |
---|---|---|
committer | Tom Willemsen | 2013-04-03 01:54:52 +0200 |
commit | 9786d89c93a1657c715fca0c8e10f09f19b4469d (patch) | |
tree | d97adb9a719174ef4fcdb00144d6599e201722e7 /emacs/init.org | |
parent | cce4cd35eac3ea26fbe8c0f04f5d15f74a93b8dd (diff) | |
download | dotfiles-9786d89c93a1657c715fca0c8e10f09f19b4469d.tar.gz dotfiles-9786d89c93a1657c715fca0c8e10f09f19b4469d.zip |
Emacs: Add case functions, vala-mode change
Add some functions that may help me managing case for enums and such.
For some reason vala-mode really likes having indent-tabs-mode turned
on, but I prefer it off anyway.
Diffstat (limited to 'emacs/init.org')
-rw-r--r-- | emacs/init.org | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/emacs/init.org b/emacs/init.org index db69785..a127d78 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -552,6 +552,42 @@ buffer hanging around. (kill-buffer (current-buffer))))) #+END_SRC +I don't have a capslock key on my keyboard, and sometimes it's +annoying to have to hold my shift key for long enums and such. The +idea is to type everything except regular caps in lower case and then +use these functions to fix them. + +#+BEGIN_SRC emacs-lisp + (defun oni:change-prev-case (num dir) + (let ((regfunc (if (eq dir 'up) 'upcase-region 'downcase-region)) + (wordfunc (if (eq dir 'up) 'upcase-word 'downcase-word))) + (if (> num 1) + (funcall regfunc (point) (- (point) num)) + (funcall wordfunc -1)))) + + (defun oni:upcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'up)) + + (defun oni:downcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'down)) + + (global-set-key (kbd "C-c u") 'oni:upcase-prev) + (global-set-key (kbd "C-c d") 'oni:downcase-prev) +#+END_SRC + +For some reason, =vala-mode= turns on =indent-tabs-mode=, I don't like +that. + +#+BEGIN_SRC emacs-lisp + (defun oni:vala-mode-func () + "Function for `vala-mode-hook'." + (setq indent-tabs-mode nil)) + + (add-hook 'vala-mode-hook 'oni:vala-mode-func) +#+END_SRC + #+BEGIN_SRC emacs-lisp (eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) (eval-after-load "smex" '(oni:smex-init)) |