Commit 55e858d7 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Adjust naming convention for dependent Gnus sessions

* doc/misc/gnus.texi (Child Gnusae): Rename node from "Slave
Gnusae" and adjust wording.  Also remove at least one joke.

* lisp/gnus/gnus-start.el (gnus-no-server-1, gnus-1)
(gnus-setup-news, gnus-save-newsrc-file): Adjust parameter names.
(gnus-child-mode): Rename and add alias.
(gnus-child-save-newsrc): Rename.
(gnus-parent-read-child-newsrc): Ditto.

* lisp/gnus/gnus-group.el (gnus-group-mode)
(gnus-group-get-new-news): Ditto.

* lisp/gnus/gnus-agent.el (gnus-child-unplugged): Rename function
from gnus-slave-unplugged (and add the latter as an obsolete alias).

* lisp/gnus/gnus.el (gnus-other-frame-function): Adjust function
names in the defcustom to new naming scheme.
(gnus-other-frame-resume-function): Ditto.
(gnus): Adjust parameter names.
parent a2a45881
Pipeline #6062 failed with stage
in 18 seconds
......@@ -436,7 +436,7 @@ Starting Gnus
* Finding the News:: Choosing a method for getting news.
* The Server is Down:: How can I read my mail then?
* Slave Gnusae:: You can have more than one Gnus active at a time.
* Child Gnusae:: You can have more than one Gnus active at a time.
* Fetching a Group:: Starting Gnus just to read a group.
* New Groups:: What is Gnus supposed to do with new groups?
* Changing Servers:: You may want to move from one server to another.
......@@ -976,7 +976,7 @@ terminology section (@pxref{Terminology}).
@menu
* Finding the News:: Choosing a method for getting news.
* The Server is Down:: How can I read my mail then?
* Slave Gnusae:: You can have more than one Gnus active at a time.
* Child Gnusae:: You can have more than one Gnus active at a time.
* New Groups:: What is Gnus supposed to do with new groups?
* Changing Servers:: You may want to move from one server to another.
* Startup Files:: Those pesky startup files---@file{.newsrc}.
......@@ -1090,9 +1090,9 @@ your primary server---instead, it will just activate all groups on level
levels.) Also @pxref{Group Levels}.
@node Slave Gnusae
@section Slave Gnusae
@cindex slave
@node Child Gnusae
@section Child Gnusae
@cindex child
You might want to run more than one Emacs with more than one Gnus at the
same time. If you are using different @file{.newsrc} files (e.g., if you
......@@ -1103,31 +1103,27 @@ The problem appears when you want to run two Gnusae that use the same
@file{.newsrc} file.
To work around that problem some, we here at the Think-Tank at the Gnus
Towers have come up with a new concept: @dfn{Masters} and
@dfn{slaves}. (We have applied for a patent on this concept, and have
taken out a copyright on those words. If you wish to use those words in
conjunction with each other, you have to send $1 per usage instance to
me. Usage of the patent (@dfn{Master/Slave Relationships In Computer
Applications}) will be much more expensive, of course.)
@findex gnus-slave
Towers have come up with a new concept: @dfn{Parents} and
@dfn{children}.
@findex gnus-child
Anyway, you start one Gnus up the normal way with @kbd{M-x gnus} (or
however you do it). Each subsequent slave Gnusae should be started with
@kbd{M-x gnus-slave}. These slaves won't save normal @file{.newsrc}
files, but instead save @dfn{slave files} that contain information only
on what groups have been read in the slave session. When a master Gnus
starts, it will read (and delete) these slave files, incorporating all
information from them. (The slave files will be read in the sequence
however you do it). Each subsequent child Gnusae should be started with
@kbd{M-x gnus-child}. These children won't save normal @file{.newsrc}
files, but instead save @dfn{child files} that contain information only
on what groups have been read in the child session. When a parent Gnus
starts, it will read (and delete) these child files, incorporating all
information from them. (The child files will be read in the sequence
they were created, so the latest changes will have precedence.)
Information from the slave files has, of course, precedence over the
information in the normal (i.e., master) @file{.newsrc} file.
Information from the child files has, of course, precedence over the
information in the normal (i.e., parent) @file{.newsrc} file.
If the @file{.newsrc*} files have not been saved in the master when the
slave starts, you may be prompted as to whether to read an auto-save
file. If you answer ``yes'', the unsaved changes to the master will be
incorporated into the slave. If you answer ``no'', the slave may see some
messages as unread that have been read in the master.
If the @file{.newsrc*} files have not been saved in the parent when the
child starts, you may be prompted as to whether to read an auto-save
file. If you answer ``yes'', the unsaved changes to the parent will be
incorporated into the child. If you answer ``no'', the child may see some
messages as unread that have been read in the parent.
......@@ -28487,9 +28483,9 @@ entry.
The format spec @code{%C} for positioning point has changed to @code{%*}.
@item
@code{gnus-slave-unplugged}
@code{gnus-child-unplugged}
A new command which starts Gnus offline in slave mode.
A new command which starts Gnus offline in child mode.
@end itemize
......@@ -207,6 +207,12 @@ Bookmark locations can refer to VC directory buffers.
** Gnus
+++
*** The name of dependent Gnus sessions has changed from "slave" to "child".
The names of the commands 'gnus-slave', 'gnus-slave-no-server' and
'gnus-slave-unplugged' have changed to 'gnus-child',
'gnus-child-no-server' and 'gnus-child-unplugged' respectively.
---
*** Change to default value of 'message-draft-headers' user option.
The 'Date' symbol has been removed from the default value, meaning that
......
......@@ -603,11 +603,18 @@ manipulated as follows:
(gnus))
;;;###autoload
(defun gnus-slave-unplugged (&optional arg)
"Read news as a slave unplugged."
(defun gnus-child-unplugged (&optional arg)
"Read news as a child unplugged."
(interactive "P")
(setq gnus-plugged nil)
(gnus arg nil 'slave))
(gnus arg nil 'child))
;;;###autoload
(define-obsolete-function-alias 'gnus-slave-unplugged #'gnus-child-unplugged
"28.1")
;;;###autoload
(defun gnus-agentize ()
......
......@@ -1129,8 +1129,8 @@ The following commands are available:
(gnus-update-group-mark-positions)
(when gnus-use-undo
(gnus-undo-mode 1))
(when gnus-slave
(gnus-slave-mode)))
(when gnus-child
(gnus-child-mode)))
(defun gnus-update-group-mark-positions ()
(save-excursion
......@@ -4024,9 +4024,9 @@ otherwise all levels below ARG will be scanned too."
(gnus-run-hooks 'gnus-get-top-new-news-hook)
(gnus-run-hooks 'gnus-get-new-news-hook)
;; Read any slave files.
(unless gnus-slave
(gnus-master-read-slave-newsrc))
;; Read any child files.
(unless gnus-child
(gnus-parent-read-child-newsrc))
(gnus-get-unread-articles (gnus-group-default-level arg t)
nil one-level)
......
......@@ -653,7 +653,7 @@ Usage: emacs -batch -l ~/.emacs -l gnus -f gnus-batch-score"
gnus-options-not-subscribe)
;; Eat all arguments.
(setq command-line-args-left nil)
(gnus-slave)
(gnus-child)
;; Apply kills to specified newsgroups in command line arguments.
(setq newsrc (cdr gnus-newsrc-alist))
(while (setq info (pop newsrc))
......
......@@ -730,7 +730,7 @@ the first newsgroup."
;; Remove Gnus frames.
(gnus-kill-gnus-frames))
(defun gnus-no-server-1 (&optional arg slave)
(defun gnus-no-server-1 (&optional arg child)
"Read network news.
If ARG is a positive number, Gnus will use that as the startup
level. If ARG is nil, Gnus will be started at level 2
......@@ -739,11 +739,11 @@ and not a positive number, Gnus will prompt the user for the name
of an NNTP server to use. As opposed to \\[gnus], this command
will not connect to the local server."
(let ((val (or arg (1- gnus-level-default-subscribed))))
(gnus val t slave)
(gnus val t child)
(make-local-variable 'gnus-group-use-permanent-levels)
(setq gnus-group-use-permanent-levels val)))
(defun gnus-1 (&optional arg dont-connect slave)
(defun gnus-1 (&optional arg dont-connect child)
"Read network news.
If ARG is non-nil and a positive number, Gnus will use that as the
startup level. If ARG is non-nil and not a positive number, Gnus will
......@@ -761,7 +761,7 @@ prompt the user for the name of an NNTP server to use."
(gnus-splash)
(gnus-run-hooks 'gnus-before-startup-hook)
(nnheader-init-server-buffer)
(setq gnus-slave slave)
(setq gnus-child child)
(gnus-read-init-file)
;; Add "native" to gnus-predefined-server-alist just to have a
......@@ -790,7 +790,7 @@ prompt the user for the name of an NNTP server to use."
(gnus-make-newsrc-file gnus-startup-file))
;; Read the dribble file.
(when (or gnus-slave gnus-use-dribble-file)
(when (or gnus-child gnus-use-dribble-file)
(gnus-dribble-read-file))
;; Do the actual startup.
......@@ -1008,11 +1008,11 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
;; Possibly eval the dribble file.
(and init
(or gnus-use-dribble-file gnus-slave)
(or gnus-use-dribble-file gnus-child)
(gnus-dribble-eval-file))
;; Slave Gnusii should then clear the dribble buffer.
(when (and init gnus-slave)
;; Child Gnusii should then clear the dribble buffer.
(when (and init gnus-child)
(gnus-dribble-clear))
(gnus-update-format-specifications)
......@@ -1030,7 +1030,7 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
;; Find new newsgroups and treat them.
(when (and init gnus-check-new-newsgroups (not level)
(gnus-check-server gnus-select-method)
(not gnus-slave)
(not gnus-child)
gnus-plugged)
(gnus-find-new-newsgroups))
......@@ -1040,8 +1040,8 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
(gnus-server-opened gnus-select-method))
(gnus-check-bogus-newsgroups))
;; Read any slave files.
(gnus-master-read-slave-newsrc)
;; Read any child files.
(gnus-parent-read-child-newsrc)
;; Find the number of unread articles in each non-dead group.
(let ((gnus-read-active-file (and (not level) gnus-read-active-file)))
......@@ -2737,15 +2737,15 @@ values from `gnus-newsrc-hashtb', and write a new value of
(gnus-agent-save-local force))
(save-excursion
(if (and (or gnus-use-dribble-file gnus-slave)
(if (and (or gnus-use-dribble-file gnus-child)
(not force)
(or (not (buffer-live-p gnus-dribble-buffer))
(zerop (with-current-buffer gnus-dribble-buffer
(buffer-size)))))
(gnus-message 4 "(No changes need to be saved)")
(gnus-run-hooks 'gnus-save-newsrc-hook)
(if gnus-slave
(gnus-slave-save-newsrc)
(if gnus-child
(gnus-child-save-newsrc)
;; Save .newsrc only if the select method is an NNTP method.
;; The .newsrc file is for interoperability with other
;; newsreaders, so saving non-NNTP groups there doesn't make
......@@ -2988,55 +2988,61 @@ SPECIFIC-VARIABLES, or those in `gnus-variable-list'."
;;;
;;; Slave functions.
;;; Child functions.
;;;
(defvar gnus-slave-mode nil)
(defvar gnus-child-mode nil)
(defun gnus-slave-mode ()
"Minor mode for slave Gnusae."
;; FIXME: gnus-slave-mode appears to never be set (i.e. it'll always be nil):
(defun gnus-child-mode ()
"Minor mode for child Gnusae."
;; FIXME: gnus-child-mode appears to never be set (i.e. it'll always be nil):
;; Remove, or fix and use define-minor-mode.
(add-minor-mode 'gnus-slave-mode " Slave" (make-sparse-keymap))
(gnus-run-hooks 'gnus-slave-mode-hook))
(add-minor-mode 'gnus-child-mode " Child" (make-sparse-keymap))
(gnus-run-hooks 'gnus-child-mode-hook))
(defun gnus-slave-save-newsrc ()
(define-obsolete-function-alias 'gnus-slave-mode #'gnus-child-mode "28.1")
(define-obsolete-variable-alias 'gnus-slave-mode-hook 'gnus-child-mode-hook
"28.1")
(defun gnus-child-save-newsrc ()
(with-current-buffer gnus-dribble-buffer
(with-file-modes (or (ignore-errors
(file-modes
(concat gnus-current-startup-file ".eld")))
(default-file-modes))
(let ((slave-name
(make-temp-file (concat gnus-current-startup-file "-slave-"))))
(let ((child-name
(make-temp-file (concat gnus-current-startup-file "-child-"))))
(let ((coding-system-for-write gnus-ding-file-coding-system))
(gnus-write-buffer slave-name))))))
(gnus-write-buffer child-name))))))
(defun gnus-master-read-slave-newsrc ()
(let ((slave-files
(defun gnus-parent-read-child-newsrc ()
(let ((child-files
(directory-files
(file-name-directory gnus-current-startup-file)
t (concat
"^" (regexp-quote
(concat
(file-name-nondirectory gnus-current-startup-file)
"-slave-")))
(file-name-nondirectory gnus-current-startup-file))
;; When the obsolete variables like
;; `gnus-slave-mode-hook' etc are removed, the "slave"
;; bit of this regexp should also be removed.
"\\(-child-\\|-slave-\\)")
t))
file)
(if (not slave-files)
() ; There are no slave files to read.
(gnus-message 7 "Reading slave newsrcs...")
(with-current-buffer (gnus-get-buffer-create " *gnus slave*")
(setq slave-files
(if (not child-files)
() ; There are no child files to read.
(gnus-message 7 "Reading child newsrcs...")
(with-current-buffer (gnus-get-buffer-create " *gnus child*")
(setq child-files
(sort (mapcar (lambda (file)
(list (file-attribute-modification-time
(file-attributes file))
file))
slave-files)
child-files)
(lambda (f1 f2)
(time-less-p (car f1) (car f2)))))
(while slave-files
(while child-files
(erase-buffer)
(setq file (nth 1 (car slave-files)))
(setq file (nth 1 (car child-files)))
(nnheader-insert-file-contents file)
(when (condition-case ()
(progn
......@@ -3045,12 +3051,12 @@ SPECIFIC-VARIABLES, or those in `gnus-variable-list'."
(error
(gnus-error 3.2 "Possible error in %s" file)
nil))
(unless gnus-slave ; Slaves shouldn't delete these files.
(unless gnus-child ; Children shouldn't delete these files.
(ignore-errors
(delete-file file))))
(setq slave-files (cdr slave-files))))
(setq child-files (cdr child-files))))
(gnus-dribble-touch)
(gnus-message 7 "Reading slave newsrcs...done"))))
(gnus-message 7 "Reading child newsrcs...done"))))
;;;
......
......@@ -2226,8 +2226,8 @@ Disabling the agent may result in noticeable loss of performance."
:group 'gnus-start
:type '(choice (function-item gnus)
(function-item gnus-no-server)
(function-item gnus-slave)
(function-item gnus-slave-no-server)))
(function-item gnus-child)
(function-item gnus-child-no-server)))
(declare-function gnus-group-get-new-news "gnus-group")
......@@ -2238,8 +2238,8 @@ Disabling the agent may result in noticeable loss of performance."
:type '(choice (function-item gnus)
(function-item gnus-group-get-new-news)
(function-item gnus-no-server)
(function-item gnus-slave)
(function-item gnus-slave-no-server)))
(function-item gnus-child)
(function-item gnus-child-no-server)))
(defcustom gnus-other-frame-parameters nil
"Frame parameters used by `gnus-other-frame' to create a Gnus frame."
......@@ -2417,8 +2417,8 @@ such as a mark that says whether an article is stored in the cache
(defvar gnus-article-buffer "*Article*")
(defvar gnus-server-buffer "*Server*")
(defvar gnus-slave nil
"Whether this Gnus is a slave or not.")
(defvar gnus-child nil
"Whether this Gnus is a child or not.")
(defvar gnus-batch-mode nil
"Whether this Gnus is running in batch mode or not.")
......@@ -4034,13 +4034,17 @@ Allow completion over sensible values."
;;; User-level commands.
;;;###autoload
(defun gnus-slave-no-server (&optional arg)
"Read network news as a slave, without connecting to the local server."
(defun gnus-child-no-server (&optional arg)
"Read network news as a child, without connecting to the local server."
(interactive "P")
(gnus-no-server arg t))
;;;###autoload
(defun gnus-no-server (&optional arg slave)
(define-obsolete-function-alias 'gnus-slave-no-server #'gnus-child-no-server
"28.1")
;;;###autoload
(defun gnus-no-server (&optional arg child)
"Read network news.
If ARG is a positive number, Gnus will use that as the startup level.
If ARG is nil, Gnus will be started at level 2. If ARG is non-nil
......@@ -4049,13 +4053,17 @@ an NNTP server to use.
As opposed to `gnus', this command will not connect to the local
server."
(interactive "P")
(gnus-no-server-1 arg slave))
(gnus-no-server-1 arg child))
;;;###autoload
(defun gnus-slave (&optional arg)
"Read news as a slave."
(defun gnus-child (&optional arg)
"Read news as a child."
(interactive "P")
(gnus arg nil 'slave))
(gnus arg nil 'child))
;;;###autoload
(define-obsolete-function-alias 'gnus-slave #'gnus-child "28.1")
(defun gnus-delete-gnus-frame ()
"Delete gnus frame unless it is the only one.
......@@ -4116,7 +4124,7 @@ current display is used."
(add-hook 'gnus-suspend-gnus-hook #'gnus-delete-gnus-frame)))))
;;;###autoload
(defun gnus (&optional arg dont-connect slave)
(defun gnus (&optional arg dont-connect child)
"Read network news.
If ARG is non-nil and a positive number, Gnus will use that as the
startup level. If ARG is non-nil and not a positive number, Gnus will
......@@ -4130,7 +4138,7 @@ prompt the user for the name of an NNTP server to use."
(message "You should byte-compile Gnus")
(sit-for 2))
(let ((gnus-action-message-log (list nil)))
(gnus-1 arg dont-connect slave)
(gnus-1 arg dont-connect child)
(gnus-final-warning)))
(declare-function debbugs-gnu "ext:debbugs-gnu"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment