EmacsLisp

マクロ ad-set-arg, ad-set-args

(defun foo (x y &optional z &rest r) (insert (format "%S\n" x)) (insert (format "%S\n" y)) (insert (format "%S\n" z)) (insert (format "%S\n" r))) => foo (defadvice foo (before foo-before activate) (ad-set-arg 1 10) (ad-set-arg 2 20) (ad-se…

マクロ ad-get-arg, ad-get-args

(defun foo (x y &optional z &rest r) ) => foo (defadvice foo (before foo-before activate) (insert (format "%S\n" (ad-get-arg 0))) (insert (format "%S\n" (ad-get-arg 1))) (insert (format "%S\n" (ad-get-arg 2))) (insert (format "%S\n" (ad-ge…

コマンド ad-disable-regexp, ad-enable-regexp

ad-activate-regexp, ad-deactivate-regexp とは何が違うんだっけ? activate, enable の違い?「活性」と「有効」。へ?

コマンド ad-disable-advice

(setq x "*") => "*" (defun foo () (format "%s %s" "foo" x)) => foo (defadvice foo (before foo-before activate) (insert "*before*")) => foo (defadvice foo (around foo-around activate) (let ((x "*around*")) ad-do-it)) => foo (defadvice foo (…

変数 ad-default-compilation-action

ad-default-compilation-action => maybe

defadvice を複数回実行

(setq x "*") => "*" (defun foo () (format "%s %s" "foo" x)) => foo (defadvice foo (around foo-around activate) (let ((x "hoge")) ad-do-it)) => foo (foo) => "foo hoge" (defadvice foo (around foo-around activate) (let ((x "HOGE")) ad-do-it))…

コマンド ad-start-advice

(setq x "*") => "*" (defun foo () (format "%s %s" "foo" x)) => foo (defadvice foo (around foo-around) (let ((x "hoge")) ad-do-it)) => foo (foo) => "foo *" (ad-start-advice) => documentation (foo) => "foo *" (defadvice foo (around foo-aroun…

コマンド ad-activate-regexp, ad-deactivate-regexp

(setq x "*") => "*" (defun foo () (format "%s %s" "foo" x)) => foo (defadvice foo (around foo-around activate) (let ((x "hoge")) ad-do-it)) => foo (defun bar () (format "%s %s" "bar" x)) => bar (defadvice bar (around bar-around activate) (…

コマンド ad-deactivate

(defun foo () (format "%s %s" "foo" x)) => foo (defadvice foo (around foo-around activate) (let ((x "hoge")) ad-do-it)) => foo (foo) => "foo hoge" (ad-deactivate 'foo) => foo (foo) error--> Symbol's value as variable is void: x

関数 ad-add-advice

(defun foo () (format "%s %s" "foo" x)) => foo (ad-add-advice 'foo '(foo-around t t (let ((x "baz")) ad-do-it)) 'around 'first) => ((active) (origname . ad-Orig-foo) (around (foo-around t t (let ((x "baz")) ad-do-it)))) (foo) error--> Symb…

包囲アドバイスと ad-do-it

(defun foo () (format "%s %s" "foo" x)) => foo (defadvice foo (around foo-around activate) (let ((x "hoge")) ad-do-it)) => foo (foo) => "foo hoge"

変数 ad-return-value

http://lc.linux.or.jp/lc2002/papers/komatsu0920h.pdf が分かりやすかったまんま (defun ad-return-value-test () "Original") => ad-return-value-test (defadvice ad-return-value-test (around ad-return-value-test-advice activate) "An advice to te…

Advising Functions

まんま (defadvice previous-line (before next-line-at-end (arg)) "Insert an empty line when moving up from the top line." (if (and next-line-add-newlines (= arg 1) (save-excursion (beginning-of-line) (bobp))) (progn (beginning-of-line) (new…

edebugのオプション

edebug-setup-hook => nil edebug-all-defs => nil edebug-all-forms => nil edebug-save-windows => t edebug-save-displayed-buffer-points => nil edebug-initial-mode => step edebug-trace => nil edebug-test-coverage => nil edebug-continue-kbd-mac…

カバレッジテスト

そんなものが用意されているのか edebug-test-coverage => nil (setq edebug-test-coverage t) => t「(fact 3)」実行後、「M-x edebug-display-freq-count」「Not inside instrumented form」とか言われちゃうぞ?

変数 edebug-print-circle

edebug-print-circle => t「デフォルト値は`nil'」って書いてあるのに?

変数 edebug-print-level

edebug-print-level => 50

変数 edebug-print-length

edebug-print-length => 50

edebug 中の評価

e EXP RET M-: EXP RET C-x C-e

C-u C-M-x eval-defun

「M-x edebug-defun」との違いは? 「C-M-x」(eval-defun)は「いったんedebugをロードすると再定義」らしい

変数 command-debug-status

command-debug-status => nilデバッガが内部で使うもの???

変数 debug-on-next-call

debug-on-next-call => nil

コマンド backtrace

(backtrace) backtrace() eval((backtrace)) eval-last-sexp(t) eval-print-last-sexp() call-interactively(eval-print-last-sexp) => nil まんま (with-output-to-temp-buffer "backtrace-output" (let ((var 1)) (save-excursion (setq var (eval '(progn…

変数 debugger

debugger => debug