Skip to content

Instantly share code, notes, and snippets.

@miyamuko
Created September 8, 2011 01:27
Show Gist options
  • Save miyamuko/1202374 to your computer and use it in GitHub Desktop.
Save miyamuko/1202374 to your computer and use it in GitHub Desktop.
バッファ内の Common Lisp の特殊文字を #xyzzy Lisp 用に変換する
;; バッファ内の Common Lisp の特殊文字を xyzzy Lisp 用に変換する
;;
;; 対応表:
;;
;; Common Lisp xyzzy Lisp char-code
;; --------------------------------------
;; #\Backspace #\C-h 8
;; #\Tab #\TAB 9
;; #\Newline #\LFD 10
;; #\Linefeed #\LFD 10
;; #\Page #\C-l 12
;; #\Return #\RET 13
;; #\Space #\SPC 32
;; #\Rubout #\DEL 127
;;
;; 参考:
;;
;; http://common-lisp.net/~crhodes/clx/dep-allegro.lisp
;; http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-7.html
;;
(defun replace-commonlisp-char-to-xyzzylisp-char-buffer ()
(interactive "*")
(save-excursion
(dolist (pair '(("#\\Backspace" . "#\\\\C-h")
("#\\Tab" . "#\\\\TAB")
("#\\Newline" . "#\\\\LFD")
("#\\Linefeed" . "#\\\\LFD")
("#\\Page" . "#\\\\C-l")
("#\\Return" . "#\\\\RET")
("#\\Space" . "#\\\\SPC")
("#\\Rubout" . "#\\\\DEL")
))
(goto-char (point-min))
(replace-buffer (car pair) (cdr pair)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment