Skip to main content
  1. Entry/

いまさらだけど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 "&quot;") (smartchr ’("&quot;!!'\&quot;&quot;</span> <span class="synConstant">&quot;\&quot;&quot;</span><span class="synSpecial">)))</span> <span class="synSpecial">(</span>local-set-key <span class="synSpecial">(</span>kbd <span class="synConstant">&quot;'&quot;</span><span class="synSpecial">)</span> <span class="synSpecial">(</span>smartchr <span class="synSpecial">'(</span><span class="synConstant">&quot;'!!’’" "’")))

(local-set-key (kbd ">") (smartchr ’(">" "->" ">>")))

(local-set-key (kbd "(") (smartchr ’("(!!')&quot;</span> <span class="synConstant">&quot;(&quot;</span><span class="synSpecial">)))</span> <span class="synSpecial">(</span>local-set-key <span class="synSpecial">(</span>kbd <span class="synConstant">&quot;{&quot;</span><span class="synSpecial">)</span> <span class="synSpecial">(</span>smartchr <span class="synSpecial">'(</span><span class="synConstant">&quot;{ !!’ }" "{\n!!'\n}&quot;</span> <span class="synConstant">&quot;{&quot;</span><span class="synSpecial">)))</span> <span class="synSpecial">(</span>local-set-key <span class="synSpecial">(</span>kbd <span class="synConstant">&quot;[&quot;</span><span class="synSpecial">)</span> <span class="synSpecial">(</span>smartchr <span class="synSpecial">'(</span><span class="synConstant">&quot;[!!’]" "["))) )

(add-hook php-mode-hook my-smartchr-setting) (add-hook javascript-mode-hook my-smartchr-setting)

本体は github にあります。404 · GitHub