X-Git-Url: https://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=lisp%2Fgnus-group.el;h=1cd16a4e043b362ff79c9814bd30a77fcc951878;hp=f3dcc40b8c48192f91071d11736c5fbc5d3d6ef2;hb=HEAD;hpb=b081ea2e35ba1ecf9e5dddb32e2cd84865c32880 diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index f3dcc40b8..1cd16a4e0 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -1,6 +1,6 @@ ;;; gnus-group.el --- group mode commands for Gnus -;; Copyright (C) 1996-2015 Free Software Foundation, Inc. +;; Copyright (C) 1996-2016 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: news @@ -155,7 +155,7 @@ list." (function-item gnus-group-sort-by-rank) (function :tag "other" nil)))) -(defcustom gnus-group-line-format "%M\%S\%p\%P\%5y:%B%(%g%)\n" +(defcustom gnus-group-line-format "%M\ %S\ %p\ %P\ %5y:%B%(%g%)\n" "*Format of group lines. It works along the same lines as a normal formatting string, with some simple extensions. @@ -213,7 +213,7 @@ See Info node `(gnus)Formatting Variables'." :group 'gnus-group-visual :type 'string) -(defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}" +(defcustom gnus-group-mode-line-format "Gnus: %%b {%M\ %:%S}" "*The format specification for the group mode line. It works along the same lines as a normal formatting string, with some simple extensions: @@ -445,7 +445,7 @@ If non-nil, the value should be a string or an alist. If it is a string, e.g. \"nnml:\", in which case `gnus-group-jump-to-group' offers \"Group: nnml:\" in the minibuffer prompt. -If it is an alist, it must consist of \(NUMBER . PROMPT\) pairs, for example: +If it is an alist, it must consist of \(NUMBER . PROMPT) pairs, for example: \((1 . \"\") (2 . \"nnfolder+archive:\")). The element with number 0 is used when no prefix argument is given to `gnus-group-jump-to-group'." :version "22.1" @@ -478,6 +478,26 @@ simple manner.") (defvar gnus-group-edit-buffer nil) +(defvar gnus-tmp-news-method) +(defvar gnus-tmp-colon) +(defvar gnus-tmp-news-server) +(defvar gnus-tmp-decoded-group) +(defvar gnus-tmp-header) +(defvar gnus-tmp-process-marked) +(defvar gnus-tmp-summary-live) +(defvar gnus-tmp-news-method-string) +(defvar gnus-tmp-group-icon) +(defvar gnus-tmp-moderated-string) +(defvar gnus-tmp-newsgroup-description) +(defvar gnus-tmp-comment) +(defvar gnus-tmp-qualified-group) +(defvar gnus-tmp-subscribed) +(defvar gnus-tmp-number-of-read) +(defvar gnus-inhibit-demon) +(defvar gnus-pick-mode) +(defvar gnus-tmp-marked-mark) +(defvar gnus-tmp-number-of-unread) + (defvar gnus-group-line-format-alist `((?M gnus-tmp-marked-mark ?c) (?S gnus-tmp-subscribed ?c) @@ -1140,8 +1160,7 @@ The following commands are available: (let ((gnus-process-mark ?\200) (gnus-group-update-hook nil) (gnus-group-marked '("dummy.group")) - (gnus-active-hashtb (make-vector 10 0)) - (topic "")) + (gnus-active-hashtb (make-vector 10 0))) (gnus-set-active "dummy.group" '(0 . 0)) (gnus-set-work-buffer) (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil) @@ -1377,7 +1396,8 @@ if it is a string, only list groups matching REGEXP." (gnus-group-prepare-flat-list-dead (gnus-union not-in-list - (setq gnus-killed-list (sort gnus-killed-list 'string<))) + (setq gnus-killed-list (sort gnus-killed-list 'string<)) + :test 'equal) gnus-level-killed ?K regexp)) (gnus-group-set-mode-line) @@ -1574,7 +1594,7 @@ if it is a string, only list groups matching REGEXP." gnus-process-mark ? )) (buffer-read-only nil) beg end - header gnus-tmp-header) ; passed as parameter to user-funcs. + gnus-tmp-header) ; passed as parameter to user-funcs. (beginning-of-line) (setq beg (point)) (gnus-add-text-properties @@ -1592,20 +1612,31 @@ if it is a string, only list groups matching REGEXP." gnus-indentation ,gnus-group-indentation gnus-level ,gnus-tmp-level)) (setq end (point)) - (when gnus-group-update-tool-bar - (gnus-put-text-property beg end 'point-entered - 'gnus-tool-bar-update) - (gnus-put-text-property beg end 'point-left - 'gnus-tool-bar-update)) + (gnus-group--setup-tool-bar-update beg end) (forward-line -1) (when (inline (gnus-visual-p 'group-highlight 'highlight)) (gnus-group-highlight-line gnus-tmp-group beg end)) (gnus-run-hooks 'gnus-group-update-hook) (forward-line))) +(defun gnus-group--setup-tool-bar-update (beg end) + (when gnus-group-update-tool-bar + (if (fboundp 'cursor-sensor-mode) + (progn + (unless (bound-and-true-p cursor-sensor-mode) + (cursor-sensor-mode 1)) + (gnus-put-text-property beg end 'cursor-sensor-functions + '(gnus-tool-bar-update))) + (gnus-put-text-property beg end 'point-entered + #'gnus-tool-bar-update) + (gnus-put-text-property beg end 'point-left + #'gnus-tool-bar-update)))) + (defun gnus-group-update-eval-form (group list) "Eval `car' of each element of LIST, and return the first that return t. Some value are bound so the form can use them." + (defvar group-age) (defvar ticked) (defvar score) (defvar level) + (defvar mailp) (defvar total) (defvar unread) (when list (let* ((entry (gnus-group-entry group)) (unread (if (numberp (car entry)) (car entry) 0)) @@ -1784,7 +1815,9 @@ already. If INFO-UNCHANGED is non-nil, dribble buffer is not updated." "Get the name of the newsgroup on the current line." (let ((group (get-text-property (point-at-bol) 'gnus-group))) (when group - (symbol-name group)))) + (if (stringp group) + group + (symbol-name group))))) (defun gnus-group-group-level () "Get the level of the newsgroup on the current line." @@ -2142,7 +2175,7 @@ be permanent." (gnus-group-decoded-name group))) (let ((regexp "[][\C-@-\t\v-*,/:-@\\^`{-\C-?]*\ \\(nn[a-z]+\\(?:\\+[^][\C-@-*,/:-@\\^`{-\C-?]+\\)?:\ -\[^][\C-@-*,./:-@\\^`{-\C-?]+\\(?:\\.[^][\C-@-*,./:-@\\^`{-\C-?]+\\)*\ +[^][\C-@-*,./:-@\\^`{-\C-?]+\\(?:\\.[^][\C-@-*,./:-@\\^`{-\C-?]+\\)*\ \\|[^][\C-@-*,./:-@\\^`{-\C-?]+\\(?:\\.[^][\C-@-*,./:-@\\^`{-\C-?]+\\)+\\)") (start (point)) (case-fold-search nil)) @@ -2403,7 +2436,7 @@ Valid input formats include: ;; URLs providing `group', `start' and `range': ((string-match ;; http://thread.gmane.org/gmane.emacs.devel/86326/focus=86525 - "^http://thread\.gmane\.org/\\([^/]+\\)/\\([0-9]+\\)/focus=\\([0-9]+\\)$" + "^http://thread\\.gmane\\.org/\\([^/]+\\)/\\([0-9]+\\)/focus=\\([0-9]+\\)$" url) (setq group (match-string 1 url) start (string-to-number (match-string 2 url)) @@ -2414,15 +2447,15 @@ Valid input formats include: ;; URLs providing `group' and `start': ((or (string-match ;; http://article.gmane.org/gmane.comp.gnu.make.bugs/3584 - "^http://\\(?:thread\\|article\\|permalink\\)\.gmane\.org/\\([^/]+\\)/\\([0-9]+\\)" + "^http://\\(?:thread\\|article\\|permalink\\)\\.gmane\\.org/\\([^/]+\\)/\\([0-9]+\\)" url) (string-match ;; Don't advertise these in the doc string yet: - "^\\(?:nntp\\|news\\)://news\.gmane\.org/\\([^/]+\\)/\\([0-9]+\\)" + "^\\(?:nntp\\|news\\)://news\\.gmane\\.org/\\([^/]+\\)/\\([0-9]+\\)" url) (string-match ;; http://news.gmane.org/group/gmane.emacs.gnus.general/thread=65099/force_load=t - "^http://news\.gmane\.org/group/\\([^/]+\\)/thread=\\([0-9]+\\)" + "^http://news\\.gmane\\.org/group/\\([^/]+\\)/thread=\\([0-9]+\\)" url)) (setq group (match-string 1 url) start (string-to-number (match-string 2 url)))) @@ -2918,7 +2951,7 @@ and NEW-NAME will be prompted for." (gnus-info-params info)) (t info)) ;; The proper documentation. - (format + (gnus-format-message "Editing the %s for `%s'." (cond ((eq part 'method) "select method") @@ -3107,8 +3140,8 @@ If SOLID (the prefix), create a solid group." (defvar nnrss-group-alist) (eval-when-compile - (defun nnrss-discover-feed (arg)) - (defun nnrss-save-server-data (arg))) + (defun nnrss-discover-feed (_arg)) + (defun nnrss-save-server-data (_arg))) (defun gnus-group-make-rss-group (&optional url) "Given a URL, discover if there is an RSS feed. If there is, use Gnus to create an nnrss group" @@ -3246,7 +3279,8 @@ mail messages or news articles in files that have numeric names." (error "%s is not an nnimap group" group)) (unless (setq acl (nnimap-acl-get mailbox (cadr method))) (error "Server does not support ACL's")) - (gnus-edit-form acl (format "Editing the access control list for `%s'. + (gnus-edit-form acl (gnus-format-message "\ +Editing the access control list for `%s'. An access control list is a list of (identifier . rights) elements. @@ -3255,7 +3289,7 @@ mail messages or news articles in files that have numeric names." Rights is a string listing a (possibly empty) set of alphanumeric characters, each character listing a set of operations which is being - controlled. Letters are reserved for ``standard'' rights, listed + controlled. Letters are reserved for \"standard\" rights, listed below. Digits are reserved for implementation or site defined rights. l - lookup (mailbox is visible to LIST/LSUB commands) @@ -3757,7 +3791,7 @@ group line." nil nil (gnus-read-active-file-p)))) (let ((newsrc (gnus-group-entry group))) (cond - ((string-match "^[ \t]*$" group) + ((string-match "\\`[ \t]*\\'" group) (error "Empty group name")) (newsrc ;; Toggle subscription flag. @@ -4075,7 +4109,9 @@ If DONT-SCAN is non-nil, scan non-activated groups as well." (gnus-group-remove-mark group) ;; Bypass any previous denials from the server. (gnus-remove-denial (setq method (gnus-find-method-for-group group))) - (if (gnus-activate-group group (if dont-scan nil 'scan) nil method) + (if (or (and (not dont-scan) + (gnus-request-group-scan group (gnus-get-info group))) + (gnus-activate-group group (if dont-scan nil 'scan) nil method)) (let ((info (gnus-get-info group)) (active (gnus-active group))) (when info @@ -4312,6 +4348,11 @@ The hook `gnus-suspend-gnus-hook' is called before actually suspending." (gnus-kill-buffer buf))) (setq gnus-backlog-articles nil) (gnus-kill-gnus-frames) + ;; Closing all the backends is useful (for instance) when when the + ;; IP addresses have changed and you need to reconnect. + (dolist (elem gnus-opened-servers) + (gnus-close-server (car elem)) + (setcar (cdr elem) 'closed)) (when group-buf (bury-buffer group-buf) (delete-windows-on group-buf t))))