diff options
author | Case Duckworth | 2021-05-21 10:45:58 -0500 |
---|---|---|
committer | Case Duckworth | 2021-05-21 10:45:58 -0500 |
commit | 727ab389b9190dae7478291615b36444fdb2b9f2 (patch) | |
tree | 24c486904e3a0d6e683dadf572e54e2243e8be8b /lisp | |
parent | Merge branch 'main' of https://tildegit.org/acdw/emacs (diff) | |
download | emacs-727ab389b9190dae7478291615b36444fdb2b9f2.tar.gz emacs-727ab389b9190dae7478291615b36444fdb2b9f2.zip |
Fix `acdw/system' argument parsing
`acdw/system' parsed arities of the form (acdw/system (:home (do-thing))) incorrectly: instead of expanding to (pcase acdw/system (:home (do-thing))), it parsed to ... something else that tried to call `:home' as a function and crapped out. I've fixed that issue and clarified the `cond' clauses.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index a1c364d..4a7d4b3 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -28,21 +28,21 @@ | |||
28 | (_ :other)) | 28 | (_ :other)) |
29 | "Which computer system is currently being used.") | 29 | "Which computer system is currently being used.") |
30 | 30 | ||
31 | (defmacro acdw/system (&rest arg) | 31 | (defmacro acdw/system (&rest args) |
32 | "Convenience macro for interfacing with `acdw/system'. | 32 | "Convenience macro for interfacing with `acdw/system'. |
33 | 33 | ||
34 | When called without arguments, it returns `acdw/system'. | 34 | When called without arguments, it returns `acdw/system'. When |
35 | When called with one argument, it returns (eq acdw/system ARG). | 35 | called with one (symbol) argument, it returns (eq acdw/system |
36 | When called with multiple arguments, it returns `pcase' over each argument." | 36 | ARG). When called with multiple arguments or a list, it returns |
37 | `pcase' over each argument." | ||
37 | (cond | 38 | (cond |
38 | ((not arg) acdw/system) | 39 | ((null args) acdw/system) |
39 | ((not (cdr arg)) | 40 | ((atom (car args)) |
40 | `(when (eq acdw/system ,(car arg)) | 41 | `(when (eq acdw/system ,(car args)) |
41 | ,(car arg))) | 42 | ,(car args))) |
42 | ((cdr arg) | 43 | (t |
43 | `(pcase acdw/system | 44 | `(pcase acdw/system |
44 | ,@arg)) | 45 | ,@args)))) |
45 | (t (error "Wrong argument type: %s" (type-of arg))))) | ||
46 | 46 | ||
47 | 47 | ||
48 | ;;; Utility functions | 48 | ;;; Utility functions |