例えばこんな感じ。
(defun smartchr-keybindings-python () (local-set-key (kbd "=") (smartchr '(" = " " == " "="))) (local-set-key (kbd "+") (smartchr '(" + " "++" " += " "+"))) (local-set-key (kbd "-") (smartchr '(" - " "--" " -= " "-"))) (local-set-key (kbd "*") (smartchr '(" * " "**" " *= " "*"))) (local-set-key (kbd "/") (smartchr '(" / " " // " " /= " "/"))) (local-set-key (kbd "<") (smartchr '(" < " " <= " "<"))) (local-set-key (kbd ">") (smartchr '(" > " " >= " ">"))) (local-set-key (kbd "(") (smartchr '("(`!!')" "("))) (local-set-key (kbd "[") (smartchr '("[`!!']" "[[`!!']]" "["))) (local-set-key (kbd "\"") (smartchr '("\"`!!'\"" "\"\"\"`!!'\"\"\"" "\""))) (local-set-key (kbd "'") (smartchr '("'`!!''" "'"))) (local-set-key (kbd ",") (smartchr '(", " ","))) (local-set-key (kbd ":") (smartchr '(": " ":")))) (add-hook 'python-mode-hook #'(lambda () (require 'smartchr) (smartchr-keybindings-python)))