Reviewers: dak, Message: David, this goes on top of https://codereview.appspot.com/555300043/
maybe I am missing something, but the regtest completes successfully. Why did you add this stuff? Description: Simplify define-markup-[list-]command-internal, This reverts additions made in commit d2199b0163c33bcb7504c87e57eefbea93e08c88 "Issue 5167/3: Split off `markup-lambda' from `define-markup-command'" In this commit, extra support for the case where command-and-args is empty was added, ie. - (let* ((command (car command-and-args)) - (args (cdr command-and-args)) + (let* ((command (if (pair? command-and-args) + (car command-and-args) + command-and-args)) + (args (and (pair? command-and-args) (cdr command-and-args))) However, markup commands are functions that are always called with arguments 'layout' and 'props', so there can never be a case that 'args' would be empty. Please review this at https://codereview.appspot.com/545590045/ Affected files (+9, -18 lines): M scm/markup-macros.scm Index: scm/markup-macros.scm diff --git a/scm/markup-macros.scm b/scm/markup-macros.scm index f71bc52747281fb0387f2f64b36f47cf583559aa..70882f05ea86d37224f5b467cd7fab096b7ce822 100644 --- a/scm/markup-macros.scm +++ b/scm/markup-macros.scm @@ -96,15 +96,10 @@ that this markup command is called by the newly defined command, adding its properties to the documented properties of the new command. There is no protection against circular definitions. " - (let* ((command (if (pair? command-and-args) - (car command-and-args) - command-and-args)) - (args (and (pair? command-and-args) (cdr command-and-args)))) - (if args - `(,define-markup-command-internal - ',command (markup-lambda ,args ,@definition) #f) - `(,define-markup-command-internal - ',command ,@definition #f)))) + (let* ((command (car command-and-args)) + (args (cdr command-and-args))) + `(,define-markup-command-internal + ',command (markup-lambda ,args ,@definition) #f))) (defmacro*-public markup-lambda (args signature @@ -157,15 +152,11 @@ not registering the markup command, this is identical to (command-and-args . definition) "Same as `define-markup-command', but defines a command that, when interpreted, returns a list of stencils instead of a single one" - (let* ((command (if (pair? command-and-args) - (car command-and-args) - command-and-args)) - (args (and (pair? command-and-args) (cdr command-and-args)))) - (if args - `(,define-markup-command-internal - ',command (markup-list-lambda ,args ,@definition) #t) - `(,define-markup-command-internal - ',command ,@definition #t)))) + (let* ((command (car command-and-args)) + (args (cdr command-and-args))) + `(,define-markup-command-internal + ',command (markup-list-lambda ,args ,@definition) #t))) + (define (define-markup-command-internal command definition is-list) (let* ((suffix (if is-list "-list" ""))
