ben  committed 4699ee8

make func-menu less intrusive when building its menubar entry

  • Participants
  • Parent commits c14794f
  • Branches default

Comments (0)

Files changed (2)

+2001-04-21  Ben Wing  <>
+	* 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  <>
 	* man.el (manual-entry): limit search to current line when trying

File func-menu.el

 ;;; 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.)"
-  (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 ()
   (and fume-running-xemacs
        (assoc fume-menubar-menu-name current-menubar)
-       (fume-add-menubar-entry)
+       (fume-add-menubar-entry t)
 (defun fume-replace-str (s r b e) (concat (substring s 0 b) r (substring s e)))