commit d15862594a31be740e325fc5a601d7d4c3231861
parent 4f27c30d9b736d7d9be80d5d74092c6d3fcb5bc1
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date: Fri, 18 Sep 2020 15:34:12 +0200
Simplify pair notations
I find pcase patterns easier to grok than cons cells, dotted pairs,
cars and cdrs.
Diffstat:
| M | .emacs | | | 40 | ++++++++++++++++++++-------------------- |
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git 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.