Mercurial > emacs
changeset 102732:febdeb5803fd
(archive-ar-summarize): Don't burp on special GNU
extension entries for lookup tables or extended file name tables.
Distinguish the internal and external name, so lookup is easier.
(archive-ar-extract): Take advantage of more precise name.
Preserve point.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 26 Mar 2009 01:19:50 +0000 |
parents | 6673a663a72e |
children | a1a47a7b5087 |
files | lisp/ChangeLog lisp/arc-mode.el |
diffstat | 2 files changed, 59 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Wed Mar 25 17:47:17 2009 +0000 +++ b/lisp/ChangeLog Thu Mar 26 01:19:50 2009 +0000 @@ -1,3 +1,11 @@ +2009-03-26 Stefan Monnier <monnier@iro.umontreal.ca> + + * arc-mode.el (archive-ar-summarize): Don't burp on special GNU + extension entries for lookup tables or extended file name tables. + Distinguish the internal and external name, so lookup is easier. + (archive-ar-extract): Take advantage of more precise name. + Preserve point. + 2009-03-25 Chong Yidong <cyd@stupidchicken.com> * play/bubbles.el (bubbles): Doc fix (Bug#2776). @@ -56,8 +64,8 @@ 2009-03-21 Eli Zaretskii <eliz@gnu.org> - * eshell/em-ls.el (eshell-ls-dir): Call - eshell-directory-files-and-attributes with additional argument + * eshell/em-ls.el (eshell-ls-dir): + Call eshell-directory-files-and-attributes with additional argument 'integer or 'string, according to numeric-uid-gid. (eshell-ls-file): Don't convert UID and GID to strings, as eshell-ls-dir already did. Enlarge max user-name string length to @@ -66,8 +74,8 @@ * eshell/esh-util.el (directory-files-and-attributes): Accept and ignore additional optional argument id-format. - (eshell-directory-files-and-attributes): Call - directory-files-and-attributes with additional argument id-format. + (eshell-directory-files-and-attributes): + Call directory-files-and-attributes with additional argument id-format. * eshell/em-ls.el (eshell-ls-file): Enlarge default size-width to 8. (eshell-ls-dir): Under -l, call eshell-ls-printable-size with last
--- a/lisp/arc-mode.el Wed Mar 25 17:47:17 2009 +0000 +++ b/lisp/arc-mode.el Thu Mar 26 01:19:50 2009 +0000 @@ -2015,6 +2015,7 @@ (search-forward "!<arch>\n") (while (looking-at archive-ar-file-header-re) (let ((name (match-string 1)) + extname ;; Emacs will automatically use float here because those ;; timestamps don't fit in our ints. (time (string-to-number (match-string 2))) @@ -2024,35 +2025,33 @@ (size (string-to-number (match-string 6)))) ;; Move to the beginning of the data. (goto-char (match-end 0)) - (cond - ((equal name "// ") - ;; FIXME: todo - nil) - ((equal name "/ ") - ;; FIXME: todo - nil) - (t - (setq time - (format-time-string - "%Y-%m-%d %H:%M" - (let ((high (truncate (/ time 65536)))) - (list high (truncate (- time (* 65536.0 high))))))) - (setq name (substring name 0 (string-match "/? *\\'" name))) - (setq user (substring user 0 (string-match " +\\'" user))) - (setq group (substring group 0 (string-match " +\\'" group))) - (setq mode (tar-grind-file-mode mode)) - ;; Move to the end of the data. - (forward-char size) (if (eq ?\n (char-after)) (forward-char 1)) - (setq size (number-to-string size)) - (if (> (length name) maxname) (setq maxname (length name))) - (if (> (length time) maxtime) (setq maxtime (length time))) - (if (> (length user) maxuser) (setq maxuser (length user))) - (if (> (length group) maxgroup) (setq maxgroup (length group))) - (if (> (length mode) maxmode) (setq maxmode (length mode))) - (if (> (length size) maxsize) (setq maxsize (length size))) - (push (vector name name nil mode - time user group size) - files))))) + (setq time + (format-time-string + "%Y-%m-%d %H:%M" + (let ((high (truncate (/ time 65536)))) + (list high (truncate (- time (* 65536.0 high))))))) + (setq extname + (cond ((equal name "// ") + (propertize ".<ExtNamesTable>." 'face 'italic)) + ((equal name "/ ") + (propertize ".<LookupTable>." 'face 'italic)) + ((string-match "/? *\\'" name) + (substring name 0 (match-beginning 0))))) + (setq user (substring user 0 (string-match " +\\'" user))) + (setq group (substring group 0 (string-match " +\\'" group))) + (setq mode (tar-grind-file-mode mode)) + ;; Move to the end of the data. + (forward-char size) (if (eq ?\n (char-after)) (forward-char 1)) + (setq size (number-to-string size)) + (if (> (length name) maxname) (setq maxname (length name))) + (if (> (length time) maxtime) (setq maxtime (length time))) + (if (> (length user) maxuser) (setq maxuser (length user))) + (if (> (length group) maxgroup) (setq maxgroup (length group))) + (if (> (length mode) maxmode) (setq maxmode (length mode))) + (if (> (length size) maxsize) (setq maxsize (length size))) + (push (vector name extname nil mode + time user group size) + files))) (setq files (nreverse files)) (goto-char (point-min)) (let* ((format (format "%%%ds %%%ds/%%-%ds %%%ds %%%ds %%s" @@ -2091,25 +2090,25 @@ (save-restriction ;; We may be in archive-mode or not, so either with or without ;; narrowing and with or without a prepended summary. - (widen) - (search-forward "!<arch>\n") - (while (and (not from) (looking-at archive-ar-file-header-re)) - (let ((this (match-string 1))) - (setq size (string-to-number (match-string 6))) - (goto-char (match-end 0)) - (setq this (substring this 0 (string-match "/? *\\'" this))) - (if (equal name this) - (setq from (point)) - ;; Move to the end of the data. - (forward-char size) (if (eq ?\n (char-after)) (forward-char 1))))) - (when from - (set-buffer-multibyte nil) - (with-current-buffer destbuf - ;; Do it within the `widen'. - (insert-buffer-substring archivebuf from (+ from size))) - (set-buffer-multibyte 'to) - ;; Inform the caller that the call succeeded. - t))))) + (save-excursion + (widen) + (search-forward "!<arch>\n") + (while (and (not from) (looking-at archive-ar-file-header-re)) + (let ((this (match-string 1))) + (setq size (string-to-number (match-string 6))) + (goto-char (match-end 0)) + (if (equal name this) + (setq from (point)) + ;; Move to the end of the data. + (forward-char size) (if (eq ?\n (char-after)) (forward-char 1))))) + (when from + (set-buffer-multibyte nil) + (with-current-buffer destbuf + ;; Do it within the `widen'. + (insert-buffer-substring archivebuf from (+ from size))) + (set-buffer-multibyte 'to) + ;; Inform the caller that the call succeeded. + t)))))) ;; ------------------------------------------------------------------------- ;; This line was a mistake; it is kept now for compatibility.