summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-sum.el
diff options
context:
space:
mode:
authorEric Abrahamsen <eric@ericabrahamsen.net>2018-06-25 17:40:19 -0700
committerEric Abrahamsen <eric@ericabrahamsen.net>2018-11-23 09:44:35 -0800
commit4ef9bcd0ff0eccb0c0810f43370eaa76aef2f4ec (patch)
tree8c84e0978048b6a9e2738cfb056a0ce7f35de5c8 /lisp/gnus/gnus-sum.el
parentefccd13c1fa451249886df696fd484c413c261ff (diff)
downloademacs-4ef9bcd0ff0eccb0c0810f43370eaa76aef2f4ec.tar.gz
Provide new gnus-mode, derive all gnus major modes from this
* lisp/gnus/gnus.el (gnus-mode): New do-nothing major mode, derived from special mode. * lisp/gnus/gnus-sum.el (gnus-summary-mode): Change from a function to a major mode, derive from gnus-mode. (gnus-summary-setup-buffer): Change call a bit -- can no longer pass an argument to the mode function. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Derive from gnus-mode. (gnus-server-setup-buffer): Remove unnecessary function. (gnus-enter-server-buffer): Call gnus-server-mode here, and call it whether the server buffer already existed or not. (gnus-server-mode): Change from a function to a major mode. (gnus-server-mode-hook): Delete custom option, this is automatically created. * lisp/gnus/gnus-salt.el (gnus-tree-mode): Derive from gnus-mode. (gnus-tree-mode-hook): Delete custom option, this is automatically created. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-hook): Delete custom option. * lisp/gnus/gnus-group.el (gnus-group-mode): * lisp/gnus/gnus-art.el (gnus-article-mode): * lisp/gnus/gnus-agent.el (gnus-category-mode): Derive from gnus-mode. (gnus-category-mode-hook): Delete custom option. (Bug#33263)
Diffstat (limited to 'lisp/gnus/gnus-sum.el')
-rw-r--r--lisp/gnus/gnus-sum.el51
1 files changed, 26 insertions, 25 deletions
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index f9fae3792b1..1c4be09e2e9 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1842,8 +1842,6 @@ increase the score of each group you read."
;;; Gnus summary mode
;;;
-(put 'gnus-summary-mode 'mode-class 'special)
-
(defvar gnus-article-commands-menu)
;; Non-orthogonal keys
@@ -3052,10 +3050,8 @@ When FORCE, rebuild the tool bar."
(defvar bidi-paragraph-direction)
-(defun gnus-summary-mode (&optional group)
+(define-derived-mode gnus-summary-mode gnus-mode "Summary"
"Major mode for reading articles.
-
-All normal editing commands are switched off.
\\<gnus-summary-mode-map>
Each line in this buffer represents one article. To read an
article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
@@ -3072,24 +3068,16 @@ buffer; read the info pages for more information (`\\[gnus-info-find-node]').
The following commands are available:
\\{gnus-summary-mode-map}"
- ;; FIXME: Use define-derived-mode.
- (interactive)
- (kill-all-local-variables)
(let ((gnus-summary-local-variables gnus-newsgroup-variables))
(gnus-summary-make-local-variables))
(gnus-summary-make-local-variables)
- (setq gnus-newsgroup-name group)
(when (gnus-visual-p 'summary-menu 'menu)
(gnus-summary-make-menu-bar)
(gnus-summary-make-tool-bar))
(gnus-make-thread-indent-array)
(gnus-simplify-mode-line)
- (setq major-mode 'gnus-summary-mode)
- (setq mode-name "Summary")
- (use-local-map gnus-summary-mode-map)
(buffer-disable-undo)
- (setq buffer-read-only t
- show-trailing-whitespace nil
+ (setq show-trailing-whitespace nil
truncate-lines t
bidi-paragraph-direction 'left-to-right)
(add-to-invisibility-spec '(gnus-sum . t))
@@ -3100,14 +3088,13 @@ The following commands are available:
(make-local-variable 'gnus-summary-dummy-line-format)
(make-local-variable 'gnus-summary-dummy-line-format-spec)
(make-local-variable 'gnus-summary-mark-positions)
+ (make-local-variable 'gnus-article-buffer)
+ (make-local-variable 'gnus-article-current)
+ (make-local-variable 'gnus-original-article-buffer)
(add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
- (gnus-run-mode-hooks 'gnus-summary-mode-hook)
- (turn-on-gnus-mailing-list-mode)
(mm-enable-multibyte)
(set (make-local-variable 'bookmark-make-record-function)
- 'gnus-summary-bookmark-make-record)
- (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
- (gnus-update-summary-mark-positions))
+ 'gnus-summary-bookmark-make-record))
(defun gnus-summary-make-local-variables ()
"Make all the local summary buffer variables."
@@ -3478,8 +3465,11 @@ display only a single character."
(current-buffer))))))
(defun gnus-summary-setup-buffer (group)
- "Initialize summary buffer.
-If the setup was successful, non-nil is returned."
+ "Initialize summary buffer for GROUP.
+This function does all setup work that relies on the specific
+value of GROUP, and puts the buffer in `gnus-summary-mode'.
+
+Returns non-nil if the setup was successful."
(let ((buffer (gnus-summary-buffer-name group))
(dead-name (concat "*Dead Summary "
(gnus-group-decoded-name group) "*")))
@@ -3493,13 +3483,15 @@ If the setup was successful, non-nil is returned."
(not gnus-newsgroup-prepared))
(set-buffer (gnus-get-buffer-create buffer))
(setq gnus-summary-buffer (current-buffer))
- (gnus-summary-mode group)
+ (gnus-summary-mode)
(when (gnus-group-quit-config group)
(set (make-local-variable 'gnus-single-article-buffer) nil))
- (make-local-variable 'gnus-article-buffer)
- (make-local-variable 'gnus-article-current)
- (make-local-variable 'gnus-original-article-buffer)
(setq gnus-newsgroup-name group)
+ (turn-on-gnus-mailing-list-mode)
+ ;; These functions don't currently depend on GROUP, but might in
+ ;; the future.
+ (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
+ (gnus-update-summary-mark-positions)
;; Set any local variables in the group parameters.
(gnus-summary-set-local-parameters gnus-newsgroup-name)
t)))
@@ -3935,6 +3927,15 @@ If SELECT-ARTICLES, only select those articles from GROUP."
(defun gnus-summary-read-group-1 (group show-all no-article
kill-buffer no-display
&optional select-articles)
+ "Display articles and threads in a Summary buffer for GROUP."
+ ;; This function calls `gnus-summary-setup-buffer' to create the
+ ;; buffer, put it in `gnus-summary-mode', and set local variables;
+ ;; `gnus-select-newsgroup' to update the group's active and marks
+ ;; from the server; and `gnus-summary-prepare' to actually insert
+ ;; lines for articles. The rest of the function is mostly concerned
+ ;; with limiting and positioning and windowing and other visual
+ ;; effects.
+
;; Killed foreign groups can't be entered.
;; (when (and (not (gnus-group-native-p group))
;; (not (gnus-gethash group gnus-newsrc-hashtb)))