summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs49
1 files changed, 30 insertions, 19 deletions
diff --git a/.emacs b/.emacs
index a1b16d6..d86df16 100644
--- a/.emacs
+++ b/.emacs
@@ -36,25 +36,6 @@
(global-set-key (kbd "C-x C-b") 'ibuffer)
-;; C-c [[:alpha:]] is reserved for users - let's make good use of it.
-
-(global-set-key (kbd "C-c c") 'compile)
-(global-set-key (kbd "C-c e f") 'auto-fill-mode)
-(global-set-key (kbd "C-c k f") 'my/kill-ring-filename)
-(global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region)
-(global-set-key (kbd "C-c k !") 'my/kill-ring-shell)
-(global-set-key (kbd "C-c m") 'man)
-(global-set-key (kbd "C-c p c") 'my/project-compile)
-(global-set-key (kbd "C-c p f") 'project-find-file)
-(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
-(global-set-key (kbd "C-c v") 'visual-line-mode)
-(global-set-key (kbd "C-c w c") 'whitespace-cleanup)
-(global-set-key (kbd "C-c w f") 'page-break-lines-mode)
-(global-set-key (kbd "C-c w m") 'whitespace-mode)
-(global-set-key (kbd "C-c w t") 'my/set-tab-width)
-
-(rg-enable-default-bindings) ; Uses the C-c s prefix.
-
;; Hopefully these will be easier to remember than TeX commands:
(require 'quail)
@@ -76,6 +57,36 @@
;; Pictograms
'("/!\\" ?⚠)))
+(defun my/make-toggle-input-method (input-method)
+ (lambda ()
+ (interactive)
+ ;; `current-input-method' is a string; if INPUT-METHOD is a
+ ;; symbol, neither eq, eql nor equal would return t.
+ (if (string= current-input-method input-method)
+ (deactivate-input-method)
+ (set-input-method input-method t))))
+
+;; C-c [[:alpha:]] is reserved for users - let's make good use of it.
+
+(global-set-key (kbd "C-c c") 'compile)
+(global-set-key (kbd "C-c e f") 'auto-fill-mode)
+(global-set-key (kbd "C-c i t") (my/make-toggle-input-method 'TeX))
+(global-set-key (kbd "C-c i u") (my/make-toggle-input-method 'my/input-method))
+(global-set-key (kbd "C-c k f") 'my/kill-ring-filename)
+(global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region)
+(global-set-key (kbd "C-c k !") 'my/kill-ring-shell)
+(global-set-key (kbd "C-c m") 'man)
+(global-set-key (kbd "C-c p c") 'my/project-compile)
+(global-set-key (kbd "C-c p f") 'project-find-file)
+(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
+(global-set-key (kbd "C-c v") 'visual-line-mode)
+(global-set-key (kbd "C-c w c") 'whitespace-cleanup)
+(global-set-key (kbd "C-c w f") 'page-break-lines-mode)
+(global-set-key (kbd "C-c w m") 'whitespace-mode)
+(global-set-key (kbd "C-c w t") 'my/set-tab-width)
+
+(rg-enable-default-bindings) ; Uses the C-c s prefix.
+
;; What's life without a little risk?
(setq disabled-command-function nil)