[STUMP] allow custom types to return nil

Eric Abrahamsen <[email protected]>
Newsgroups gmane.comp.window-managers.stumpwm.devel
Message-ID <[email protected]>
I've been working on another patch to the manual, documenting commands
and custom types. In the course of writing an example of a custom type,
I discovered that you can't have a type return a nil value: it aborts
the interactive call. This is mentioned in a FIXME in
`call-interactively'.

For more complicated custom types I don't see why returning a nil value
should make the command blow up altogether. I've attached a patch which
allows nil return values -- I doubt it will cause any problems, but I'm
also happy to just run it locally for a few weeks first and see if
anything happens.

E

_______________________________________________
Stumpwm-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
0001-Allow-types-to-return-nil-values.patch (text/x-diff, 1 KB)
From 013ecba15953248ac1058a3200be488311a7293b Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <[email protected]>
Date: Fri, 21 Mar 2014 10:56:10 +0800
Subject: [PATCH 1/2] Allow types to return nil values

---
 command.lisp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/command.lisp b/command.lisp
index 861af42..4ba4551 100644
--- a/command.lisp
+++ b/command.lisp
@@ -488,8 +488,7 @@ user aborted."
                                        (argument-line-end-p arg-line))
                                   (loop-finish)
                                   ;; FIXME: Is it presumptuous to assume NIL means abort?
-                                  (or (funcall fn arg-line prompt)
-                                      (throw 'error :abort)))))))
+                                  (funcall fn arg-line prompt)t)))))
       ;; Did the whole string get parsed?
       (unless (or (argument-line-end-p arg-line)
                   (position-if 'alphanumericp (argument-line-string arg-line) :start (argument-line-start arg-line)))
-- 
1.9.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.