From 727ab389b9190dae7478291615b36444fdb2b9f2 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 21 May 2021 10:45:58 -0500 Subject: 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. --- lisp/acdw.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lisp') 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 @@ (_ :other)) "Which computer system is currently being used.") -(defmacro acdw/system (&rest arg) +(defmacro acdw/system (&rest args) "Convenience macro for interfacing with `acdw/system'. -When called without arguments, it returns `acdw/system'. -When called with one argument, it returns (eq acdw/system ARG). -When called with multiple arguments, it returns `pcase' over each argument." +When called without arguments, it returns `acdw/system'. When +called with one (symbol) argument, it returns (eq acdw/system +ARG). When called with multiple arguments or a list, it returns +`pcase' over each argument." (cond - ((not arg) acdw/system) - ((not (cdr arg)) - `(when (eq acdw/system ,(car arg)) - ,(car arg))) - ((cdr arg) + ((null args) acdw/system) + ((atom (car args)) + `(when (eq acdw/system ,(car args)) + ,(car args))) + (t `(pcase acdw/system - ,@arg)) - (t (error "Wrong argument type: %s" (type-of arg))))) + ,@args)))) ;;; Utility functions -- cgit 1.4.1-21-gabe81