From cc21c2356dbbf361a288cdb061f2f708b5392b93 Mon Sep 17 00:00:00 2001 From: Gnus developers Date: Tue, 25 Dec 2012 22:12:59 +0000 Subject: [PATCH] Merge changes made in Gnus master 2012-12-25 Lars Ingebrigtsen * gnus-sum.el (gnus-set-global-variables): Don't copy over the summary buffer to the article buffer here, because that clobbers multiple article buffers. * gnus-art.el (gnus-article-setup-buffer): Make sure that the article buffer always points to the right summary buffer. 2012-12-25 John Wiegley * auth-source.el (auth-source-netrc-parse): Allow using "password" as the password (bug#12097). 2012-12-25 Lars Ingebrigtsen * shr.el (shr-tag-a): Don't tagify elements that don't have HREFs (bug#13263). * gnus-salt.el (gnus-highlight-selected-tree): Check whether the Tree buffer exists before using it (bug#12475). * gnus-agent.el (gnus-agent-fetch-articles): Don't fetch articles from offline groups (bug#11937). * message.el (message-yank-original): When using customize to set the value of `message-cite-style', the variable it set to a symbol that's the name of the variable, which must then be dereferenced (bug#12616). 2012-09-13 Wolfgang Jenkner * lisp/gnus-spec.el (gnus-face-face-function): Initialize the value of the `face' property with a list whose car is the face specified in the format string and whose cdr is (nil). * lisp/gnus-util.el (gnus-put-text-property-excluding-characters-with-faces): Change accordingly. (gnus-get-text-property-excluding-characters-with-faces): New function. * lisp/gnus-sum.el (gnus-summary-highlight-line): * lisp/gnus-salt.el (gnus-tree-highlight-node): * lisp/gnus-group.el (gnus-group-highlight-line): Use it. --- lisp/gnus/ChangeLog | 50 ++++++++++++++++++++++++++++++++++--- lisp/gnus/auth-source.el | 2 +- lisp/gnus/gnus-agent.el | 3 ++- lisp/gnus/gnus-art.el | 23 ++++++++--------- lisp/gnus/gnus-group.el | 2 +- lisp/gnus/gnus-salt.el | 54 +++++++++++++++++++++------------------- lisp/gnus/gnus-spec.el | 9 ++++++- lisp/gnus/gnus-sum.el | 13 +++------- lisp/gnus/gnus-util.el | 33 ++++++++++++++++-------- lisp/gnus/message.el | 4 ++- lisp/gnus/shr.el | 3 ++- 11 files changed, 128 insertions(+), 68 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a1a64cc80c..2916b40df2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,45 @@ +2012-12-25 Lars Ingebrigtsen + + * gnus-sum.el (gnus-set-global-variables): Don't copy over the summary + buffer to the article buffer here, because that clobbers multiple + article buffers. + + * gnus-art.el (gnus-article-setup-buffer): Make sure that the article + buffer always points to the right summary buffer. + +2012-12-25 John Wiegley + + * auth-source.el (auth-source-netrc-parse): Allow using "password" as + the password (bug#12097). + +2012-12-25 Lars Ingebrigtsen + + * shr.el (shr-tag-a): Don't tagify elements that don't have HREFs + (bug#13263). + + * gnus-salt.el (gnus-highlight-selected-tree): Check whether the Tree + buffer exists before using it (bug#12475). + + * gnus-agent.el (gnus-agent-fetch-articles): Don't fetch articles from + offline groups (bug#11937). + + * message.el (message-yank-original): When using customize to set the + value of `message-cite-style', the variable it set to a symbol that's + the name of the variable, which must then be dereferenced (bug#12616). + +2012-12-25 Wolfgang Jenkner + + * lisp/gnus-spec.el (gnus-face-face-function): Initialize the value of + the `face' property with a list whose car is the face specified in the + format string and whose cdr is (nil). + * lisp/gnus-util.el + (gnus-put-text-property-excluding-characters-with-faces): Change + accordingly. + (gnus-get-text-property-excluding-characters-with-faces): New function. + * lisp/gnus-sum.el (gnus-summary-highlight-line): + * lisp/gnus-salt.el (gnus-tree-highlight-node): + * lisp/gnus-group.el (gnus-group-highlight-line): Use it. + 2012-12-25 Lars Ingebrigtsen * nnimap.el (nnimap-authenticator): Expand to allow specifying the @@ -8,7 +50,7 @@ mark state when moving articles. Otherwise unticked articles will get their ticks back after moving. -2012-12-24 Lars Ingebrigtsen +2012-12-25 Lars Ingebrigtsen * gnus-srvr.el (gnus-browse-delete-group): Fix syntax error. @@ -26,11 +68,11 @@ to nil to allow re-selecting groups that gain articles. (gnus-bug-group-download-format-alist): Update the URL. -2012-12-23 Andreas Schwab +2012-12-25 Andreas Schwab * shr.el (shr-tag-em): Render em as italic, not bold. -2012-12-23 Lars Ingebrigtsen +2012-12-25 Lars Ingebrigtsen * gnus-int.el (gnus-backend-trace): Factor out into its own function for reuse. @@ -38,7 +80,7 @@ (gnus-finish-retrieve-group-infos): Add backend tracing. (gnus-backend-trace): Also note the elapsed seconds. -2012-12-22 Philipp Haselwarter +2012-12-25 Philipp Haselwarter * gnus-sync.el (gnus-sync-file-encrypt-to, gnus-sync-save): Set epa-file-encrypt-to from variable to avoid querying. diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 4c5e5ffadc..b5b0c773e9 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -1008,7 +1008,7 @@ Note that the MAX parameter is used so we can exit the parse early." (while (and (zerop (forward-line 1)) (looking-at "$"))) (narrow-to-region (point) (point))) - ((member elem tokens) + ((and (member elem tokens) (null pair)) ;; Tokens that don't have a following value are ignored, ;; except "default". (when (and pair (or (cdr pair) diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 60d6102f7c..297c654034 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -1489,7 +1489,8 @@ downloaded into the agent." (defun gnus-agent-fetch-articles (group articles) "Fetch ARTICLES from GROUP and put them into the Agent." - (when articles + (when (and articles + (gnus-online (gnus-group-method group))) (gnus-agent-load-alist group) (let* ((alist gnus-agent-article-alist) (headers (if (< (length articles) 2) nil gnus-newsgroup-headers)) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 43c8ca7860..53e3d67161 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -4539,18 +4539,17 @@ commands: (gnus-article-mode)) (setq truncate-lines gnus-article-truncate-lines) (current-buffer)) - (with-current-buffer (gnus-get-buffer-create name) - (gnus-article-mode) - (setq truncate-lines gnus-article-truncate-lines) - (make-local-variable 'gnus-summary-buffer) - (setq gnus-summary-buffer - (gnus-summary-buffer-name gnus-newsgroup-name)) - (gnus-summary-set-local-parameters gnus-newsgroup-name) - (when article-lapsed-timer - (gnus-stop-date-timer)) - (when gnus-article-update-date-headers - (gnus-start-date-timer gnus-article-update-date-headers)) - (current-buffer))))) + (let ((summary gnus-summary-buffer)) + (with-current-buffer (gnus-get-buffer-create name) + (gnus-article-mode) + (setq truncate-lines gnus-article-truncate-lines) + (set (make-local-variable 'gnus-summary-buffer) summary) + (gnus-summary-set-local-parameters gnus-newsgroup-name) + (when article-lapsed-timer + (gnus-stop-date-timer)) + (when gnus-article-update-date-headers + (gnus-start-date-timer gnus-article-update-date-headers)) + (current-buffer)))))) (defun gnus-article-stop-animations () (dolist (timer (and (boundp 'timer-list) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 2fc87f097f..80183c263d 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -1667,7 +1667,7 @@ and ends at END." (let ((face (cdar (gnus-group-update-eval-form group gnus-group-highlight)))) - (unless (eq face (get-text-property beg 'face)) + (unless (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face)) (let ((inhibit-read-only t)) (gnus-put-text-property-excluding-characters-with-faces beg end 'face diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el index 760a7a0942..cb4101b580 100644 --- a/lisp/gnus/gnus-salt.el +++ b/lisp/gnus/gnus-salt.el @@ -659,7 +659,7 @@ Two predefined functions are available: (while (and list (not (eval (caar list)))) (setq list (cdr list))))) - (unless (eq (setq face (cdar list)) (get-text-property beg 'face)) + (unless (eq (setq face (cdar list)) (gnus-get-text-property-excluding-characters-with-faces beg 'face)) (gnus-put-text-property-excluding-characters-with-faces beg end 'face (if (boundp face) (symbol-value face) face))))) @@ -828,31 +828,33 @@ Two predefined functions are available: (defun gnus-highlight-selected-tree (article) "Highlight the selected article in the tree." - (let ((buf (current-buffer)) - region) - (set-buffer gnus-tree-buffer) - (when (setq region (gnus-tree-article-region article)) - (when (or (not gnus-selected-tree-overlay) - (gnus-extent-detached-p gnus-selected-tree-overlay)) - ;; Create a new overlay. - (gnus-overlay-put - (setq gnus-selected-tree-overlay - (gnus-make-overlay (point-min) (1+ (point-min)))) - 'face gnus-selected-tree-face)) - ;; Move the overlay to the article. - (gnus-move-overlay - gnus-selected-tree-overlay (goto-char (car region)) (cdr region)) - (gnus-tree-minimize) - (gnus-tree-recenter) - (let ((selected (selected-window))) - (when (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t) - (select-window (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t)) - (gnus-horizontal-recenter) - (select-window selected)))) -;; If we remove this save-excursion, it updates the wrong mode lines?!? - (with-current-buffer gnus-tree-buffer - (gnus-set-mode-line 'tree)) - (set-buffer buf))) + (when (buffer-live-p gnus-tree-buffer) + (let ((buf (current-buffer)) + region) + (set-buffer gnus-tree-buffer) + (when (setq region (gnus-tree-article-region article)) + (when (or (not gnus-selected-tree-overlay) + (gnus-extent-detached-p gnus-selected-tree-overlay)) + ;; Create a new overlay. + (gnus-overlay-put + (setq gnus-selected-tree-overlay + (gnus-make-overlay (point-min) (1+ (point-min)))) + 'face gnus-selected-tree-face)) + ;; Move the overlay to the article. + (gnus-move-overlay + gnus-selected-tree-overlay (goto-char (car region)) (cdr region)) + (gnus-tree-minimize) + (gnus-tree-recenter) + (let ((selected (selected-window))) + (when (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t) + (select-window + (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t)) + (gnus-horizontal-recenter) + (select-window selected)))) + ;; If we remove this save-excursion, it updates the wrong mode lines?!? + (with-current-buffer gnus-tree-buffer + (gnus-set-mode-line 'tree)) + (set-buffer buf)))) (defun gnus-tree-highlight-article (article face) (with-current-buffer (gnus-get-tree-buffer) diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el index f40177d5c6..22d4627bf2 100644 --- a/lisp/gnus/gnus-spec.el +++ b/lisp/gnus/gnus-spec.el @@ -265,7 +265,14 @@ Return a list of updated types." (defun gnus-face-face-function (form type) `(gnus-add-text-properties (point) (progn ,@form (point)) - '(gnus-face t face ,(symbol-value (intern (format "gnus-face-%d" type)))))) + (cons 'face + (cons + ;; Delay consing the value of the `face' property until + ;; `gnus-add-text-properties' runs, since it will be modified + ;; by `gnus-put-text-property-excluding-characters-with-faces'. + (list ',(symbol-value (intern (format "gnus-face-%d" type))) nil) + ;; Redundant now, but still convenient. + '(gnus-face t))))) (defun gnus-balloon-face-function (form type) `(gnus-put-text-property diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 7c3bf9f02a..429dd55525 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -3493,8 +3493,8 @@ If the setup was successful, non-nil is returned." (set-buffer buffer) (setq gnus-summary-buffer (current-buffer)) (not gnus-newsgroup-prepared)) - ;; Fix by Sudish Joseph - (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer))) + (set-buffer (gnus-get-buffer-create buffer)) + (setq gnus-summary-buffer (current-buffer)) (gnus-summary-mode group) (when (gnus-group-quit-config group) (set (make-local-variable 'gnus-single-article-buffer) nil)) @@ -3552,11 +3552,7 @@ buffer that was in action when the last article was fetched." (if (consp (car locals)) (set (caar locals) (pop vlist)) (set (car locals) (pop vlist))) - (setq locals (cdr locals)))) - ;; The article buffer also has local variables. - (when (gnus-buffer-live-p gnus-article-buffer) - (set-buffer gnus-article-buffer) - (setq gnus-summary-buffer summary)))))) + (setq locals (cdr locals)))))))) (defun gnus-summary-article-unread-p (article) "Say whether ARTICLE is unread or not." @@ -7874,7 +7870,6 @@ If STOP is non-nil, just stop when reaching the end of the message. Also see the variable `gnus-article-skip-boring'." (interactive "P") - (setq gnus-summary-buffer (current-buffer)) (gnus-set-global-variables) (let ((article (gnus-summary-article-number)) (article-window (get-buffer-window gnus-article-buffer t)) @@ -12524,7 +12519,7 @@ If REVERSE, save parts that do not match TYPE." (memq article gnus-newsgroup-undownloaded) (not (memq article gnus-newsgroup-cached))))) (let ((face (funcall (gnus-summary-highlight-line-0)))) - (unless (eq face (get-text-property beg 'face)) + (unless (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face)) (gnus-put-text-property-excluding-characters-with-faces beg (point-at-eol) 'face (setq face (if (boundp face) (symbol-value face) face))) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 7b1e2b5c79..1c22bdfd2c 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -866,18 +866,29 @@ If there's no subdirectory, delete DIRECTORY as well." (setq beg (point))) (gnus-overlay-put (gnus-make-overlay beg (point)) prop val))))) -(defun gnus-put-text-property-excluding-characters-with-faces (beg end - prop val) - "The same as `put-text-property', but don't put props on characters with the `gnus-face' property." - (let ((b beg)) - (while (/= b end) - (when (get-text-property b 'gnus-face) - (setq b (next-single-property-change b 'gnus-face nil end))) - (when (/= b end) +(defun gnus-put-text-property-excluding-characters-with-faces (beg end prop val) + "The same as `put-text-property', except where `gnus-face' is set. +If so, and PROP is `face', set the second element of its value to VAL. +Otherwise, do nothing." + (while (< beg end) + ;; Property values are compared with `eq'. + (let ((stop (next-single-property-change beg 'face nil end))) + (if (get-text-property beg 'gnus-face) + (when (eq prop 'face) + (setcar (cdr (get-text-property beg 'face)) val)) (inline - (gnus-put-text-property - b (setq b (next-single-property-change b 'gnus-face nil end)) - prop val)))))) + (gnus-put-text-property beg stop prop val))) + (setq beg stop)))) + +(defun gnus-get-text-property-excluding-characters-with-faces (pos prop) + "The same as `get-text-property', except where `gnus-face' is set. +If so, and PROP is `face', return the second element of its value. +Otherwise, return the value." + (let ((val (get-text-property pos prop))) + (if (and (get-text-property pos 'gnus-face) + (eq prop 'face)) + (cadr val) + (get-text-property pos prop)))) (defmacro gnus-faces-at (position) "Return a list of faces at POSITION." diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 24159d4c2a..2995daa270 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3814,7 +3814,9 @@ prefix, and don't delete any headers." (interactive "P") ;; eval the let forms contained in message-cite-style (eval - `(let ,message-cite-style + `(let ,(if (symbolp message-cite-style) + (symbol-value message-cite-style) + message-cite-style) (message--yank-original-internal ',arg)))) (defun message-yank-buffer (buffer) diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index 322c1d5d08..2ccbbc1001 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el @@ -931,7 +931,8 @@ ones, in case fg and bg are nil." (start (point)) shr-start) (shr-generic cont) - (shr-urlify (or shr-start start) (shr-expand-url url) title))) + (when url + (shr-urlify (or shr-start start) (shr-expand-url url) title)))) (defun shr-tag-object (cont) (let ((start (point)) -- 2.20.1