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))