Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (setq lexical-binding t)
- (defun projectize-1 (cmd f &rest args)
- (if (eq cmd real-this-command)
- (let* ((proot
- (and (= 0
- (prefix-numeric-value current-prefix-arg))
- (locate-dominating-file "." ".git")))
- (default-directory (or proot default-directory)))
- (when proot
- (setq current-prefix-arg nil))
- (apply #'funcall-interactively f
- (advice-eval-interactive-spec
- (cadr (interactive-form f)))))
- (apply f args)))
- (defun projectize (&rest cmds)
- (dolist (cmd cmds)
- (advice-add cmd :around
- (lambda (f &rest args)
- (interactive "P")
- (apply #'projectize-1 cmd f args)))))
- (projectize #'rgrep)
Add Comment
Please, Sign In to add comment