aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-12-02 02:05:48 +0000
committerStefan Monnier2007-12-02 02:05:48 +0000
commitc9db111a741ff4c64a779d848101b1b9e6e5b9f5 (patch)
treecf26c987685ab1f68a25f9355e90927d368646e1
parent29c7eba8a113cffc54f3a52476194e383326d9a4 (diff)
downloademacs-c9db111a741ff4c64a779d848101b1b9e6e5b9f5.tar.gz
emacs-c9db111a741ff4c64a779d848101b1b9e6e5b9f5.zip
(archive-find-type): Add recognition of rar-exe format.
(archive-rar-summarize): Allow the file name to be passed as argument. Remove unused vars `header' and `footer'. (archive-rar-exe-summarize, archive-rar-exe-extract): New functions.
-rw-r--r--lisp/ChangeLog22
-rw-r--r--lisp/arc-mode.el52
2 files changed, 57 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f32f7c86531..db23a638f98 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12007-12-02 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * arc-mode.el (archive-find-type): Add recognition of rar-exe format.
4 (archive-rar-summarize): Allow the file name to be passed as argument.
5 Remove unused vars `header' and `footer'.
6 (archive-rar-exe-summarize, archive-rar-exe-extract): New functions.
7
12007-12-01 Dan Nicolaescu <dann@ics.uci.edu> 82007-12-01 Dan Nicolaescu <dann@ics.uci.edu>
2 9
3 * log-edit.el (log-edit-show-diff): New function. 10 * log-edit.el (log-edit-show-diff): New function.
@@ -38,8 +45,8 @@
38 * textmodes/org-export-latex.el (org-export-latex-cleaned-string): 45 * textmodes/org-export-latex.el (org-export-latex-cleaned-string):
39 Move args on defun line. 46 Move args on defun line.
40 47
41 * textmodes/org.el (org-calendar-holiday): Use 48 * textmodes/org.el (org-calendar-holiday):
42 calendar-check-holidays instead of the obsolete 49 Use calendar-check-holidays instead of the obsolete
43 check-calendar-holidays. 50 check-calendar-holidays.
44 (add-to-diary-list, table--at-cell-p, Info-find-node, bbdb) 51 (add-to-diary-list, table--at-cell-p, Info-find-node, bbdb)
45 (bbdb-company, bbdb-current-record, bbdb-name) 52 (bbdb-company, bbdb-current-record, bbdb-name)
@@ -69,8 +76,8 @@
69 76
70 * longlines.el (longlines-show-hard-newlines): Remove handling of 77 * longlines.el (longlines-show-hard-newlines): Remove handling of
71 buffer-undo-list and buffer-modified status. 78 buffer-undo-list and buffer-modified status.
72 (longlines-show-region, longlines-unshow-hard-newlines): Handle 79 (longlines-show-region, longlines-unshow-hard-newlines):
73 buffer-undo-list, buffer-modified status, inhibit-read-only, and 80 Handle buffer-undo-list, buffer-modified status, inhibit-read-only, and
74 inhibit-modification-hooks here to avoid that a buffer appears 81 inhibit-modification-hooks here to avoid that a buffer appears
75 modified when toggling visibility of hard newlines. 82 modified when toggling visibility of hard newlines.
76 83
@@ -160,8 +167,8 @@
160 * net/newsticker.el (w3m-toggle-inline-image, htmlr-reset) 167 * net/newsticker.el (w3m-toggle-inline-image, htmlr-reset)
161 (htmlr-step): Declare as functions. 168 (htmlr-step): Declare as functions.
162 169
163 * net/eudcb-bbdb.el (eudc-bbdb-extract-addresses): Use 170 * net/eudcb-bbdb.el (eudc-bbdb-extract-addresses):
164 bbdb-address-zip rather than bbdb-address-zip-string. 171 Use bbdb-address-zip rather than bbdb-address-zip-string.
165 172
1662007-11-28 Richard Stallman <rms@gnu.org> 1732007-11-28 Richard Stallman <rms@gnu.org>
167 174
@@ -190,8 +197,7 @@
190 197
191 * nxml/nxml-maint.el (nxml-create-unicode-char-name-sets): 198 * nxml/nxml-maint.el (nxml-create-unicode-char-name-sets):
192 * nxml/nxml-mode.el (nxml-get-char-name, nxml-insert-named-char): 199 * nxml/nxml-mode.el (nxml-get-char-name, nxml-insert-named-char):
193 * nxml/xsd-regexp.el (xsdre-gen-categories): Use mapc rather than 200 * nxml/xsd-regexp.el (xsdre-gen-categories): Change mapcar -> mapc.
194 mapcar.
195 201
196 * nxml/nxml-outln.el (nxml-token-start-tag-p) 202 * nxml/nxml-outln.el (nxml-token-start-tag-p)
197 (nxml-token-end-tag-p): Move definitions before use. 203 (nxml-token-end-tag-p): Move definitions before use.
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 404e4543e0b..8fb9e239b1c 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -705,6 +705,9 @@ archive.
705 ;; Note this regexp is also in archive-exe-p. 705 ;; Note this regexp is also in archive-exe-p.
706 ((looking-at "MZ\\(.\\|\n\\)\\{34\\}LH[aA]'s SFX ") 'lzh-exe) 706 ((looking-at "MZ\\(.\\|\n\\)\\{34\\}LH[aA]'s SFX ") 'lzh-exe)
707 ((looking-at "Rar!") 'rar) 707 ((looking-at "Rar!") 'rar)
708 ((and (looking-at "MZ")
709 (re-search-forward "Rar!" (+ (point) 100000) t))
710 'rar-exe)
708 (t (error "Buffer format not recognized"))))) 711 (t (error "Buffer format not recognized")))))
709;; ------------------------------------------------------------------------- 712;; -------------------------------------------------------------------------
710 713
@@ -1844,10 +1847,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1844;; ------------------------------------------------------------------------- 1847;; -------------------------------------------------------------------------
1845;;; Section: Rar Archives 1848;;; Section: Rar Archives
1846 1849
1847(defun archive-rar-summarize () 1850(defun archive-rar-summarize (&optional file)
1848 (let* ((file buffer-file-name) 1851 ;; File is used internally for `archive-rar-exe-summarize'.
1849 (copy (file-local-copy file)) 1852 (unless file (setq file buffer-file-name))
1850 header footer 1853 (let* ((copy (file-local-copy file))
1851 (maxname 10) 1854 (maxname 10)
1852 (maxsize 5) 1855 (maxsize 5)
1853 (files ())) 1856 (files ()))
@@ -1856,9 +1859,6 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1856 (if copy (delete-file copy)) 1859 (if copy (delete-file copy))
1857 (goto-char (point-min)) 1860 (goto-char (point-min))
1858 (re-search-forward "^-+\n") 1861 (re-search-forward "^-+\n")
1859 (setq header
1860 (buffer-substring (save-excursion (re-search-backward "^[^ ]"))
1861 (point)))
1862 (while (looking-at (concat " \\(.*\\)\n" ;Name. 1862 (while (looking-at (concat " \\(.*\\)\n" ;Name.
1863 ;; Size ; Packed. 1863 ;; Size ; Packed.
1864 " +\\([0-9]+\\) +[0-9]+" 1864 " +\\([0-9]+\\) +[0-9]+"
@@ -1878,8 +1878,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1878 size (match-string 3) 1878 size (match-string 3)
1879 ;; Date, Time. 1879 ;; Date, Time.
1880 (match-string 4) (match-string 5)) 1880 (match-string 4) (match-string 5))
1881 files))) 1881 files))))
1882 (setq footer (buffer-substring (point) (point-max))))
1883 (setq files (nreverse files)) 1882 (setq files (nreverse files))
1884 (goto-char (point-min)) 1883 (goto-char (point-min))
1885 (let* ((format (format " %%s %%s %%%ds %%5s %%s" maxsize)) 1884 (let* ((format (format " %%s %%s %%%ds %%5s %%s" maxsize))
@@ -1921,9 +1920,44 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1921 (delete-directory (expand-file-name name dest))) 1920 (delete-directory (expand-file-name name dest)))
1922 (delete-directory dest))))) 1921 (delete-directory dest)))))
1923 1922
1923;;; Section: Rar self-extracting .exe archives.
1924
1925(defun archive-rar-exe-summarize ()
1926 (let ((tmpfile (make-temp-file "rarexe")))
1927 (unwind-protect
1928 (progn
1929 (goto-char (point-min))
1930 (re-search-forward "Rar!")
1931 (write-region (match-beginning 0) (point-max) tmpfile)
1932 (archive-rar-summarize tmpfile))
1933 (delete-file tmpfile))))
1934
1935(defun archive-rar-exe-extract (archive name)
1936 (let* ((tmpfile (make-temp-file "rarexe"))
1937 (buf (find-buffer-visiting archive))
1938 (tmpbuf (unless buf (generate-new-buffer " *rar-exe*"))))
1939 (unwind-protect
1940 (progn
1941 (with-current-buffer (or buf tmpbuf)
1942 (save-excursion
1943 (save-restriction
1944 (if buf
1945 ;; point-max unwidened is assumed to be the end of the
1946 ;; summary text and the beginning of the actual file data.
1947 (progn (goto-char (point-max)) (widen))
1948 (insert-file-contents-literally archive)
1949 (goto-char (point-min)))
1950 (re-search-forward "Rar!")
1951 (write-region (match-beginning 0) (point-max) tmpfile))))
1952 (archive-rar-extract tmpfile name))
1953 (if tmpbuf (kill-buffer tmpbuf))
1954 (delete-file tmpfile))))
1955
1956
1924;; ------------------------------------------------------------------------- 1957;; -------------------------------------------------------------------------
1925;; This line was a mistake; it is kept now for compatibility. 1958;; This line was a mistake; it is kept now for compatibility.
1926;; rms 15 Oct 98 1959;; rms 15 Oct 98
1960
1927(provide 'archive-mode) 1961(provide 'archive-mode)
1928 1962
1929(provide 'arc-mode) 1963(provide 'arc-mode)