Re: error in unless
- From: Ken Tilton <kennytilton@xxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 05:22:24 -0400
Ken Tilton wrote:
Gijs Hillenius wrote:
Hello,
I'm a beginner in lisp & programming, which explains why I'm not
seeing the mistake in the following bit of code:
I would like to add this to my .gnus:
(defun audacious-now-playing ()
"Insert the title of the song I'm currently listening to."
(let ((track (shell-command-to-string "audtool --current-song")))
(unless (string-equal "no song playing." track) (save-excursion
(goto-char (point-min))
(re-search-forward "^--text follows this line--")
(forward-line 0)
(insert "X-Now-Playing: " track)))))
(add-hook 'message-setup-hook 'audacious-now-playing)
The way I adapted this existing bit of code, the unless condition does
not work like intended and I end up with a "X-Now-Playing: No song
playing." x-header in emails.
I would appreciate it if someone could point out what I'm doing
wrong.
What I like to do in cases like this is, just before the unless, print out both the value of track and then the actual condition copied directly from the unless:
(print `(hunh? ,track ,(string-equal ...etc...)))
I am guessing you'll see a nil after the track value and then you can stop worrying about UNLESS and start worrying about your typing or something else.
Oh, hang on, UNLESS goes the other way, so I am guessing you see a t after the track value.
kt
--
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/
"In the morning, hear the Way;
in the evening, die content!"
-- Confucius
.
- Follow-Ups:
- Re: error in unless
- From: Gijs Hillenius
- Re: error in unless
- References:
- error in unless
- From: Gijs Hillenius
- Re: error in unless
- From: Ken Tilton
- error in unless
- Prev by Date: cheap wholesale, NBA,adidas ( paypal accept ) ( www.top-saler.com )
- Next by Date: Re: error in unless
- Previous by thread: Re: error in unless
- Next by thread: Re: error in unless
- Index(es):
Relevant Pages
|