diff options
| author | Stefan Monnier | 2008-04-03 20:05:39 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-03 20:05:39 +0000 |
| commit | fb3aad6604e651b37ae28d010b78678f4de389ee (patch) | |
| tree | f02ae680a756a4173c3013bdd7e12a25da467309 | |
| parent | 7fe7479dc555e408ee4d932af942a8bad4651f5c (diff) | |
| download | emacs-fb3aad6604e651b37ae28d010b78678f4de389ee.tar.gz emacs-fb3aad6604e651b37ae28d010b78678f4de389ee.zip | |
(archive-mode-map): Obey mouse-1-click-follows-link.
(archive-try-jka-compr): New function.
(archive-set-buffer-as-visiting-file): Use it.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/arc-mode.el | 38 |
2 files changed, 34 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 44d7465c24a..998dfb3c4dd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2008-04-03 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-04-03 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * arc-mode.el (archive-mode-map): Obey mouse-1-click-follows-link. | ||
| 4 | (archive-try-jka-compr): New function. | ||
| 5 | (archive-set-buffer-as-visiting-file): Use it. | ||
| 6 | |||
| 3 | * tar-mode.el (tar-mode-map): Obey mouse-1-click-follows-link. | 7 | * tar-mode.el (tar-mode-map): Obey mouse-1-click-follows-link. |
| 4 | 8 | ||
| 5 | 2008-04-03 Chong Yidong <cyd@stupidchicken.com> | 9 | 2008-04-03 Chong Yidong <cyd@stupidchicken.com> |
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 1bb4d2d477b..335248d9920 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el | |||
| @@ -358,6 +358,8 @@ Archive and member name will be added." | |||
| 358 | (define-key map "M" 'archive-chmod-entry) | 358 | (define-key map "M" 'archive-chmod-entry) |
| 359 | (define-key map "G" 'archive-chgrp-entry) | 359 | (define-key map "G" 'archive-chgrp-entry) |
| 360 | (define-key map "O" 'archive-chown-entry) | 360 | (define-key map "O" 'archive-chown-entry) |
| 361 | ;; Let mouse-1 follow the link. | ||
| 362 | (define-key map [follow-link] 'mouse-face) | ||
| 361 | 363 | ||
| 362 | (if (fboundp 'command-remapping) | 364 | (if (fboundp 'command-remapping) |
| 363 | (progn | 365 | (progn |
| @@ -892,6 +894,26 @@ using `make-temp-file', and the generated name is returned." | |||
| 892 | ;; ------------------------------------------------------------------------- | 894 | ;; ------------------------------------------------------------------------- |
| 893 | ;;; Section: Member extraction | 895 | ;;; Section: Member extraction |
| 894 | 896 | ||
| 897 | (defun archive-try-jka-compr () | ||
| 898 | (when (and auto-compression-mode | ||
| 899 | (jka-compr-get-compression-info buffer-file-name)) | ||
| 900 | (let* ((basename (file-name-nondirectory buffer-file-name)) | ||
| 901 | (tmpname (if (string-match ":\\([^:]+\\)\\'" basename) | ||
| 902 | (match-string 1 basename) basename)) | ||
| 903 | (tmpfile (make-temp-file (file-name-sans-extension tmpname) | ||
| 904 | nil | ||
| 905 | (file-name-extension tmpname 'period)))) | ||
| 906 | (unwind-protect | ||
| 907 | (progn | ||
| 908 | (let ((coding-system-for-write 'no-conversion) | ||
| 909 | ;; Don't re-compress this data just before decompressing it. | ||
| 910 | (jka-compr-inhibit t)) | ||
| 911 | (write-region (point-min) (point-max) tmpfile nil 'quiet)) | ||
| 912 | (erase-buffer) | ||
| 913 | (let ((coding-system-for-read 'no-conversion)) | ||
| 914 | (insert-file-contents tmpfile))) | ||
| 915 | (delete-file tmpfile))))) | ||
| 916 | |||
| 895 | (defun archive-file-name-handler (op &rest args) | 917 | (defun archive-file-name-handler (op &rest args) |
| 896 | (or (eq op 'file-exists-p) | 918 | (or (eq op 'file-exists-p) |
| 897 | (let ((file-name-handler-alist nil)) | 919 | (let ((file-name-handler-alist nil)) |
| @@ -921,13 +943,12 @@ using `make-temp-file', and the generated name is returned." | |||
| 921 | (car (find-operation-coding-system | 943 | (car (find-operation-coding-system |
| 922 | 'insert-file-contents | 944 | 'insert-file-contents |
| 923 | (cons filename (current-buffer)) t)))))) | 945 | (cons filename (current-buffer)) t)))))) |
| 924 | (if (and (not coding-system-for-read) | 946 | (unless (or coding-system-for-read |
| 925 | (not enable-multibyte-characters)) | 947 | enable-multibyte-characters) |
| 926 | (setq coding | 948 | (setq coding |
| 927 | (coding-system-change-text-conversion coding 'raw-text))) | 949 | (coding-system-change-text-conversion coding 'raw-text))) |
| 928 | (if (and coding | 950 | (unless (memq coding '(nil no-conversion)) |
| 929 | (not (eq coding 'no-conversion))) | 951 | (decode-coding-region (point-min) (point-max) coding) |
| 930 | (decode-coding-region (point-min) (point-max) coding) | ||
| 931 | (setq last-coding-system-used coding)) | 952 | (setq last-coding-system-used coding)) |
| 932 | (set-buffer-modified-p nil) | 953 | (set-buffer-modified-p nil) |
| 933 | (kill-local-variable 'buffer-file-coding-system) | 954 | (kill-local-variable 'buffer-file-coding-system) |
| @@ -999,6 +1020,7 @@ using `make-temp-file', and the generated name is returned." | |||
| 999 | (progn | 1020 | (progn |
| 1000 | (set-buffer-modified-p nil) | 1021 | (set-buffer-modified-p nil) |
| 1001 | (kill-buffer buffer)) | 1022 | (kill-buffer buffer)) |
| 1023 | (archive-try-jka-compr) ;Pretty ugly hack :-( | ||
| 1002 | (archive-set-buffer-as-visiting-file ename) | 1024 | (archive-set-buffer-as-visiting-file ename) |
| 1003 | (goto-char (point-min)) | 1025 | (goto-char (point-min)) |
| 1004 | (rename-buffer bufname) | 1026 | (rename-buffer bufname) |
| @@ -2088,7 +2110,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2088 | (with-current-buffer destbuf | 2110 | (with-current-buffer destbuf |
| 2089 | ;; Do it within the `widen'. | 2111 | ;; Do it within the `widen'. |
| 2090 | (insert-buffer-substring archivebuf from (+ from size))) | 2112 | (insert-buffer-substring archivebuf from (+ from size))) |
| 2091 | (set-buffer-multibyte t) | 2113 | (set-buffer-multibyte 'to) |
| 2092 | ;; Inform the caller that the call succeeded. | 2114 | ;; Inform the caller that the call succeeded. |
| 2093 | t))))) | 2115 | t))))) |
| 2094 | 2116 | ||