You are not logged in.

#1 2011-05-22 07:23:10

falsum
Member
From: Calgary - Canada
Registered: 2010-03-04
Posts: 38

[Solved] stumpwm: how to get rid of newline using run-shell-command

Hi all,

in order to set up my mode-line for stumpwm, I've been using the commad
run-shell-command such as in:

(setf *screen-mode-line-format*
      (list
      '(:eval (run-shell-command "date" t))
      '(:eval (run-shell-command "date" t))))

However, each instance of run-shell-command creates an unnecessary
newline (so that my mode line contains two lines without necessity).
Do you know how I can get rid of this newline?

Thanks!

Last edited by falsum (2011-05-23 07:12:27)

Offline

#2 2011-05-22 10:44:54

jiyuu
Member
Registered: 2010-04-13
Posts: 63

Re: [Solved] stumpwm: how to get rid of newline using run-shell-command

I didn't test it but the function you want is 'string-trim' or 'string-right-trim'.
You use it like this:

(string-trim '(#\Newline) my-string)

So in your case:

(setf *screen-mode-line-format*
      (list
      '(:eval (string-trim '(#\Newline)
                (run-shell-command "date" t)))
      '(:eval (run-shell-command "date" t))))

Offline

#3 2011-05-23 07:09:25

falsum
Member
From: Calgary - Canada
Registered: 2010-03-04
Posts: 38

Re: [Solved] stumpwm: how to get rid of newline using run-shell-command

jiyuu wrote:

I didn't test it but the function you want is 'string-trim' or 'string-right-trim'.
You use it like this:

(string-trim '(#\Newline) my-string)

So in your case:

(setf *screen-mode-line-format*
      (list
      '(:eval (string-trim '(#\Newline)
                (run-shell-command "date" t)))
      '(:eval (run-shell-command "date" t))))

That works perfectly well. Thanks a lot jiyuu!!

Offline

Board footer

Powered by FluxBB