;;; gnus-uu.el --- extract (uu)encoded files in Gnus
-;; Copyright (C) 198,995,86,87,93,94,95,96,97,98 Free Software Foundation, Inc.
+;; Copyright (C) 1985,86,87,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Created: 2 Oct 1993
(require 'gnus-art)
(require 'message)
(require 'gnus-msg)
-(require 'mm-decode)
(defgroup gnus-extract nil
"Extracting encoded files."
;; Various variables users may set
-(defcustom gnus-uu-tmp-dir
- (cond ((fboundp 'temp-directory) (temp-directory))
- ((boundp 'temporary-file-directory) temporary-file-directory)
- ("/tmp/"))
+(defcustom gnus-uu-tmp-dir "/tmp/"
"*Variable saying where gnus-uu is to do its work.
Default is \"/tmp/\"."
:group 'gnus-extract
(defvar gnus-uu-shar-begin-string "^#! */bin/sh")
(defvar gnus-uu-shar-file-name nil)
-(defvar gnus-uu-shar-name-marker
- "begin [0-7][0-7][0-7][ \t]+\\(\\(\\w\\|\\.\\)*\\b\\)")
+(defvar gnus-uu-shar-name-marker "begin [0-7][0-7][0-7][ \t]+\\(\\(\\w\\|\\.\\)*\\b\\)")
(defvar gnus-uu-postscript-begin-string "^%!PS-")
(defvar gnus-uu-postscript-end-string "^%%EOF$")
(delete-region (point) (gnus-point-at-eol))
(insert from))
(message-forward post))
+ (delete-file file)
+ (kill-buffer buf)
(setq gnus-uu-digest-from-subject nil)))
(defun gnus-uu-digest-post-forward (&optional n)
(defun gnus-uu-mark-thread ()
"Marks all articles downwards in this thread."
(interactive)
- (gnus-save-hidden-threads
- (let ((level (gnus-summary-thread-level)))
- (while (and (gnus-summary-set-process-mark (gnus-summary-article-number))
- (zerop (gnus-summary-next-subject 1))
- (> (gnus-summary-thread-level) level)))))
+ (let ((level (gnus-summary-thread-level)))
+ (while (and (gnus-summary-set-process-mark (gnus-summary-article-number))
+ (zerop (gnus-summary-next-subject 1))
+ (> (gnus-summary-thread-level) level))))
(gnus-summary-position-point))
(defun gnus-uu-unmark-thread ()
(eq in-state 'first-and-last))
(progn
(setq state (list 'begin))
- (save-excursion
- (set-buffer (gnus-get-buffer-create "*gnus-uu-body*"))
- (erase-buffer))
+ (save-excursion (set-buffer (gnus-get-buffer-create "*gnus-uu-body*"))
+ (erase-buffer))
(save-excursion
(set-buffer (gnus-get-buffer-create "*gnus-uu-pre*"))
(erase-buffer)
;; finally just replaces the next to last number with "[0-9]+".
(save-excursion
(set-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name))
- (buffer-disable-undo)
+ (buffer-disable-undo (current-buffer))
(erase-buffer)
(insert (regexp-quote string))
string)
(save-excursion
(set-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name))
- (buffer-disable-undo)
+ (buffer-disable-undo (current-buffer))
(while string-list
(erase-buffer)
(insert (caar string-list))
&optional sloppy limit no-errors)
(let ((state 'first)
(gnus-asynchronous nil)
- (gnus-inhibit-treatment t)
has-been-begin article result-file result-files process-state
gnus-summary-display-article-function
- gnus-article-prepare-hook
+ gnus-article-display-hook gnus-article-prepare-hook
article-series files)
(while (and articles
(when (setq buf (get-buffer gnus-uu-output-buffer-name))
(kill-buffer buf))))
+(defun gnus-quote-arg-for-sh-or-csh (arg)
+ (let ((pos 0) new-pos accum)
+ ;; *** bug: we don't handle newline characters properly
+ (while (setq new-pos (string-match "[!`\"$\\& \t{}]" arg pos))
+ (push (substring arg pos new-pos) accum)
+ (push "\\" accum)
+ (push (list (aref arg new-pos)) accum)
+ (setq pos (1+ new-pos)))
+ (if (= pos 0)
+ arg
+ (apply 'concat (nconc (nreverse accum) (list (substring arg pos)))))))
+
;; Inputs an action and a filename and returns a full command, making sure
;; that the filename will be treated as a single argument when the shell
;; executes the command.
(defun gnus-uu-command (action file)
- (let ((quoted-file (mm-quote-arg file)))
+ (let ((quoted-file (gnus-quote-arg-for-sh-or-csh file)))
(if (string-match "%s" action)
(format action quoted-file)
(concat action " " quoted-file))))
(gnus-summary-post-news)
- (let ((map (make-sparse-keymap)))
- (set-keymap-parent map (current-local-map))
- (use-local-map map))
+ (use-local-map (copy-keymap (current-local-map)))
(local-set-key "\C-c\C-c" 'gnus-summary-edit-article-done)
(local-set-key "\C-c\C-c" 'gnus-uu-post-news-inews)
(local-set-key "\C-c\C-s" 'gnus-uu-post-news-inews)