From xemacs-m  Wed Apr 23 13:11:13 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id NAA10282
	for <xemacs-beta@xemacs.org>; Wed, 23 Apr 1997 13:11:11 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id UAA24352; Wed, 23 Apr 1997 20:11:10 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Re: 20.2-b1 change in load-sound-file
References: <3411.861807414@rtp.ericsson.se> <m23eshwrhy.fsf@altair.xemacs.org>
X-URL: ftp://gnjilux.cc.fer.hr/pub/unix/util/wget/
X-Save-Project-Gutenberg: <URL:http://www.promo.net/pg/nl/pgny_nov96.html>
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 23 Apr 1997 20:11:09 +0200
In-Reply-To: Steven L Baur's message of 23 Apr 1997 10:58:33 -0700
Message-ID: <kigohb5fw3m.fsf@jagor.srce.hr>
Lines: 95
X-Mailer: Gnus v5.4.45/XEmacs 19.15

Steven L Baur <steve@miranova.com> writes:

> Raymond Toy <toy@rtp.ericsson.se> writes:
> 
> > Signaling: (wrong-type-argument stringp nil)
> >   find-file-name-handler(nil file-name-sans-versions)
> >   file-name-sans-versions(nil)
> >   find-buffer-file-coding-system-from-filename(nil)
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> There is a MULE bug in sound.el.

Offhand, I wouldn't say it's a MULE bug.  The backtrace says:

  insert-file-contents(nil)
  load-sound-file("bboop.au" bboop 30)

Which means that insert-file-contents gets called with nil.  It's
natural that one function or the other below this will bomb (in this
case it was a MULE function).

The bug (and the change wrt 19.15) is in `load-sound-file'.  It used
to be:

  (insert-file-contents filename)

which works correctly with `default-directory' changed via `let' and a
directory-less file specified.  But the current version says:

  (insert-file-contents 
   (locate-file filename  default-sound-directory-list  sound-ext ))

`locate-file' now happily ignores the `default-directory'.  IMHO the
current behaviour is better.

Note to Raymond:

Try using the following construct:

(push "/apps/public/xemacs/sounds/" default-sound-directory-list)
(load-sound-file "bboop.au" 'bboop 30)
...etc...

It should work, and it's cleaner (no mucking with `default-directory').

The Right Thing is, of course, to signal an error if the file wasn't
located, not to call `insert-file-contents' with nil.

Apply this patch [Steve, I think this is good enough for 20.2]:

--- sound.el.orig	Wed Apr 23 20:00:12 1997
+++ sound.el	Wed Apr 23 20:10:10 1997
@@ -92,14 +92,14 @@
   :type '(repeat  (sexp :tag "Sound")
 		  ))
 
-(defcustom default-sound-directory data-directory
+(defcustom default-sound-directory (concat data-directory "sounds/")
   "Default directory to load a sound file from."
   :group 'sound
   :type 'directory
   )
 
 (defcustom sound-ext ""
-  "Filename extensions to complet sound file name with. If more than one 
+  "Filename extensions to complete sound file name with. If more than one 
    extension is used, they should be separated by \":\". "
   :group 'sound
   :type 'string)
@@ -130,14 +130,15 @@
 nVolume (0 for default): ")
   (or (symbolp sound-name) (error "sound-name not a symbol"))
   (or (null volume) (integerp volume) (error "volume not an integer or nil"))
-  (let (buf data)
+  (let (buf data
+	(file (locate-file filename  default-sound-directory-list  sound-ext)))
+    (or file (error "Cannot locate %s" filename))
     (unwind-protect
 	(save-excursion
 	  (set-buffer (setq buf (get-buffer-create " *sound-tmp*")))
 	  (buffer-disable-undo (current-buffer))
 	  (erase-buffer)
-	  (insert-file-contents 
-	   (locate-file filename  default-sound-directory-list  sound-ext ))
+	  (insert-file-contents file)
 	  (setq data (buffer-string))
 	  (erase-buffer))
       (and buf (kill-buffer buf)))


-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
4.  Thou shalt not warlorde a sig if it bee the sig of Kibo, nor if
    it bee the sig of the Inner Circle.

