Created
May 30, 2024 13:38
-
-
Save podhmo/d5554b98abaf9cf60798a994fcbc246e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; cl-letfを利用すれば内部の関数の呼び出しをすげかえる | |
(defun my:hello () | |
(message "hello %s" "world")) | |
;; これは単に *Messages* bufferに出力するだけ | |
(my:hello) | |
;; これは kill-ring に追加もしてくれる | |
(cl-letf ((original-message (symbol-function 'message)) | |
((symbol-function 'message) | |
(lambda (x &rest args) | |
(let ((text (apply 'format (cons x args)))) | |
(funcall original-message text) | |
(kill-new text) | |
text)))) | |
(my:hello)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment