From d15862594a31be740e325fc5a601d7d4c3231861 Mon Sep 17 00:00:00 2001 From: KΓ©vin Le Gouguec Date: Fri, 18 Sep 2020 15:34:12 +0200 Subject: Simplify pair notations I find pcase patterns easier to grok than cons cells, dotted pairs, cars and cdrs. --- .emacs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.emacs b/.emacs index d25d2ef..bfea698 100644 --- a/.emacs +++ b/.emacs @@ -51,21 +51,21 @@ "my/symbols" "UTF-8" "𝒰" t "Input arbitrary Unicode symbols with other arbitrary symbols.") -(mapc (lambda (item) - (quail-defrule (car item) (cdr item) "my/symbols")) - (list - ;; Punctuation - '("..." ?…) - ;; Math symbols - '("~~" ?β‰ˆ) '("~~_" ?β‰Š) '("~=" ?β‰…) '("~_" ?≃) - '("=_" ?≑) '("^=" ?≙) '(":=" ?≔) - '("-->" ?β†’) '("-/>" ?↛) '("==>" ?β‡’) '("=/>" ?⇏) - '("<--" ?←) '("" ?↔) '("<=>" ?⇔) - ;; Emojis - '("\\o/" ?πŸ™Œ) '("\\m/" ?🀘) - ;; Pictograms - '("/!\\" ?⚠))) +(pcase-dolist + (`(,key ,translation) + '(;; Punctuation + ("..." ?…) + ;; Math symbols + ("~~" ?β‰ˆ) ("~~_" ?β‰Š) ("~=" ?β‰…) ("~_" ?≃) + ("=_" ?≑) ("^=" ?≙) (":=" ?≔) + ("-->" ?β†’) ("-/>" ?↛) ("==>" ?β‡’) ("=/>" ?⇏) + ("<--" ?←) ("" ?↔) ("<=>" ?⇔) + ;; Emojis + ("\\o/" ?πŸ™Œ) ("\\m/" ?🀘) + ;; Pictograms + ("/!\\" ?⚠))) + (quail-defrule key translation "my/symbols")) (defmacro my/make-input-toggle (input-method) (let ((fsym (intern (format "my/toggle-input-%s" input-method))) @@ -131,20 +131,20 @@ (declare (indent defun)) `(defvar ,name (let ((map (define-prefix-command ',name))) - (pcase-dolist (`(,key . ,fun) ,bindings) + (pcase-dolist (`(,key ,fun) ,bindings) (define-key map key fun)) map) ,doc)) (my/define-prefix-command my/display-map "Keymap for display-related commands." - '(("t" . toggle-truncate-lines) - ("v" . visual-line-mode))) + '(("t" toggle-truncate-lines) + ("v" visual-line-mode))) (my/define-prefix-command my/input-map "Keymap for input methods shortcuts." - `(("t" . ,(my/make-input-toggle TeX)) - ("u" . ,(my/make-input-toggle my/symbols)))) + `(("t" ,(my/make-input-toggle TeX)) + ("u" ,(my/make-input-toggle my/symbols)))) ;; C-c [[:alpha:]] is reserved for users - let's make good use of it. -- cgit v1.2.3