(shr-tag-li): Get <li> indentation right.
[gnus] / lisp / gnus-gravatar.el
index 187b816..de373cf 100644 (file)
 (defcustom gnus-gravatar-size 32
   "How big should gravatars be displayed."
   :type 'integer
+  :version "24.1"
   :group 'gnus-gravatar)
 
-(defcustom gnus-gravatar-relief 1
-  "If non-nil, adds a shadow rectangle around the image. The
-value, relief, specifies the width of the shadow lines, in
-pixels. If relief is negative, shadows are drawn so that the
-image appears as a pressed button; otherwise, it appears as an
-unpressed button."
+(defcustom gnus-gravatar-properties '(:ascent center :relief 1)
+  "List of image properties applied to Gravatar images."
+  :type 'list
+  :version "24.1"
   :group 'gnus-gravatar)
 
 (defun gnus-gravatar-transform-address (header category)
@@ -68,15 +67,16 @@ Set image category to CATEGORY."
     (gnus-with-article-headers
       (gnus-article-goto-header header)
       (mail-header-narrow-to-field)
-      (goto-char (point-max))
       (let ((real-name (cdr address))
             (mail-address (car address)))
         (when (if real-name             ; have a realname, go for it!
-                  (search-backward real-name)
-                (search-backward address))
+                  (and (search-forward real-name nil t)
+                       (search-backward real-name nil t))
+                (and (search-forward mail-address nil t)
+                     (search-backward mail-address nil t)))
           (goto-char (1- (point)))
           ;; If we're on the " quoting the name, go backward
-          (when (looking-at "\"")
+          (when (looking-at "[\"<]")
             (goto-char (1- (point))))
           ;; Do not do anything if there's already a gravatar. This can
           ;; happens if the buffer has been regenerated in the mean time, for
@@ -87,7 +87,7 @@ Set image category to CATEGORY."
                   (point (point))
                   (gravatar (append
                              gravatar
-                             `(:ascent center :relief ,gnus-gravatar-relief))))
+                             gnus-gravatar-properties)))
               (gnus-put-image gravatar nil category)
               (put-text-property point (point) 'gnus-gravatar address)
               (gnus-add-wash-type category)