Mercurial > emacs
annotate lisp/obsolete/uncompress.el @ 83619:5da6a46ddbd6
* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
* termhooks.h (union display_info): Add mac_display_info.
* term.c (init_tty): Only use terminal->kboard when MULTI_KBOARD
is defined.
* macterm.h (struct mac_display_info): Add terminal.
* w32term.c (w32_initialize): Make static.
* macterm.c (XTset_terminal_modes): Add a terminal parameter.
(XTreset_terminal_modes): Likewise.
(x_clear_frame): Add a frame parameter.
(note_mouse_movement): Get rif from the frame.
(mac_term_init): Initialize the terminal.
(mac_initialize): Make static and move terminal initialization ...
(mac_create_terminal): ... in this new function.
* macmenu.c: Reorder includes.
(Fx_popup_menu): Use terminal specific mouse_position_hook.
* macfns.c (x_set_mouse_color): Get rif from the frame.
(x_set_tool_bar_lines): Don't use updating_frame.
(mac_window): Add 2 new parameters for consistency with other
systems.
(Fx_create_frame): Fix doc string. Rename the parameter.
(Fx_create_frame): Set the frame parameters following what is done
in X11 and w32.
(Fx_open_connection): Remove window-system check.
(start_hourglass): Likewise.
(x_create_tip_frame): Get the keyboard from the terminal.
* w32fns.c (Fx_create_frame): Use kboard from the terminal.
* term/mac-win.el: Provide mac-win.
(mac-initialized): New variable.
(mac-initialize-window-system): New function. Move global setup
here.
(handle-args-function-alist, frame-creation-function-alist):
(window-system-initialization-alist): Add mac entries.
* loadup.el: Load mac-win on a Mac.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sat, 19 May 2007 19:08:02 +0000 |
parents | e3694f1cb928 |
children | 1e016d63f292 95d0cdf160ea |
rev | line source |
---|---|
39125 | 1 ;;; uncompress.el --- auto-decompression hook for visiting .Z files |
2 | |
64751
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1992, 1994, 2001, 2002, 2003, 2004, |
75347 | 4 ;; 2005, 2006, 2007 Free Software Foundation, Inc. |
39125 | 5 |
6 ;; Maintainer: FSF | |
7 ;; Keywords: files | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
39125 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; This package can be used to arrange for automatic uncompress of | |
29 ;; compressed files when they are visited. | |
30 ;; All that's necessary is to load it. This can conveniently be done from | |
31 ;; your .emacs file. | |
32 | |
33 ;; M-x auto-compression-mode is a more modern replacement for this package. | |
34 | |
35 ;;; Code: | |
36 | |
37 ;; When we are about to make a backup file, | |
38 ;; uncompress the file we visited | |
39 ;; so that making the backup can work properly. | |
40 ;; This is used as a write-file-hook. | |
41 | |
42 (defvar uncompress-program "gunzip" | |
43 "Program to use for uncompression.") | |
44 | |
45 (defun uncompress-backup-file () | |
46 (and buffer-file-name make-backup-files (not buffer-backed-up) | |
47 (not (file-exists-p buffer-file-name)) | |
48 (call-process uncompress-program nil nil nil buffer-file-name)) | |
49 nil) | |
50 | |
51 (or (assoc "\\.Z$" auto-mode-alist) | |
52 (setq auto-mode-alist | |
53 (cons '("\\.Z$" . uncompress-while-visiting) auto-mode-alist))) | |
54 (or (assoc "\\.gz$" auto-mode-alist) | |
55 (setq auto-mode-alist | |
56 (cons '("\\.gz$" . uncompress-while-visiting) auto-mode-alist))) | |
57 (or (assoc "\\.tgz$" auto-mode-alist) | |
58 (setq auto-mode-alist | |
59 (cons '("\\.tgz$" . uncompress-while-visiting) auto-mode-alist))) | |
60 | |
61 (defun uncompress-while-visiting () | |
62 "Temporary \"major mode\" used for .Z and .gz files, to uncompress them. | |
63 It then selects a major mode from the uncompressed file name and contents." | |
64 (if (and (not (null buffer-file-name)) | |
65 (string-match "\\.Z$" buffer-file-name)) | |
66 (set-visited-file-name | |
67 (substring buffer-file-name 0 (match-beginning 0))) | |
68 (if (and (not (null buffer-file-name)) | |
69 (string-match "\\.gz$" buffer-file-name)) | |
70 (set-visited-file-name | |
71 (substring buffer-file-name 0 (match-beginning 0))) | |
72 (if (and (not (null buffer-file-name)) | |
73 (string-match "\\.tgz$" buffer-file-name)) | |
74 (set-visited-file-name | |
75 (concat (substring buffer-file-name 0 (match-beginning 0)) ".tar"))))) | |
76 (message "Uncompressing...") | |
77 (let ((buffer-read-only nil) | |
78 (coding-system-for-write 'no-conversion) | |
79 (coding-system-for-read | |
80 (car (find-operation-coding-system | |
81 'insert-file-contents | |
82 buffer-file-name t)))) | |
83 (shell-command-on-region (point-min) (point-max) uncompress-program t)) | |
84 (goto-char (point-min)) | |
85 (message "Uncompressing...done") | |
86 (set-buffer-modified-p nil) | |
62189
0cbd8db584f6
Set `find-file-not-found-functions', not `find-file-not-found-hooks'; use
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
87 (add-hook 'write-file-functions 'uncompress-backup-file nil t) |
39125 | 88 (normal-mode)) |
89 | |
62189
0cbd8db584f6
Set `find-file-not-found-functions', not `find-file-not-found-hooks'; use
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
90 (add-hook 'find-file-not-found-functions 'find-compressed-version) |
39125 | 91 |
92 (defun find-compressed-version () | |
93 "Hook to read and uncompress the compressed version of a file." | |
94 ;; Just pretend we had visited the compressed file, | |
95 ;; and uncompress-while-visiting will do the rest. | |
96 (let (name) | |
97 (if (file-exists-p (setq name (concat buffer-file-name ".Z"))) | |
98 (setq buffer-file-name name) | |
99 (if (file-exists-p (setq name (concat buffer-file-name ".gz"))) | |
100 (setq buffer-file-name name))) | |
101 (if (eq name buffer-file-name) | |
102 (progn | |
103 (insert-file-contents buffer-file-name t) | |
104 (goto-char (point-min)) | |
105 ;; No need for this, because error won't be set to t | |
106 ;; if this function returns t. | |
107 ;; (setq error nil) | |
108 t)))) | |
109 | |
49072
03a8f1957f3e
Display message that this package is obsolete.
Richard M. Stallman <rms@gnu.org>
parents:
39125
diff
changeset
|
110 (message "The uncompress package is obsolete; use M-x auto-compression-mode") |
03a8f1957f3e
Display message that this package is obsolete.
Richard M. Stallman <rms@gnu.org>
parents:
39125
diff
changeset
|
111 |
39125 | 112 (provide 'uncompress) |
113 | |
52401 | 114 ;;; arch-tag: 626658d4-fcce-499a-990d-d165f2ed7da3 |
39125 | 115 ;;; uncompress.el ends here |