;;;; jcgs' voice-mode setup ;;; Time-stamp: <2007-02-25 18:42:11 jcgs> ;;; sets things up for various parts of pbv (require 'cl) (when (boundp 'vr-win-class) (message "vr-win-class was %S" vr-win-class)) ;; (setq vr-win-title ".*emacs.*") (setq vr-log-send t vr-log-read t vr-log-heard t vr-log-do t vr-active-minibuffers nil ;; vr-win-class "Emacs" ) (setq vr-activation-list '("^\\*scratch\\*$" "\\.txt$")) (defun jcgs-report-vr-setup (whence) "Report my vr setup, as seen when called WHENCE." (message "Starting VR connection: at %s, vr-command=%S vr-host=%S vr-port=%S" whence vr-command vr-host vr-port)) (defvar vr-almost-default-voice-command-list '( ;; VR Mode commands ("activate buffer" . vr-add-to-activation-list) ;; general emacs commands ("quit" . [?\C-g]) ;; keystrokes that often should not be self-inserted ("enter" . [?\C-j]) ("tab" . [?\C-i]) ("space" . [? ]) ;; files ("find file" . flexi-find-file) save-buffer ("save file" . save-buffer) find-file-other-window find-file-other-frame ;; buffers ("switch to buffer" . flexi-switch-to-buffer) kill-buffer ;; switch-to-buffer-other-window ;; switch-to-buffer-other-frame ;; windows ("split window" . split-window-vertically) other-window delete-window delete-other-windows ;; frames ;; cursor movement beginning-of-line end-of-line beginning-of-buffer end-of-buffer forward-paragraph backward-paragraph scroll-up scroll-down ("page down" . scroll-up) ("page up" . scroll-down) ;; formatting fill-paragraph ;; modes auto-fill-mode ) "Modified version of default command list.") (defvar voice-required-features '(spoken-forms versor-voice gentext-voice emacs-lisp-voice flexi-choose-voice general-voice insert-voice text-structures dired-voice rpn-edit voicescript languide embedded-commands type-break-voice misc-voice movements-voice prefix-voice texinfo-voice word-isearch-voice voice-assist-key sidebrain-voice planner-voice) "Things that must be required to use with the voice system.") (defun start-voice-system () "Start the voice system." (interactive) (if (and (boundp 'vr-host) (stringp vr-host) (not (host-is-reachable vr-host))) (message "Needs vr-host %s but could not reach it" vr-host) (message "Choosing voice system") (if (and (boundp 'old-voice) old-voice) (let ((voice-dir (substitute-in-file-name "$GATHERED/emacs/voice/vrmode/"))) (message "Using old version of voice system") (add-lispdir voice-dir) (load-file (substitute-in-file-name "$GATHERED/emacs/voice/vrmode/vr.el"))) (let ((voice-dir (substitute-in-file-name "$COMMON/open-projects/emacs-vr-mode/vrmode/"))) (message "Using new version of voice system") (add-lispdir voice-dir) (load-file (expand-file-name "vr.el" voice-dir)))) (message "Chosen voice system and loaded library") ;; the collection of voice commands provided in the original pbvkit: (message "just a message: %S" (substitute-in-file-name "$GATHERED/emacs/voice/elisp/vr-mode-commands.el")) (load-file "$GATHERED/emacs/voice/elisp/vr-mode-commands.el") (add-lispdir "$COMMON/emacs/my-extensions-to-packages/voice") ;; (add-lispdir "$GATHERED/emacs/voice/else") (add-lispdir "$GATHERED/emacs/voice/elisp") ;; (add-lispdir "$GATHERED/emacs/voice/voicegrip/EmacsMacros") (message "Adding features needed to support my voice commands") ;; The following packages are loaded to make their contributions to the ;; voice command list. (mapcar 'require voice-required-features) (message "Required features loaded for voice") ;; (load-library "else-mode.el") (load-library "cachepad.el") ;; (load-library "translate-mode.el") ;; (load-library "vgEmacs.el") (setq vr-voice-command-list '( vr-almost-default-voice-command-list ; modified from vr-default-voice-command-list provided with vr-mode.el vr-dired-commands vr-general-commands ; assorted things that I've added vr-versor-command-list ; movements within current dimension vr-versor-dimension-command-list ; names of dimensions vr-flexi-choose-top-commands ; commands that use flexi choose vr-flexi-choose-commands ; shortcuts directly to lines vr-prefix-commands rpn-voice-commands ; editing using a stack vs-command-list ; control of voice scripting sensible-languages-commands ; navigation according to the sense of programming languages vr-nested-blocks-voice-commands ; generalized in/out/over nested things vr-embedded-commands-top-commands ; recognize command phrases in text as it is entered vr-gentext-commands ; markup constructs in various markup languages vr-emacs-lisp-commands ; for programming in elisp vr-insert-commands ; parentheses, comment, latest, expand etc vr-text-structure-commands ; parentheses etc ;; vr-insert-menu-commands vr-movement-commands vr-journal-commands ; journalling stuff -- start a new day type-break-voice-commands ;; stuff that came in the original pack vr-cachepad-command-list ;; vr-else-command-list ; vr-emacs-command-list ; vr-python-command-list ; vr-setnu-command-list ;; vr-translate-mode-command-list ;; vr-voicegrip-command-list ;; vr-vr-command-list vr-sidebrain-commands vr-texinfo-commands vr-muse-commands vr-word-isearch-commands vr-planner-commands misc-voice-command-list vr-vr-help-command-list )) (setup-flexi-choose-minibuffer) (setq vr-command (substitute-in-file-name (if (and (boundp 'old-voice) old-voice) "$GATHERED/emacs/voice/vrmode/vr.exe" "$GATHERED/emacs/voice/vrmode9/vr.exe")) vr-commands-file (substitute-in-file-name "$COMMON/tmp/vr-commands.html")) (add-hook 'vr-mode-setup-hook (lambda () (jcgs-report-vr-setup "from vr-mode-setup-hook"))) (add-hook 'vr-mode-setup-hook (lambda () (message "vr-voice-command-list=%S" vr-voice-command-list))) (add-hook 'vr-mode-startup-hook (lambda () (jcgs-report-vr-setup "from vr-mode-startup-hook"))) (setq stacks-popup-frame t) (require 'screen-setups) (add-to-list 'stacks-frame-parameters (cons 'font (second (get-screen-setup "tiny" "compact")))) ;; (show-stacks) (message "About to start vr mode, using %s" vr-command) (message "Command list is %S" vr-voice-command-list) (vr-mode 1) (message "Started vr mode") (create-cache-window) (message "Created cache window") )) (if (on-voice-system) (start-voice-system) (message "Not a voice system") ) ;;; end of mode-setups/voice-setup.el