[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacspeak-wl.el (mark indication and unread mark voice lock)



 南谷です。いろいろ忙殺されていて、mlがあまりフォローできていません。
ごめんなさい。
 emacspeak-wl.elをいじりました。
 まず、マークを「リファイル」、「アンリード」など意味で読むようにしました。
ただし、マークのシンボルの代わりに意味を読むのではなく、意味を読み
上げてその後該当メッセージに関する番号、マークのシンボル、日付...という
通常の情報1行分を読むという状態です。
 また、井上さんのコードを手本に声変えをするようにしました。ただし、wlには
無数のマークがあるので、一つ一つに特定の声を割り当てても繁雑になるだけ
と考え、既に意味の読み上げもあるので、未読のもののみ同じ声に変える
ようにしました。
 wlには一時的マーク、永続的マークという2種類のマーク群があります。
これらはSummaryでそれぞれ1カラムで示されます。
で、永続的マークで、read/unread/cached/uncachedなどを示しているのですが、
永続的マークには$のシンボルで現されるimportantマークというのもあります。
$を手動で付けてしまうと、未読、既読マークが消えてしまい、声変えもなくな
ります。メッセージに付いている一時的マークを返す関数は発見したの
ですが、永続的マークについてはそういう関数がないみたいなので、現在は
Summaryバッファをregexpで調べているので、こうなってます。
 それと、質問なのですが、emacspeak-wl.elでカーソル移動の読み上げを
(emacspeak-read-line)で読み上げるようにしているアドバイスがいくつか
ありますが、これらはemacspeak標準の機能で読み上げれる
みたいです。マーク読み上げなどとの兼ね合いもあって、整理したいと考
えているのですが、まずいでしょうか?特にWindows上での状況が分からな
いので躊躇しています。
 以上、とりとめもなく書いてしまいましたが、報告です。
 変更が大幅で、コードも自信がないので、まずは添付してみます。
興味のある方お試し下さい。


===File ~/emacspeak-wl.el===================================
;;; emacspeak-wl.el --- Speech enable Wanderlust -- Fluent spoken access to Yet Another Message Interface on Emacsen
;;; $Id: emacspeak-wl.el,v 1.1.2.9 2001/04/19 12:12:41 minatani Exp $
;;; $Author: minatani $ 
;;; Description:  Emacspeak extension to speech enable wanderlust
;;; Keywords: Emacspeak, wl,wanderlust , mail,News Advice, Spoken Output
;;{{{  LCD Archive entry: 

;;; LCD Archive Entry:
;;; emacspeak| T. V. Raman |raman@cs.cornell.edu 
;;; A speech interface to Emacs |
;;; $Date: 2001/04/19 12:12:41 $ |
;;;  $Revision: 1.1.2.9 $ | 
;;; Location undetermined
;;;

;;}}}
;;{{{  Copyright:
;;;Copyright (C) 1995 -- 2000, T. V. Raman 
;;; Copyright (c) 1994, 1995 by Digital Equipment Corporation.
;;; 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.

;;}}}
(require 'cl)
(declaim  (optimize  (safety 0) (speed 3)))
(eval-when (compile) (require 'wl)
           (require 'wl-folder)
           (require 'wl-summary)
           (require 'wl-thread)
           (require 'wl-address)
           (require 'wl-draft)
           (require 'voice-lock)
           (require 'emacspeak-keymap)
           (require 'emacspeak-fix-interactive))
(require 'emacspeak-speak)

(require 'emacspeak-sounds)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar emacspeak-wl-unread-mark-voice 'paul-animated)
;;{{{ voice lock keywords
(defvar wl-summary-voice-lock-keywords nil
  "keywords for wl-summary-mode")
(setq wl-summary-voice-lock-keywords
      (append wl-summary-voice-lock-keywords
;	      '(("\\(^ *[0-9]+.[\\!NU]\\)" 1 emacspeak-wl-unread-mark-voice)
	      '(("\\(^ *[0-9]+.[\\!NU].*$\\)" 1 emacspeak-wl-unread-mark-voice)
)))
;;}}}

;;{{{ hook
(add-hook 'wl-summary-mode-hook
          (function (lambda ()
		      (make-local-variable 'voice-lock-support-mode)
		      (setq voice-lock-support-mode 'lazy-voice-lock-mode)
		      (make-local-variable 'voice-lock-defaults)
		      (setq voice-lock-defaults '(wl-summary-voice-lock-keywords t))
		      (voice-lock-mode 1)
		      (define-key wl-summary-mode-map ","    'emacspeak-wl-summary-jump-to-summary-message)
		      (define-key wl-summary-mode-map "\C-p"
			'emacspeak-wl-summary-previous-line)
		      (define-key wl-summary-mode-map "\C-n"
			'emacspeak-wl-summary-next-line)
		      (define-key wl-summary-mode-map '[up]
			'emacspeak-wl-summary-previous-line)
		      (define-key wl-summary-mode-map '[down]
			'emacspeak-wl-summary-next-line)
		      )))
;;{{{ Advise top-level Wanderlust command
;(defadvice wl (after emacspeak pre act )
;  "read the mode line after wl starts."
;  (emacspeak-speak-mode-line))

;(defadvice wl-exit (after emacspeak pre act )
;  "read the mode line after wl End."
;  (emacspeak-speak-mode-line))

;(defadvice wl-folder-prev-entity (after emacspeak pre act)
;  "speeks the message after movement for folder mode"
;  (emacspeak-speak-line))

;(defadvice wl-folder-next-entity (after emacspeak pre act)
;  "speeks the message after movement for folder mode"
;  (emacspeak-speak-line))

;(defadvice wl-folder-prev-unread (after emacspeak pre act)
;  "speeks the message after movement for folder mode"
;  (emacspeak-speak-line))

;(defadvice wl-folder-next-unread (after emacspeak pre act)
;  "speeks the message after movement for folder mode"
;  (emacspeak-speak-line))

;(defadvice wl-folder-goto-first-unread-folder (after emacspeak pre act)
;  "speak the message unread folder for summary"
;  (emacspeak-speak-line))

;(defadvice wl-folder-suspend (after emacspeak pre act)
;  "announces after wanderlust suspends."
;  (emacspeak-speak-mode-line))

(defadvice wl-summary-prev (after emacspeak pre act)
  "speeks the message after movement"
;  (emacspeak-speak-line)
;(emacspeak-wl-read-temp-mark)
;(emacspeak-wl-read-permanent-mark)
(let ((dtk-stop-immediately nil))
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)
  )

(defadvice wl-summary-next (after emacspeak pre act)
  "speeks the message after movement"
;  (emacspeak-speak-line)
(let ((dtk-stop-immediately nil))
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)
  )

(defadvice wl-summary-display-top (after emacspeak pre act)
  "speeks the message after movement"
;  (emacspeak-speak-line)
(let ((dtk-stop-immediately nil))
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)
  )

(defadvice wl-summary-display-bottom (after emacspeak pre act)
  "speeks the message after movement"
;  (emacspeak-speak-line)
(let ((dtk-stop-immediately nil))
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)
  )

(defadvice wl-summary-goto-folder (after emacspeak pre act)
  "speeks the message after folder movement"
  (emacspeak-speak-line)
  )

(defadvice wl-summary-reply (after emacspeak pre act )
  "speeks the current line after new message is opened."
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )

(defadvice wl-summary-reply-with-citation (after emacspeak pre act )
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft with citation is prepared")
  )

(defadvice wl-summary-write (after emacspeak pre act )
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )

(defadvice wl-summary-forward (after emacspeak pre act )
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )

(defadvice wl-summary-reedit(after emacspeak pre act)
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )

(defadvice wl-summary-resend-bounced-mail (after emacspeak pre act)
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )

(defadvice wl-summary-write-current-folder (after emacspeak pre act)
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )
 
(defadvice wl-draft (after emacspeak pre act )
  "Tells that draft is prepared"
  (dtk-set-punctuations-to-all)
  (dtk-speak "draft is prepared")
  )

(defadvice wl-summary-down (after emacspeak pre act)
  "speeks the message after movement"
;  (emacspeak-speak-line)
(let ((dtk-stop-immediately nil))
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)
  )

(defadvice wl-summary-up (after emacspeak pre act)
  "speeks the message after movement"
;  (emacspeak-speak-line)
(let ((dtk-stop-immediately nil))
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)
  )

;(defadvice wl-summary-exit (after emacspeak pre act)
;  "speeks the message aftersummary quit  "
;  (emacspeak-speak-mode-line)
;)

;(defadvice wl-summary-force-exit (after emacspeak pre act)
;  "speeks the message aftersummary quit  "
;  (emacspeak-speak-mode-line)
;)

(defadvice wl-folder-jump-to-current-entity (after emacspeak pre act)
  "Speak The Message after folder jumped current "
  (emacspeak-speak-mode-line)
  )  

(defadvice wl-summary-jump-to-current-message (after emacspeak pre act)
  "speak msg number and go to end of the header"
  (dtk-speak wl-message-buffer-cur-number)
  (search-forward "\n\n")
  (backward-char))

(defadvice wl-summary-jump-to-parent-message (after emacspeak pre act)
  "speak the parent message"
  (emacspeak-speak-line))

(defadvice wl-draft-mimic-kill-buffer (after emacspeak pre act)
  "anounce kill draft buffer"
(emacspeak-speak-mode-line))


(defun emacspeak-wl-summary-jump-to-summary-message ()
  "Jump to message which cursor located on summary buffer and speak msg number, go to end of the header"
  (interactive)
  (if (wl-summary-message-number)
      (progn (wl-summary-redisplay)
	     (wl-summary-jump-to-current-message))
    (message "No message to display.")))


;;}}}
(provide 'emacspeak-wl)

(defun emacspeak-wl-read-temp-mark ()
(interactive)
(setq msg-no (wl-summary-message-number))
(if 
(wl-summary-msg-marked-as-target msg-no)
(setq temp-mark "target")
(if (wl-summary-msg-marked-as-copied msg-no)
(setq temp-mark "copy")
(if (wl-summary-msg-marked-as-deleted msg-no)
(setq temp-mark "delete")
(if (wl-summary-msg-marked-as-refiled msg-no)
(setq temp-mark "refile")
(setq temp-mark " ")
))))
;(dtk-speak mark)
temp-mark
)

(defun emacspeak-wl-read-permanent-mark ()
  (interactive)
  (beginning-of-line)
(when (looking-at "^ *\\([0-9]+\\)[^0-9]\\([^0-9]\\)")
  (progn
    (setq mark (wl-match-buffer 2))
    (if (string= mark wl-summary-new-mark)
	(setq per-mark "new")
      (if (string=  mark wl-summary-unread-uncached-mark)
(setq per-mark "unread uncached")
      (if (string= mark wl-summary-important-mark)
(setq per-mark "important")
(if (string= mark wl-summary-unread-cached-mark)
(setq per-mark "unread")
(if (string= mark wl-summary-read-uncached-mark)
(setq per-mark "uncached")
(setq per-mark " ")
)))))))
;(dtk-speak per-mark)
per-mark
)

(defvar wl-temp-line "")

(defun emacspeak-wl-summary-speak-current-line-with-markmeaning ()
(interactive)
(save-excursion
(beginning-of-line)
(setq start (point))
(end-of-line)
(setq end (point))
(setq line (buffer-substring start end ))
(let ((dtk-stop-immediately t))
(dtk-speak (concat (emacspeak-wl-read-temp-mark)  (emacspeak-wl-read-permanent-mark) line))
)))



(defun emacspeak-wl-summary-speak-line ()
  "Speaks current summary line as specified."
;  (emacspeak-speak-line)
(emacspeak-wl-summary-speak-current-line-with-markmeaning)
)

(defun emacspeak-wl-summary-next-line (arg)
  (interactive "p")
  (next-line arg)
  (emacspeak-wl-summary-speak-line)
)

(defun emacspeak-wl-summary-previous-line (arg)
  (interactive "p")
  (previous-line arg)
  (emacspeak-wl-summary-speak-line)
)
============================================================