annotate lisp/=gnusmisc.el @ 8712:9bc99cd7a6ee

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Tue, 06 Sep 1994 05:29:15 +0000
parents eaaf6c8933b2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; gnusmisc.el --- miscellaneous commands for GNUS newsreader
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
3 ;; Copyright (C) 1989, 1990, 1993 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
4
8100
eaaf6c8933b2 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
5 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
6 ;; Keywords: news
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
7
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
13 ;; any later version.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
18 ;; GNU General Public License for more details.
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
19
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
20 ;; You should have received a copy of the GNU General Public License
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
24 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
25
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 (require 'gnus)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;;; GNUS Browse-Killed Mode
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath).
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;; I'd like to thank him very much.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
35 (defvar gnus-browse-killed-mode-hook nil
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 "*A hook for GNUS Browse-Killed Mode.")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
38 (defvar gnus-browse-killed-buffer "*Killed Newsgroup*")
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
39 (defvar gnus-browse-killed-mode-map nil)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 (defvar gnus-winconf-browse-killed nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
42 (autoload 'timezone-make-date-arpa-standard "timezone")
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
43
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
44 (put 'gnus-browse-killed-mode 'mode-class 'special)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
45
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
46
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
47 ;;;
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
48 ;;; GNUS Browse-Killed Mode
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
49 ;;;
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
50
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
51 ;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath).
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
52 ;; I'd like to thank him very much.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 ;; Make the buffer to be managed by GNUS.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
56 (or (memq gnus-browse-killed-buffer gnus-buffer-list)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (setq gnus-buffer-list
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
58 (cons gnus-browse-killed-buffer gnus-buffer-list)))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
60 (if gnus-browse-killed-mode-map
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 nil
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
62 (setq gnus-browse-killed-mode-map (make-keymap))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
63 (suppress-keymap gnus-browse-killed-mode-map t)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
64 (define-key gnus-browse-killed-mode-map " " 'gnus-group-next-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
65 (define-key gnus-browse-killed-mode-map "\177" 'gnus-group-prev-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
66 (define-key gnus-browse-killed-mode-map "\C-n" 'gnus-group-next-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
67 (define-key gnus-browse-killed-mode-map "\C-p" 'gnus-group-prev-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
68 (define-key gnus-browse-killed-mode-map "n" 'gnus-group-next-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
69 (define-key gnus-browse-killed-mode-map "p" 'gnus-group-prev-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
70 (define-key gnus-browse-killed-mode-map "y" 'gnus-browse-killed-yank)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
71 (define-key gnus-browse-killed-mode-map "\C-y" 'gnus-browse-killed-yank)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
72 (define-key gnus-browse-killed-mode-map "l" 'gnus-list-killed-groups)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
73 (define-key gnus-browse-killed-mode-map "q" 'gnus-browse-killed-exit)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
74 (define-key gnus-browse-killed-mode-map "\C-c\C-c" 'gnus-browse-killed-exit)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
75 (define-key gnus-browse-killed-mode-map "\C-c\C-i" 'gnus-info-find-node))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
77 (defun gnus-browse-killed-mode ()
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 "Major mode for browsing the killed newsgroups.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 All normal editing commands are turned off.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 Instead, these commands are available:
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
81 \\{gnus-browse-killed-mode-map}
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
83 The killed newsgroups are saved in the quick startup file (.newsrc.el)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
84 unless it against the options line in the startup file (.newsrc).
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
86 Entry to this mode calls gnus-browse-killed-mode-hook with no arguments,
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 if that value is non-nil."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (kill-all-local-variables)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 ;; Gee. Why don't you upgrade?
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (cond ((boundp 'mode-line-modified)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (setq mode-line-modified "--- "))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 ((listp (default-value 'mode-line-format))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 (setq mode-line-format
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (cons "--- " (cdr (default-value 'mode-line-format)))))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 (t
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (setq mode-line-format
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 "--- GNUS: Killed Newsgroups %[(%m)%]----%3p-%-")))
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
99 (setq major-mode 'gnus-browse-killed-mode)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (setq mode-name "Browse-Killed")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 (setq mode-line-buffer-identification "GNUS: Killed Newsgroups")
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
102 (use-local-map gnus-browse-killed-mode-map)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (buffer-flush-undo (current-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (setq buffer-read-only t) ;Disable modification
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
105 (run-hooks 'gnus-browse-killed-mode-hook))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
107 (defun gnus-list-killed-groups ()
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
108 "List the killed newsgroups.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
109 The keys y and C-y yank the newsgroup on the current line into the
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
110 Newsgroups buffer."
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (or gnus-killed-assoc
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (error "No killed newsgroups"))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 ;; Save current window configuration if this is first invocation..
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
115 (or (get-buffer-window gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (setq gnus-winconf-browse-killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (current-window-configuration)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 ;; Prepare browsing buffer.
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
119 (pop-to-buffer (get-buffer-create gnus-browse-killed-buffer))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
120 (gnus-browse-killed-mode)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 (killed-assoc gnus-killed-assoc))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (erase-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (while killed-assoc
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
125 (insert (gnus-group-prepare-line (car killed-assoc)))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (setq killed-assoc (cdr killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 ))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
130 (defun gnus-browse-killed-yank ()
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 "Yank current newsgroup to Newsgroup buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (interactive)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
133 (let ((group (gnus-group-group-name)))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 (if group
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 (let* ((buffer-read-only nil)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
136 (killed (gnus-gethash group gnus-killed-hashtb)))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
137 (pop-to-buffer gnus-group-buffer) ;Needed to adjust point.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 (if killed
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
139 (gnus-group-insert-group killed))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
140 (pop-to-buffer gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 (delete-region (point)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 )))
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
145 (gnus-browse-killed-check-buffer))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
147 (defun gnus-browse-killed-check-buffer ()
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 "Exit if the buffer is empty by deleting the window and killing the buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (and (null gnus-killed-assoc)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
150 (get-buffer gnus-browse-killed-buffer)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
151 (gnus-browse-killed-exit)))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
153 (defun gnus-browse-killed-exit ()
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 "Exit this mode by deleting the window and killing the buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 (interactive)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
156 (and (get-buffer-window gnus-browse-killed-buffer)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
157 (delete-window (get-buffer-window gnus-browse-killed-buffer)))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
158 (kill-buffer gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 ;; Restore previous window configuration if available.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 (and gnus-winconf-browse-killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 (set-window-configuration gnus-winconf-browse-killed))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 (setq gnus-winconf-browse-killed nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 ;;; kill/yank newsgroup commands of GNUS Group Mode
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
169 (defun gnus-group-transpose-groups (arg)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
170 "Exchange current newsgroup and previous newsgroup.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
171 With argument ARG, takes previous newsgroup and moves it past ARG newsgroup."
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
172 (interactive "p")
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
173 ;; BUG: last newsgroup and the last but one cannot be transposed
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
174 ;; since gnus-group-search-forward does not move forward beyond the
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
175 ;; last. If we instead use forward-line, no problem, but I don't
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
176 ;; want to use it for later extension.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
177 (while (> arg 0)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
178 (gnus-group-search-forward t t)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
179 (gnus-group-kill-group 1)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
180 (gnus-group-search-forward nil t)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
181 (gnus-group-yank-group)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
182 (gnus-group-search-forward nil t)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
183 (setq arg (1- arg))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
184 ))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
185
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
186 (defun gnus-group-kill-region (begin end)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
187 "Kill newsgroups in current region (excluding current point).
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
188 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
189 (interactive "r")
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
190 (let ((lines
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
191 ;; Exclude a line where current point is on.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
192 (1-
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
193 ;; Count lines.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
194 (save-excursion
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
195 (count-lines
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
196 (progn
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
197 (goto-char begin)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
198 (beginning-of-line)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
199 (point))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
200 (progn
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
201 (goto-char end)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
202 (end-of-line)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
203 (point)))))))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
204 (goto-char begin)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
205 (beginning-of-line) ;Important when LINES < 1
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
206 (gnus-group-kill-group lines)))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
207
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
208 (defun gnus-group-kill-group (n)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 "Kill newsgroup on current line, repeated prefix argument N times.
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
210 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 (interactive "p")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (group nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 (while (> n 0)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
215 (setq group (gnus-group-group-name))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (or group
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (signal 'end-of-buffer nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 (delete-region (point)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 (gnus-kill-newsgroup group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 (setq n (1- n))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 ;; Add to killed newsgroups in the buffer if exists.
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
224 (if (get-buffer gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 (save-excursion
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
226 (set-buffer gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (let ((buffer-read-only nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (goto-char (point-min))
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
229 (insert (gnus-group-prepare-line (car gnus-killed-assoc)))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 )
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 (search-forward ":" nil t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 ))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
235 (defun gnus-group-yank-group ()
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
236 "Yank the last newsgroup killed with \\[gnus-group-kill-group],
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2843
diff changeset
237 inserting it before the newsgroup on the line containing point."
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (interactive)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
239 (gnus-group-insert-group (car gnus-killed-assoc))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 ;; Remove killed newsgroups from the buffer if exists.
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
241 (if (get-buffer gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (save-excursion
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
243 (set-buffer gnus-browse-killed-buffer)
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 (let ((buffer-read-only nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 (delete-region (point-min)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 )))
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
249 (gnus-browse-killed-check-buffer))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
251 (defun gnus-group-insert-group (info)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
252 "Insert newsgroup at current line using gnus-newsrc-assoc INFO."
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 (if (null gnus-killed-assoc)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (error "No killed newsgroups"))
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
255 ;; Huuum. It this right?
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
256 ;;(if (not gnus-have-all-newsgroups)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
257 ;; (error
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
258 ;; (substitute-command-keys
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
259 ;; "Not all newsgroups are displayed. Type \\[gnus-group-list-all-groups] to display all newsgroups.")))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 (let ((buffer-read-only nil)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
261 (group (gnus-group-group-name)))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 (gnus-insert-newsgroup info group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 (beginning-of-line)
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
264 (insert (gnus-group-prepare-line info))
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (forward-line -1)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (search-forward ":" nil t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 ))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 206
diff changeset
268
2843
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
269
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
270 ;;; Rewrite Date: field in GMT to local
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
271
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
272 (defun gnus-gmt-to-local ()
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
273 "Rewrite Date: field described in GMT to local in current buffer.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
274 The variable gnus-local-timezone is used for local time zone.
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
275 Intended to be used with gnus-article-prepare-hook."
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
276 (save-excursion
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
277 (save-restriction
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
278 (widen)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
279 (goto-char (point-min))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
280 (narrow-to-region (point-min)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
281 (progn (search-forward "\n\n" nil 'move) (point)))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
282 (goto-char (point-min))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
283 (if (re-search-forward "^Date:[ \t]\\(.*\\)$" nil t)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
284 (let ((buffer-read-only nil)
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
285 (date (buffer-substring (match-beginning 1) (match-end 1))))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
286 (delete-region (match-beginning 1) (match-end 1))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
287 (insert
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
288 (timezone-make-date-arpa-standard date nil gnus-local-timezone))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
289 ))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
290 )))
cd90d49526ae Version 3.15 from Umeda.
Richard M. Stallman <rms@gnu.org>
parents: 851
diff changeset
291
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 206
diff changeset
292 (provide 'gnusmisc)
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
293
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
294 ;;; gnusmisc.el ends here