diff options
| -rw-r--r-- | .emacs | 40 |
1 files changed, 23 insertions, 17 deletions
@@ -47,12 +47,12 @@ ;; Hopefully these will be easier to remember than TeX commands: -(require 'quail) -(quail-define-package "my/input-method" "symbols" "𝒰" t - "Input arbitrary symbols with other arbitrary symbols.") +(quail-define-package + "my/symbols" "UTF-8" "𝒰" t + "Input arbitrary Unicode symbols with other arbitrary symbols.") (mapc (lambda (item) - (quail-defrule (car item) (cdr item) "my/input-method")) + (quail-defrule (car item) (cdr item) "my/symbols")) (list ;; Punctuation '("..." ?…) @@ -67,17 +67,21 @@ ;; Pictograms '("/!\\" ?⚠))) -;; C-c [[:alpha:]] is reserved for users - let's make good use of it. - -(defun my/make-toggle-input-method (input-method) - (lambda () - (:documentation (format "Toggle `%s' input method." input-method)) - (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)))) +(defmacro my/make-input-toggle (input-method) + (let ((fsym (intern (format "my/toggle-input-%s" input-method))) + ;; Unfortunately, by default `help-make-xrefs' does not try to + ;; cross-reference input methods, as `help-xref-mule-regexp' + ;; is nil. This can be worked around by setting this variable + ;; to `help-xref-mule-regexp-template'. + (doc (format "Toggle `%s' input method." input-method))) + `(defun ,fsym () + ,doc + (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))))) (defun my/set-tab-width (&optional arg) (interactive "P") @@ -123,12 +127,14 @@ (require 'project) (magit-status (project-prompt-project-dir))) +;; 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 d t") 'toggle-truncate-lines) (global-set-key (kbd "C-c d v") 'visual-line-mode) (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 i t") (my/make-input-toggle TeX)) +(global-set-key (kbd "C-c i u") (my/make-input-toggle my/symbols)) (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) |
