いまさらだけどsmartchr.elを入れてみた
id:k1LoW さんの 空気のようなEmacs Lisp -2010 冬- - Emacs/Lisp/Drill - Emacsグループ を読んで、いまだに smartchr を使ってなかったことを思い出したので入れてみた。
全てのモードで有効にするのは逆に不便になるので("-"を使った箇条書きとか)、add-hook で必要なモードでだけ有効にするようにした。
;; INSTALL ;; (install-elisp "https://github.com/imakado/emacs-smartchr/raw/master/smartchr.el")(require ’smartchr)
(defun my-smartchr-setting () (local-set-key (kbd "=") (smartchr ’(" = " " == " "="))) (local-set-key (kbd "+") (smartchr ’(" + " "++" " += " "+"))) (local-set-key (kbd "-") (smartchr ’(" - " "–" " -= " "-")))
(local-set-key (kbd """) (smartchr ’(""
!!'\""</span> <span class="synConstant">"\""</span><span class="synSpecial">)))</span> <span class="synSpecial">(</span>local-set-key <span class="synSpecial">(</span>kbd <span class="synConstant">"'"</span><span class="synSpecial">)</span> <span class="synSpecial">(</span>smartchr <span class="synSpecial">'(</span><span class="synConstant">"'
!!’’" "’")))(local-set-key (kbd ">") (smartchr ’(">" "->" ">>")))
(local-set-key (kbd "(") (smartchr ’("(
!!')"</span> <span class="synConstant">"("</span><span class="synSpecial">)))</span> <span class="synSpecial">(</span>local-set-key <span class="synSpecial">(</span>kbd <span class="synConstant">"{"</span><span class="synSpecial">)</span> <span class="synSpecial">(</span>smartchr <span class="synSpecial">'(</span><span class="synConstant">"{
!!’ }" "{\n!!'\n}"</span> <span class="synConstant">"{"</span><span class="synSpecial">)))</span> <span class="synSpecial">(</span>local-set-key <span class="synSpecial">(</span>kbd <span class="synConstant">"["</span><span class="synSpecial">)</span> <span class="synSpecial">(</span>smartchr <span class="synSpecial">'(</span><span class="synConstant">"[
!!’]" "["))) )(add-hook ’php-mode-hook ’my-smartchr-setting) (add-hook ’javascript-mode-hook ’my-smartchr-setting)
本体は github にあります。404 · GitHub