Re: Please test this apps-menu.jl fix
- From: Teika Kazura <teika lavabit com>
- To: sawfish-list gnome org
- Subject: Re: Please test this apps-menu.jl fix
- Date: Tue, 06 Apr 2010 14:48:20 +0900 (JST)
Thanks a lot, Matthew. It had a typo, but other than that, it's good.
Attached one has the fix, and minor readability improvements:
* Replacements are done when possible from 'if' to 'when'. (Nested
'if' is hard to track.)
* Internal var 'check-stream' is renamed to 'line'. It's a string,
not stream.
Regards,
Teika (Teika kazura)
diff --git a/lisp/sawfish/wm/ext/apps-menu.jl b/lisp/sawfish/wm/ext/apps-menu.jl
index 19e1e8f..f731da9 100644
--- a/lisp/sawfish/wm/ext/apps-menu.jl
+++ b/lisp/sawfish/wm/ext/apps-menu.jl
@@ -82,17 +82,25 @@ set this to non-nil.")
;; fdo-desktop-file-parsing
+ (define (desktop-skip-line-p instring)
+ (or (eq (aref instring 0) ?#)
+ (eq (aref instring 0) ?\n)))
+
+ (define (check-if-desktop-stream instream)
+ (let ((line (read-line instream)))
+ (when line
+ (if (string= line "[Desktop Entry]\n")
+ 't
+ (when (desktop-skip-line-p line)
+ (check-if-desktop-stream instream))))))
+
(define (desktop-file-p directory-file)
(condition-case nil
(let ((this-file (open-file directory-file 'read)))
- (string= (read-line this-file) "[Desktop Entry]\n"))
+ (check-if-desktop-stream this-file))
;; unreadable -> return nil
(file-error)))
- (define (desktop-skip-line-p instring)
- (or (eq (aref instring 0) ?#)
- (eq (aref instring 0) ?\n)))
-
(define (desktop-group-p instring)
(eq (aref instring 0) ?\[))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]