Commit 51e4457a authored by Stefan Monnier's avatar Stefan Monnier

* lisp/tar-mode.el: Use lexical-binding; remove redundant :groups.

(tar-new-entry): Remove unused var `buffer`.
parent 98247645
;;; tar-mode.el --- simple editing of tar files from GNU Emacs
;;; tar-mode.el --- simple editing of tar files from GNU Emacs -*- lexical-binding:t -*-
;; Copyright (C) 1990-1991, 1993-2019 Free Software Foundation, Inc.
......@@ -110,8 +110,7 @@ this is the size of the *tape* blocks, but when writing to a file, it doesn't
matter much. The only noticeable difference is that if a tar file does not
have a blocksize of 20, tar will tell you that; all this really controls is
how many null padding bytes go on the end of the tar file."
:type '(choice integer (const nil))
:group 'tar)
:type '(choice integer (const nil)))
(defcustom tar-update-datestamp nil
"Non-nil means Tar mode should play fast and loose with sub-file datestamps.
......@@ -121,14 +120,12 @@ You may or may not want this - it is good in that you can tell when a file
in a tar archive has been changed, but it is bad for the same reason that
editing a file in the tar archive at all is bad - the changed version of
the file never exists on disk."
:type 'boolean
:group 'tar)
:type 'boolean)
(defcustom tar-mode-show-date nil
"Non-nil means Tar mode should show the date/time of each subfile.
This information is useful, but it takes screen space away from file names."
:type 'boolean
:group 'tar)
:type 'boolean)
(defvar tar-parse-info nil)
(defvar tar-superior-buffer nil
......@@ -344,7 +341,7 @@ write-date, checksum, link-type, and link-name."
n)))
(define-obsolete-function-alias 'tar-parse-octal-long-integer
'tar-parse-octal-integer "27.1")
#'tar-parse-octal-integer "27.1")
(defun tar-parse-octal-integer-safe (string)
(if (zerop (length string)) (error "empty string"))
......@@ -595,7 +592,7 @@ MODE should be an integer which is a file mode value."
(let ((create-lockfiles nil) ; avoid changing dir mtime by lock_file
(inhibit-read-only t)
(total-summaries
(mapconcat 'tar-header-block-summarize tar-parse-info "\n")))
(mapconcat #'tar-header-block-summarize tar-parse-info "\n")))
(insert total-summaries "\n")
(goto-char (point-min))
(restore-buffer-modified-p modified))))
......@@ -729,13 +726,13 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
;; Now move the Tar data into an auxiliary buffer, so we can use the main
;; buffer for the summary.
(cl-assert (not (tar-data-swapped-p)))
(set (make-local-variable 'revert-buffer-function) 'tar-mode-revert)
(set (make-local-variable 'revert-buffer-function) #'tar-mode-revert)
;; We started using write-contents-functions, but this hook is not
;; used during auto-save, so we now use
;; write-region-annotate-functions which hooks at a lower-level.
(add-hook 'write-region-annotate-functions 'tar-write-region-annotate nil t)
(add-hook 'kill-buffer-hook 'tar-mode-kill-buffer-hook nil t)
(add-hook 'change-major-mode-hook 'tar-change-major-mode-hook nil t)
(add-hook 'write-region-annotate-functions #'tar-write-region-annotate nil t)
(add-hook 'kill-buffer-hook #'tar-mode-kill-buffer-hook nil t)
(add-hook 'change-major-mode-hook #'tar-change-major-mode-hook nil t)
;; Tar data is made of bytes, not chars.
(set-buffer-multibyte nil) ;Hopefully a no-op.
(set (make-local-variable 'tar-data-buffer)
......@@ -769,12 +766,12 @@ actually appear on disk when you save the tar-file's buffer."
(or (and (boundp 'tar-superior-buffer) tar-superior-buffer)
(error "This buffer is not an element of a tar file"))
(cond (tar-subfile-mode
(add-hook 'write-file-functions 'tar-subfile-save-buffer nil t)
(add-hook 'write-file-functions #'tar-subfile-save-buffer nil t)
;; turn off auto-save.
(auto-save-mode -1)
(setq buffer-auto-save-file-name nil))
(t
(remove-hook 'write-file-functions 'tar-subfile-save-buffer t))))
(remove-hook 'write-file-functions #'tar-subfile-save-buffer t))))
;; Revert the buffer and recompute the dired-like listing.
......@@ -1030,8 +1027,7 @@ the current tar-entry."
(defun tar-new-entry (filename &optional index)
"Insert a new empty regular file before point."
(interactive "*sFile name: ")
(let* ((buffer (current-buffer))
(index (or index (tar-current-position)))
(let* ((index (or index (tar-current-position)))
(d-list (and (not (zerop index))
(nthcdr (+ -1 index) tar-parse-info)))
(pos (if d-list
......@@ -1063,7 +1059,7 @@ the current tar-entry."
With a prefix argument, mark that many files."
(interactive "p")
(beginning-of-line)
(dotimes (i (abs p))
(dotimes (_ (abs p))
(if (tar-current-descriptor unflag) ; barf if we're not on an entry-line.
(progn
(delete-char 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment