[Top][All Lists]

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

Re: Bad defcustom in speedbar, or non-interactive message in locate-libr

From: Stefan Monnier
Subject: Re: Bad defcustom in speedbar, or non-interactive message in locate-library
Date: Thu, 27 Jan 2005 20:56:29 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> I think that what is happening here is that a default value for
> speedbar-use-imenu-flag, which causes a message to be written to the echo
> area, is being reexecuted repeatedly. I believe that this is a bug, and that
> the defcustom of speedbar-use-imenu-flag needs to be redefined. One possible
> fix (surely not the best) is to wrap the defcustom's init value in (let
> ((executing-kbd-macro t))...) to prevent its locate-library message from
> appearing. (This was why I asked for a way to inhibit messages, which I
> still think is needed as an enhancement.)

A better fix is to remove this horrible call to locate-library and use
(fboundp 'imenu) instead.  See patch below,


--- speedbar.el 11 nov 2004 17:07:22 -0500      1.60
+++ speedbar.el 27 jan 2005 20:55:51 -0500      
@@ -1,6 +1,7 @@
 ;;; speedbar.el --- quick access to files and tags in a frame
-;;; Copyright (C) 1996, 97, 98, 99, 2000, 01 Free Software Foundation
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2005
+;;           Free Software Foundation
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Version: 0.11a
@@ -170,6 +171,8 @@
 ;; - More functions to create buttons and options
 ;; - Timeout directories we haven't visited in a while.
+;;; Code:
 (require 'assoc)
 (require 'easymenu)
@@ -201,7 +204,6 @@
   :prefix "speedbar-"
   :group 'speedbar)
-;;; Code:
 (defvar speedbar-initial-expansion-mode-alist
   '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map
@@ -373,7 +375,7 @@
                        (symbol :tag "Property")
                        (sexp :tag "Value"))))
-(defcustom speedbar-use-imenu-flag (stringp (locate-library "imenu"))
+(defcustom speedbar-use-imenu-flag (fboundp 'imenu)
   "*Non-nil means use imenu for file parsing.  nil to use etags.
 XEmacs prior to 20.4 doesn't support imenu, therefore the default is to
 use etags instead.  Etags support is not as robust as imenu support."
@@ -3749,7 +3751,7 @@
-(eval-when-compile (if (locate-library "imenu") (require 'imenu)))
+(eval-when-compile (condition-case nil (require 'imenu) (error nil)))
 (defun speedbar-fetch-dynamic-imenu (file)
   "Load FILE into a buffer, and generate tags using Imenu.
@@ -4359,5 +4361,5 @@
 ;; run load-time hooks
 (run-hooks 'speedbar-load-hook)
-;;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
+;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
 ;;; speedbar.el ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]