;;; 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 <larsi@gnus.org>
;; Keywords: news
(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.
: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:
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"
(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)
(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)
(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)
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
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))
"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."
(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))
;; 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))
;; 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))))
(let ((coding-system-for-write 'binary)
(coding-system-for-read 'binary))
(with-temp-file tmpfile
- (set-buffer-multibyte nil)
+ (mm-disable-multibyte)
(dolist (id ids)
(url-insert-file-contents (format mbox-url id)))
(goto-char (point-min))
(gnus-info-params info))
(t info))
;; The proper documentation.
- (format
+ (gnus-format-message
"Editing the %s for `%s'."
(cond
((eq part 'method) "select method")
(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"
(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.
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)
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.
(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
(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))))