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

Possible emacspeak bug

Hi Raman,

I think I’ve found a bug in emacspeak-m-player.el

It relates to the initialisation of the mplayer executable. 

You have the following definition

(defcustom emacspeak-m-player-program
  (executable-find "mplayer")
  "Media player program."
  :type 'string
  :set  #'(lambda (sym val)
            (set-default sym
                         (executable-find val)))
  :group 'emacspeak-m-player)

The error I get is “file mode specificaiton error: (wrong-type-argument: stringp nil)

This is under OSX. I do not have mplayer installed. 

The problem I think is that the initial value for the value is supposed to be the return value from executable-find. However, you also call executable-find in the set! function. 

If you don’t have mplayer installed, the result is nil. This is passed as the val to the lambda used as the set! function. However, that funciton also calls executable-find with the val value. This results in executable-find being called with an argument of nil, generating the wrong type argument error.

Perhaps change the lambda to something like

#’(lambda (sym val)
  (if val
    (set-default sym (executable-find val))
   (set-default sym nil)))

though I still find it ‘clumsy’ to be calling executable-find twice when the initial value is processed. Note also that the documentation for defcustom states 

"The function should not modify its value argument destructively. “

so perhaps the set! lamba should not call executable-find at all and instead trust that the user sets this correctly?




Tim Cross
Information Security Manager

Information Technology Directorate

University of New England
Armidale N.S.W. 2351 Australia

Email: tcross@xxxxxxxxxxx
Phone: +61 2 6773 3210
Mobile: +61 428 212 217

Note: Available Mon - thu Only

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

|All Past Years |Current Year|

If you have questions about this archive or had problems using it, please contact us.

Contact Info Page