? completions.patch ? cvsdo.pl Index: package.lisp =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/package.lisp,v retrieving revision 1.30 diff -u -r1.30 package.lisp --- package.lisp 13 May 2007 04:43:12 -0000 1.30 +++ package.lisp 9 Jun 2007 22:32:00 -0000 @@ -124,4 +124,9 @@ #:run-with-timer #:cancel-timer #:timer-p + ;; completions + #:completions + #:prepare-shell-completion-tree + #:program-in-path-p + #:*shell-completion-tree* )) Index: stumpwm.asd =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/stumpwm.asd,v retrieving revision 1.15 diff -u -r1.15 stumpwm.asd --- stumpwm.asd 11 May 2007 21:57:24 -0000 1.15 +++ stumpwm.asd 9 Jun 2007 22:32:00 -0000 @@ -30,6 +30,7 @@ (:file "kmap") (:file "input") (:file "core") + (:file "completions") (:file "user") (:file "mode-line") (:file "stumpwm") Index: stumpwm.lisp =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/stumpwm.lisp,v retrieving revision 1.68 diff -u -r1.68 stumpwm.lisp --- stumpwm.lisp 13 May 2007 04:52:00 -0000 1.68 +++ stumpwm.lisp 9 Jun 2007 22:32:00 -0000 @@ -168,6 +168,19 @@ (num (parse-integer (subseq rest 0 dot)))) (values host num))) +(defun prepare-shell-completion-tree (&optional full-path (path (split-string (getenv "PATH") ":"))) + "Prepare a completion tree for programs in PATH. If FULL-PATH is T +then insert the full path, otherwise just the filename." + (loop + for p in path + for dir = (probe-file p) + when dir + nconc (loop + for file in (directory (merge-pathnames (make-pathname :name :wild) dir)) + for namestring = (file-namestring file) + when (pathname-is-executable-p file) + do (insert-string *shell-completion-tree* (if full-path (namestring file) namestring))))) + ;; Usage: (stumpwm) (defun stumpwm (&optional (display-str (or (getenv "DISPLAY") ":0")) protocol) "Start the stump window manager." @@ -189,6 +202,8 @@ (xlib:access-error () (return-from stumpwm (write-line "Another window manager is running.")))) (mapc 'process-existing-windows *screen-list*) + ;; prepare the completion list + (prepare-shell-completion-tree) ;; We need to setup each screen with its current window. Go ;; through them in reverse so the first screen's frame ends up ;; with focus. @@ -201,7 +216,8 @@ (let ((*package* (find-package *default-package*))) (multiple-value-bind (success err rc) (load-rc-file) (if success - (and *startup-message* (message "~a" *startup-message*)) + (when *startup-message* + (message "~a" *startup-message*)) (message "Error loading ~A: ~A" rc err)))) ;; Let's manage. (let ((*package* (find-package *default-package*))) Index: user.lisp =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/user.lisp,v retrieving revision 1.110 diff -u -r1.110 user.lisp --- user.lisp 10 May 2007 10:36:14 -0000 1.110 +++ user.lisp 9 Jun 2007 22:32:02 -0000 @@ -375,9 +375,9 @@ (show-frame-indicator group)))) (defun programs-in-path (base &optional full-path (path (split-string (getenv "PATH") ":"))) - "Return a list of programs in the path that start with BASE. if -FULL-PATH is T then return the full path, otherwise just return -the filename." + "Return a list of programs in PATH that start with BASE. If +FULL-PATH is T then return the full path, otherwise just return the +filename." (loop for p in path for dir = (probe-file p) @@ -757,7 +757,7 @@ (define-stumpwm-type :shell (input prompt) (or (argument-pop-rest input) - (completing-read (current-screen) prompt 'programs-in-path))) + (completing-read (current-screen) prompt 'completions))) (define-stumpwm-type :rest (input prompt) (or (argument-pop-rest input)