Robert Goldman wrote:
Troels Henriksen wrote:
Robert Goldman rpgoldman@real-time.com writes:
I made a stab at it, but no, it didn't seem to work. I am attaching two different versions of the file-browser: one that works, using a new presentation-type, dir-pathname, and one that tries to do the job with (and pathname (satisfies cl-fad:directory-pathname-p)), that doesn't work.
It seems that the `and' type doesn't work at all. Try doing (present 2 'integer) and then (accept '(and integer)) - the previous output will not be selectable.
Hm....
At least in presentation-defs.lisp, there is no accept presentation method for AND. Is this the culprit?
By analogy, I tried whacking together the following definition for presentation-defs: (define-presentation-method accept ((type and) (stream input-editing-stream) (view textual-view) &key) (let ((scan-begin (stream-scan-pointer stream)) success value) (dolist (and-type types) (setf (stream-scan-pointer stream) scan-begin) (multiple-value-setq (success value) (block try-accept (handler-case (values t (accept and-type :stream stream :view view :prompt nil)) (parse-error () (return-from try-accept nil))))) (unless success (simple-parse-error "Input type is not of type ~S" types))) value))
But then I get an error that SATISFIES is an unknown presentation type. I suspect that this is because it's not a primary presentation type, so I need to use presentation-typep here instead of a recursive accept...
Best, R
OK, the following works to let me enter values of type (and pathname (satisfies cl-fad:directory-pathname-p)) to the command prompt. But I still don't get the ability to mouse-select the directory list entries for the presentation-to-command-translator.
(define-presentation-method accept ((type and) (stream input-editing-stream) (view textual-view) &key) (let* ((subtype (first types)) (value (accept subtype :stream stream :view view :prompt nil))) (unless (presentation-typep value type) (simple-parse-error "Input type is not of type ~S" type)) value))
BTW, the command prompt is pretty uninformative: Edit Directory (and) :
Is this where an abbreviation and description would be helpful?
Cheers, R