From xemacs-m  Mon Jul 21 01:33:13 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id BAA25156
	for <xemacs-beta@xemacs.org>; Mon, 21 Jul 1997 01:33:12 -0500 (CDT)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.6/8.8.6) id XAA02633;
	Sun, 20 Jul 1997 23:36:43 -0700
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: Re: speedbar
References: <m2g1t9vtbz.fsf@sauna.ton.tut.fi>
X-Face: `'%\i;ySOu]g?NlziJSk_$&@]KP`}~PEQPjZ5;nxSaDW_o$4+4%Ab]%Ifw3ZR;7TIT3,O,'
 @2{L;]ox6kc;$_5kU'n**9vFg-]eV~GbxSVCx|(s%uR[],*:^WKmC`B}(;|k9/m]gwt?&`t;^rfCJg
 khHH>pP1W\)xM0U@!FNDD72{3fDP$PkBhx^7Z?-WxH6DbFN:QOnT`llzW}VGdYv;n9lzljQvKTIBhQ
 YuV
X-Attribution: sb
From: SL Baur <steve@xemacs.org>
In-Reply-To: Markus Linnala's message of "21 Jul 1997 08:59:28 +0300"
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
Date: 20 Jul 1997 23:36:42 -0700
Message-ID: <m24t9o9ait.fsf@altair.xemacs.org>
Lines: 112
X-Mailer: Gnus v5.4.64/XEmacs 20.3(beta15) - "Berlin"

Markus Linnala <maage@cs.tut.fi> writes:

> I have some problems with it.

> Below is very quick patch to make it actually work. After applying it
> I can start speedbar by manually doing an autoload. Why doesn't
> autload work automatically, as I suppose it should?

The autoload magic cookie was broken.

> Well actually I don't know what I'm doing.

O.K.  I've added some comments, and attached what I think is a better
version of the patch.

> [2  <text/plain; US-ASCII (7bit)>]
> --- lisp/utils/speedbar.el.~1~	Mon Jun 30 02:13:33 1997
> +++ lisp/utils/speedbar.el	Mon Jul 21 08:49:28 1997
> @@ -328,7 +328,8 @@
>  is attached to.  To add more frame defaults, `cons' new alist members
>  onto this variable through the `speedbar-load-hook'")
 
> -(defvar speedbar-use-imenu-flag (stringp (locate-library "imenu"))
> +(defvar speedbar-use-imenu-flag (and (not running-xemacs) 
> +				     (stringp (locate-library "imenu")))

This isn't good because Eric is Doing The Right Thing and doing a
feature test instead of a straight version test (as you are
substituting).  The fact that there is an imenu in XEmacs but it
doesn't work is not his fault.  I've removed imenu from beta15 and put 
it in the Attic on ftp.xemacs.org should someone wish to work on it.

>    "*Non-nil means use imenu for file parsing.  nil to use etags.
>  XEmacs doesn't support imenu, therefore the default is to use etags
>  instead.  Etags support is not as robust as imenu support.")
> @@ -722,7 +723,8 @@
>  	(let ((params (cons (cons 'height (frame-height))
>  			    speedbar-frame-parameters)))
>  	  (setq speedbar-frame
> -		(if (< emacs-major-version 20) ;a bug is fixed in v20 & later
> +		(if (or running-xemacs 

A better version of this test is (featurep 'xemacs).  It won't bomb on 
Emacs and you don't have to do
(and (boundp 'running-xemacs) running-xemacs)

That being said, there is already an XEmacs detection variable in this 
file -- `speedbar-xemacsp'.

> -    (if speedbar-xemacsp (set-buffer-menubar (list km)))))
> +    ;(if speedbar-xemacsp (set-buffer-menubar (list km)))
> +))

What does this avoid, exactly?  Does this code work on earlier XEmacsen?
It should either be removed entirely, or have a guard on XEmacs version
number.



Rename imenu.el and imenu.elc to -imenu.el and -imenu.elc or delete
them.  You will have to rebuild the autoloads with `make autoloads'
for the new autoloads to take effect.

Index: lisp/utils/speedbar.el
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/lisp/utils/speedbar.el,v
retrieving revision 1.2
diff -u -r1.2 speedbar.el
--- speedbar.el	1997/06/29 23:13:33	1.2
+++ speedbar.el	1997/07/21 06:25:54
@@ -672,8 +672,9 @@
 
 ;;; Mode definitions/ user commands
 ;;
-;;###autoload
+;;;###autoload
 (defalias 'speedbar 'speedbar-frame-mode)
+;;;###autoload
 (defun speedbar-frame-mode (&optional arg)
   "Enable or disable speedbar.  Positive ARG means turn on, negative turn off.
 nil means toggle.  Once the speedbar frame is activated, a buffer in
@@ -722,7 +723,8 @@
 	(let ((params (cons (cons 'height (frame-height))
 			    speedbar-frame-parameters)))
 	  (setq speedbar-frame
-		(if (< emacs-major-version 20) ;a bug is fixed in v20 & later
+		(if (or speedbar-xemacsp
+			(< emacs-major-version 20)) ;a bug is fixed in v20 & later
 		    (make-frame params)
 		  (let ((x-pointer-shape x-pointer-top-left-arrow)
 			(x-sensitive-text-pointer-shape x-pointer-hand2))
@@ -761,7 +763,9 @@
 (defun speedbar-frame-width ()
   "Return the width of the speedbar frame in characters.
 nil if it doesn't exist."
-  (and speedbar-frame (cdr (assoc 'width (frame-parameters speedbar-frame)))))
+  (and speedbar-frame
+       (frame-live-p speedbar-frame)
+       (cdr (assoc 'width (frame-parameters speedbar-frame)))))
 
 (defun speedbar-mode ()
   "Major mode for managing a display of directories and tags.
@@ -887,7 +891,8 @@
 		    ;; The trailer
 		    speedbar-easymenu-definition-trailer)))
     (easy-menu-define speedbar-menu-map speedbar-key-map "Speedbar menu" md)
-    (if speedbar-xemacsp (set-buffer-menubar (list km)))))
+    ;; (if speedbar-xemacsp (set-buffer-menubar (list km)))
+))
 
 
 ;;; User Input stuff

