anchor.diff:         (let* ((dom (plump:parse response))
                 (titles (and dom (plump:get-elements-by-tag-name dom "title"))))
            (when titles
  -           (string-limit
  -            (string-trim '(#\space)
  -                         (ppcre:regex-replace-all
  -                          "\\s+"
  -                          (plump:text (plump:first-child (elt titles 0)))
  -                          " "))
  -            100))))
  +           (format-snippet (plump:text (plump:first-child (elt titles 0)))))))
         ("text/plain"
  -       (string-limit
  -        (string-trim '(#\space)
  -                     (ppcre:regex-replace-all
  -                      "\\s+"
  -                      response
  -                      " "))
  -        100)))))
  +       (format-snippet response)))))
   
   (defun retrieve-uri-summary (uri)
     (handler-case
  
positive.code:   (write-to-file (data-path "urls.lisp")
                   (urls-of module)))
  
  (defun generic-uri-summary (response headers)
    (multiple-value-bind (type subtype)
        (drakma:get-content-type headers)
  
negative.code:         (usocket:timeout-error ()
            nil)))))
  
  (defun google-api-search (query cse-id api-key)
    (pushnew '("application" . "json") drakma:*text-content-types* :test #'equal)
    (let ((response
            (drakma:http-request "https://www.googleapis.com/customsearch/v1"
                                 :parameters `(("q" . ,query)
                                               ("num" . "1")
                                               ("cx" . ,cse-id)
                                               ("key" . ,api-key)))))
      (when response
        (let* ((result (json:decode-json-from-string response))
               (item (first (cdr (assoc :items result)))))
          (and item
               (format nil "~a - ~a - ~a"
                       (cdr (assoc :link item))
                       (format-snippet (cdr (assoc :title item)))
                       (format-snippet (cdr (assoc :snippet item)))))))))
  
  (defmethod handle-command ((module web-module)
                             (cmd (eql 'g))
                             message args)
    "g <search> - Return first Google result for search."
    (cond
      ((not (and (search-api-key-of module) (search-cse-id-of module)))
       (reply-to message "Sorry, search engine is not configured."))
      (args
       (let* ((query (join-to-string " " args))
              (result (google-api-search query
                                         (search-cse-id-of module)
                                         (search-api-key-of module))))
         (if result
             (reply-to message "~a" result)
             (reply-to message "No search results found for '~a'" query))))
      (t
       (reply-to message "Missing search terms."))))
  
  