annotate lisp/=gnusmisc.el @ 496:dcdf0a92df40

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Wed, 15 Jan 1992 19:43:09 +0000
parents 011f87971acb
children 4cd7543be581
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 ;;; Miscellaneous commands for GNUS newsreader
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 ;; Copyright (C) 1989 Fujitsu Laboratories LTD.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3 ;; Copyright (C) 1989, 1990 Masanobu UMEDA
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 ;; $Header: gnusmisc.el,v 1.2 90/03/23 13:25:04 umerin Locked $
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 ;; This file is part of GNU Emacs.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; GNU Emacs is distributed in the hope that it will be useful,
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;; but WITHOUT ANY WARRANTY. No author or distributor
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; accepts responsibility to anyone for the consequences of using it
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; or for whether it serves any particular purpose or works at all,
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 ;; unless he says so in writing. Refer to the GNU Emacs General Public
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; License for full details.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; Everyone is granted permission to copy, modify and redistribute
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; GNU Emacs, but only under the conditions described in the
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; GNU Emacs General Public License. A copy of this license is
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; supposed to have been given to you along with GNU Emacs so you
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; can know your rights and responsibilities. It should be in a
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; file named COPYING. Among other things, the copyright notice
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; and this notice must be preserved on all copies.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 (provide 'gnusmisc)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 (require 'gnus)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;;; GNUS Browse-Killed Mode
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath).
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;; I'd like to thank him very much.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 (defvar gnus-Browse-killed-mode-hook nil
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 "*A hook for GNUS Browse-Killed Mode.")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 (defvar gnus-Browse-killed-buffer "*Killed Newsgroup*")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 (defvar gnus-Browse-killed-mode-map nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (defvar gnus-winconf-browse-killed nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 (put 'gnus-Browse-killed-mode 'mode-class 'special)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ;; Make the buffer to be managed by GNUS.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 (or (memq gnus-Browse-killed-buffer gnus-buffer-list)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 (setq gnus-buffer-list
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 (cons gnus-Browse-killed-buffer gnus-buffer-list)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 (if gnus-Browse-killed-mode-map
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 nil
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (setq gnus-Browse-killed-mode-map (make-keymap))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (suppress-keymap gnus-Browse-killed-mode-map t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (define-key gnus-Browse-killed-mode-map " " 'gnus-Group-next-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (define-key gnus-Browse-killed-mode-map "\177" 'gnus-Group-prev-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 (define-key gnus-Browse-killed-mode-map "\C-n" 'gnus-Group-next-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 (define-key gnus-Browse-killed-mode-map "\C-p" 'gnus-Group-prev-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (define-key gnus-Browse-killed-mode-map "n" 'gnus-Group-next-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (define-key gnus-Browse-killed-mode-map "p" 'gnus-Group-prev-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (define-key gnus-Browse-killed-mode-map "y" 'gnus-Browse-killed-yank)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (define-key gnus-Browse-killed-mode-map "\C-y" 'gnus-Browse-killed-yank)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (define-key gnus-Browse-killed-mode-map "l" 'gnus-Browse-killed-groups)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (define-key gnus-Browse-killed-mode-map "q" 'gnus-Browse-killed-exit)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (define-key gnus-Browse-killed-mode-map "\C-c\C-c" 'gnus-Browse-killed-exit)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (define-key gnus-Browse-killed-mode-map "\C-c\C-i" 'gnus-Info-find-node))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 (defun gnus-Browse-killed-mode ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 "Major mode for browsing the killed newsgroups.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 All normal editing commands are turned off.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 Instead, these commands are available:
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 \\{gnus-Browse-killed-mode-map}
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 The killed newsgroups are saved in the quick startup file \".newsrc.el\"
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 unless disabled inthe options line of the startup file \".newsrc\".
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 Entry to this mode calls `gnus-Browse-killed-mode-hook' with no arguments
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 if that value is non-nil."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 (kill-all-local-variables)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 ;; Gee. Why don't you upgrade?
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 (cond ((boundp 'mode-line-modified)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (setq mode-line-modified "--- "))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 ((listp (default-value 'mode-line-format))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (setq mode-line-format
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (cons "--- " (cdr (default-value 'mode-line-format)))))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (t
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (setq mode-line-format
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 "--- GNUS: Killed Newsgroups %[(%m)%]----%3p-%-")))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (setq major-mode 'gnus-Browse-killed-mode)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (setq mode-name "Browse-Killed")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (setq mode-line-buffer-identification "GNUS: Killed Newsgroups")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (use-local-map gnus-Browse-killed-mode-map)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (buffer-flush-undo (current-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (setq buffer-read-only t) ;Disable modification
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (run-hooks 'gnus-Browse-killed-mode-hook))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (defun gnus-Browse-killed-groups ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 "Browse the killed newsgroups.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 \\<gnus-Browse-killed-mode-map>\\[gnus-Browse-killed-yank] yanks the newsgroup on the current line into the Newsgroups buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 (or gnus-killed-assoc
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (error "No killed newsgroups"))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 ;; Save current window configuration if this is first invocation..
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 (or (get-buffer-window gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (setq gnus-winconf-browse-killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (current-window-configuration)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 ;; Prepare browsing buffer.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 (pop-to-buffer (get-buffer-create gnus-Browse-killed-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 (gnus-Browse-killed-mode)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 (killed-assoc gnus-killed-assoc))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 (erase-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (while killed-assoc
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (insert (gnus-Group-prepare-line (car killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (setq killed-assoc (cdr killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 ))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (defun gnus-Browse-killed-yank ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 "Yank current newsgroup to Newsgroup buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (let ((group (gnus-Group-group-name)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (if group
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 (let* ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (killed (assoc group gnus-killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (pop-to-buffer gnus-Group-buffer) ;Needed to adjust point.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (if killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (gnus-Group-insert-group killed))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (pop-to-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (delete-region (point)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (gnus-Browse-killed-check-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 (defun gnus-Browse-killed-check-buffer ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 "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
136 (and (null gnus-killed-assoc)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (get-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 (gnus-Browse-killed-exit)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 (defun gnus-Browse-killed-exit ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 "Exit this mode by deleting the window and killing the buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (and (get-buffer-window gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 (delete-window (get-buffer-window gnus-Browse-killed-buffer)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (kill-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 ;; Restore previous window configuration if available.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (and gnus-winconf-browse-killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (set-window-configuration gnus-winconf-browse-killed))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (setq gnus-winconf-browse-killed nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 ;;; kill/yank newsgroup commands of GNUS Group Mode
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (defun gnus-Group-kill-group (n)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 "Kill newsgroup on current line, repeated prefix argument N times.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 The killed newsgroups can be yanked by using \\[gnus-Group-yank-group]."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 (interactive "p")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 (group nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 (while (> n 0)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 (setq group (gnus-Group-group-name))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 (or group
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 (signal 'end-of-buffer nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 (delete-region (point)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 (gnus-kill-newsgroup group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 (setq n (1- n))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 ;; Add to killed newsgroups in the buffer if exists.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 (if (get-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 (save-excursion
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 (set-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 (let ((buffer-read-only nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 (insert (gnus-Group-prepare-line (car gnus-killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 )
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 (search-forward ":" nil t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 ))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 (defun gnus-Group-yank-group ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 "Yank the last newsgroup killed with \\[gnus-Group-kill-group],
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 inserting it before the newsgroup on the line containging point."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 (gnus-Group-insert-group (car gnus-killed-assoc))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 ;; Remove killed newsgroups from the buffer if exists.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 (if (get-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 (save-excursion
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 (set-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 (let ((buffer-read-only nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 (delete-region (point-min)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 (gnus-Browse-killed-check-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (defun gnus-Group-insert-group (info)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 "Insert newsgroup at current line using `gnus-newsrc-assoc' INFO."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 (if (null gnus-killed-assoc)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (error "No killed newsgroups"))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 (if (not gnus-have-all-newsgroups)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 (error
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (substitute-command-keys
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 "Not all newsgroups are displayed. Type \\[gnus-Group-list-all-groups] to display all newsgroups.")))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (group (gnus-Group-group-name)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 (gnus-insert-newsgroup info group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 (insert (gnus-Group-prepare-line info))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 (forward-line -1)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (search-forward ":" nil t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 ))