/[emacs]/emacs/lisp/arc-mode.el
ViewVC logotype

Diff of /emacs/lisp/arc-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.59 by eliz, Tue Apr 27 12:44:42 2004 UTC revision 1.60 by monnier, Sat Apr 9 19:18:17 2005 UTC
# Line 1  Line 1 
1  ;;; arc-mode.el --- simple editing of archives  ;;; arc-mode.el --- simple editing of archives
2    
3  ;; Copyright (C) 1995, 1997, 1998, 2003 Free Software Foundation, Inc.  ;; Copyright (C) 1995, 1997, 1998, 2003, 2005 Free Software Foundation, Inc.
4    
5  ;; Author: Morten Welinder <terra@gnu.org>  ;; Author: Morten Welinder <terra@gnu.org>
6  ;; Keywords: archives msdog editing major-mode  ;; Keywords: archives msdog editing major-mode
# Line 330  Archive and member name will be added." Line 330  Archive and member name will be added."
330  (defvar archive-proper-file-start nil "Position of real archive's start.")  (defvar archive-proper-file-start nil "Position of real archive's start.")
331  (defvar archive-read-only nil "Non-nil if the archive is read-only on disk.")  (defvar archive-read-only nil "Non-nil if the archive is read-only on disk.")
332  (defvar archive-local-name nil "Name of local copy of remote archive.")  (defvar archive-local-name nil "Name of local copy of remote archive.")
333  (defvar archive-mode-map nil "Local keymap for archive mode listings.")  (defvar archive-mode-map
334      (let ((map (make-keymap)))
335        (suppress-keymap map)
336        (define-key map " " 'archive-next-line)
337        (define-key map "a" 'archive-alternate-display)
338        ;;(define-key map "c" 'archive-copy)
339        (define-key map "d" 'archive-flag-deleted)
340        (define-key map "\C-d" 'archive-flag-deleted)
341        (define-key map "e" 'archive-extract)
342        (define-key map "f" 'archive-extract)
343        (define-key map "\C-m" 'archive-extract)
344        (define-key map "g" 'revert-buffer)
345        (define-key map "h" 'describe-mode)
346        (define-key map "m" 'archive-mark)
347        (define-key map "n" 'archive-next-line)
348        (define-key map "\C-n" 'archive-next-line)
349        (define-key map [down] 'archive-next-line)
350        (define-key map "o" 'archive-extract-other-window)
351        (define-key map "p" 'archive-previous-line)
352        (define-key map "q" 'quit-window)
353        (define-key map "\C-p" 'archive-previous-line)
354        (define-key map [up] 'archive-previous-line)
355        (define-key map "r" 'archive-rename-entry)
356        (define-key map "u" 'archive-unflag)
357        (define-key map "\M-\C-?" 'archive-unmark-all-files)
358        (define-key map "v" 'archive-view)
359        (define-key map "x" 'archive-expunge)
360        (define-key map "\177" 'archive-unflag-backwards)
361        (define-key map "E" 'archive-extract-other-window)
362        (define-key map "M" 'archive-chmod-entry)
363        (define-key map "G" 'archive-chgrp-entry)
364        (define-key map "O" 'archive-chown-entry)
365    
366        (if (fboundp 'command-remapping)
367            (progn
368              (define-key map [remap advertised-undo] 'archive-undo)
369              (define-key map [remap undo] 'archive-undo))
370          (substitute-key-definition 'advertised-undo 'archive-undo map global-map)
371          (substitute-key-definition 'undo 'archive-undo map global-map))
372    
373        (define-key map
374          (if (featurep 'xemacs) 'button2 [mouse-2]) 'archive-mouse-extract)
375    
376        (if (featurep 'xemacs)
377            ()                              ; out of luck
378    
379          (define-key map [menu-bar immediate]
380            (cons "Immediate" (make-sparse-keymap "Immediate")))
381          (define-key map [menu-bar immediate alternate]
382            '(menu-item "Alternate Display" archive-alternate-display
383              :enable (boundp (archive-name "alternate-display"))
384              :help "Toggle alternate file info display"))
385          (define-key map [menu-bar immediate view]
386            '(menu-item "View This File" archive-view
387              :help "Display file at cursor in View Mode"))
388          (define-key map [menu-bar immediate display]
389            '(menu-item "Display in Other Window" archive-display-other-window
390              :help "Display file at cursor in another window"))
391          (define-key map [menu-bar immediate find-file-other-window]
392            '(menu-item "Find in Other Window" archive-extract-other-window
393              :help "Edit file at cursor in another window"))
394          (define-key map [menu-bar immediate find-file]
395            '(menu-item "Find This File" archive-extract
396              :help "Extract file at cursor and edit it"))
397    
398          (define-key map [menu-bar mark]
399            (cons "Mark" (make-sparse-keymap "Mark")))
400          (define-key map [menu-bar mark unmark-all]
401            '(menu-item "Unmark All" archive-unmark-all-files
402              :help "Unmark all marked files"))
403          (define-key map [menu-bar mark deletion]
404            '(menu-item "Flag" archive-flag-deleted
405              :help "Flag file at cursor for deletion"))
406          (define-key map [menu-bar mark unmark]
407            '(menu-item "Unflag" archive-unflag
408              :help "Unmark file at cursor"))
409          (define-key map [menu-bar mark mark]
410            '(menu-item "Mark" archive-mark
411              :help "Mark file at cursor"))
412    
413          (define-key map [menu-bar operate]
414            (cons "Operate" (make-sparse-keymap "Operate")))
415          (define-key map [menu-bar operate chown]
416            '(menu-item "Change Owner..." archive-chown-entry
417              :enable (fboundp (archive-name "chown-entry"))
418              :help "Change owner of marked files"))
419          (define-key map [menu-bar operate chgrp]
420            '(menu-item "Change Group..." archive-chgrp-entry
421              :enable (fboundp (archive-name "chgrp-entry"))
422              :help "Change group ownership of marked files"))
423          (define-key map [menu-bar operate chmod]
424            '(menu-item "Change Mode..." archive-chmod-entry
425              :enable (fboundp (archive-name "chmod-entry"))
426              :help "Change mode (permissions) of marked files"))
427          (define-key map [menu-bar operate rename]
428            '(menu-item "Rename to..." archive-rename-entry
429              :enable (fboundp (archive-name "rename-entry"))
430              :help "Rename marked files"))
431          ;;(define-key map [menu-bar operate copy]
432          ;;  '(menu-item "Copy to..." archive-copy))
433          (define-key map [menu-bar operate expunge]
434            '(menu-item "Expunge Marked Files" archive-expunge
435              :help "Delete all flagged files from archive"))
436          map))
437      "Local keymap for archive mode listings.")
438  (defvar archive-file-name-indent nil "Column where file names start.")  (defvar archive-file-name-indent nil "Column where file names start.")
439    
440  (defvar archive-remote nil "Non-nil if the archive is outside file system.")  (defvar archive-remote nil "Non-nil if the archive is outside file system.")
# Line 358  Each descriptor is a vector of the form Line 462  Each descriptor is a vector of the form
462   [EXT-FILE-NAME INT-FILE-NAME CASE-FIDDLED MODE ...]")   [EXT-FILE-NAME INT-FILE-NAME CASE-FIDDLED MODE ...]")
463  (make-variable-buffer-local 'archive-files)  (make-variable-buffer-local 'archive-files)
464    
 (defvar archive-lemacs  
   (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)  
   "*Non-nil when running under under Lucid Emacs or Xemacs.")  
465  ;; -------------------------------------------------------------------------  ;; -------------------------------------------------------------------------
466  ;; Section: Support functions.  ;; Section: Support functions.
467    
# Line 586  archive. Line 687  archive.
687  ;; -------------------------------------------------------------------------  ;; -------------------------------------------------------------------------
688  ;; Section: Key maps  ;; Section: Key maps
689    
690  (if archive-mode-map nil  (let ((item1 '(archive-subfile-mode " Archive")))
   (setq archive-mode-map (make-keymap))  
   (suppress-keymap archive-mode-map)  
   (define-key archive-mode-map " " 'archive-next-line)  
   (define-key archive-mode-map "a" 'archive-alternate-display)  
   ;;(define-key archive-mode-map "c" 'archive-copy)  
   (define-key archive-mode-map "d" 'archive-flag-deleted)  
   (define-key archive-mode-map "\C-d" 'archive-flag-deleted)  
   (define-key archive-mode-map "e" 'archive-extract)  
   (define-key archive-mode-map "f" 'archive-extract)  
   (define-key archive-mode-map "\C-m" 'archive-extract)  
   (define-key archive-mode-map "g" 'revert-buffer)  
   (define-key archive-mode-map "h" 'describe-mode)  
   (define-key archive-mode-map "m" 'archive-mark)  
   (define-key archive-mode-map "n" 'archive-next-line)  
   (define-key archive-mode-map "\C-n" 'archive-next-line)  
   (define-key archive-mode-map [down] 'archive-next-line)  
   (define-key archive-mode-map "o" 'archive-extract-other-window)  
   (define-key archive-mode-map "p" 'archive-previous-line)  
   (define-key archive-mode-map "q" 'quit-window)  
   (define-key archive-mode-map "\C-p" 'archive-previous-line)  
   (define-key archive-mode-map [up] 'archive-previous-line)  
   (define-key archive-mode-map "r" 'archive-rename-entry)  
   (define-key archive-mode-map "u" 'archive-unflag)  
   (define-key archive-mode-map "\M-\C-?" 'archive-unmark-all-files)  
   (define-key archive-mode-map "v" 'archive-view)  
   (define-key archive-mode-map "x" 'archive-expunge)  
   (define-key archive-mode-map "\177" 'archive-unflag-backwards)  
   (define-key archive-mode-map "E" 'archive-extract-other-window)  
   (define-key archive-mode-map "M" 'archive-chmod-entry)  
   (define-key archive-mode-map "G" 'archive-chgrp-entry)  
   (define-key archive-mode-map "O" 'archive-chown-entry)  
   
   (if archive-lemacs  
       (progn  
         ;; Not a nice "solution" but it'll have to do  
         (define-key archive-mode-map "\C-xu" 'archive-undo)  
         (define-key archive-mode-map "\C-_" 'archive-undo))  
     (define-key archive-mode-map [remap advertised-undo] 'archive-undo)  
     (define-key archive-mode-map [remap undo] 'archive-undo))  
   
   (define-key archive-mode-map  
     (if archive-lemacs 'button2 [mouse-2]) 'archive-mouse-extract)  
   
   (if archive-lemacs  
       ()                                ; out of luck  
   
     (define-key archive-mode-map [menu-bar immediate]  
       (cons "Immediate" (make-sparse-keymap "Immediate")))  
     (define-key archive-mode-map [menu-bar immediate alternate]  
       '(menu-item "Alternate Display" archive-alternate-display  
                   :enable (boundp (archive-name "alternate-display"))  
                   :help "Toggle alternate file info display"))  
     (define-key archive-mode-map [menu-bar immediate view]  
       '(menu-item "View This File" archive-view  
                   :help "Display file at cursor in View Mode"))  
     (define-key archive-mode-map [menu-bar immediate display]  
       '(menu-item "Display in Other Window" archive-display-other-window  
                   :help "Display file at cursor in another window"))  
     (define-key archive-mode-map [menu-bar immediate find-file-other-window]  
       '(menu-item "Find in Other Window" archive-extract-other-window  
                   :help "Edit file at cursor in another window"))  
     (define-key archive-mode-map [menu-bar immediate find-file]  
       '(menu-item "Find This File" archive-extract  
                   :help "Extract file at cursor and edit it"))  
   
     (define-key archive-mode-map [menu-bar mark]  
       (cons "Mark" (make-sparse-keymap "Mark")))  
     (define-key archive-mode-map [menu-bar mark unmark-all]  
       '(menu-item "Unmark All" archive-unmark-all-files  
                   :help "Unmark all marked files"))  
     (define-key archive-mode-map [menu-bar mark deletion]  
       '(menu-item "Flag" archive-flag-deleted  
                   :help "Flag file at cursor for deletion"))  
     (define-key archive-mode-map [menu-bar mark unmark]  
       '(menu-item "Unflag" archive-unflag  
                   :help "Unmark file at cursor"))  
     (define-key archive-mode-map [menu-bar mark mark]  
       '(menu-item "Mark" archive-mark  
                   :help "Mark file at cursor"))  
   
     (define-key archive-mode-map [menu-bar operate]  
       (cons "Operate" (make-sparse-keymap "Operate")))  
     (define-key archive-mode-map [menu-bar operate chown]  
       '(menu-item "Change Owner..." archive-chown-entry  
                   :enable (fboundp (archive-name "chown-entry"))  
                   :help "Change owner of marked files"))  
     (define-key archive-mode-map [menu-bar operate chgrp]  
       '(menu-item "Change Group..." archive-chgrp-entry  
                   :enable (fboundp (archive-name "chgrp-entry"))  
                   :help "Change group ownership of marked files"))  
     (define-key archive-mode-map [menu-bar operate chmod]  
       '(menu-item "Change Mode..." archive-chmod-entry  
                   :enable (fboundp (archive-name "chmod-entry"))  
                   :help "Change mode (permissions) of marked files"))  
     (define-key archive-mode-map [menu-bar operate rename]  
       '(menu-item "Rename to..." archive-rename-entry  
                   :enable (fboundp (archive-name "rename-entry"))  
                   :help "Rename marked files"))  
     ;;(define-key archive-mode-map [menu-bar operate copy]  
     ;;  '(menu-item "Copy to..." archive-copy))  
     (define-key archive-mode-map [menu-bar operate expunge]  
       '(menu-item "Expunge Marked Files" archive-expunge  
                   :help "Delete all flagged files from archive"))  
   ))  
   
 (let* ((item1 '(archive-subfile-mode " Archive"))  
        (items (list item1)))  
691    (or (member item1 minor-mode-alist)    (or (member item1 minor-mode-alist)
692        (setq minor-mode-alist (append items minor-mode-alist))))        (setq minor-mode-alist (cons item1 minor-mode-alist))))
693  ;; -------------------------------------------------------------------------  ;; -------------------------------------------------------------------------
694  (defun archive-find-type ()  (defun archive-find-type ()
695    (widen)    (widen)
# Line 762  when parsing the archive." Line 756  when parsing the archive."
756          ;; Using `concat' here copies the text also, so we can add          ;; Using `concat' here copies the text also, so we can add
757          ;; properties without problems.          ;; properties without problems.
758          (let ((text (concat (aref fil 0) "\n")))          (let ((text (concat (aref fil 0) "\n")))
759            (if archive-lemacs            (if (featurep 'xemacs)
760                ()                        ; out of luck                ()                        ; out of luck
761              (add-text-properties              (add-text-properties
762               (aref fil 1) (aref fil 2)               (aref fil 1) (aref fil 2)
# Line 1809  This doesn't recover lost files, it just Line 1803  This doesn't recover lost files, it just
1803    
1804  (provide 'arc-mode)  (provide 'arc-mode)
1805    
1806  ;;; arch-tag: e5966a01-35ec-4f27-8095-a043a79b457b  ;; arch-tag: e5966a01-35ec-4f27-8095-a043a79b457b
1807  ;;; arc-mode.el ends here  ;;; arc-mode.el ends here

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26