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")
|
("a" ag "ag")
|
||||||
("h" find-grep "find-grep"))
|
("h" find-grep "find-grep"))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** General
|
** General
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(require 'anaphora)
|
|
||||||
|
|
||||||
(defun my-compile-project (file &optional prefix cmd)
|
(defun my-compile-project (file &optional prefix cmd)
|
||||||
"Enter ancestor directory containing FILE and run compile command CMD.
|
"Enter ancestor directory containing FILE and run compile command CMD.
|
||||||
If CMD is not supplied, use `compile-command'.
|
If CMD is not supplied, use `compile-command'.
|
||||||
With PREFIX argument and omitted CMD, prompt for command."
|
With PREFIX argument and omitted CMD, prompt for command."
|
||||||
(interactive "fDominating File: \nP")
|
(interactive "fDominating File: \nP")
|
||||||
(awhen (locate-dominating-file default-directory file)
|
(when-let ((dir (locate-dominating-file default-directory file)))
|
||||||
(cd it))
|
(cd dir))
|
||||||
(compile
|
(compile
|
||||||
(cond (prefix
|
(cond (prefix
|
||||||
(compilation-read-command
|
(compilation-read-command
|
||||||
|
|
Loading…
Reference in New Issue