Mercurial > hg > xemacs-beta
comparison lisp/modes/arc-mode.el @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | 28f395d8dc7a |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
1 ;;; arc-mode.el --- simple editing of archives | 1 ;;; arc-mode.el --- simple editing of archives |
2 | 2 |
3 ;;; Copyright (C) 1995 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1995 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Morten Welinder (terra@diku.dk) | 5 ;; Author: Morten Welinder (terra@diku.dk) |
6 ;; Keywords: archives msdog editing major-mode | 6 ;; Keywords: archives msdog editing major-mode |
7 ;; Favourite-brand-of-beer: None, I hate beer. | 7 ;; Favourite-brand-of-beer: None, I hate beer. |
8 | 8 |
9 ;;; This file is part of GNU Emacs. | 9 ;; This file is part of XEmacs. |
10 ;;; | 10 |
11 ;;; GNU Emacs is free software; you can redistribute it and/or modify | 11 ;; XEmacs is free software; you can redistribute it and/or modify it |
12 ;;; it under the terms of the GNU General Public License as published by | 12 ;; under the terms of the GNU General Public License as published by |
13 ;;; the Free Software Foundation; either version 2, or (at your option) | 13 ;; the Free Software Foundation; either version 2, or (at your option) |
14 ;;; any later version. | 14 ;; any later version. |
15 ;;; | 15 |
16 ;;; GNU Emacs is distributed in the hope that it will be useful, | 16 ;; XEmacs is distributed in the hope that it will be useful, but |
17 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 ;;; GNU General Public License for more details. | 19 ;; General Public License for more details. |
20 ;;; | 20 |
21 ;;; You should have received a copy of the GNU General Public License | 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 | 22 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
23 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
24 | 24 ;; 02111-1307, USA. |
25 ;;; Synched up with: FSF 19.30. | 25 |
26 ;;; Synched up with: FSF 19.34. | |
26 | 27 |
27 ;;; Commentary: | 28 ;;; Commentary: |
28 ;; | 29 |
29 ;; NAMING: "arc" is short for "archive" and does not refer specifically | 30 ;; NAMING: "arc" is short for "archive" and does not refer specifically |
30 ;; to files whose name end in ".arc" | 31 ;; to files whose name end in ".arc" |
31 ;; | 32 ;; |
32 ;; This code does not decode any files internally, although it does | 33 ;; This code does not decode any files internally, although it does |
33 ;; understand the directory level of the archives. For this reason, | 34 ;; understand the directory level of the archives. For this reason, |
87 ;; | 88 ;; |
88 ;; ZOO An archive header followed by a series of (header,file). | 89 ;; ZOO An archive header followed by a series of (header,file). |
89 ;; Each member header points to the next. The archive is | 90 ;; Each member header points to the next. The archive is |
90 ;; terminated by a bogus header with a zero next link. | 91 ;; terminated by a bogus header with a zero next link. |
91 ;; ------------------------------------- | 92 ;; ------------------------------------- |
92 ;; HOOKS: `foo' means one the the supported archive types. | 93 ;; HOOKS: `foo' means one of the supported archive types. |
93 ;; | 94 ;; |
94 ;; archive-mode-hook | 95 ;; archive-mode-hook |
95 ;; archive-foo-mode-hook | 96 ;; archive-foo-mode-hook |
96 ;; archive-extract-hooks | 97 ;; archive-extract-hooks |
97 | 98 |
166 "*Program and its options to run in order to extract a zip file member. | 167 "*Program and its options to run in order to extract a zip file member. |
167 Extraction should happen to standard output. Archive and member name will | 168 Extraction should happen to standard output. Archive and member name will |
168 be added. If `archive-zip-use-pkzip' is non-nil then this program is | 169 be added. If `archive-zip-use-pkzip' is non-nil then this program is |
169 expected to extract to a file junking the directory part of the name.") | 170 expected to extract to a file junking the directory part of the name.") |
170 | 171 |
171 ;; For several reasons the latter behaviour is not desireable in general. | 172 ;; For several reasons the latter behaviour is not desirable in general. |
172 ;; (1) It uses more disk space. (2) Error checking is worse or non- | 173 ;; (1) It uses more disk space. (2) Error checking is worse or non- |
173 ;; existent. (3) It tends to do funny things with other systems' file | 174 ;; existent. (3) It tends to do funny things with other systems' file |
174 ;; names. | 175 ;; names. |
175 | 176 |
176 (defvar archive-zip-expunge | 177 (defvar archive-zip-expunge |
252 | 253 |
253 (defvar archive-files nil "Vector of file descriptors. Each descriptor is | 254 (defvar archive-files nil "Vector of file descriptors. Each descriptor is |
254 a vector of [ext-file-name int-file-name case-fiddled mode ...]") | 255 a vector of [ext-file-name int-file-name case-fiddled mode ...]") |
255 (make-variable-buffer-local 'archive-files) | 256 (make-variable-buffer-local 'archive-files) |
256 | 257 |
257 (defvar archive-lemacs | 258 ;; XEmacs change |
259 (defvar archive-xemacs | |
258 (string-match "\\(Lucid\\|XEmacs\\)" emacs-version) | 260 (string-match "\\(Lucid\\|XEmacs\\)" emacs-version) |
259 "*Non-nil when running under under Lucid Emacs or Xemacs.") | 261 "*Non-nil when running under Lucid Emacs or XEmacs.") |
260 ;; ------------------------------------------------------------------------- | 262 ;; ------------------------------------------------------------------------- |
261 ;; Section: Support functions. | 263 ;; Section: Support functions. |
262 | 264 |
263 (defsubst archive-name (suffix) | 265 (defsubst archive-name (suffix) |
264 (intern (concat "archive-" (symbol-name archive-subtype) "-" suffix))) | 266 (intern (concat "archive-" (symbol-name archive-subtype) "-" suffix))) |
496 (define-key archive-mode-map "E" 'archive-extract-other-window) | 498 (define-key archive-mode-map "E" 'archive-extract-other-window) |
497 (define-key archive-mode-map "M" 'archive-chmod-entry) | 499 (define-key archive-mode-map "M" 'archive-chmod-entry) |
498 (define-key archive-mode-map "G" 'archive-chgrp-entry) | 500 (define-key archive-mode-map "G" 'archive-chgrp-entry) |
499 (define-key archive-mode-map "O" 'archive-chown-entry) | 501 (define-key archive-mode-map "O" 'archive-chown-entry) |
500 | 502 |
501 (if archive-lemacs | 503 (if archive-xemacs |
502 (progn | 504 (progn |
503 ;; Not a nice "solution" but it'll have to do | 505 ;; Not a nice "solution" but it'll have to do |
504 (define-key archive-mode-map "\C-xu" 'archive-undo) | 506 (define-key archive-mode-map "\C-xu" 'archive-undo) |
505 (define-key archive-mode-map "\C-_" 'archive-undo)) | 507 (define-key archive-mode-map "\C-_" 'archive-undo)) |
506 (substitute-key-definition 'undo 'archive-undo | 508 (substitute-key-definition 'undo 'archive-undo |
507 archive-mode-map global-map)) | 509 archive-mode-map global-map)) |
508 | 510 |
509 (define-key archive-mode-map | 511 (define-key archive-mode-map |
510 (if archive-lemacs 'button2 [mouse-2]) 'archive-mouse-extract) | 512 (if archive-xemacs 'button2 [mouse-2]) 'archive-mouse-extract) |
511 | 513 |
512 (if archive-lemacs | 514 (if archive-xemacs |
513 () ; out of luck | 515 () ; out of luck |
514 ;; Get rid of the Edit menu bar item to save space. | 516 ;; Get rid of the Edit menu bar item to save space. |
515 (define-key archive-mode-map [menu-bar edit] 'undefined) | 517 (define-key archive-mode-map [menu-bar edit] 'undefined) |
516 | 518 |
517 (define-key archive-mode-map [menu-bar immediate] | 519 (define-key archive-mode-map [menu-bar immediate] |
616 (set-buffer-modified-p modified) | 618 (set-buffer-modified-p modified) |
617 (goto-char archive-file-list-start) | 619 (goto-char archive-file-list-start) |
618 (archive-next-line no))) | 620 (archive-next-line no))) |
619 | 621 |
620 (defun archive-summarize-files (files) | 622 (defun archive-summarize-files (files) |
621 "Insert a desciption of a list of files annotated with proper mouse face" | 623 "Insert a description of a list of files annotated with proper mouse face" |
622 (setq archive-file-list-start (point-marker)) | 624 (setq archive-file-list-start (point-marker)) |
623 (setq archive-file-name-indent (if files (aref (car files) 1) 0)) | 625 (setq archive-file-name-indent (if files (aref (car files) 1) 0)) |
624 ;; We don't want to do an insert for each element since that takes too | 626 ;; We don't want to do an insert for each element since that takes too |
625 ;; long when the archive -- which has to be moved in memory -- is large. | 627 ;; long when the archive -- which has to be moved in memory -- is large. |
626 (insert | 628 (insert |
630 (function | 632 (function |
631 (lambda (fil) | 633 (lambda (fil) |
632 ;; Using `concat' here copies the text also, so we can add | 634 ;; Using `concat' here copies the text also, so we can add |
633 ;; properties without problems. | 635 ;; properties without problems. |
634 (let ((text (concat (aref fil 0) "\n"))) | 636 (let ((text (concat (aref fil 0) "\n"))) |
635 (if archive-lemacs | 637 (if archive-xemacs |
636 () ; out of luck | 638 () ; out of luck |
637 (put-text-property (aref fil 1) (aref fil 2) | 639 (put-text-property (aref fil 1) (aref fil 2) |
638 'mouse-face 'highlight | 640 'mouse-face 'highlight |
639 text)) | 641 text)) |
640 text))) | 642 text))) |