Commits

Anonymous committed 4699ee8

make func-menu less intrusive when building its menubar entry

Comments (0)

Files changed (2)

+2001-04-21  Ben Wing  <ben@xemacs.org>
+
+	* func-menu.el:
+	* func-menu.el (fume-add-menubar-entry):
+	* func-menu.el (fume-do-add-menubar-entry): New.
+	* func-menu.el (fume-update-menubar-entry): When invoked from
+	find-file-hooks, delay creation of menubar entry until XEmacs
+	becomes idle.  This way, func-menu will not intrude when files are
+	loaded temporarily (e.g. as part of patch-to-change-log).
+
 2001-04-06  Glynn Clements  <glynn.clements@virgin.net>
 
 	* man.el (manual-entry): limit search to current line when trying
 
 ;;; Routines to add/remove/update function menu from menubar
 ;;;
-(defun fume-add-menubar-entry ()
+(defun fume-add-menubar-entry (&optional force)
+  "Add a menubar entry for the functions in the current buffer.
+Meant to be added to `find-file-hooks'.  If FORCE is non-nil, actually
+do the operation now; otherwise, delay until the next time the event
+loop is processed. (This is so that Lisp routines that temporarily load
+a file, process it, and then kill it will not be slowed down by
+function-menu processing.)"
   (interactive)
-  (save-window-excursion (function-menu t)))
+  (if force
+      (save-window-excursion (function-menu t))
+    (enqueue-eval-event 'fume-do-add-menubar-entry (current-buffer))))
+
+(defun fume-do-add-menubar-entry (buffer)
+  (and (buffer-live-p buffer)
+       (save-excursion
+	 (save-window-excursion
+	   (set-buffer buffer)
+	   (function-menu t)))))
 
 (defun fume-remove-menubar-entry ()
   (interactive)
   (and fume-running-xemacs
        fume-not-tty
        (assoc fume-menubar-menu-name current-menubar)
-       (fume-add-menubar-entry)
+       (fume-add-menubar-entry t)
        t))
 
 (defun fume-replace-str (s r b e) (concat (substring s 0 b) r (substring s e)))