Use when-let instead of awhen
This commit is contained in:
parent
671b7c2ab6
commit
0564bde343
7
init.org
7
init.org
|
@ -2920,17 +2920,16 @@ _u_: next word ^_l_: edit lines^ _s_: next whole symbol
|
|||
("a" ag "ag")
|
||||
("h" find-grep "find-grep"))
|
||||
#+END_SRC
|
||||
|
||||
** General
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'anaphora)
|
||||
|
||||
(defun my-compile-project (file &optional prefix cmd)
|
||||
"Enter ancestor directory containing FILE and run compile command CMD.
|
||||
If CMD is not supplied, use `compile-command'.
|
||||
With PREFIX argument and omitted CMD, prompt for command."
|
||||
(interactive "fDominating File: \nP")
|
||||
(awhen (locate-dominating-file default-directory file)
|
||||
(cd it))
|
||||
(when-let ((dir (locate-dominating-file default-directory file)))
|
||||
(cd dir))
|
||||
(compile
|
||||
(cond (prefix
|
||||
(compilation-read-command
|
||||
|
|
Loading…
Reference in New Issue