Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro make-cmd (cmd &optional search)
- "Some function factory."
- (let ((fn (intern (concat "fn-" cmd))))
- `(defun ,fn (&optional args)
- (interactive)
- (let ((str (symbol-name ',fn))
- ,@(when search
- '((dir "~"))))
- (message "Called %S from %S" str
- (or (and (bound-and-true-p dir) dir)
- default-directory))))))
- ;; functions `fn-f1' and `fn-f2' aren't added to obarray
- (dolist (x '("f1" "f2"))
- `(make-cmd ,x t))
- ;; works like this
- (make-cmd "f1" t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement