annotate lisp/=gnusmisc.el @ 828:4b56424868f6

*** empty log message ***
author Eric S. Raymond <esr@snark.thyrsus.com>
date Tue, 21 Jul 1992 07:57:59 +0000
parents e694e0879463
children 20674ae6bf52
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
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
3 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
4 ;; Last-Modified: 10 Jun 1992
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
5 ;; Keywords: news
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
6
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
7 ;; $Header: gnusmisc.el,v 1.2 90/03/23 13:25:04 umerin Locked $
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
8
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
9 ;; Copyright (C) 1989, 1990 Free Software Foundation, Inc.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
13 ;; 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
14 ;; 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
15 ;; 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
16 ;; any later version.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
18 ;; 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
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
21 ;; GNU General Public License for more details.
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
22
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
23 ;; 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
24 ;; 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
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
27 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 711
diff changeset
28
206
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 (require 'gnus)
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 ;;; GNUS Browse-Killed Mode
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath).
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; I'd like to thank him very much.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (defvar gnus-Browse-killed-mode-hook nil
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 "*A hook for GNUS Browse-Killed Mode.")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 (defvar gnus-Browse-killed-buffer "*Killed Newsgroup*")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (defvar gnus-Browse-killed-mode-map nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 (defvar gnus-winconf-browse-killed nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 (put 'gnus-Browse-killed-mode 'mode-class 'special)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 ;; Make the buffer to be managed by GNUS.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (or (memq gnus-Browse-killed-buffer gnus-buffer-list)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (setq gnus-buffer-list
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (cons gnus-Browse-killed-buffer gnus-buffer-list)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (if gnus-Browse-killed-mode-map
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 nil
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 (setq gnus-Browse-killed-mode-map (make-keymap))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (suppress-keymap gnus-Browse-killed-mode-map t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (define-key gnus-Browse-killed-mode-map " " 'gnus-Group-next-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (define-key gnus-Browse-killed-mode-map "\177" 'gnus-Group-prev-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (define-key gnus-Browse-killed-mode-map "\C-n" 'gnus-Group-next-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (define-key gnus-Browse-killed-mode-map "\C-p" 'gnus-Group-prev-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (define-key gnus-Browse-killed-mode-map "n" 'gnus-Group-next-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (define-key gnus-Browse-killed-mode-map "p" 'gnus-Group-prev-group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (define-key gnus-Browse-killed-mode-map "y" 'gnus-Browse-killed-yank)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (define-key gnus-Browse-killed-mode-map "\C-y" 'gnus-Browse-killed-yank)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 (define-key gnus-Browse-killed-mode-map "l" 'gnus-Browse-killed-groups)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 (define-key gnus-Browse-killed-mode-map "q" 'gnus-Browse-killed-exit)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (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
68 (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
69
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 (defun gnus-Browse-killed-mode ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 "Major mode for browsing the killed newsgroups.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 All normal editing commands are turned off.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 Instead, these commands are available:
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 \\{gnus-Browse-killed-mode-map}
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 The killed newsgroups are saved in the quick startup file \".newsrc.el\"
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 unless disabled inthe options line of the startup file \".newsrc\".
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 Entry to this mode calls `gnus-Browse-killed-mode-hook' with no arguments
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 if that value is non-nil."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (kill-all-local-variables)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 ;; Gee. Why don't you upgrade?
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (cond ((boundp 'mode-line-modified)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (setq mode-line-modified "--- "))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 ((listp (default-value 'mode-line-format))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (setq mode-line-format
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (cons "--- " (cdr (default-value 'mode-line-format)))))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (t
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (setq mode-line-format
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 "--- GNUS: Killed Newsgroups %[(%m)%]----%3p-%-")))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (setq major-mode 'gnus-Browse-killed-mode)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (setq mode-name "Browse-Killed")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 (setq mode-line-buffer-identification "GNUS: Killed Newsgroups")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (use-local-map gnus-Browse-killed-mode-map)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 (buffer-flush-undo (current-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (setq buffer-read-only t) ;Disable modification
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (run-hooks 'gnus-Browse-killed-mode-hook))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (defun gnus-Browse-killed-groups ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 "Browse the killed newsgroups.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 \\<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
103 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (or gnus-killed-assoc
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 (error "No killed newsgroups"))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 ;; Save current window configuration if this is first invocation..
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 (or (get-buffer-window gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 (setq gnus-winconf-browse-killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 (current-window-configuration)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 ;; Prepare browsing buffer.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (pop-to-buffer (get-buffer-create gnus-Browse-killed-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (gnus-Browse-killed-mode)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 (killed-assoc gnus-killed-assoc))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 (erase-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (while killed-assoc
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (insert (gnus-Group-prepare-line (car killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 (setq killed-assoc (cdr killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 ))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 (defun gnus-Browse-killed-yank ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 "Yank current newsgroup to Newsgroup buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (let ((group (gnus-Group-group-name)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (if group
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (let* ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 (killed (assoc group gnus-killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (pop-to-buffer gnus-Group-buffer) ;Needed to adjust point.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 (if killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 (gnus-Group-insert-group killed))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (pop-to-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 (delete-region (point)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (gnus-Browse-killed-check-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (defun gnus-Browse-killed-check-buffer ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 "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
141 (and (null gnus-killed-assoc)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 (get-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (gnus-Browse-killed-exit)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (defun gnus-Browse-killed-exit ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 "Exit this mode by deleting the window and killing the buffer."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (and (get-buffer-window gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (delete-window (get-buffer-window gnus-Browse-killed-buffer)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 (kill-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 ;; Restore previous window configuration if available.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (and gnus-winconf-browse-killed
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 (set-window-configuration gnus-winconf-browse-killed))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 (setq gnus-winconf-browse-killed nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 ;;; kill/yank newsgroup commands of GNUS Group Mode
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 ;;;
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 (defun gnus-Group-kill-group (n)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 "Kill newsgroup on current line, repeated prefix argument N times.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 The killed newsgroups can be yanked by using \\[gnus-Group-yank-group]."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 (interactive "p")
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 (group nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 (while (> n 0)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 (setq group (gnus-Group-group-name))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 (or group
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 (signal 'end-of-buffer nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 (delete-region (point)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 (gnus-kill-newsgroup group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 (setq n (1- n))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 ;; Add to killed newsgroups in the buffer if exists.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 (if (get-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 (save-excursion
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 (set-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 (let ((buffer-read-only nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 (insert (gnus-Group-prepare-line (car gnus-killed-assoc)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 )
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 (search-forward ":" nil t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 ))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 (defun gnus-Group-yank-group ()
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 "Yank the last newsgroup killed with \\[gnus-Group-kill-group],
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 inserting it before the newsgroup on the line containging point."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 (interactive)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 (gnus-Group-insert-group (car gnus-killed-assoc))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 ;; Remove killed newsgroups from the buffer if exists.
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 (if (get-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 (save-excursion
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 (set-buffer gnus-Browse-killed-buffer)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 (let ((buffer-read-only nil))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 (goto-char (point-min))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (delete-region (point-min)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (progn (forward-line 1) (point)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 )))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (gnus-Browse-killed-check-buffer))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 (defun gnus-Group-insert-group (info)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 "Insert newsgroup at current line using `gnus-newsrc-assoc' INFO."
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 (if (null gnus-killed-assoc)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (error "No killed newsgroups"))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (if (not gnus-have-all-newsgroups)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 (error
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (substitute-command-keys
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 "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
212 (let ((buffer-read-only nil)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (group (gnus-Group-group-name)))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 (gnus-insert-newsgroup info group)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 (beginning-of-line)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (insert (gnus-Group-prepare-line info))
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (forward-line -1)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (search-forward ":" nil t)
011f87971acb Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 ))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 206
diff changeset
220
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 206
diff changeset
221 (provide 'gnusmisc)
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
222
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
223 ;;; gnusmisc.el ends here