stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [STUMP] A patch


From: Shawn Betts
Subject: Re: [STUMP] A patch
Date: 15 Nov 2004 16:39:31 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Manuel Giraud <address@hidden> writes:

> Hi,
> 
> With the recent repository update, here is a new patch:

Hi Manuel,

there's a variable, *window-format-fn* that you can bind to a function
that does the formatting. Rather than put this in core you could do:

(defun my-win-format (screen w)
  "Return a formatted string"
  (format nil "~D~C~A"
          (window-number screen w)
          (cond ((xlib:window-equal w (screen-current-window screen))
                 #\*)
                ((and (xlib:window-p (second (screen-mapped-windows screen)))
                      (xlib:window-equal w (second (screen-mapped-windows 
screen))))
                 #\+)
                (t #\-))
          (subseq (window-name w) 0 *window-name-max-length*)))

(setf *window-format-fn* 'my-win-format)

But admittedly that's duplicate code which is bad. What we REALLY need
is just a format string..which I'm in the process of adding :).

> diff -u -r1.21 stumpwm.lisp
> --- stumpwm.lisp      12 Nov 2004 06:35:47 -0000      1.21
> +++ stumpwm.lisp      15 Nov 2004 16:26:54 -0000
> @@ -100,6 +100,10 @@
>    ;; In the event of an error, we always need to close the display
>    (unwind-protect
>        (progn
> +     ;; Load rc file
> +     (multiple-value-bind (success err rc) (load-rc-file)
> +       (unless success
> +         (format t "Error loading ~A: ~A" rc err)))
>       ;; Initialize all the screens
>       (handler-case
>        (setf *screen-list* (mapcar #'init-screen (xlib:display-roots 
> *display*)))
> @@ -114,10 +118,6 @@
>       ;; Setup our keys. FIXME: should this be in the hook?
>       (set-default-bindings)
>       (echo-string (first *screen-list*) "Welcome to The Stump Window 
> Manager!")
> -     (multiple-value-bind (success err rc) (load-rc-file)
> -       (unless success
> -         (echo-string (first *screen-list*)
> -                      (format "Error loading ~A: ~A" rc err))))
>       (run-hook *start-hook*)
>       ;; Let's manage.
>       (stumpwm-internal-loop))

I'm curious about this change. Why did you make this change?

> +(defun run-command-string (str)
> +  "Execute the given command string."
> +  (let* ((split (remove "" (split-sequence:split-sequence #\Space str) :test 
> 'string-equal))
> +      (prog (car split))
> +      (args (cdr split)))
> +    (port:run-prog prog :args args :wait nil)))
> +
> +(defun partial-command (prompt cmd)
> +  "Provide a function that will execute the command completed by the
> +stumpwm user. Behave mostly like `shell-command' if PROMPT is the
> +empty string."
> +  #'(lambda (screen)
> +      (let ((cmd (read-one-line screen prompt cmd)))
> +     (unless (null cmd)
> +       (run-command-string cmd)))))
> +

I'm puzzled by this hunk too. Why have a run-command-string when you
can run it through /bin/sh and have all the niceness it provides?

Also, you should be able to put these commands in your .stumpwmrc (Not
that I don't appreciate the patch).

Where are you getting the split-sequence package from?

I reworked the above by adding an &optional initial-input to
shell-command. You should see it in CVS shortly.

I put your sample rc file in CVS. Thanks! I've also added you to the
AUTHORS file.

-Shawn





reply via email to

[Prev in Thread] Current Thread [Next in Thread]