Re: error in unless
- From: Ken Tilton <kennytilton@xxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 04:28:16 -0400
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.
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: Ken Tilton
- Re: error in unless
- References:
- error in unless
- From: Gijs Hillenius
- error in unless
- Prev by Date: error in unless
- Next by Date: cheap wholesale, NBA,adidas ( paypal accept ) ( www.top-saler.com )
- Previous by thread: error in unless
- Next by thread: Re: error in unless
- Index(es):
Relevant Pages
|
|