diff options
| author | Glenn Morris | 2010-10-04 21:17:51 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-10-04 21:17:51 -0700 |
| commit | 726c53571776e3cf8f91ccab25f43f300e2d3153 (patch) | |
| tree | 442b0223c15c877c651599ecffa2668dd5b34df3 | |
| parent | 61e42a9cb64564c2174ac0ec6313e2239301a192 (diff) | |
| download | emacs-726c53571776e3cf8f91ccab25f43f300e2d3153.tar.gz emacs-726c53571776e3cf8f91ccab25f43f300e2d3153.zip | |
* lisp/obsolete/rnews.el, lisp/obsolete/rnewspost.el: Remove files.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/obsolete/rnews.el | 981 | ||||
| -rw-r--r-- | lisp/obsolete/rnewspost.el | 447 |
3 files changed, 4 insertions, 1428 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f0a0866962..03dee4d904d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2010-10-05 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * obsolete/rnews.el, obsolete/rnewspost.el: Remove files. | ||
| 4 | |||
| 1 | 2010-10-04 Michael Albinus <michael.albinus@gmx.de> | 5 | 2010-10-04 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | Continue reorganization of load dependencies. (Bug#7156) | 7 | Continue reorganization of load dependencies. (Bug#7156) |
diff --git a/lisp/obsolete/rnews.el b/lisp/obsolete/rnews.el deleted file mode 100644 index 5b0f5d5a6b0..00000000000 --- a/lisp/obsolete/rnews.el +++ /dev/null | |||
| @@ -1,981 +0,0 @@ | |||
| 1 | ;;; rnews.el --- USENET news reader for GNU Emacs | ||
| 2 | |||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 2001, 2002, 2003, 2004, | ||
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Maintainer: FSF | ||
| 7 | ;; Keywords: news | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 14 | ;; (at your option) any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 23 | |||
| 24 | ;;; Commentary: | ||
| 25 | |||
| 26 | ;; This file has been obsolete since Emacs 21.1. | ||
| 27 | |||
| 28 | ;;; Change Log: | ||
| 29 | |||
| 30 | ;; Created Sun Mar 10,1985 at 21:35:01 ads and sundar@hernes.ai.mit.edu | ||
| 31 | ;; Should do the point pdl stuff sometime | ||
| 32 | ;; finito except pdl.... Sat Mar 16,1985 at 06:43:44 | ||
| 33 | ;; lets keep the summary stuff out until we get it working .. | ||
| 34 | ;; sundar@hermes.ai.mit.edu Wed Apr 10,1985 at 16:32:06 | ||
| 35 | ;; hack slash maim. mly@gnu.org Thu 18 Apr, 1985 06:11:14 | ||
| 36 | ;; modified to correct reentrance bug, to not bother with groups that | ||
| 37 | ;; received no new traffic since last read completely, to find out | ||
| 38 | ;; what traffic a group has available much more quickly when | ||
| 39 | ;; possible, to do some completing reads for group names - should | ||
| 40 | ;; be much faster... | ||
| 41 | ;; KING@KESTREL.arpa, Thu Mar 13 09:03:28 1986 | ||
| 42 | ;; made news-{next,previous}-group skip groups with no new messages; and | ||
| 43 | ;; added checking for unsubscribed groups to news-add-news-group | ||
| 44 | ;; tower@gnu.org Jul 18 1986 | ||
| 45 | ;; bound rmail-output to C-o; and changed header-field commands binding to | ||
| 46 | ;; agree with the new C-c C-f usage in sendmail | ||
| 47 | ;; tower@gnu.org Sep 3 1986 | ||
| 48 | ;; added news-rotate-buffer-body | ||
| 49 | ;; tower@gnu.org Oct 17 1986 | ||
| 50 | ;; made messages more user friendly, cleaned up news-inews | ||
| 51 | ;; move posting and mail code to new file rnewpost.el | ||
| 52 | ;; tower@gnu.org Oct 29 1986 | ||
| 53 | ;; added caesar-region, rename news-caesar-buffer-body, hacked accordingly | ||
| 54 | ;; tower@gnu.org Nov 21 1986 | ||
| 55 | ;; added tower@gnu.org 22 Apr 87 | ||
| 56 | |||
| 57 | ;;; Code: | ||
| 58 | |||
| 59 | (require 'mail-utils) | ||
| 60 | (require 'sendmail) | ||
| 61 | |||
| 62 | (defvar caesar-translate-table) | ||
| 63 | (defvar minor-modes) | ||
| 64 | (defvar news-buffer-save) | ||
| 65 | (defvar news-group-name) | ||
| 66 | (defvar news-minor-modes) | ||
| 67 | |||
| 68 | (autoload 'rmail-output "rmailout" | ||
| 69 | "Append this message to Unix mail file named FILE-NAME." | ||
| 70 | t) | ||
| 71 | |||
| 72 | (autoload 'news-reply "rnewspost" | ||
| 73 | "Compose and post a reply to the current article on USENET. | ||
| 74 | While composing the reply, use \\[mail-yank-original] to yank the original | ||
| 75 | message into it." | ||
| 76 | t) | ||
| 77 | |||
| 78 | (autoload 'news-mail-other-window "rnewspost" | ||
| 79 | "Send mail in another window. | ||
| 80 | While composing the message, use \\[mail-yank-original] to yank the | ||
| 81 | original message into it." | ||
| 82 | t) | ||
| 83 | |||
| 84 | (autoload 'news-post-news "rnewspost" | ||
| 85 | "Begin editing a new USENET news article to be posted." | ||
| 86 | t) | ||
| 87 | |||
| 88 | (autoload 'news-mail-reply "rnewspost" | ||
| 89 | "Mail a reply to the author of the current article. | ||
| 90 | While composing the reply, use \\[mail-yank-original] to yank the original | ||
| 91 | message into it." | ||
| 92 | t) | ||
| 93 | |||
| 94 | (defvar news-group-hook-alist nil | ||
| 95 | "Alist of (GROUP-REGEXP . HOOK) pairs. | ||
| 96 | Just before displaying a message, each HOOK is called | ||
| 97 | if its GROUP-REGEXP matches the current newsgroup name.") | ||
| 98 | |||
| 99 | (defvar rmail-last-file (expand-file-name "~/mbox.news")) | ||
| 100 | |||
| 101 | ;Now in paths.el. | ||
| 102 | ;(defvar news-path "/usr/spool/news/" | ||
| 103 | ; "The root directory below which all news files are stored.") | ||
| 104 | |||
| 105 | (defvar news-startup-file "$HOME/.newsrc" "Contains ~/.newsrc") | ||
| 106 | (defvar news-certification-file "$HOME/.news-dates" "Contains ~/.news-dates") | ||
| 107 | |||
| 108 | ;; random headers that we decide to ignore. | ||
| 109 | (defvar news-ignored-headers | ||
| 110 | "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:" | ||
| 111 | "All random fields within the header of a message.") | ||
| 112 | |||
| 113 | (defvar news-mode-map nil) | ||
| 114 | (defvar news-read-first-time-p t) | ||
| 115 | ;; Contains the (dotified) news groups of which you are a member. | ||
| 116 | (defvar news-user-group-list nil) | ||
| 117 | |||
| 118 | (defvar news-current-news-group nil) | ||
| 119 | (defvar news-current-group-begin nil) | ||
| 120 | (defvar news-current-group-end nil) | ||
| 121 | (defvar news-current-certifications nil | ||
| 122 | "An assoc list of a group name and the time at which it is | ||
| 123 | known that the group had no new traffic") | ||
| 124 | (defvar news-current-certifiable nil | ||
| 125 | "The time when the directory we are now working on was written") | ||
| 126 | |||
| 127 | (defvar news-message-filter nil | ||
| 128 | "User specifiable filter function that will be called during | ||
| 129 | formatting of the news file") | ||
| 130 | |||
| 131 | ;(defvar news-mode-group-string "Starting-Up" | ||
| 132 | ; "Mode line group name info is held in this variable") | ||
| 133 | (defvar news-list-of-files nil | ||
| 134 | "Global variable in which we store the list of files | ||
| 135 | associated with the current newsgroup") | ||
| 136 | (defvar news-list-of-files-possibly-bogus nil | ||
| 137 | "variable indicating we only are guessing at which files are available. | ||
| 138 | Not currently used.") | ||
| 139 | |||
| 140 | ;; association list in which we store lists of the form | ||
| 141 | ;; (pointified-group-name (first last old-last)) | ||
| 142 | (defvar news-group-article-assoc nil) | ||
| 143 | |||
| 144 | (defvar news-current-message-number 0 "Displayed Article Number") | ||
| 145 | (defvar news-total-current-group 0 "Total no of messages in group") | ||
| 146 | |||
| 147 | (defvar news-unsubscribe-groups ()) | ||
| 148 | (defvar news-point-pdl () "List of visited news messages.") | ||
| 149 | (defvar news-no-jumps-p t) | ||
| 150 | (defvar news-buffer () "Buffer into which news files are read.") | ||
| 151 | |||
| 152 | (defmacro news-push (item ref) | ||
| 153 | (list 'setq ref (list 'cons item ref))) | ||
| 154 | |||
| 155 | (defmacro news-cadr (x) (list 'car (list 'cdr x))) | ||
| 156 | (defmacro news-cdar (x) (list 'cdr (list 'car x))) | ||
| 157 | (defmacro news-caddr (x) (list 'car (list 'cdr (list 'cdr x)))) | ||
| 158 | (defmacro news-cadar (x) (list 'car (list 'cdr (list 'car x)))) | ||
| 159 | (defmacro news-caadr (x) (list 'car (list 'car (list 'cdr x)))) | ||
| 160 | (defmacro news-cdadr (x) (list 'cdr (list 'car (list 'cdr x)))) | ||
| 161 | |||
| 162 | (defmacro news-wins (pfx index) | ||
| 163 | `(file-exists-p (concat ,pfx "/" (int-to-string ,index)))) | ||
| 164 | |||
| 165 | (defvar news-max-plausible-gap 2 | ||
| 166 | "* In an rnews directory, the maximum possible gap size. | ||
| 167 | A gap is a sequence of missing messages between two messages that exist. | ||
| 168 | An empty file does not contribute to a gap -- it ends one.") | ||
| 169 | |||
| 170 | (defun news-find-first-and-last (prefix base) | ||
| 171 | (and (news-wins prefix base) | ||
| 172 | (cons (news-find-first-or-last prefix base -1) | ||
| 173 | (news-find-first-or-last prefix base 1)))) | ||
| 174 | |||
| 175 | (defmacro news-/ (a1 a2) | ||
| 176 | ;; a form of / that guarantees that (/ -1 2) = 0 | ||
| 177 | (if (zerop (/ -1 2)) | ||
| 178 | `(/ ,a1 ,a2) | ||
| 179 | `(if (< ,a1 0) | ||
| 180 | (- (/ (- ,a1) ,a2)) | ||
| 181 | (/ ,a1 ,a2)))) | ||
| 182 | |||
| 183 | (defun news-find-first-or-last (pfx base dirn) | ||
| 184 | ;; first use powers of two to find a plausible ceiling | ||
| 185 | (let ((original-dir dirn)) | ||
| 186 | (while (news-wins pfx (+ base dirn)) | ||
| 187 | (setq dirn (* dirn 2))) | ||
| 188 | (setq dirn (news-/ dirn 2)) | ||
| 189 | ;; Then use a binary search to find the high water mark | ||
| 190 | (let ((offset (news-/ dirn 2))) | ||
| 191 | (while (/= offset 0) | ||
| 192 | (if (news-wins pfx (+ base dirn offset)) | ||
| 193 | (setq dirn (+ dirn offset))) | ||
| 194 | (setq offset (news-/ offset 2)))) | ||
| 195 | ;; If this high-water mark is bogus, recurse. | ||
| 196 | (let ((offset (* news-max-plausible-gap original-dir))) | ||
| 197 | (while (and (/= offset 0) (not (news-wins pfx (+ base dirn offset)))) | ||
| 198 | (setq offset (- offset original-dir))) | ||
| 199 | (if (= offset 0) | ||
| 200 | (+ base dirn) | ||
| 201 | (news-find-first-or-last pfx (+ base dirn offset) original-dir))))) | ||
| 202 | |||
| 203 | (defun rnews () | ||
| 204 | "Read USENET news for groups for which you are a member and add or | ||
| 205 | delete groups. | ||
| 206 | You can reply to articles posted and send articles to any group. | ||
| 207 | |||
| 208 | Type \\[describe-mode] once reading news to get a list of rnews commands." | ||
| 209 | (interactive) | ||
| 210 | (let ((last-buffer (buffer-name))) | ||
| 211 | (make-local-variable 'rmail-last-file) | ||
| 212 | (switch-to-buffer (setq news-buffer (get-buffer-create "*news*"))) | ||
| 213 | (news-mode) | ||
| 214 | (setq news-buffer-save last-buffer) | ||
| 215 | (setq buffer-read-only nil) | ||
| 216 | (erase-buffer) | ||
| 217 | (setq buffer-read-only t) | ||
| 218 | (set-buffer-modified-p t) | ||
| 219 | (sit-for 0) | ||
| 220 | (message "Getting new USENET news...") | ||
| 221 | (news-set-mode-line) | ||
| 222 | (news-get-certifications) | ||
| 223 | (news-get-new-news))) | ||
| 224 | |||
| 225 | (defun news-group-certification (group) | ||
| 226 | (cdr-safe (assoc group news-current-certifications))) | ||
| 227 | |||
| 228 | |||
| 229 | (defun news-set-current-certifiable () | ||
| 230 | ;; Record the date that corresponds to the directory you are about to check | ||
| 231 | (let ((file (concat news-path | ||
| 232 | (string-subst-char ?/ ?. news-current-news-group)))) | ||
| 233 | (setq news-current-certifiable | ||
| 234 | (nth 5 (file-attributes | ||
| 235 | (or (file-symlink-p file) file)))))) | ||
| 236 | |||
| 237 | (defun news-get-certifications () | ||
| 238 | ;; Read the certified-read file from last session | ||
| 239 | (save-excursion | ||
| 240 | (save-window-excursion | ||
| 241 | (setq news-current-certifications | ||
| 242 | (car-safe | ||
| 243 | (condition-case var | ||
| 244 | (let* | ||
| 245 | ((file (substitute-in-file-name news-certification-file)) | ||
| 246 | (buf (find-file-noselect file))) | ||
| 247 | (and (file-exists-p file) | ||
| 248 | (progn | ||
| 249 | (switch-to-buffer buf 'norecord) | ||
| 250 | (unwind-protect | ||
| 251 | (read-from-string (buffer-string)) | ||
| 252 | (kill-buffer buf))))) | ||
| 253 | (error nil))))))) | ||
| 254 | |||
| 255 | (defun news-write-certifications () | ||
| 256 | ;; Write a certification file. | ||
| 257 | ;; This is an assoc list of group names with doubletons that represent | ||
| 258 | ;; mod times of the directory when group is read completely. | ||
| 259 | (save-excursion | ||
| 260 | (save-window-excursion | ||
| 261 | (with-output-to-temp-buffer | ||
| 262 | "*CeRtIfIcAtIoNs*" | ||
| 263 | (print news-current-certifications)) | ||
| 264 | (let ((buf (get-buffer "*CeRtIfIcAtIoNs*"))) | ||
| 265 | (switch-to-buffer buf) | ||
| 266 | (write-file (substitute-in-file-name news-certification-file)) | ||
| 267 | (kill-buffer buf))))) | ||
| 268 | |||
| 269 | (defun news-set-current-group-certification () | ||
| 270 | (let ((cgc (assoc news-current-news-group news-current-certifications))) | ||
| 271 | (if cgc (setcdr cgc news-current-certifiable) | ||
| 272 | (news-push (cons news-current-news-group news-current-certifiable) | ||
| 273 | news-current-certifications)))) | ||
| 274 | |||
| 275 | (defun news-set-message-counters () | ||
| 276 | "Scan through current news-groups filelist to figure out how many messages | ||
| 277 | are there. Set counters for use with minor mode display." | ||
| 278 | (if (null news-list-of-files) | ||
| 279 | (setq news-current-message-number 0))) | ||
| 280 | |||
| 281 | (if news-mode-map | ||
| 282 | nil | ||
| 283 | (setq news-mode-map (make-keymap)) | ||
| 284 | (suppress-keymap news-mode-map) | ||
| 285 | (define-key news-mode-map "." 'beginning-of-buffer) | ||
| 286 | (define-key news-mode-map " " 'scroll-up) | ||
| 287 | (define-key news-mode-map "\177" 'scroll-down) | ||
| 288 | (define-key news-mode-map "n" 'news-next-message) | ||
| 289 | (define-key news-mode-map "c" 'news-make-link-to-message) | ||
| 290 | (define-key news-mode-map "p" 'news-previous-message) | ||
| 291 | (define-key news-mode-map "j" 'news-goto-message) | ||
| 292 | (define-key news-mode-map "q" 'news-exit) | ||
| 293 | (define-key news-mode-map "e" 'news-exit) | ||
| 294 | (define-key news-mode-map "\ej" 'news-goto-news-group) | ||
| 295 | (define-key news-mode-map "\en" 'news-next-group) | ||
| 296 | (define-key news-mode-map "\ep" 'news-previous-group) | ||
| 297 | (define-key news-mode-map "l" 'news-list-news-groups) | ||
| 298 | (define-key news-mode-map "?" 'describe-mode) | ||
| 299 | (define-key news-mode-map "g" 'news-get-new-news) | ||
| 300 | (define-key news-mode-map "f" 'news-reply) | ||
| 301 | (define-key news-mode-map "m" 'news-mail-other-window) | ||
| 302 | (define-key news-mode-map "a" 'news-post-news) | ||
| 303 | (define-key news-mode-map "r" 'news-mail-reply) | ||
| 304 | (define-key news-mode-map "o" 'news-save-item-in-file) | ||
| 305 | (define-key news-mode-map "\C-o" 'rmail-output) | ||
| 306 | (define-key news-mode-map "t" 'news-show-all-headers) | ||
| 307 | (define-key news-mode-map "x" 'news-force-update) | ||
| 308 | (define-key news-mode-map "A" 'news-add-news-group) | ||
| 309 | (define-key news-mode-map "u" 'news-unsubscribe-current-group) | ||
| 310 | (define-key news-mode-map "U" 'news-unsubscribe-group) | ||
| 311 | (define-key news-mode-map "\C-c\C-r" 'news-caesar-buffer-body)) | ||
| 312 | |||
| 313 | (defun news-mode () | ||
| 314 | "News Mode is used by M-x rnews for reading USENET Newsgroups articles. | ||
| 315 | New readers can find additional help in newsgroup: news.announce.newusers . | ||
| 316 | All normal editing commands are turned off. | ||
| 317 | Instead, these commands are available: | ||
| 318 | |||
| 319 | . move point to front of this news article (same as Meta-<). | ||
| 320 | Space scroll to next screen of this news article. | ||
| 321 | Delete scroll down previous page of this news article. | ||
| 322 | n move to next news article, possibly next group. | ||
| 323 | p move to previous news article, possibly previous group. | ||
| 324 | j jump to news article specified by numeric position. | ||
| 325 | M-j jump to news group. | ||
| 326 | M-n goto next news group. | ||
| 327 | M-p goto previous news group. | ||
| 328 | l list all the news groups with current status. | ||
| 329 | ? print this help message. | ||
| 330 | C-c C-r caesar rotate all letters by 13 places in the article's body (rot13). | ||
| 331 | g get new USENET news. | ||
| 332 | f post a reply article to USENET. | ||
| 333 | a post an original news article. | ||
| 334 | A add a newsgroup. | ||
| 335 | o save the current article in the named file (append if file exists). | ||
| 336 | C-o output this message to a Unix-format mail file (append it). | ||
| 337 | c \"copy\" (actually link) current or prefix-arg msg to file. | ||
| 338 | warning: target directory and message file must be on same device | ||
| 339 | (UNIX magic) | ||
| 340 | t show all the headers this news article originally had. | ||
| 341 | q quit reading news after updating .newsrc file. | ||
| 342 | e exit updating .newsrc file. | ||
| 343 | m mail a news article. Same as C-x 4 m. | ||
| 344 | x update last message seen to be the current message. | ||
| 345 | r mail a reply to this news article. Like m but initializes some fields. | ||
| 346 | u unsubscribe from current newsgroup. | ||
| 347 | U unsubscribe from specified newsgroup." | ||
| 348 | (interactive) | ||
| 349 | (kill-all-local-variables) | ||
| 350 | (make-local-variable 'news-read-first-time-p) | ||
| 351 | (setq news-read-first-time-p t) | ||
| 352 | (make-local-variable 'news-current-news-group) | ||
| 353 | ; (setq news-current-news-group "??") | ||
| 354 | (make-local-variable 'news-current-group-begin) | ||
| 355 | (setq news-current-group-begin 0) | ||
| 356 | (make-local-variable 'news-current-message-number) | ||
| 357 | (setq news-current-message-number 0) | ||
| 358 | (make-local-variable 'news-total-current-group) | ||
| 359 | (make-local-variable 'news-buffer-save) | ||
| 360 | (make-local-variable 'version-control) | ||
| 361 | (setq version-control 'never) | ||
| 362 | (make-local-variable 'news-point-pdl) | ||
| 363 | ; This breaks it. I don't have time to figure out why. -- RMS | ||
| 364 | ; (make-local-variable 'news-group-article-assoc) | ||
| 365 | (setq major-mode 'news-mode) | ||
| 366 | (setq mode-line-process '(news-minor-modes)) | ||
| 367 | (setq mode-name "NEWS") | ||
| 368 | (news-set-mode-line) | ||
| 369 | (set-syntax-table text-mode-syntax-table) | ||
| 370 | (use-local-map news-mode-map) | ||
| 371 | (setq local-abbrev-table text-mode-abbrev-table) | ||
| 372 | (run-mode-hooks 'news-mode-hook)) | ||
| 373 | |||
| 374 | (defun string-subst-char (new old string) | ||
| 375 | (let (index) | ||
| 376 | (setq old (regexp-quote (char-to-string old)) | ||
| 377 | string (substring string 0)) | ||
| 378 | (while (setq index (string-match old string)) | ||
| 379 | (aset string index new))) | ||
| 380 | string) | ||
| 381 | |||
| 382 | ;; update read message number | ||
| 383 | (defmacro news-update-message-read (ngroup nno) | ||
| 384 | (list 'setcar | ||
| 385 | (list 'news-cdadr | ||
| 386 | (list 'assoc ngroup 'news-group-article-assoc)) | ||
| 387 | nno)) | ||
| 388 | |||
| 389 | (defun news-parse-range (number-string) | ||
| 390 | "Parse string representing range of numbers of he form <a>-<b> | ||
| 391 | to a list (a . b)" | ||
| 392 | (let ((n (string-match "-" number-string))) | ||
| 393 | (if n | ||
| 394 | (cons (string-to-number (substring number-string 0 n)) | ||
| 395 | (string-to-number (substring number-string (1+ n)))) | ||
| 396 | (setq n (string-to-number number-string)) | ||
| 397 | (cons n n)))) | ||
| 398 | |||
| 399 | ;(defun is-in (elt lis) | ||
| 400 | ; (catch 'foo | ||
| 401 | ; (while lis | ||
| 402 | ; (if (equal (car lis) elt) | ||
| 403 | ; (throw 'foo t) | ||
| 404 | ; (setq lis (cdr lis)))))) | ||
| 405 | |||
| 406 | (defun news-get-new-news () | ||
| 407 | "Get new USENET news, if there is any for the current user." | ||
| 408 | (interactive) | ||
| 409 | (if (not (null news-user-group-list)) | ||
| 410 | (news-update-newsrc-file)) | ||
| 411 | (setq news-group-article-assoc ()) | ||
| 412 | (setq news-user-group-list ()) | ||
| 413 | (message "Looking up %s file..." news-startup-file) | ||
| 414 | (let ((file (substitute-in-file-name news-startup-file)) | ||
| 415 | (temp-user-groups ())) | ||
| 416 | (save-excursion | ||
| 417 | (let ((newsrcbuf (find-file-noselect file)) | ||
| 418 | start end endofline tem) | ||
| 419 | (set-buffer newsrcbuf) | ||
| 420 | (goto-char 0) | ||
| 421 | (while (search-forward ": " nil t) | ||
| 422 | (setq end (point)) | ||
| 423 | (beginning-of-line) | ||
| 424 | (setq start (point)) | ||
| 425 | (end-of-line) | ||
| 426 | (setq endofline (point)) | ||
| 427 | (setq tem (buffer-substring start (- end 2))) | ||
| 428 | (let ((range (news-parse-range | ||
| 429 | (buffer-substring end endofline)))) | ||
| 430 | (if (assoc tem news-group-article-assoc) | ||
| 431 | (message "You are subscribed twice to %s; I ignore second" | ||
| 432 | tem) | ||
| 433 | (setq temp-user-groups (cons tem temp-user-groups) | ||
| 434 | news-group-article-assoc | ||
| 435 | (cons (list tem (list (car range) | ||
| 436 | (cdr range) | ||
| 437 | (cdr range))) | ||
| 438 | news-group-article-assoc))))) | ||
| 439 | (kill-buffer newsrcbuf))) | ||
| 440 | (setq temp-user-groups (nreverse temp-user-groups)) | ||
| 441 | (message "Prefrobnicating...") | ||
| 442 | (switch-to-buffer news-buffer) | ||
| 443 | (setq news-user-group-list temp-user-groups) | ||
| 444 | (while (and temp-user-groups | ||
| 445 | (not (news-read-files-into-buffer | ||
| 446 | (car temp-user-groups) nil))) | ||
| 447 | (setq temp-user-groups (cdr temp-user-groups))) | ||
| 448 | (if (null temp-user-groups) | ||
| 449 | (message "No news is good news.") | ||
| 450 | (message "")))) | ||
| 451 | |||
| 452 | (defun news-list-news-groups () | ||
| 453 | "Display all the news groups to which you belong." | ||
| 454 | (interactive) | ||
| 455 | (with-output-to-temp-buffer "*Newsgroups*" | ||
| 456 | (with-current-buffer standard-output | ||
| 457 | (insert | ||
| 458 | "News Group Msg No. News Group Msg No.\n") | ||
| 459 | (insert | ||
| 460 | "------------------------- -------------------------\n") | ||
| 461 | (let ((temp news-user-group-list) | ||
| 462 | (flag nil)) | ||
| 463 | (while temp | ||
| 464 | (let ((item (assoc (car temp) news-group-article-assoc))) | ||
| 465 | (insert (car item)) | ||
| 466 | (indent-to (if flag 52 20)) | ||
| 467 | (insert (int-to-string (news-cadr (news-cadr item)))) | ||
| 468 | (if flag | ||
| 469 | (insert "\n") | ||
| 470 | (indent-to 33)) | ||
| 471 | (setq temp (cdr temp) flag (not flag)))))))) | ||
| 472 | |||
| 473 | ;; Mode line hack | ||
| 474 | (defun news-set-mode-line () | ||
| 475 | "Set mode line string to something useful." | ||
| 476 | (setq mode-line-process | ||
| 477 | (concat " " | ||
| 478 | (if (integerp news-current-message-number) | ||
| 479 | (int-to-string news-current-message-number) | ||
| 480 | "??") | ||
| 481 | "/" | ||
| 482 | (if (integerp news-current-group-end) | ||
| 483 | (int-to-string news-current-group-end) | ||
| 484 | news-current-group-end))) | ||
| 485 | (setq mode-line-buffer-identification | ||
| 486 | (concat "NEWS: " | ||
| 487 | news-current-news-group | ||
| 488 | ;; Enough spaces to pad group name to 17 positions. | ||
| 489 | (substring " " | ||
| 490 | 0 (max 0 (- 17 (length news-current-news-group)))))) | ||
| 491 | (set-buffer-modified-p t) | ||
| 492 | (sit-for 0)) | ||
| 493 | |||
| 494 | (defun news-goto-news-group (gp) | ||
| 495 | "Takes a string and goes to that news group." | ||
| 496 | (interactive (list (completing-read "NewsGroup: " | ||
| 497 | news-group-article-assoc))) | ||
| 498 | (message "Jumping to news group %s..." gp) | ||
| 499 | (news-select-news-group gp) | ||
| 500 | (message "Jumping to news group %s... done." gp)) | ||
| 501 | |||
| 502 | (defun news-select-news-group (gp) | ||
| 503 | (let ((grp (assoc gp news-group-article-assoc))) | ||
| 504 | (if (null grp) | ||
| 505 | (error "Group %s not subscribed to" gp) | ||
| 506 | (progn | ||
| 507 | (news-update-message-read news-current-news-group | ||
| 508 | (news-cdar news-point-pdl)) | ||
| 509 | (news-read-files-into-buffer (car grp) nil) | ||
| 510 | (news-set-mode-line))))) | ||
| 511 | |||
| 512 | (defun news-goto-message (arg) | ||
| 513 | "Goes to the article ARG in current newsgroup." | ||
| 514 | (interactive "p") | ||
| 515 | (if (null current-prefix-arg) | ||
| 516 | (setq arg (read-no-blanks-input "Go to article: " ""))) | ||
| 517 | (news-select-message arg)) | ||
| 518 | |||
| 519 | (defun news-select-message (arg) | ||
| 520 | (if (stringp arg) (setq arg (string-to-number arg))) | ||
| 521 | (let ((file (concat news-path | ||
| 522 | (string-subst-char ?/ ?. news-current-news-group) | ||
| 523 | "/" arg))) | ||
| 524 | (if (= arg | ||
| 525 | (or (news-cadr (memq (news-cdar news-point-pdl) news-list-of-files)) | ||
| 526 | 0)) | ||
| 527 | (setcdr (car news-point-pdl) arg)) | ||
| 528 | (setq news-current-message-number arg) | ||
| 529 | (if (file-exists-p file) | ||
| 530 | (let ((buffer-read-only nil)) | ||
| 531 | (news-read-in-file file) | ||
| 532 | (news-set-mode-line)) | ||
| 533 | (news-set-mode-line) | ||
| 534 | (error "Article %d nonexistent" arg)))) | ||
| 535 | |||
| 536 | (defun news-force-update () | ||
| 537 | "updates the position of last article read in the current news group" | ||
| 538 | (interactive) | ||
| 539 | (setcdr (car news-point-pdl) news-current-message-number) | ||
| 540 | (message "Updated to %d" news-current-message-number)) | ||
| 541 | |||
| 542 | (defun news-next-message (arg) | ||
| 543 | "Move ARG messages forward within one newsgroup. | ||
| 544 | Negative ARG moves backward. | ||
| 545 | If ARG is 1 or -1, moves to next or previous newsgroup if at end." | ||
| 546 | (interactive "p") | ||
| 547 | (let ((no (+ arg news-current-message-number))) | ||
| 548 | (if (or (< no news-current-group-begin) | ||
| 549 | (> no news-current-group-end)) | ||
| 550 | (cond ((= arg 1) | ||
| 551 | (news-set-current-group-certification) | ||
| 552 | (news-next-group)) | ||
| 553 | ((= arg -1) | ||
| 554 | (news-previous-group)) | ||
| 555 | (t (error "Article out of range"))) | ||
| 556 | (let ((plist (news-get-motion-lists | ||
| 557 | news-current-message-number | ||
| 558 | news-list-of-files))) | ||
| 559 | (if (< arg 0) | ||
| 560 | (news-select-message (nth (1- (- arg)) (car (cdr plist)))) | ||
| 561 | (news-select-message (nth (1- arg) (car plist)))))))) | ||
| 562 | |||
| 563 | (defun news-previous-message (arg) | ||
| 564 | "Move ARG messages backward in current newsgroup. | ||
| 565 | With no arg or arg of 1, move one message | ||
| 566 | and move to previous newsgroup if at beginning. | ||
| 567 | A negative ARG means move forward." | ||
| 568 | (interactive "p") | ||
| 569 | (news-next-message (- arg))) | ||
| 570 | |||
| 571 | (defun news-move-to-group (arg) | ||
| 572 | "Given arg move forward or backward to a new newsgroup." | ||
| 573 | (let ((cg news-current-news-group)) | ||
| 574 | (let ((plist (news-get-motion-lists cg news-user-group-list)) | ||
| 575 | ngrp) | ||
| 576 | (if (< arg 0) | ||
| 577 | (or (setq ngrp (nth (1- (- arg)) (news-cadr plist))) | ||
| 578 | (error "No previous news groups")) | ||
| 579 | (or (setq ngrp (nth arg (car plist))) | ||
| 580 | (error "No more news groups"))) | ||
| 581 | (news-select-news-group ngrp)))) | ||
| 582 | |||
| 583 | (defun news-next-group () | ||
| 584 | "Moves to the next user group." | ||
| 585 | (interactive) | ||
| 586 | ; (message "Moving to next group...") | ||
| 587 | (news-move-to-group 0) | ||
| 588 | (while (null news-list-of-files) | ||
| 589 | (news-move-to-group 0))) | ||
| 590 | ; (message "Moving to next group... done.") | ||
| 591 | |||
| 592 | (defun news-previous-group () | ||
| 593 | "Moves to the previous user group." | ||
| 594 | (interactive) | ||
| 595 | ; (message "Moving to previous group...") | ||
| 596 | (news-move-to-group -1) | ||
| 597 | (while (null news-list-of-files) | ||
| 598 | (news-move-to-group -1))) | ||
| 599 | ; (message "Moving to previous group... done.") | ||
| 600 | |||
| 601 | (defun news-get-motion-lists (arg listy) | ||
| 602 | "Given a msgnumber/group this will return a list of two lists; | ||
| 603 | one for moving forward and one for moving backward." | ||
| 604 | (let ((temp listy) | ||
| 605 | (result ())) | ||
| 606 | (catch 'out | ||
| 607 | (while temp | ||
| 608 | (if (equal (car temp) arg) | ||
| 609 | (throw 'out (cons (cdr temp) (list result))) | ||
| 610 | (setq result (nconc (list (car temp)) result)) | ||
| 611 | (setq temp (cdr temp))))))) | ||
| 612 | |||
| 613 | ;; miscellaneous io routines | ||
| 614 | (defun news-read-in-file (filename) | ||
| 615 | (erase-buffer) | ||
| 616 | (let ((start (point))) | ||
| 617 | (insert-file-contents filename) | ||
| 618 | (news-convert-format) | ||
| 619 | ;; Run each hook that applies to the current newsgroup. | ||
| 620 | (let ((hooks news-group-hook-alist)) | ||
| 621 | (while hooks | ||
| 622 | (goto-char start) | ||
| 623 | (if (string-match (car (car hooks)) news-group-name) | ||
| 624 | (funcall (cdr (car hooks)))) | ||
| 625 | (setq hooks (cdr hooks)))) | ||
| 626 | (goto-char start) | ||
| 627 | (forward-line 1) | ||
| 628 | (if (eobp) | ||
| 629 | (message "(Empty file?)") | ||
| 630 | (goto-char start)))) | ||
| 631 | |||
| 632 | (defun news-convert-format () | ||
| 633 | (save-excursion | ||
| 634 | (save-restriction | ||
| 635 | (let* ((start (point)) | ||
| 636 | (end (condition-case () | ||
| 637 | (progn (search-forward "\n\n") (point)) | ||
| 638 | (error nil))) | ||
| 639 | has-from has-date) | ||
| 640 | (cond (end | ||
| 641 | (narrow-to-region start end) | ||
| 642 | (goto-char start) | ||
| 643 | (setq has-from (search-forward "\nFrom:" nil t)) | ||
| 644 | (cond ((and (not has-from) has-date) | ||
| 645 | (goto-char start) | ||
| 646 | (search-forward "\nDate:") | ||
| 647 | (beginning-of-line) | ||
| 648 | (kill-line) (kill-line))) | ||
| 649 | (news-delete-headers start) | ||
| 650 | (goto-char start))))))) | ||
| 651 | |||
| 652 | (defun news-show-all-headers () | ||
| 653 | "Redisplay current news item with all original headers" | ||
| 654 | (interactive) | ||
| 655 | (let (news-ignored-headers | ||
| 656 | (buffer-read-only ())) | ||
| 657 | (erase-buffer) | ||
| 658 | (news-set-mode-line) | ||
| 659 | (news-read-in-file | ||
| 660 | (concat news-path | ||
| 661 | (string-subst-char ?/ ?. news-current-news-group) | ||
| 662 | "/" (int-to-string news-current-message-number))))) | ||
| 663 | |||
| 664 | (defun news-delete-headers (pos) | ||
| 665 | (goto-char pos) | ||
| 666 | (and (stringp news-ignored-headers) | ||
| 667 | (while (re-search-forward news-ignored-headers nil t) | ||
| 668 | (beginning-of-line) | ||
| 669 | (delete-region (point) | ||
| 670 | (progn (re-search-forward "\n[^ \t]") | ||
| 671 | (forward-char -1) | ||
| 672 | (point)))))) | ||
| 673 | |||
| 674 | (defun news-exit () | ||
| 675 | "Quit news reading session and update the .newsrc file." | ||
| 676 | (interactive) | ||
| 677 | (if (y-or-n-p "Do you really wanna quit reading news ? ") | ||
| 678 | (progn (message "Updating %s..." news-startup-file) | ||
| 679 | (news-update-newsrc-file) | ||
| 680 | (news-write-certifications) | ||
| 681 | (message "Updating %s... done" news-startup-file) | ||
| 682 | (message "Now do some real work") | ||
| 683 | (quit-window) | ||
| 684 | (switch-to-buffer news-buffer-save) | ||
| 685 | (setq news-user-group-list ())) | ||
| 686 | (message ""))) | ||
| 687 | |||
| 688 | (defun news-update-newsrc-file () | ||
| 689 | "Updates the .newsrc file in the users home dir." | ||
| 690 | (let ((newsrcbuf (find-file-noselect | ||
| 691 | (substitute-in-file-name news-startup-file))) | ||
| 692 | (tem news-user-group-list) | ||
| 693 | group) | ||
| 694 | (save-excursion | ||
| 695 | (if (not (null news-current-news-group)) | ||
| 696 | (news-update-message-read news-current-news-group | ||
| 697 | (news-cdar news-point-pdl))) | ||
| 698 | (set-buffer newsrcbuf) | ||
| 699 | (while tem | ||
| 700 | (setq group (assoc (car tem) news-group-article-assoc)) | ||
| 701 | (if (= (news-cadr (news-cadr group)) (news-caddr (news-cadr group))) | ||
| 702 | nil | ||
| 703 | (goto-char 0) | ||
| 704 | (if (search-forward (concat (car group) ": ") nil t) | ||
| 705 | (kill-line nil) | ||
| 706 | (insert (car group) ": \n") (backward-char 1)) | ||
| 707 | (insert (int-to-string (car (news-cadr group))) "-" | ||
| 708 | (int-to-string (news-cadr (news-cadr group))))) | ||
| 709 | (setq tem (cdr tem))) | ||
| 710 | (while news-unsubscribe-groups | ||
| 711 | (setq group (assoc (car news-unsubscribe-groups) | ||
| 712 | news-group-article-assoc)) | ||
| 713 | (goto-char 0) | ||
| 714 | (if (search-forward (concat (car group) ": ") nil t) | ||
| 715 | (progn | ||
| 716 | (backward-char 2) | ||
| 717 | (kill-line nil) | ||
| 718 | (insert "! " (int-to-string (car (news-cadr group))) | ||
| 719 | "-" (int-to-string (news-cadr (news-cadr group)))))) | ||
| 720 | (setq news-unsubscribe-groups (cdr news-unsubscribe-groups))) | ||
| 721 | (save-buffer) | ||
| 722 | (kill-buffer (current-buffer))))) | ||
| 723 | |||
| 724 | |||
| 725 | (defun news-unsubscribe-group (group) | ||
| 726 | "Removes you from newgroup GROUP." | ||
| 727 | (interactive (list (completing-read "Unsubscribe from group: " | ||
| 728 | news-group-article-assoc))) | ||
| 729 | (news-unsubscribe-internal group)) | ||
| 730 | |||
| 731 | (defun news-unsubscribe-current-group () | ||
| 732 | "Removes you from the newsgroup you are now reading." | ||
| 733 | (interactive) | ||
| 734 | (if (y-or-n-p "Do you really want to unsubscribe from this group ? ") | ||
| 735 | (news-unsubscribe-internal news-current-news-group))) | ||
| 736 | |||
| 737 | (defun news-unsubscribe-internal (group) | ||
| 738 | (let ((tem (assoc group news-group-article-assoc))) | ||
| 739 | (if tem | ||
| 740 | (progn | ||
| 741 | (setq news-unsubscribe-groups (cons group news-unsubscribe-groups)) | ||
| 742 | (news-update-message-read group (news-cdar news-point-pdl)) | ||
| 743 | (if (equal group news-current-news-group) | ||
| 744 | (news-next-group)) | ||
| 745 | (message "")) | ||
| 746 | (error "Not subscribed to group: %s" group)))) | ||
| 747 | |||
| 748 | (defun news-save-item-in-file (file) | ||
| 749 | "Save the current article that is being read by appending to a file." | ||
| 750 | (interactive "FSave item in file: ") | ||
| 751 | (append-to-file (point-min) (point-max) file)) | ||
| 752 | |||
| 753 | (defun news-get-pruned-list-of-files (gp-list end-file-no) | ||
| 754 | "Given a news group it finds all files in the news group. | ||
| 755 | The arg must be in slashified format. | ||
| 756 | Using ls was found to be too slow in a previous version." | ||
| 757 | (let | ||
| 758 | ((answer | ||
| 759 | (and | ||
| 760 | (not (and end-file-no | ||
| 761 | (equal (news-set-current-certifiable) | ||
| 762 | (news-group-certification gp-list)) | ||
| 763 | (setq news-list-of-files nil | ||
| 764 | news-list-of-files-possibly-bogus t))) | ||
| 765 | (let* ((file-directory (concat news-path | ||
| 766 | (string-subst-char ?/ ?. gp-list))) | ||
| 767 | tem | ||
| 768 | (last-winner | ||
| 769 | (and end-file-no | ||
| 770 | (news-wins file-directory end-file-no) | ||
| 771 | (news-find-first-or-last file-directory end-file-no 1)))) | ||
| 772 | (setq news-list-of-files-possibly-bogus t news-list-of-files nil) | ||
| 773 | (if last-winner | ||
| 774 | (progn | ||
| 775 | (setq news-list-of-files-possibly-bogus t | ||
| 776 | news-current-group-end last-winner) | ||
| 777 | (while (> last-winner end-file-no) | ||
| 778 | (news-push last-winner news-list-of-files) | ||
| 779 | (setq last-winner (1- last-winner))) | ||
| 780 | news-list-of-files) | ||
| 781 | (if (or (not (file-directory-p file-directory)) | ||
| 782 | (not (file-readable-p file-directory))) | ||
| 783 | nil | ||
| 784 | (setq news-list-of-files | ||
| 785 | (condition-case error | ||
| 786 | (directory-files file-directory) | ||
| 787 | (file-error | ||
| 788 | (if (string= (nth 2 error) "permission denied") | ||
| 789 | (message "Newsgroup %s is read-protected" | ||
| 790 | gp-list) | ||
| 791 | (signal 'file-error (cdr error))) | ||
| 792 | nil))) | ||
| 793 | (setq tem news-list-of-files) | ||
| 794 | (while tem | ||
| 795 | (if (or (not (string-match "^[0-9]*$" (car tem))) | ||
| 796 | ;; don't get confused by directories that look like numbers | ||
| 797 | (file-directory-p | ||
| 798 | (concat file-directory "/" (car tem))) | ||
| 799 | (<= (string-to-number (car tem)) end-file-no)) | ||
| 800 | (setq news-list-of-files | ||
| 801 | (delq (car tem) news-list-of-files))) | ||
| 802 | (setq tem (cdr tem))) | ||
| 803 | (if (null news-list-of-files) | ||
| 804 | (progn (setq news-current-group-end 0) | ||
| 805 | nil) | ||
| 806 | (setq news-list-of-files | ||
| 807 | (mapcar 'string-to-number news-list-of-files)) | ||
| 808 | (setq news-list-of-files (sort news-list-of-files '<)) | ||
| 809 | (setq news-current-group-end | ||
| 810 | (elt news-list-of-files | ||
| 811 | (1- (length news-list-of-files)))) | ||
| 812 | news-list-of-files))))))) | ||
| 813 | (or answer (progn (news-set-current-group-certification) nil)))) | ||
| 814 | |||
| 815 | (defun news-read-files-into-buffer (group reversep) | ||
| 816 | (let* ((files-start-end (news-cadr (assoc group news-group-article-assoc))) | ||
| 817 | (start-file-no (car files-start-end)) | ||
| 818 | (end-file-no (news-cadr files-start-end)) | ||
| 819 | (buffer-read-only nil)) | ||
| 820 | (setq news-current-news-group group) | ||
| 821 | (setq news-current-message-number nil) | ||
| 822 | (setq news-current-group-end nil) | ||
| 823 | (news-set-mode-line) | ||
| 824 | (news-get-pruned-list-of-files group end-file-no) | ||
| 825 | (news-set-mode-line) | ||
| 826 | ;; @@ should be a lot smarter than this if we have to move | ||
| 827 | ;; @@ around correctly. | ||
| 828 | (setq news-point-pdl (list (cons (car files-start-end) | ||
| 829 | (news-cadr files-start-end)))) | ||
| 830 | (if (null news-list-of-files) | ||
| 831 | (progn (erase-buffer) | ||
| 832 | (setq news-current-group-end end-file-no) | ||
| 833 | (setq news-current-group-begin end-file-no) | ||
| 834 | (setq news-current-message-number end-file-no) | ||
| 835 | (news-set-mode-line) | ||
| 836 | ; (message "No new articles in " group " group.") | ||
| 837 | nil) | ||
| 838 | (setq news-current-group-begin (car news-list-of-files)) | ||
| 839 | (if reversep | ||
| 840 | (setq news-current-message-number news-current-group-end) | ||
| 841 | (if (> (car news-list-of-files) end-file-no) | ||
| 842 | (setcdr (car news-point-pdl) (car news-list-of-files))) | ||
| 843 | (setq news-current-message-number news-current-group-begin)) | ||
| 844 | (news-set-message-counters) | ||
| 845 | (news-set-mode-line) | ||
| 846 | (news-read-in-file (concat news-path | ||
| 847 | (string-subst-char ?/ ?. group) | ||
| 848 | "/" | ||
| 849 | (int-to-string | ||
| 850 | news-current-message-number))) | ||
| 851 | (news-set-message-counters) | ||
| 852 | (news-set-mode-line) | ||
| 853 | t))) | ||
| 854 | |||
| 855 | (defun news-add-news-group (gp) | ||
| 856 | "Resubscribe to or add a USENET news group named GROUP (a string)." | ||
| 857 | ; @@ (completing-read ...) | ||
| 858 | ; @@ could be based on news library file ../active (slightly fascist) | ||
| 859 | ; @@ or (expensive to compute) all directories under the news spool directory | ||
| 860 | (interactive "sAdd news group: ") | ||
| 861 | (let ((file-dir (concat news-path (string-subst-char ?/ ?. gp)))) | ||
| 862 | (save-excursion | ||
| 863 | (if (null (assoc gp news-group-article-assoc)) | ||
| 864 | (let ((newsrcbuf (find-file-noselect | ||
| 865 | (substitute-in-file-name news-startup-file)))) | ||
| 866 | (if (file-directory-p file-dir) | ||
| 867 | (progn | ||
| 868 | (switch-to-buffer newsrcbuf) | ||
| 869 | (goto-char 0) | ||
| 870 | (if (search-forward (concat gp "! ") nil t) | ||
| 871 | (progn | ||
| 872 | (message "Re-subscribing to group %s." gp) | ||
| 873 | ;;@@ news-unsubscribe-groups isn't being used | ||
| 874 | ;;(setq news-unsubscribe-groups | ||
| 875 | ;; (delq gp news-unsubscribe-groups)) | ||
| 876 | (backward-char 2) | ||
| 877 | (delete-char 1) | ||
| 878 | (insert ":")) | ||
| 879 | (progn | ||
| 880 | (message | ||
| 881 | "Added %s to your list of newsgroups." gp) | ||
| 882 | (goto-char (point-max)) | ||
| 883 | (insert gp ": 1-1\n"))) | ||
| 884 | (search-backward gp nil t) | ||
| 885 | (let (start end endofline tem) | ||
| 886 | (search-forward ": " nil t) | ||
| 887 | (setq end (point)) | ||
| 888 | (beginning-of-line) | ||
| 889 | (setq start (point)) | ||
| 890 | (end-of-line) | ||
| 891 | (setq endofline (point)) | ||
| 892 | (setq tem (buffer-substring start (- end 2))) | ||
| 893 | (let ((range (news-parse-range | ||
| 894 | (buffer-substring end endofline)))) | ||
| 895 | (setq news-group-article-assoc | ||
| 896 | (cons (list tem (list (car range) | ||
| 897 | (cdr range) | ||
| 898 | (cdr range))) | ||
| 899 | news-group-article-assoc)))) | ||
| 900 | (save-buffer) | ||
| 901 | (kill-buffer (current-buffer))) | ||
| 902 | (message "Newsgroup %s doesn't exist." gp))) | ||
| 903 | (message "Already subscribed to group %s." gp))))) | ||
| 904 | |||
| 905 | (defun news-make-link-to-message (number newname) | ||
| 906 | "Forges a link to an rnews message numbered number (current if no arg) | ||
| 907 | Good for hanging on to a message that might or might not be | ||
| 908 | automatically deleted." | ||
| 909 | (interactive "P | ||
| 910 | FName to link to message: ") | ||
| 911 | (add-name-to-file | ||
| 912 | (concat news-path | ||
| 913 | (string-subst-char ?/ ?. news-current-news-group) | ||
| 914 | "/" (if number | ||
| 915 | (prefix-numeric-value number) | ||
| 916 | news-current-message-number)) | ||
| 917 | newname)) | ||
| 918 | |||
| 919 | ;;; caesar-region written by phr@gnu.org Nov 86 | ||
| 920 | ;;; modified by tower@gnu.org Nov 86 | ||
| 921 | (defun caesar-region (&optional n) | ||
| 922 | "Caesar rotation of region by N, default 13, for decrypting netnews." | ||
| 923 | (interactive (if current-prefix-arg ; Was there a prefix arg? | ||
| 924 | (list (prefix-numeric-value current-prefix-arg)) | ||
| 925 | (list nil))) | ||
| 926 | (cond ((not (numberp n)) (setq n 13)) | ||
| 927 | (t (setq n (mod n 26)))) ;canonicalize N | ||
| 928 | (if (not (zerop n)) ; no action needed for a rot of 0 | ||
| 929 | (progn | ||
| 930 | (if (or (not (boundp 'caesar-translate-table)) | ||
| 931 | (/= (aref caesar-translate-table ?a) (+ ?a n))) | ||
| 932 | (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper) | ||
| 933 | (message "Building caesar-translate-table...") | ||
| 934 | (setq caesar-translate-table (make-vector 256 0)) | ||
| 935 | (while (< i 256) | ||
| 936 | (aset caesar-translate-table i i) | ||
| 937 | (setq i (1+ i))) | ||
| 938 | (setq lower (concat lower lower) upper (upcase lower) i 0) | ||
| 939 | (while (< i 26) | ||
| 940 | (aset caesar-translate-table (+ ?a i) (aref lower (+ i n))) | ||
| 941 | (aset caesar-translate-table (+ ?A i) (aref upper (+ i n))) | ||
| 942 | (setq i (1+ i))) | ||
| 943 | (message "Building caesar-translate-table... done"))) | ||
| 944 | (let ((from (region-beginning)) | ||
| 945 | (to (region-end)) | ||
| 946 | (i 0) str len) | ||
| 947 | (setq str (buffer-substring from to)) | ||
| 948 | (setq len (length str)) | ||
| 949 | (while (< i len) | ||
| 950 | (aset str i (aref caesar-translate-table (aref str i))) | ||
| 951 | (setq i (1+ i))) | ||
| 952 | (goto-char from) | ||
| 953 | (kill-region from to) | ||
| 954 | (insert str))))) | ||
| 955 | |||
| 956 | ;;; news-caesar-buffer-body written by paul@media-lab.mit.edu Wed Oct 1, 1986 | ||
| 957 | ;;; hacked further by tower@gnu.org | ||
| 958 | (defun news-caesar-buffer-body (&optional rotnum) | ||
| 959 | "Caesar rotates all letters in the current buffer by 13 places. | ||
| 960 | Used to encode/decode possibly offensive messages (commonly in net.jokes). | ||
| 961 | With prefix arg, specifies the number of places to rotate each letter forward. | ||
| 962 | Mail and USENET news headers are not rotated." | ||
| 963 | (interactive (if current-prefix-arg ; Was there a prefix arg? | ||
| 964 | (list (prefix-numeric-value current-prefix-arg)) | ||
| 965 | (list nil))) | ||
| 966 | (save-excursion | ||
| 967 | (let ((buffer-status buffer-read-only)) | ||
| 968 | (setq buffer-read-only nil) | ||
| 969 | ;; setup the region | ||
| 970 | (set-mark (if (equal major-mode 'news-mode) | ||
| 971 | (progn (goto-char (point-min)) | ||
| 972 | (search-forward "\n\n" nil t)) | ||
| 973 | (mail-text-start))) | ||
| 974 | (goto-char (point-max)) | ||
| 975 | (caesar-region rotnum) | ||
| 976 | (setq buffer-read-only buffer-status)))) | ||
| 977 | |||
| 978 | (provide 'rnews) | ||
| 979 | |||
| 980 | ;; arch-tag: c032a20b-cafb-466c-b3fa-5be404a18f8c | ||
| 981 | ;;; rnews.el ends here | ||
diff --git a/lisp/obsolete/rnewspost.el b/lisp/obsolete/rnewspost.el deleted file mode 100644 index 10d821a0b4c..00000000000 --- a/lisp/obsolete/rnewspost.el +++ /dev/null | |||
| @@ -1,447 +0,0 @@ | |||
| 1 | ;;; rnewspost.el --- USENET news poster/mailer for GNU Emacs | ||
| 2 | |||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1995, 2001, 2002, 2003, 2004, 2005, | ||
| 4 | ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Maintainer: FSF | ||
| 7 | ;; Keywords: mail, news | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 14 | ;; (at your option) any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 23 | |||
| 24 | ;;; Commentary: | ||
| 25 | |||
| 26 | ;; This file has been obsolete since Emacs 21.1. | ||
| 27 | |||
| 28 | ;;; Change Log: | ||
| 29 | |||
| 30 | ;; moved posting and mail code from rnews.el | ||
| 31 | ;; tower@gnu.org Wed Oct 29 1986 | ||
| 32 | ;; brought posting code almost up to the revision of RFC 850 for News 2.11 | ||
| 33 | ;; - couldn't see handling the special meaning of the Keyword: poster | ||
| 34 | ;; - not worth the code space to support the old A news Title: (which | ||
| 35 | ;; Subject: replaced) and Article-I.D.: (which Message-ID: replaced) | ||
| 36 | ;; tower@gnu.org Nov 86 | ||
| 37 | ;; changed C-c C-r key-binding due to rename of news-caesar-buffer-body | ||
| 38 | ;; tower@gnu.org 21 Nov 86 | ||
| 39 | ;; added (require 'rnews) tower@gnu.org 22 Apr 87 | ||
| 40 | ;; restricted call of news-show-all-headers in news-post-news & news-reply | ||
| 41 | ;; tower@gnu.org 28 Apr 87 | ||
| 42 | ;; commented out Posting-Front-End to save USENET bytes tower@gnu.org Jul 31 87 | ||
| 43 | ;; commented out -n and -t args in news-inews tower@gnu.org 15 Oct 87 | ||
| 44 | |||
| 45 | ;Now in paths.el. | ||
| 46 | ;(defvar news-inews-program "inews" | ||
| 47 | ; "Function to post news.") | ||
| 48 | |||
| 49 | ;; Replying and posting news items are done by these functions. | ||
| 50 | ;; imported from rmail and modified to work with rnews ... | ||
| 51 | ;; Mon Mar 25,1985 at 03:07:04 ads@mit-hermes. | ||
| 52 | ;; this is done so that rnews can operate independently from rmail.el and | ||
| 53 | ;; sendmail and doesn't have to autoload these functions. | ||
| 54 | ;; | ||
| 55 | ;;; >> Nuked by Mly to autoload those functions again, as the duplication of | ||
| 56 | ;;; >> code was making maintenance too difficult. | ||
| 57 | |||
| 58 | ;;; Code: | ||
| 59 | |||
| 60 | (require 'sendmail) | ||
| 61 | (require 'rnews) | ||
| 62 | |||
| 63 | (defvar mail-reply-buffer) | ||
| 64 | |||
| 65 | (defvar news-reply-mode-map () "Mode map used by news-reply.") | ||
| 66 | |||
| 67 | (or news-reply-mode-map | ||
| 68 | (progn | ||
| 69 | (setq news-reply-mode-map (make-keymap)) | ||
| 70 | (define-key news-reply-mode-map "\C-c\C-f\C-d" 'news-reply-distribution) | ||
| 71 | (define-key news-reply-mode-map "\C-c\C-f\C-k" 'news-reply-keywords) | ||
| 72 | (define-key news-reply-mode-map "\C-c\C-f\C-n" 'news-reply-newsgroups) | ||
| 73 | (define-key news-reply-mode-map "\C-c\C-f\C-f" 'news-reply-followup-to) | ||
| 74 | (define-key news-reply-mode-map "\C-c\C-f\C-s" 'mail-subject) | ||
| 75 | (define-key news-reply-mode-map "\C-c\C-f\C-a" 'news-reply-summary) | ||
| 76 | (define-key news-reply-mode-map "\C-c\C-t" 'mail-text) | ||
| 77 | (define-key news-reply-mode-map "\C-c\C-r" 'news-caesar-buffer-body) | ||
| 78 | (define-key news-reply-mode-map "\C-c\C-w" 'news-reply-signature) | ||
| 79 | (define-key news-reply-mode-map "\C-c\C-y" 'news-reply-yank-original) | ||
| 80 | (define-key news-reply-mode-map "\C-c\C-q" 'mail-fill-yanked-message) | ||
| 81 | (define-key news-reply-mode-map "\C-c\C-c" 'news-inews) | ||
| 82 | (define-key news-reply-mode-map "\C-c\C-s" 'news-inews) | ||
| 83 | (define-key news-reply-mode-map [menu-bar] (make-sparse-keymap)) | ||
| 84 | (define-key news-reply-mode-map [menu-bar fields] | ||
| 85 | (cons "Fields" (make-sparse-keymap "Fields"))) | ||
| 86 | (define-key news-reply-mode-map [menu-bar fields news-reply-distribution] | ||
| 87 | '("Distribution" . news-reply-distribution)) | ||
| 88 | (define-key news-reply-mode-map [menu-bar fields news-reply-keywords] | ||
| 89 | '("Keywords" . news-reply-keywords)) | ||
| 90 | (define-key news-reply-mode-map [menu-bar fields news-reply-newsgroups] | ||
| 91 | '("Newsgroups" . news-reply-newsgroups)) | ||
| 92 | (define-key news-reply-mode-map [menu-bar fields news-reply-followup-to] | ||
| 93 | '("Followup-to" . news-reply-followup-to)) | ||
| 94 | (define-key news-reply-mode-map [menu-bar fields mail-subject] | ||
| 95 | '("Subject" . mail-subject)) | ||
| 96 | (define-key news-reply-mode-map [menu-bar fields news-reply-summary] | ||
| 97 | '("Summary" . news-reply-summary)) | ||
| 98 | (define-key news-reply-mode-map [menu-bar fields mail-text] | ||
| 99 | '("Text" . mail-text)) | ||
| 100 | (define-key news-reply-mode-map [menu-bar news] | ||
| 101 | (cons "News" (make-sparse-keymap "News"))) | ||
| 102 | (define-key news-reply-mode-map [menu-bar news news-caesar-buffer-body] | ||
| 103 | '("Rot13" . news-caesar-buffer-body)) | ||
| 104 | (define-key news-reply-mode-map [menu-bar news news-reply-yank-original] | ||
| 105 | '("Yank Original" . news-reply-yank-original)) | ||
| 106 | (define-key news-reply-mode-map [menu-bar news mail-fill-yanked-message] | ||
| 107 | '("Fill Yanked Messages" . mail-fill-yanked-message)) | ||
| 108 | (define-key news-reply-mode-map [menu-bar news news-inews] | ||
| 109 | '("Send" . news-inews)))) | ||
| 110 | |||
| 111 | (defun news-reply-mode () | ||
| 112 | "Major mode for editing news to be posted on USENET. | ||
| 113 | First-time posters are asked to please read the articles in newsgroup: | ||
| 114 | news.announce.newusers . | ||
| 115 | Like Text Mode but with these additional commands: | ||
| 116 | |||
| 117 | C-c C-s news-inews (post the message) C-c C-c news-inews | ||
| 118 | C-c C-f move to a header field (and create it if there isn't): | ||
| 119 | C-c C-f C-n move to Newsgroups: C-c C-f C-s move to Subj: | ||
| 120 | C-c C-f C-f move to Followup-To: C-c C-f C-k move to Keywords: | ||
| 121 | C-c C-f C-d move to Distribution: C-c C-f C-a move to Summary: | ||
| 122 | C-c C-y news-reply-yank-original (insert current message, in NEWS). | ||
| 123 | C-c C-q mail-fill-yanked-message (fill what was yanked). | ||
| 124 | C-c C-r caesar rotate all letters by 13 places in the article's body (rot13)." | ||
| 125 | (interactive) | ||
| 126 | (kill-all-local-variables) | ||
| 127 | (make-local-variable 'mail-reply-buffer) | ||
| 128 | (setq mail-reply-buffer nil) | ||
| 129 | (set-syntax-table text-mode-syntax-table) | ||
| 130 | (use-local-map news-reply-mode-map) | ||
| 131 | (setq local-abbrev-table text-mode-abbrev-table) | ||
| 132 | (setq major-mode 'news-reply-mode) | ||
| 133 | (setq mode-name "News Reply") | ||
| 134 | (make-local-variable 'paragraph-separate) | ||
| 135 | (make-local-variable 'paragraph-start) | ||
| 136 | (run-mode-hooks 'text-mode-hook 'news-reply-mode-hook)) | ||
| 137 | |||
| 138 | (defvar news-reply-yank-from "" | ||
| 139 | "Save `From:' field for `news-reply-yank-original'.") | ||
| 140 | |||
| 141 | (defvar news-reply-yank-message-id "" | ||
| 142 | "Save `Message-Id:' field for `news-reply-yank-original'.") | ||
| 143 | |||
| 144 | (defun news-reply-yank-original (arg) | ||
| 145 | "Insert the message being replied to, if any (in Mail mode). | ||
| 146 | Puts point before the text and mark after. | ||
| 147 | Indents each nonblank line ARG spaces (default 3). | ||
| 148 | Just \\[universal-argument] as argument means don't indent | ||
| 149 | and don't delete any header fields." | ||
| 150 | (interactive "P") | ||
| 151 | (mail-yank-original arg) | ||
| 152 | (exchange-point-and-mark) | ||
| 153 | (run-hooks 'news-reply-header-hook)) | ||
| 154 | |||
| 155 | (defvar news-reply-header-hook | ||
| 156 | (lambda () | ||
| 157 | (insert "In article " news-reply-yank-message-id | ||
| 158 | " " news-reply-yank-from " writes:\n\n")) | ||
| 159 | "Hook for inserting a header at the top of a yanked message.") | ||
| 160 | |||
| 161 | (defun news-reply-newsgroups () | ||
| 162 | "Move point to end of `Newsgroups:' field. | ||
| 163 | RFC 850 constrains the `Newsgroups:' field to be a comma-separated list | ||
| 164 | of valid newsgroup names at your site. For example, | ||
| 165 | Newsgroups: news.misc,comp.misc,rec.misc" | ||
| 166 | (interactive) | ||
| 167 | (expand-abbrev) | ||
| 168 | (goto-char (point-min)) | ||
| 169 | (mail-position-on-field "Newsgroups")) | ||
| 170 | |||
| 171 | (defun news-reply-followup-to () | ||
| 172 | "Move point to end of `Followup-To:' field. Create the field if none. | ||
| 173 | One usually requests followups to only one newsgroup. | ||
| 174 | RFC 850 constrains the `Followup-To:' field to be a comma-separated list | ||
| 175 | of valid newsgroups names at your site, and it must be a subset of the | ||
| 176 | `Newsgroups:' field. For example: | ||
| 177 | Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc | ||
| 178 | Followup-To: news.misc,comp.misc,rec.misc" | ||
| 179 | (interactive) | ||
| 180 | (expand-abbrev) | ||
| 181 | (or (mail-position-on-field "Followup-To" t) | ||
| 182 | (progn (mail-position-on-field "newsgroups") | ||
| 183 | (insert "\nFollowup-To: "))) | ||
| 184 | ;; @@ could do a completing read based on the Newsgroups: field to | ||
| 185 | ;; @@ fill in the Followup-To: field | ||
| 186 | ) | ||
| 187 | |||
| 188 | (defun news-reply-distribution () | ||
| 189 | "Move point to end of `Distribution:' optional field. | ||
| 190 | Create the field if none. Without this field the posting goes to all of | ||
| 191 | USENET. The field is used to restrict the posting to parts of USENET." | ||
| 192 | (interactive) | ||
| 193 | (expand-abbrev) | ||
| 194 | (mail-position-on-field "Distribution") | ||
| 195 | ;; @@could do a completing read based on the news library file: | ||
| 196 | ;; @@ ../distributions to fill in the field. | ||
| 197 | ) | ||
| 198 | |||
| 199 | (defun news-reply-keywords () | ||
| 200 | "Move point to end of `Keywords:' optional field. Create the field if none. | ||
| 201 | Used as an aid to the news reader, it can contain a few, well selected keywords | ||
| 202 | identifying the message." | ||
| 203 | (interactive) | ||
| 204 | (expand-abbrev) | ||
| 205 | (mail-position-on-field "Keywords")) | ||
| 206 | |||
| 207 | (defun news-reply-summary () | ||
| 208 | "Move point to end of `Summary:' optional field. Create the field if none. | ||
| 209 | Used as an aid to the news reader, it can contain a succinct | ||
| 210 | summary (abstract) of the message." | ||
| 211 | (interactive) | ||
| 212 | (expand-abbrev) | ||
| 213 | (mail-position-on-field "Summary")) | ||
| 214 | |||
| 215 | (defun news-reply-signature () | ||
| 216 | "The inews program appends `~/.signature' automatically." | ||
| 217 | (interactive) | ||
| 218 | (message "Posting news will append your signature automatically.")) | ||
| 219 | |||
| 220 | (defun news-setup (to subject in-reply-to newsgroups replybuffer) | ||
| 221 | "Set up the news reply or posting buffer with the proper headers and mode." | ||
| 222 | (setq mail-reply-buffer replybuffer) | ||
| 223 | (let ((mail-setup-hook nil) | ||
| 224 | ;; Avoid inserting a signature. | ||
| 225 | (mail-signature)) | ||
| 226 | (if (null to) | ||
| 227 | ;; this hack is needed so that inews wont be confused by | ||
| 228 | ;; the fcc: and bcc: fields | ||
| 229 | (let ((mail-self-blind nil) | ||
| 230 | (mail-archive-file-name nil)) | ||
| 231 | (mail-setup to subject in-reply-to nil replybuffer nil) | ||
| 232 | (beginning-of-line) | ||
| 233 | (delete-region (point) (progn (forward-line 1) (point))) | ||
| 234 | (goto-char (point-max))) | ||
| 235 | (mail-setup to subject in-reply-to nil replybuffer nil)) | ||
| 236 | ;;;(mail-position-on-field "Posting-Front-End") | ||
| 237 | ;;;(insert (emacs-version)) | ||
| 238 | (goto-char (point-max)) | ||
| 239 | (if (let ((case-fold-search t)) | ||
| 240 | (re-search-backward "^Subject:" (point-min) t)) | ||
| 241 | (progn (beginning-of-line) | ||
| 242 | (insert "Newsgroups: " (or newsgroups "") "\n") | ||
| 243 | (if (not newsgroups) | ||
| 244 | (backward-char 1) | ||
| 245 | (goto-char (point-max))))) | ||
| 246 | (let (actual-header-separator) | ||
| 247 | (rfc822-goto-eoh) | ||
| 248 | (setq actual-header-separator (buffer-substring | ||
| 249 | (point) | ||
| 250 | (save-excursion (end-of-line) (point)))) | ||
| 251 | (setq paragraph-start | ||
| 252 | (concat "^" actual-header-separator "$\\|" paragraph-start)) | ||
| 253 | (setq paragraph-separate | ||
| 254 | (concat "^" actual-header-separator "$\\|" paragraph-separate))) | ||
| 255 | (run-hooks 'news-setup-hook))) | ||
| 256 | |||
| 257 | (defun news-inews () | ||
| 258 | "Send a news message using inews." | ||
| 259 | (interactive) | ||
| 260 | (let* (newsgroups subject | ||
| 261 | (case-fold-search nil)) | ||
| 262 | (save-excursion | ||
| 263 | (save-restriction | ||
| 264 | (narrow-to-region (point-min) (mail-header-end)) | ||
| 265 | (setq newsgroups (mail-fetch-field "newsgroups") | ||
| 266 | subject (mail-fetch-field "subject"))) | ||
| 267 | (widen) | ||
| 268 | (goto-char (point-min)) | ||
| 269 | (run-hooks 'news-inews-hook) | ||
| 270 | (mail-sendmail-undelimit-header) | ||
| 271 | (goto-char (point-max)) | ||
| 272 | ;; require a newline at the end for inews to append .signature to | ||
| 273 | (or (= (preceding-char) ?\n) | ||
| 274 | (insert ?\n)) | ||
| 275 | (message "Posting to USENET...") | ||
| 276 | (unwind-protect | ||
| 277 | (if (not (eq 0 | ||
| 278 | (call-process-region (point-min) (point-max) | ||
| 279 | news-inews-program nil 0 nil | ||
| 280 | "-h"))) ; take all header lines! | ||
| 281 | ;@@ setting of subject and newsgroups still needed? | ||
| 282 | ;"-t" subject | ||
| 283 | ;"-n" newsgroups | ||
| 284 | (error "Posting to USENET failed") | ||
| 285 | (message "Posting to USENET... done")) | ||
| 286 | (mail-sendmail-delimit-header) | ||
| 287 | (set-buffer-modified-p nil))) | ||
| 288 | (bury-buffer))) | ||
| 289 | |||
| 290 | ;@@ shares some code with news-reply and news-post-news | ||
| 291 | (defun news-mail-reply () | ||
| 292 | "Mail a reply to the author of the current article. | ||
| 293 | While composing the reply, use \\[news-reply-yank-original] to yank the | ||
| 294 | original message into it." | ||
| 295 | (interactive) | ||
| 296 | (let (from cc subject date to reply-to message-id | ||
| 297 | (buffer (current-buffer))) | ||
| 298 | (save-restriction | ||
| 299 | (narrow-to-region (point-min) (progn (goto-char (point-min)) | ||
| 300 | (search-forward "\n\n") | ||
| 301 | (1- (point)))) | ||
| 302 | (setq from (mail-fetch-field "from") | ||
| 303 | subject (mail-fetch-field "subject") | ||
| 304 | reply-to (mail-fetch-field "reply-to") | ||
| 305 | date (mail-fetch-field "date") | ||
| 306 | message-id (mail-fetch-field "message-id"))) | ||
| 307 | (setq to from) | ||
| 308 | (pop-to-buffer "*mail*") | ||
| 309 | (mail nil | ||
| 310 | (if reply-to reply-to to) | ||
| 311 | subject | ||
| 312 | (let ((stop-pos (string-match " *at \\| *@ \\| *(\\| *<" from))) | ||
| 313 | (concat (if stop-pos (substring from 0 stop-pos) from) | ||
| 314 | "'s message " | ||
| 315 | (if message-id | ||
| 316 | (concat message-id " of ") | ||
| 317 | "of ") | ||
| 318 | date)) | ||
| 319 | nil | ||
| 320 | buffer))) | ||
| 321 | |||
| 322 | ;@@ the guts of news-reply and news-post-news should be combined. -tower | ||
| 323 | (defun news-reply () | ||
| 324 | "Compose and post a reply (aka a followup) to the current article on USENET. | ||
| 325 | While composing the followup, use \\[news-reply-yank-original] to yank the | ||
| 326 | original message into it." | ||
| 327 | (interactive) | ||
| 328 | (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") | ||
| 329 | (let (from cc subject date to followup-to newsgroups message-of | ||
| 330 | references distribution message-id | ||
| 331 | (buffer (current-buffer))) | ||
| 332 | (save-restriction | ||
| 333 | (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | ||
| 334 | ;@@ of article file | ||
| 335 | (equal major-mode 'news-mode) ;@@ if rmail-mode, | ||
| 336 | ;@@ should show full headers | ||
| 337 | (progn | ||
| 338 | (news-show-all-headers) ;@@ should save/restore header state, | ||
| 339 | ;@@ but rnews.el lacks support | ||
| 340 | (narrow-to-region (point-min) (progn (goto-char (point-min)) | ||
| 341 | (search-forward "\n\n") | ||
| 342 | (- (point) 1))))) | ||
| 343 | (setq from (mail-fetch-field "from") | ||
| 344 | news-reply-yank-from from | ||
| 345 | ;; @@ not handling old Title: field | ||
| 346 | subject (mail-fetch-field "subject") | ||
| 347 | date (mail-fetch-field "date") | ||
| 348 | followup-to (mail-fetch-field "followup-to") | ||
| 349 | newsgroups (or followup-to | ||
| 350 | (mail-fetch-field "newsgroups")) | ||
| 351 | references (mail-fetch-field "references") | ||
| 352 | ;; @@ not handling old Article-I.D.: field | ||
| 353 | distribution (mail-fetch-field "distribution") | ||
| 354 | message-id (mail-fetch-field "message-id") | ||
| 355 | news-reply-yank-message-id message-id) | ||
| 356 | (pop-to-buffer "*post-news*") | ||
| 357 | (news-reply-mode) | ||
| 358 | (if (and (buffer-modified-p) | ||
| 359 | (not | ||
| 360 | (y-or-n-p "Unsent article being composed; erase it? "))) | ||
| 361 | () | ||
| 362 | (progn | ||
| 363 | (erase-buffer) | ||
| 364 | (and subject | ||
| 365 | (progn (if (string-match "\\`Re: " subject) | ||
| 366 | (while (string-match "\\`Re: " subject) | ||
| 367 | (setq subject (substring subject 4)))) | ||
| 368 | (setq subject (concat "Re: " subject)))) | ||
| 369 | (and from | ||
| 370 | (progn | ||
| 371 | (let ((stop-pos | ||
| 372 | (string-match " *at \\| *@ \\| *(\\| *<" from))) | ||
| 373 | (setq message-of | ||
| 374 | (concat | ||
| 375 | (if stop-pos (substring from 0 stop-pos) from) | ||
| 376 | "'s message " | ||
| 377 | (if message-id | ||
| 378 | (concat message-id " of ") | ||
| 379 | "of ") | ||
| 380 | date))))) | ||
| 381 | (news-setup | ||
| 382 | nil | ||
| 383 | subject | ||
| 384 | message-of | ||
| 385 | newsgroups | ||
| 386 | buffer) | ||
| 387 | (if followup-to | ||
| 388 | (progn (news-reply-followup-to) | ||
| 389 | (insert followup-to))) | ||
| 390 | (if distribution | ||
| 391 | (progn | ||
| 392 | (mail-position-on-field "Distribution") | ||
| 393 | (insert distribution))) | ||
| 394 | (mail-position-on-field "References") | ||
| 395 | (if references | ||
| 396 | (insert references)) | ||
| 397 | (if (and references message-id) | ||
| 398 | (insert " ")) | ||
| 399 | (if message-id | ||
| 400 | (insert message-id)) | ||
| 401 | (goto-char (point-max)))))) | ||
| 402 | (message ""))) | ||
| 403 | |||
| 404 | ;@@ the guts of news-reply and news-post-news should be combined. -tower | ||
| 405 | ;;;###autoload | ||
| 406 | (defun news-post-news (&optional noquery) | ||
| 407 | "Begin editing a new USENET news article to be posted. | ||
| 408 | Type \\[describe-mode] once editing the article to get a list of commands. | ||
| 409 | If NOQUERY is non-nil, we do not query before doing the work." | ||
| 410 | (interactive) | ||
| 411 | (if (or noquery | ||
| 412 | (y-or-n-p "Are you sure you want to post to all of USENET? ")) | ||
| 413 | (let ((buffer (current-buffer))) | ||
| 414 | (save-restriction | ||
| 415 | (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | ||
| 416 | ;@@ of article file | ||
| 417 | (equal major-mode 'news-mode) ;@@ if rmail-mode, | ||
| 418 | ;@@ should show full headers | ||
| 419 | (progn | ||
| 420 | (news-show-all-headers) ;@@ should save/restore header state, | ||
| 421 | ;@@ but rnews.el lacks support | ||
| 422 | (narrow-to-region (point-min) (progn (goto-char (point-min)) | ||
| 423 | (search-forward "\n\n") | ||
| 424 | (- (point) 1))))) | ||
| 425 | (setq news-reply-yank-from (mail-fetch-field "from") | ||
| 426 | ;; @@ not handling old Article-I.D.: field | ||
| 427 | news-reply-yank-message-id (mail-fetch-field "message-id"))) | ||
| 428 | (pop-to-buffer "*post-news*") | ||
| 429 | (news-reply-mode) | ||
| 430 | (if (and (buffer-modified-p) | ||
| 431 | (not (y-or-n-p "Unsent article being composed; erase it? "))) | ||
| 432 | () ;@@ not saving point from last time | ||
| 433 | (progn (erase-buffer) | ||
| 434 | (news-setup () () () () buffer)))) | ||
| 435 | (message ""))) | ||
| 436 | |||
| 437 | (defun news-mail-other-window () | ||
| 438 | "Send mail in another window. | ||
| 439 | While composing the message, use \\[news-reply-yank-original] to yank the | ||
| 440 | original message into it." | ||
| 441 | (interactive) | ||
| 442 | (mail-other-window nil nil nil nil nil (current-buffer))) | ||
| 443 | |||
| 444 | (provide 'rnewspost) | ||
| 445 | |||
| 446 | ;; arch-tag: 18f7b2af-cf9a-49e4-878b-71eb49913e00 | ||
| 447 | ;;; rnewspost.el ends here | ||