Skip to content

Instantly share code, notes, and snippets.

@xuchunyang
Last active January 7, 2019 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuchunyang/8710ba9d0816f096bf8f to your computer and use it in GitHub Desktop.
Save xuchunyang/8710ba9d0816f096bf8f to your computer and use it in GitHub Desktop.
(setf (buffer-string) (buffer-name))
(setf (mark) 10
(point) 20)
(setq my-list '(0 1 2 3 4 5))
(cl-letf ((my-list))
(message "%s" my-list)) ;; ==> "(0 1 2 3 4 5)"
(let ((my-list))
(message "%s" my-list)) ;; ==> "nil"
(cl-letf (((car my-list) 1000)
((elt my-list 3) 200))
(message "%s" my-list)) ;; ==> "(1000 1 2 200 4 5)"
(cl-letf (((symbol-function 'message) #'ignore))
(message "hi")) ;; ==> nil
;; hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment