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

Bug in emacspeak-get-voicefied-mode-name



I forgot to add my modified version of the code. Here it is. It appears to have
fixed the problem, though not extensively tested.

(defsubst emacspeak-get-voicefied-mode-name (mode-name)
  "Return voicefied version of this mode-name."
  (declare (special emacspeak-voicefied-mode-names))
  (let* ((mode-name-str (if (stringp mode-name)
                            mode-name
                          (format-mode-line mode-name)))
         (result (gethash mode-name-str emacspeak-voicefied-mode-names)))
    (or result
        (progn
          (setq result (copy-sequence mode-name-str))
          (put-text-property 0 (length result)
                             'personality voice-animate result)
          (puthash mode-name-str result emacspeak-voicefied-mode-names)
          result))))


Tim Cross writes:
 > Hi Raman,
 > 
 > I have found a bug in emacspeak-get-voicefied-mode-name. I think I know what
 > needs to be done to fix it, but wanted to check first. 
 > 
 > Details
 > 
 > GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0) of 2011-01-31 on
 > blind-mole
 > 
 > Latest emacspeak from svn
 > 
 > Recipe to reproduce. 
 > 
 > 1. Open an org-mode agenda todo list with C-c a t
 > 2. Hit C-e m to speak the mode line
 > 
 > Gives the backtrace 
 > 
 > Debugger entered--Lisp error: (wrong-type-argument buffer-or-string-p ("Org-Agenda"
 > "" " " (:eval (org-agenda-span-name org-agenda-current-span)) "" "" " Diary" " Ddl"
 > " Grid" "" "" "" "" ""))
 >   ad-Orig-put-text-property(0 14 personality acss-a7-p7-s6 ("Org-Agenda" "" " "
 > (:eval (org-agenda-span-name org-agenda-current-span)) "" "" " Diary" " Ddl" " Grid"
 > "" "" "" "" ""))
 >   put-text-property(0 14 personality acss-a7-p7-s6 ("Org-Agenda" "" " " (:eval
 > (org-agenda-span-name org-agenda-current-span)) "" "" " Diary" " Ddl" " Grid" "" ""
 > "" "" ""))
 > 
 > I've tracked this down to emacspeak-get-voicefied-mode-name. The problem
 > appears to be that this function expects the mode name to be a string. However,
 > according to the documentation, is usually a string, but can be any of the
 > constructs for mode-line-format. 
 > 
 > According to the documentation, to get a string, you need to format mode-name
 > with format-mode-line. Therefore, my suggested (untested) solution would be to
 > format mode-name using mode-line-format and use that string as the key to the
 > hash and as the argument passed to put-text-properties. My only concern with
 > doing this is that it would seem you get more than just the mode name,
 > potentially making the function return a more verbose result than is
 > desired. Therefore, it may need to be slightly more complicated i.e. test if
 > the argument is a string, if it is use it, if it is not, format with
 > format-mode-line and take the first word from that string. 
 > 
 > Am I on the right track?
 > 
 > Tim
 > 
 > 
 > 
 > -- 
 > Tim Cross
 > Information Technology 
 > University of New England
 >  Phone: +61 2 6773 3210
 > Mobile: 0428 212217
 >    Fax: +61 2 6773 3424
 > E-Mail: tcross@une.edu.au
 >    Web: http://www.une.edu.au/itd
 > ---
 > Please avoid sending me Word or PowerPoint attachments.
 > See http://www.gnu.org/philosophy/no-word-attachments.html
 > 
 > Any fool can make things bigger, more complex, and more violent. It takes a
 > touch of genius (and a lot of courage) to move in the opposite direction.
 >                                                            âAlbert Einstein
 > 
 > 
 > 
 > 
 > 
 > 
 > -----------------------------------------------------------------------------
 > To unsubscribe from the emacspeak list or change your address on the
 > emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
 > subject of "unsubscribe" or "help".
 > 

-- 
Tim Cross
Information Technology 
University of New England
 Phone: +61 2 6773 3210
Mobile: 0428 212217
   Fax: +61 2 6773 3424
E-Mail: tcross@une.edu.au
   Web: http://www.une.edu.au/itd
---
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Any fool can make things bigger, more complex, and more violent. It takes a
touch of genius (and a lot of courage) to move in the opposite direction.
                                                           âAlbert Einstein






-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
subject of "unsubscribe" or "help".



If you have questions about this archive or had problems using it, please send mail to:

priestdo@cs.vassar.edu No Soliciting!

Emacspeak List Archive | 2010 | 2009 | 2008 | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 | 2001 | 2000 | 1999 | 1998 | Pre 1998

Emacspeak Files | Emacspeak Blog | Search the archive