Remove nnml-retrieve-groups that is unnecessary and somewhat problematic
[gnus] / lisp / gnus-uu.el
index d6aad53..f216466 100644 (file)
@@ -1,7 +1,7 @@
 ;;; gnus-uu.el --- extract (uu)encoded files in Gnus
 
-;; Copyright (C) 1985-1987, 1993-1998, 2000-2011
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1993-1998, 2000-2015 Free Software
+;; Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Created: 2 Oct 1993
@@ -41,7 +41,7 @@
   :group 'gnus)
 
 (defgroup gnus-extract-view nil
-  "Viewwing extracted files."
+  "Viewing extracted files."
   :group 'gnus-extract)
 
 (defgroup gnus-extract-archive nil
@@ -79,10 +79,10 @@ To change the behavior, you can either edit this variable or set
 
 For example:
 
-To make gnus-uu use 'xli' to display JPEG and GIF files, put the
+To make gnus-uu use `xli' to display JPEG and GIF files, put the
 following in your .emacs file:
 
-  (setq gnus-uu-user-view-rules '((\"jpg$\\\\|gif$\" \"xli\")))
+  (setq gnus-uu-user-view-rules \\='((\"jpg$\\\\|gif$\" \"xli\")))
 
 Both these variables are lists of lists with two string elements.  The
 first string is a regular expression.  If the file name matches this
@@ -140,10 +140,10 @@ details."
 
 (defcustom gnus-uu-user-archive-rules nil
   "A list that can be set to override the default archive unpacking commands.
-To use, for instance, 'untar' to unpack tar files and 'zip -x' to
+To use, for instance, `untar' to unpack tar files and `zip -x' to
 unpack zip files, say the following:
   (setq gnus-uu-user-archive-rules
-    '((\"\\\\.tar$\" \"untar\")
+    \\='((\"\\\\.tar$\" \"untar\")
       (\"\\\\.zip$\" \"zip -x\")))"
   :group 'gnus-extract-archive
   :type '(repeat (group regexp (string :tag "Command"))))
@@ -366,7 +366,7 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
   (interactive
    (list current-prefix-arg
         (file-name-as-directory
-         (read-file-name "Uudecode and save in dir: "
+         (read-directory-name "Uudecode and save in dir: "
                          gnus-uu-default-dir
                          gnus-uu-default-dir t))))
   (gnus-uu-decode-with-method 'gnus-uu-uustrip-article n dir nil nil t))
@@ -381,7 +381,7 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
   (interactive
    (list current-prefix-arg
         (file-name-as-directory
-         (read-file-name "Unshar and save in dir: "
+         (read-directory-name "Unshar and save in dir: "
                          gnus-uu-default-dir
                          gnus-uu-default-dir t))))
   (gnus-uu-decode-with-method 'gnus-uu-unshar-article n dir nil 'scan t))
@@ -390,12 +390,11 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
   "Saves the current article."
   (interactive
    (list current-prefix-arg
-        (read-file-name
-         (if gnus-uu-save-separate-articles
-             "Save articles in dir: "
-           "Save articles in file: ")
-         gnus-uu-default-dir
-         gnus-uu-default-dir)))
+        (if gnus-uu-save-separate-articles
+            (read-directory-name
+             "Save articles in dir: " gnus-uu-default-dir gnus-uu-default-dir)
+          (read-file-name
+           "Save article in file: " gnus-uu-default-dir gnus-uu-default-dir))))
   (setq gnus-uu-saved-article-name file)
   (gnus-uu-decode-with-method 'gnus-uu-save-article n nil t))
 
@@ -404,9 +403,10 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
   (interactive
    (list current-prefix-arg
         (file-name-as-directory
-         (read-file-name "Unbinhex and save in dir: "
+         (read-directory-name "Unbinhex and save in dir: "
                          gnus-uu-default-dir
                          gnus-uu-default-dir))))
+  (gnus-uu-initialize)
   (setq gnus-uu-binhex-article-name
        (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir)))
   (gnus-uu-decode-with-method 'gnus-uu-binhex-article n dir))
@@ -416,7 +416,7 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
   (interactive
    (list current-prefix-arg
         (file-name-as-directory
-         (read-file-name "yEnc decode and save in dir: "
+         (read-directory-name "yEnc decode and save in dir: "
                          gnus-uu-default-dir
                          gnus-uu-default-dir))))
   (setq gnus-uu-yenc-article-name nil)
@@ -458,10 +458,11 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
   "Saves and views the current article."
   (interactive
    (list current-prefix-arg
-        (read-file-name  (if gnus-uu-save-separate-articles
-                             "Save articles is dir: "
-                           "Save articles in file: ")
-                         gnus-uu-default-dir gnus-uu-default-dir)))
+        (if gnus-uu-save-separate-articles
+            (read-directory-name "Save articles in dir: "
+                                 gnus-uu-default-dir gnus-uu-default-dir)
+          (read-file-name "Save articles in file: "
+                          gnus-uu-default-dir gnus-uu-default-dir))))
   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
     (gnus-uu-decode-save n file)))
 
@@ -471,6 +472,7 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
    (list current-prefix-arg
         (read-file-name "Unbinhex, view and save in dir: "
                         gnus-uu-default-dir gnus-uu-default-dir)))
+  (gnus-uu-initialize)
   (setq gnus-uu-binhex-article-name
        (mm-make-temp-file (expand-file-name "binhex" gnus-uu-work-dir)))
   (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
@@ -482,8 +484,9 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
 (defun gnus-uu-digest-mail-forward (&optional n post)
   "Digests and forwards all articles in this series."
   (interactive "P")
+  (gnus-uu-initialize)
   (let ((gnus-uu-save-in-digest t)
-       (file (mm-make-temp-file (nnheader-concat gnus-uu-tmp-dir "forward")))
+       (file (mm-make-temp-file (nnheader-concat gnus-uu-work-dir "forward")))
        (message-forward-as-mime message-forward-as-mime)
        (mail-parse-charset gnus-newsgroup-charset)
        (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
@@ -640,7 +643,7 @@ When called interactively, prompt for REGEXP."
     (let ((level (gnus-summary-thread-level)))
       (while (and (gnus-summary-set-process-mark
                   (gnus-summary-article-number))
-                 (zerop (gnus-summary-next-subject 1 nil t))
+                 (zerop (forward-line 1))
                  (> (gnus-summary-thread-level) level)))))
   (gnus-summary-position-point))
 
@@ -650,7 +653,7 @@ When called interactively, prompt for REGEXP."
   (let ((level (gnus-summary-thread-level)))
     (while (and (gnus-summary-remove-process-mark
                 (gnus-summary-article-number))
-               (zerop (gnus-summary-next-subject 1))
+               (zerop (forward-line 1))
                (> (gnus-summary-thread-level) level))))
   (gnus-summary-position-point))
 
@@ -727,7 +730,7 @@ When called interactively, prompt for REGEXP."
 ;; All PostScript functions written by Erik Selberg <speed@cs.washington.edu>.
 
 (defun gnus-uu-decode-postscript (&optional n)
-  "Gets postscript of the current article."
+  "Gets PostScript of the current article."
   (interactive "P")
   (gnus-uu-decode-with-method 'gnus-uu-decode-postscript-article n))
 
@@ -738,11 +741,11 @@ When called interactively, prompt for REGEXP."
     (gnus-uu-decode-postscript n)))
 
 (defun gnus-uu-decode-postscript-and-save (n dir)
-  "Extracts postscript and saves the current article."
+  "Extracts PostScript and saves the current article."
   (interactive
    (list current-prefix-arg
         (file-name-as-directory
-         (read-file-name "Save in dir: "
+         (read-directory-name "Save in dir: "
                          gnus-uu-default-dir
                          gnus-uu-default-dir t))))
   (gnus-uu-decode-with-method 'gnus-uu-decode-postscript-article
@@ -870,10 +873,9 @@ When called interactively, prompt for REGEXP."
          (setq state (list 'middle))))
       (with-current-buffer "*gnus-uu-body*"
        (goto-char (setq beg (point-max)))
-       (save-excursion
+       (with-current-buffer buffer
          (save-restriction
-           (set-buffer buffer)
-           (let (buffer-read-only)
+           (let ((inhibit-read-only t))
              (set-text-properties (point-min) (point-max) nil)
              ;; These two are necessary for XEmacs 19.12 fascism.
              (put-text-property (point-min) (point-max) 'invisible nil)
@@ -907,8 +909,7 @@ When called interactively, prompt for REGEXP."
                                 (match-beginning 0)
                                 (or (and (re-search-forward "^[^ \t]" nil t)
                                          (1- (point)))
-                                    (progn (forward-line 1) (point)))))))))
-           (widen)))
+                                    (progn (forward-line 1) (point)))))))))))
        (if (and message-forward-as-mime gnus-uu-digest-buffer)
          (if message-forward-show-mml
              (progn
@@ -1290,6 +1291,7 @@ When called interactively, prompt for REGEXP."
 ;; the process-function has been successful and nil otherwise.
 (defun gnus-uu-grab-articles (articles process-function
                                       &optional sloppy limit no-errors)
+  (require 'gnus-async)
   (let ((state 'first)
        (gnus-asynchronous nil)
        (gnus-inhibit-treatment t)
@@ -1614,16 +1616,6 @@ Gnus might fail to display all of it.")
                   gnus-shell-command-separator  " sh")))))
     state))
 
-;; Returns the name of what the shar file is going to unpack.
-(defun gnus-uu-find-name-in-shar ()
-  (let ((oldpoint (point))
-       res)
-    (goto-char (point-min))
-    (when (re-search-forward gnus-uu-shar-name-marker nil t)
-      (setq res (buffer-substring (match-beginning 1) (match-end 1))))
-    (goto-char oldpoint)
-    res))
-
 ;; `gnus-uu-choose-action' chooses what action to perform given the name
 ;; and `gnus-uu-file-action-list'.  Returns either nil if no action is
 ;; found, or the name of the command to run if such a rule is found.
@@ -1845,8 +1837,8 @@ Gnus might fail to display all of it.")
 
 ;; Initializing
 
-(add-hook 'gnus-exit-group-hook 'gnus-uu-clean-up)
-(add-hook 'gnus-exit-group-hook        'gnus-uu-delete-work-dir)
+(add-hook 'gnus-summary-prepare-exit-hook 'gnus-uu-clean-up)
+(add-hook 'gnus-summary-prepare-exit-hook 'gnus-uu-delete-work-dir)
 
 \f