From f3549fe066432d9ad12a7986e8748ea9e71008fb Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 16 Feb 2016 09:04:01 +0100 Subject: [PATCH] Add toggle-char-case defun --- init.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/init.el b/init.el index a3a8103..8c8e8a6 100644 --- a/init.el +++ b/init.el @@ -269,3 +269,17 @@ (add-to-list 'auto-mode-alist '("\\.vala\\'" . vala-mode)) (add-to-list 'auto-mode-alist '("\\.erl\\'" . erlang-mode)) (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)) + +(defun toggle-char-case (arg-move-point) + "Toggle the case of the char after point. Based on Xah's toggle letter +case defun version 2015-12-22 + +URL `http://ergoemacs.org/emacs/modernization_upcase-word.html' +Version 2016-02-16" + (interactive "P") + (let ((case-fold-search nil)) + (cond + ((looking-at "[[:lower:]]") (upcase-region (point) (1+ (point)))) + ((looking-at "[[:upper:]]") (downcase-region (point) (1+ (point))))) + (cond + (arg-move-point (right-char)))))