stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] My .stumpwmrc and a modified display-keybinding


From: Luca Capello
Subject: Re: [STUMP] My .stumpwmrc and a modified display-keybinding
Date: Wed, 10 Jan 2007 01:41:51 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux)

Hello!

On Tue, 09 Jan 2007 23:57:11 +0100, Luca Capello wrote:
> On Fri, 05 Jan 2007 17:53:07 +0100, gwern branwen wrote:
>> On a stylistic note, you probably replace stuff like the
>> 'substitute' you are running on shell output with a pipeline to
>> 'tr'; this is probably more portable - where would you run Stumpwm
>> where there *isn't* the basic complement of Unix commands? And it
>> makes the output useful for non-Stumpwm purposes. Similarly, your
>> 'show-time' command is better done by a call to 'date', in my
>> opinion.
>
> Maybe it's my tr knowledge, but I cannot obtain the same result
> (empty lines added for better reading):
[...]
> STUMPWM> (defun test-newline-tr ()
>   (run-shell-command "echo -e \"Hello,\n world\" | tr -d '\n'" t))
> TEST-NEWLINE-TR
>
> STUMPWM> (test-newline-tr)
> "Hello, world
> "
> STUMPWM>
> =====

Thanks to matley (Luigi Panzeri) for having found the error, i.e. the
escaping of the \n.  Thus, now we've two methods (again, empty lines
added for better reading):
=====
STUMPWM> (defun test-newline-tr ()
  (run-shell-command "echo -e \"Hello,\\n world\" | tr -d '\\n'" t))
TEST-NEWLINE-TR

STUMPWM> (test-newline-tr)
"Hello, world"

STUMPWM> STUMPWM> (defun test-newline-tr ()
  (run-shell-command "echo -e \"Hello,\\n world\" | tr -d \\\\n" t))
STYLE-WARNING: redefining TEST-NEWLINE-TR in DEFUN
TEST-NEWLINE-TR

STUMPWM> (test-newline-tr)
"Hello, world"

STUMPWM>
=====

I'd go for the former, any comments?

Thx, bye,
Gismo / Luca

Attachment: pgp9_sPkENBUQ.pgp
Description: PGP signature


reply via email to

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