;;; arc-mode.el --- simple editing of archives
-;; Copyright (C) 1995, 1997, 1998, 2003, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 1998, 2002, 2003, 2004,
+;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Morten Welinder <terra@gnu.org>
;; Keywords: archives msdog editing major-mode
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
(make-temp-name
(expand-file-name (if (eq system-type 'ms-dos) "ar" "archive.tmp")
temporary-file-directory))
- "Directory for temporary files made by arc-mode.el."
+ "Directory for temporary files made by `arc-mode.el'."
:type 'directory
:group 'archive)
'("unzip" "-qq" "-c"))
"*Program and its options to run in order to extract a zip file member.
Extraction should happen to standard output. Archive and member name will
-be added. If `archive-zip-use-pkzip' is non-nil then this program is
-expected to extract to a file junking the directory part of the name."
+be added."
:type '(list (string :tag "Program")
(repeat :tag "Options"
:inline t
(intern (concat "archive-" (symbol-name archive-subtype) "-" suffix)))
(defun archive-l-e (str &optional len)
- "Convert little endian string/vector to integer.
-Alternatively, first argument may be a buffer position in the current buffer
-in which case a second argument, length, should be supplied."
+ "Convert little endian string/vector STR to integer.
+Alternatively, STR may be a buffer position in the current buffer
+in which case a second argument, length LEN, should be supplied."
(if (stringp str)
(setq len (length str))
(setq str (buffer-substring str (+ str len))))
(format "%02d:%02d:%02d" hour minute second)))
(defun archive-unixdate (low high)
- "Stringify unix (LOW HIGH) date."
+ "Stringify Unix (LOW HIGH) date."
(let ((str (current-time-string (cons high low))))
(format "%s-%s-%s"
(substring str 8 10)
(substring str 20 24))))
(defun archive-unixtime (low high)
- "Stringify unix (LOW HIGH) time."
+ "Stringify Unix (LOW HIGH) time."
(let ((str (current-time-string (cons high low))))
(substring str 11 19)))
(defun archive-get-descr (&optional noerror)
"Return the descriptor vector for file at point.
-Does not signal an error if optional second argument NOERROR is non-nil."
+Does not signal an error if optional argument NOERROR is non-nil."
(let ((no (archive-get-lineno)))
(if (and (>= (point) archive-file-list-start)
(< no (length archive-files)))
(defun archive-alternate-display ()
"Toggle alternative display.
-To avoid very long lines some archive mode don't show all information.
+To avoid very long lines archive mode does not show all information.
This function changes the set of information shown for each files."
(interactive)
(setq archive-alternate-display (not archive-alternate-display))
(archive-name
(or (and archive-subfile-mode (aref archive-subfile-mode 0))
archive)))
- (make-directory archive-tmpdir t)
- ;; If ARCHIVE includes leading directories, make sure they
- ;; exist under archive-tmpdir.
- (let ((arch-dir (file-name-directory archive)))
- (if arch-dir
- (make-directory (concat
- (file-name-as-directory archive-tmpdir)
- arch-dir)
- t)))
(setq archive-local-name
(archive-unique-fname archive-name archive-tmpdir))
+ ;; Maked sure all the leading directories in
+ ;; archive-local-name exist under archive-tmpdir, so that
+ ;; the directory structure recorded in the archive is
+ ;; reconstructed in the temporary directory.
+ (make-directory (file-name-directory archive-local-name) t)
(save-restriction
(widen)
(write-region start (point-max) archive-local-name nil 'nomessage))
(defun archive-extract (&optional other-window-p event)
"In archive mode, extract this entry of the archive into its own buffer."
(interactive (list nil last-input-event))
- (if event (mouse-set-point event))
+ (if event (posn-set-point (event-end event)))
(let* ((view-p (eq other-window-p 'view))
(descr (archive-get-descr))
(ename (aref descr 0))
(read-only-p (or archive-read-only
view-p
(string-match file-name-invalid-regexp ename)))
+ (arcfilename (expand-file-name (concat arcname ":" iname)))
(buffer (get-buffer bufname))
(just-created nil))
- (if buffer
+ (if (and buffer
+ (string= (buffer-file-name buffer) arcfilename))
nil
(setq archive (archive-maybe-copy archive))
+ (setq bufname (generate-new-buffer-name bufname))
(setq buffer (get-buffer-create bufname))
(setq just-created t)
(with-current-buffer buffer
- (setq buffer-file-name
- (expand-file-name (concat arcname ":" iname)))
+ (setq buffer-file-name arcfilename)
(setq buffer-file-truename
(abbreviate-file-name buffer-file-name))
;; Set the default-directory to the dir of the superior buffer.
"In archive mode, un-mark this member if it is marked to be deleted.
With a prefix argument, un-mark that many files forward."
(interactive "p")
- (archive-flag-deleted p ? ))
+ (archive-flag-deleted p ?\s))
(defun archive-unflag-backwards (p)
"In archive mode, un-mark this member if it is marked to be deleted.
With a prefix argument, un-mark that many members backward."
(interactive "p")
- (archive-flag-deleted (- p) ? ))
+ (archive-flag-deleted (- p) ?\s))
(defun archive-unmark-all-files ()
"Remove all marks."
(save-excursion
(goto-char archive-file-list-start)
(while (< (point) archive-file-list-end)
- (or (= (following-char) ? )
- (progn (delete-char 1) (insert ? )))
+ (or (= (following-char) ?\s)
+ (progn (delete-char 1) (insert ?\s)))
(forward-line 1)))
(restore-buffer-modified-p modified)))
(defun archive-chmod-entry (new-mode)
"Change the protection bits associated with all marked or this member.
The new protection bits can either be specified as an octal number or
-as a relative change like \"g+rw\" as for chmod(2)"
+as a relative change like \"g+rw\" as for chmod(2)."
(interactive "sNew mode (octal or relative): ")
(if archive-read-only (error "Archive is read-only"))
(let ((func (archive-name "chmod-entry")))