ilisp / guile-ilisp.scm

Diff from to

guile-ilisp.scm

       (let ((start-index
 	     (if with-procedure?
 		 (string-length pattern)
-		 (1+ (string-index doc #\space
-				   (string-length pattern))))))
-	(let ((eol-index (string-index doc #\newline start-index)))
+		 (min (1+ (or (string-index doc #\space
+					    (string-length pattern))
+			      (string-length pattern)))
+		      (or (string-index doc #\newline
+					(string-length pattern))
+			  (string-length pattern))))))
+	(let ((eol-index (or (string-index doc #\newline start-index)
+			     (string-length doc))))
 	  (string-append 
 	   "("
 	   (let loop ((bol-index (+ 1 eol-index))
   ;; meaningful result even if we aren't allowed to read the
   ;; documentation files (EXPENSIVE? = #f).
     (cond
+     ((and (procedure? obj)
+	   (procedure-property obj 'arglist))
+      => (lambda (arglist)
+	   (let ((required-args (car arglist))
+		 (optional-args (cadr arglist))
+		 (keyword-args (caddr arglist))
+		 (allow-other-keys? (cadddr arglist))
+		 (rest-arg (car (cddddr arglist))))
+	     (with-output-to-string
+	       (lambda ()
+		 (define (arg-only arg/default)
+		   (if (pair? arg/default) (car arg/default) arg/default))
+		 (write
+		  (append
+		   (if arglist-only?
+		       '()
+		       (list sym))
+		   required-args
+		   (if (not (null? optional-args))
+		       (cons #:optional (map arg-only optional-args))
+		       '())
+		   (if (not (null? keyword-args))
+		       (cons #:key (map arg-only keyword-args))
+		       '())
+		   (if allow-other-keys?
+		       (list #:allow-other-keys)
+		       '())
+		   (if rest-arg rest-arg '()))))))))
      ((closure? obj)
       (let ((formals (cadr (procedure-source obj))))
 	(if arglist-only? formals (cons sym formals))))
 
 (define-public (ilisp-in-package package)
   (set-current-module (string->module package))
-  (process-use-modules '((guile-ilisp)))
+  (process-use-modules '(((guile-ilisp))))
   *unspecified*)
 
 (define-public (ilisp-eval form package filename line)
 	     (write 'nil)))
 	 (lambda (key . args)
 	   (if (eq? key 'result)
-	       (begin (write (car args)) (newline) (write #t) (newline))
-	       (write 'nil)))))
+	       (begin (write (car args)) (newline) (write #t))
+	       (begin (write 'nil)))))
+  (newline))
 
 (define-public (ilisp-macroexpand-1 expression package)
   (write (save-module-excursion
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.