Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;;;;
;;;; LispM風 キーバインド
;;;; TI Explorerの「Zmacs Editor Reference」をもとに再現
;;;; 2243192-0001A_Zmacs_Jun87.pdf
(progn
;; system eでエディタ起動
;; system eを押すと複数のエディタ窓を巡回
;; system control eで別のエディタ起動
)
;;;; help
;; help c
;; document command
;; slime-describe-symbol
;; HELP W
;; Where Is
;;;;; P41
;; m-x Arglist
;; -----------
;; => slime-arglist
;; c-sh-v Describe Variable At Point
;; ---------------------------------
;; => slime-describe-symbol ???
;; m-. Edit Definition
;; -------------------
;; => slime-edit-definition
;; m-esc Evaluate Mini Buffer
;; --------------------------
;; =>
;; m-sh-e Evaluate Region Varbose
;; ------------------------------
;; => slime-eval-region ?
(define-key slime-mode-map [(meta shift ?e)]
'slime-eval-region)
;; m-x Function Apropos
;; --------------------
;; => c-c c-d a slime-apropos ???
;; m-x List Callers
;; ----------------
;; => c-c < slime-list-callers
;; m-x List Combined Methods
;; -------------------------
;; =>
;; m-x List Flavor Methods
;; -----------------------
;; =>
;; m-x List Methods
;; ----------------
;; =>
;; m-sh-d Long Documentation
;; -------------------------
;; => slime-documentation ?
(define-key slime-mode-map [(meta shift ?d)]
'slime-documentation)
;; c-sh-a Quick Arglist
;; --------------------
;; => slime-arglist ?
(define-key slime-mode-map [(control shift ?a)]
'slime-arglist)
;; c-sh-d Quick Documentation
;; -------------------------
;; => slime-documentation ?
;; 俺定義と競合
'(define-key slime-mode-map [(control shift ?d)]
'slime-documentation)
;; P48 ----------------
;; c-m-l Select Previous Buffer
;; ----------------------------
;; =>
;; P53 ----------------
;; c-m-[ Beginig Of Definition
;; ----------------------------
;; => c-m-a slime-beginning-of-defun ?
(define-key slime-mode-map [(control meta ?\[)]
'slime-beginning-of-defun)
(define-key slime-mode-map [(control meta up)]
'slime-beginning-of-defun)
;; c-m-] End Of Definition
;; -----------------------
;; => c-m-e slime-end-of-defun ?
(define-key slime-mode-map [(control meta ?\])]
'slime-end-of-defun)
(define-key slime-mode-map [(control meta down)]
'slime-end-of-defun)
;; m-x Backward Sexp No Up
;; -----------------------
;; =>
;; m-x Forward Sexp No Up
;; -----------------------
;; =>
;; m-x Down Indented Line
;; ----------------------
;; c-n はDown Real Line
;; =>
;; m-x Backward Down List
;; ----------------------
;; =>
;; c-m-( Backward Up List
;; ----------------------
;; =>
;; m-) Moveover )
;; --------------
;; =>
;; c-x s Save Position
;; -------------------
;; => c-x r spc point-to-register ?
(global-set-key [(control ?x) ?s]
'point-to-register)
;; c-x j Jump To Saved Position
;; -------------------
;; => register-to-point ?
(global-set-key [(control ?x) ?j]
'register-to-point)
;; c-x x Put Register
;; ----------------
;; => C-x r s copy-to-register ?
(define-key slime-mode-map [(control ?x) ?x]
'copy-to-register)
;; m-x Update Attribute List
;; -------------------------
;; =>
;; P67
;; c-m-rubout Backward Kill Sexp
;; -----------------------------
;; => c-m-backspace backward-kill-sexp
(global-set-key [(control meta backspace)]
'backward-kill-sexp)
;; c-status Show Kill History
;; --------------------------
;; =>
;; m-sh-e Evaluate Region Varbose
;; ------------------------------
;; => slime-eval-region ?
(define-key slime-mode-map [(meta shift ?e)]
'slime-eval-region)
;; c-sh-e Evaluate Region
;; ----------------------
;; => slime-eval-region ?
;; リージョンにdefvarがある場合
;; 1) カーソル位置にdefvarがある場合、値を再定義
;; 2) その他は、変更しない
;; c-m-sh-e Evaluate Region Hack
;; ----------------------
;; => slime-eval-region ?
;; リージョンにdefvarがある場合
;; リージョンにdefvarがある場合、値を再定義
(progn
(defun slime-eval-region-hack (start end)
(interactive "r")
(slime-eval-with-transcript
`(swank:interactive-eval-region
,(replace-regexp-in-string
"defvar"
"defparameter"
(buffer-substring-no-properties start end)))))
(define-key slime-mode-map [(control meta shift ?e)]
'slime-eval-region-hack))
(progn
;;
;; slime-compile-defun
;;
(define-key slime-mode-map [(control shift ?c)] 'slime-compile-defun))
(progn
;;
;; slime-eval-defun
;;
(define-key slime-mode-map [(control shift ?e)] 'slime-eval-defun))
(progn
;;
;; move-past-close-and-reindentをlispmと同じような挙動にしたい
;;
(defun string-right-trim (bag str)
(let ((strl (nreverse (string-to-list str)))
(bag (if (atom bag) (list bag) bag)))
(while (memq (car strl) bag)
(pop strl))
(concat (nreverse strl))))
(defadvice move-past-close-and-reindent (before mpcar-before ())
(cond ( ;; "foo"のうち foo"の上にいる場合
(not (thing-at-point 'list))
(cond ( ;; "foo"のうち 後の"の上にいる場合
(= ?\" (following-char))
(forward-char 1))
( ;; "foo"のうち fooの上にいる場合
t
(forward-sexp)
(forward-char 1))))
( ;; "foo"のうち 前の"の上にいる場合
(= ?\" (following-char))
(forward-sexp))
(t nil)))
(ad-activate 'move-past-close-and-reindent)
;; 解除
;; (ad-deactivate 'move-past-close-and-reindent)
)
(progn
;;
;; forward-up-list
;;
(defun forward-up-list (arg)
(interactive "p")
(up-list arg)
(forward-list))
(global-set-key "\M-\}" 'forward-up-list))
'(progn
;;
;; m-[で()を挿入
;;
(global-set-key [(meta ?\[)] 'insert-parentheses)
(global-set-key [(meta ?\])] 'move-past-close-and-reindent))
(progn
;;
;; zmacs-forward-sexp
;;
(defun zmacs-forward-sexp (n)
(interactive "p")
(cond ((string= ")" (thing-at-point 'char))
(forward-up-list n))
;;((string= "" (thing-at-point 'char))
;;(forward-up-list n))
(t (forward-sexp n))))
(global-set-key [(control meta ?f)] 'zmacs-forward-sexp))
(progn
;;
;; zmacs-backward-sexp
;;
(defun zmacs-backward-sexp (n)
(interactive "p")
(cond ((= 40 (char-before))
(up-list))
(t (backward-sexp n))))
(global-set-key [(control meta ?b)] 'zmacs-backward-sexp))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.