1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
|
;;; emacspeak-tar.el --- Speech enable Tar Mode -- Manipulate tar archives from Emacs
;;; $Id: emacspeak-tar.el,v 11.0 1999/11/29 16:58:57 raman Exp $
;;; $Author: raman $
;;; Description: Auditory interface to tar mode
;;; Keywords: Emacspeak, Speak, Spoken Output, tar
;;{{{ LCD Archive entry:
;;; LCD Archive Entry:
;;; emacspeak| T. V. Raman |raman@cs.cornell.edu
;;; A speech interface to Emacs |
;;; $Date: 1999/11/29 16:58:57 $ |
;;; $Revision: 11.0 $ |
;;; Location undetermined
;;;
;;}}}
;;{{{ Copyright:
;;; Copyright (c) 1997 by T. V. Raman
;;; All Rights Reserved.
;;;
;;; This file is not part of GNU Emacs, but the same permissions apply.
;;;
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; GNU Emacs is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;}}}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;{{{ Required modules
(require 'cl)
(declaim (optimize (safety 0) (speed 3)))
(require 'emacspeak-speak)
(require 'emacspeak-keymap)
(require 'emacspeak-sounds)
(eval-when (compile)
(require 'tar-mode)
(require 'emacspeak-fix-interactive))
;;}}}
;;{{{ Introduction
;;;Auditory interface to tar mode
;;}}}
;;{{{ Helpers
(defun emacspeak-tar-speak-line ()
"Speak line in tar mode intelligently"
(cond
((= (following-char) 0)
(message "No file on this line"))
(t(save-excursion
(end-of-line)
(skip-syntax-backward "^ ")
(emacspeak-speak-line 1)))))
;;}}}
;;{{{ Advice
(defadvice tar-quit (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'close-object)
(emacspeak-speak-mode-line)))
(defadvice tar-next-line (after emacspeak pre act comp)
"Provide spoken feedback"
(when (interactive-p )
(emacspeak-tar-speak-line)))
(defadvice tar-previous-line (after emacspeak pre act comp)
"Provide spoken feedback"
(when (interactive-p )
(emacspeak-tar-speak-line)))
(defadvice tar-flag-deleted (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'delete-object)
(emacspeak-tar-speak-line)))
(defadvice tar-unflag (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'yank-object)
(emacspeak-tar-speak-line)))
(defadvice tar-unflag-backwards (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'yank-object)
(emacspeak-tar-speak-line)))
(defadvice tar-extract (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'open-object)
(emacspeak-speak-mode-line)))
(defadvice tar-extract-other-window (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'open-object)
(emacspeak-speak-mode-line)))
(defadvice tar-view (after emacspeak pre act comp)
"Provide auditory feedback"
(when (interactive-p)
(emacspeak-auditory-icon 'open-object)
(emacspeak-speak-mode-line)))
;;}}}
;;{{{ additional interactive commands
(defun emacspeak-tar-speak-file-permissions()
"Speak permissions of file current entry "
(interactive)
(unless (eq major-mode 'tar-mode)
(error "This command should be called only in tar mode"))
(let ((entry (tar-current-descriptor))
(mode nil)
(string " "))
(cond
((null entry)
(message "No file on this line"))
(t
(setq mode
(tar-header-mode (tar-desc-tokens entry)))
(aset string 0 (if (zerop (logand 256 mode)) ?- ?r))
(aset string 1 (if (zerop (logand 128 mode)) ?- ?w))
(aset string 2 (if (zerop (logand 64 mode)) ?- ?x))
(aset string 3 (if (zerop (logand 32 mode)) ?- ?r))
(aset string 4 (if (zerop (logand 16 mode)) ?- ?w))
(aset string 5 (if (zerop (logand 8 mode)) ?- ?x))
(aset string 6 (if (zerop (logand 4 mode)) ?- ?r))
(aset string 7 (if (zerop (logand 2 mode)) ?- ?w))
(aset string 8 (if (zerop (logand 1 mode)) ?- ?x))
(if (zerop (logand 1024 mode)) nil (aset string 2 ?s))
(if (zerop (logand 2048 mode)) nil (aset string 5 ?s))
(message "Permissions %s "
string)))))
(defun emacspeak-tar-speak-file-size()
"Speak size of file current entry "
(interactive)
(unless (eq major-mode 'tar-mode)
(error "This command should be called only in tar mode"))
(let ((entry (tar-current-descriptor)))
(cond
((null entry)
(message "No file on this line"))
(t (message "File size %s "
(tar-header-size (tar-desc-tokens
entry)))))))
(defun emacspeak-tar-speak-file-date()
"Speak date of file current entry "
(interactive)
(declare (special emacspeak-speak-time-format-string))
(unless (eq major-mode 'tar-mode)
(error "This command should be called only in tar mode"))
(let ((entry (tar-current-descriptor)))
(cond
((null entry)
(message "No file on this line"))
(t (message "Modified on %s "
(format-time-string
emacspeak-speak-time-format-string
(tar-header-date
(tar-desc-tokens entry))))))))
(defun emacspeak-tar-setup-keys ()
"Setup emacspeak keys for tar mode"
(declare (special tar-mode-map))
(emacspeak-keymap-remove-emacspeak-edit-commands tar-mode-map)
(define-key tar-mode-map "z" 'emacspeak-tar-speak-file-size)
(define-key tar-mode-map "/" 'emacspeak-tar-speak-file-permissions)
(define-key tar-mode-map "c" 'emacspeak-tar-speak-file-date)
)
(eval-when (load)
(emacspeak-tar-setup-keys))
;;}}}
(provide 'emacspeak-tar)
;;{{{ end of file
;;; local variables:
;;; folded-file: t
;;; byte-compile-dynamic: t
;;; end:
;;}}}
|