git.fiddlerwoaroof.com
Browse code

chore: reformat

Ed Langley authored on 06/11/2019 06:39:34
Showing 1 changed files
... ...
@@ -3,11 +3,11 @@
3 3
 
4 4
 (defmacro setup-libraries-for-feeds (&body body)
5 5
   `(let ((plump:*tag-dispatchers* plump:*xml-tags*)
6
-	 (drakma:*drakma-default-external-format* :utf-8)
7
-	 (drakma:*text-content-types* 
8
-	  (pairlis '("application" "application" "application")
9
-		   '("atom+xml"    "rss+xml"     "xml")
10
-		   drakma:*text-content-types*)))
6
+         (drakma:*drakma-default-external-format* :utf-8)
7
+         (drakma:*text-content-types*
8
+           (pairlis '("application" "application" "application")
9
+                    '("atom+xml"    "rss+xml"     "xml")
10
+                    drakma:*text-content-types*)))
11 11
      ,@body))
12 12
 
13 13
 (defvar *user-agent* "alimenta/0.0")
... ...
@@ -38,47 +38,48 @@
38 38
 
39 39
 (defun feed-ambiguous (choices)
40 40
   (error 'feed-ambiguous
41
-	 :choices choices))
41
+         :choices choices))
42 42
 
43 43
 (defun no-feed (url)
44 44
   (cerror "Skip this feed" 'no-feed :url url))
45 45
 
46 46
 (defun fetch-feed-from-url (url &key type)
47 47
   (setup-libraries-for-feeds
48
-    (let* ((feeds (alimenta.discover:discover-feed (drakma:http-request url
49
-									:user-agent *user-agent*
50
-									:decode-content t)))
51
-	   (feeds (if type (remove-if-not (lambda (x) (eql type (car x)))
52
-					  feeds)
53
-		      feeds)))
48
+    (let* ((feeds (alimenta.discover:discover-feed
49
+                   (drakma:http-request url
50
+                                        :user-agent *user-agent*
51
+                                        :decode-content t)))
52
+           (feeds (if type (remove-if-not (lambda (x) (eql type (car x)))
53
+                                          feeds)
54
+                      feeds)))
54 55
       (if (not feeds)
55
-	  (no-feed url)
56
-	  (fetch-doc-from-url
57
-	   (cdar 
58
-	    (restart-case
59
-		(if (cdr feeds) (feed-ambiguous feeds) feeds)
60
-	      (take-first-feed nil
61
-		:report (lambda (s) (format s "Take the first feed"))
62
-		feeds)
63
-	      (take-nth-feed (n)
64
-		:report (lambda (s) (format s "Take the nth feed"))
65
-		(list (elt feeds n)))
66
-	      (select-feed (selector)
67
-		:report (lambda (s) (format s "Provide a function to select the right feed"))
68
-		(find-if selector feeds)))))))))
56
+          (no-feed url)
57
+          (fetch-doc-from-url
58
+           (cdar 
59
+            (restart-case
60
+                (if (cdr feeds) (feed-ambiguous feeds) feeds)
61
+              (take-first-feed nil
62
+                :report (lambda (s) (format s "Take the first feed"))
63
+                feeds)
64
+              (take-nth-feed (n)
65
+                :report (lambda (s) (format s "Take the nth feed"))
66
+                (list (elt feeds n)))
67
+              (select-feed (selector)
68
+                :report (lambda (s) (format s "Provide a function to select the right feed"))
69
+                (find-if selector feeds)))))))))
69 70
 
70 71
 (defmacro with-retry ((retry-message &rest args) action &body other-restarts)
71 72
   `(loop (restart-case (return ,action)
72
-	   (retry ()
73
-	     :report (lambda (s) (format s ,retry-message ,@args)))
74
-	   ,@other-restarts)))
73
+           (retry ()
74
+             :report (lambda (s) (format s ,retry-message ,@args)))
75
+           ,@other-restarts)))
75 76
 
76 77
 (defun pull-feed (url &key detect type)
77 78
   (with-retry ("Retry fetching feed ~a" url)
78
-      (to-feed
79
-       (if detect
80
-	   (fetch-feed-from-url url)
81
-	   (fetch-doc-from-url url)) 
82
-       :type type)
79
+              (to-feed
80
+               (if detect
81
+                   (fetch-feed-from-url url)
82
+                   (fetch-doc-from-url url)) 
83
+               :type type)
83 84
     (skip-feed () (return)
84
-	       :report (lambda (s) (format s "Skip fetching feed ~a" url)))))
85
+               :report (lambda (s) (format s "Skip fetching feed ~a" url)))))