From: Julien Danjou Date: Tue, 28 Sep 2010 11:47:12 +0000 (+0000) Subject: Merge changes made in Gnus trunk. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~47^2~20 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b6fda8fc58840bab97ef1cb0fce3c26908edb815;p=emacs.git Merge changes made in Gnus trunk. gnus-gravatar.el (gnus-gravatar-insert): Fix search backward. gnus-gravatar.el (gnus-gravatar-insert): Fix search in case mail-address contains the same string as real-name. gnus-gravatar.el (gnus-gravatar-insert): More robust search. gnus-ems.el (gnus-put-image): Revert Lars, change and insert non-blank in header, otherwise it'll get stripped. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 95cb6792889..830f481e8f7 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,14 @@ +2010-09-28 Julien Danjou + + * gnus-gravatar.el (gnus-gravatar-insert): Fix search in case + mail-address contains the same string as real-name. + + * gnus-ems.el (gnus-put-image): Revert Lars, change and insert + non-blank in header, otherwise it'll get stripped. + + * gnus-gravatar.el (gnus-gravatar-insert): Search backward for + real-name, and then for mail address rather than doing : or , search. + 2010-09-28 Katsumi Yamaoka * nnimap.el (auth-source-forget-user-or-password) diff --git a/lisp/gnus/gnus-ems.el b/lisp/gnus/gnus-ems.el index 7b3f3d8a80e..b4a2fe960c6 100644 --- a/lisp/gnus/gnus-ems.el +++ b/lisp/gnus/gnus-ems.el @@ -277,7 +277,7 @@ (defun gnus-put-image (glyph &optional string category) (let ((point (point))) - (insert-image glyph (or string " ")) + (insert-image glyph (or string "*")) (put-text-property point (point) 'gnus-image-category category) (unless string (put-text-property (1- (point)) (point) diff --git a/lisp/gnus/gnus-gravatar.el b/lisp/gnus/gnus-gravatar.el index 54679f43ff3..14e224051bb 100644 --- a/lisp/gnus/gnus-gravatar.el +++ b/lisp/gnus/gnus-gravatar.el @@ -59,7 +59,7 @@ unpressed button." (gravatar-retrieve (car address) 'gnus-gravatar-insert - (list header (car address) category))))))) + (list header address category))))))) (defun gnus-gravatar-insert (gravatar header address category) "Insert GRAVATAR for ADDRESS in HEADER in current article buffer. @@ -68,24 +68,31 @@ Set image category to CATEGORY." (gnus-with-article-headers (gnus-article-goto-header header) (mail-header-narrow-to-field) - (when (and (search-forward address nil t) - (or (search-backward ", " nil t) - (search-backward ": " nil t))) - (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 - ;; example we were fetching someaddress, and then we change to - ;; another mail with the same someaddress. - (unless (memq 'gnus-gravatar (text-properties-at (point))) - (let ((inhibit-read-only t) - (point (point)) - (gravatar (append - gravatar - `(:ascent center :relief ,gnus-gravatar-relief)))) - (gnus-put-image gravatar nil category) - (put-text-property point (point) 'gnus-gravatar address) - (gnus-add-wash-type category) - (gnus-add-image category gravatar))))))) + (let ((real-name (cdr address)) + (mail-address (car address))) + (when (if real-name ; have a realname, go for it! + (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 "\"") + (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 + ;; example we were fetching someaddress, and then we change to + ;; another mail with the same someaddress. + (unless (memq 'gnus-gravatar (text-properties-at (point))) + (let ((inhibit-read-only t) + (point (point)) + (gravatar (append + gravatar + `(:ascent center :relief ,gnus-gravatar-relief)))) + (gnus-put-image gravatar nil category) + (put-text-property point (point) 'gnus-gravatar address) + (gnus-add-wash-type category) + (gnus-add-image category gravatar)))))))) ;;;###autoload (defun gnus-treat-from-gravatar ()