Uwe,
http://www.parhasard.net/easymenu.el is easymenu.el with the below
patch, and eliminates the folding mode error messages. I understand the
code, and I’ve tested it locally on 21.4 and 21.5, but if you were to load
it explicitly from your ~/.xemacs/init.el --
(load-file "/home/oub/downloaded-easymenu.el")
after saving it to /home/uwe/downloaded-easymenu.el, I’d appreciate the
testing.
Ar an t-aonú lá is triochad de mí na Nollaig, scríobh Uwe Brauer:
Aidan> Uwe’s right in his subject line, it is the easymenu
Aidan> change. But, the change looks right to me, and I haven’t
Aidan> taken the time to look into what a good fix would be.
Thanks. Now things are even worse: I just realized that when I used
folding.el[1] on lisp files, calling folding mode returns an error
(while for example Latex files don't cause any problems!)
I attach the error message (debug-on-error) and I also debugged the
function, that is folding-mode itself. The problem occurs in the last
line of that function
(easy-menu-remove folding-mode-menu))))
I attach the error-message of that call as well
Finally I had a look into the chance you mentioned it is just a
chance from < to >. Can somebody tell why this change has been done?
The change was done because:
(defun easy-menu-remove (menu)
"Remove MENU from the current menu bar."
(when (featurep 'menubar)
(setq easy-menu-all-popups (delq menu easy-menu-all-popups)
mode-popup-menu (if (< (length easy-menu-all-popups) 1)
(cons (easy-menu-title)
(reverse easy-menu-all-popups))
[...]
as it was originally is clearly wrong. In the true branch of the (if ...)
statement, reversing easy-menu-all-popups is a waste of time, because its
length is zero. Michael added those lines on 2001-04-12, and there’s no
ChangeLog entry for why. After lots of reading of code, I find he did it to
add entries in the button-3 popup-menu for easy-menu menus.
(I looked into what the FSF are doing with it lately, to encounter this from
RMS. He’s better at designing spokes than Per, apparently:
;;; Commentary:
;; This is compatible with easymenu.el by Per Abrahamsen
;; but it is much simpler as it doesn't try to support other Emacs versions.
;; The code was mostly derived from lmenu.el.)
lisp/ChangeLog addition:
2006-01-03 Aidan Kehoe <kehoea(a)parhasard.net>
* easymenu.el: Update copyright.
* easymenu.el (easy-menu-all-popups):
Add a docstring.
* easymenu.el (easy-menu-add):
Document a bug, rework the function to preserve any existing
non-default mode-popup-menu instead of overwriting it, and not to
bother normalising the menu title (nothing else does).
* easymenu.el (easy-menu-remove):
Restore the default mode-popup-menu instead of leaving an empty
one when we remove the last easy-menu popup.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: lisp/easymenu.el
Index: lisp/easymenu.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/easymenu.el,v
retrieving revision 1.8
diff -u -u -r1.8 easymenu.el
--- lisp/easymenu.el 2005/03/25 16:15:56 1.8
+++ lisp/easymenu.el 2006/01/03 00:00:11
@@ -1,6 +1,6 @@
;;; easymenu.el - Easy menu support for Emacs 19 and XEmacs.
-;; Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1995, 2005 Free Software Foundation, Inc.
;; Author: Per Abrahamsen <abraham(a)dina.kvl.dk>
;; Maintainer: XEmacs Development Team
@@ -166,25 +166,45 @@
(when (featurep 'menubar)
(apply 'add-menu args)))
-;; This variable hold the easy-menu mode menus of all major and
-;; minor modes currently in effect in the current buffer.
-(defvar easy-menu-all-popups nil)
+(defvar easy-menu-all-popups nil
+ "Don't use this.
+This variable holds the menus of all major and minor modes in effect in the
+current buffer. ")
(make-variable-buffer-local 'easy-menu-all-popups)
(defun easy-menu-add (menu &optional map)
"Add MENU to the current menu bar."
+ ;; If you uncomment the following, do an xemacs -vanilla, type M-x
+ ;; folding-mode RET, you'll see that this code, which theoretically has
+ ;; *scratch* as its buffer context, can't see *scratch*'s value for
+ ;; mode-popup-menu--the default overrides it.
+ ;;
+ ;; This is not specific to *scratch*--try it on ~/.xemacs/init.el--but it
+ ;; does appear to be specific to the first time mode-popup-menu is
+ ;; accessed as a buffer-local variable in non-interactive code (that is,
+ ;; M-: mode-popup-menu RET gives the correct value).
+ ;;
+ ;; My fixing this right now isn't going to happen. Aidan Kehoe, 2006-01-03
+; (message (concat "inside easy-menu-add, menu is %s, "
+; "mode-popup-menu is %s, current buffer is %s, "
+; "default-value mode-popup-menu is %s, "
+; "easy-menu-all-popups is %s")
+; menu mode-popup-menu (current-buffer)
+; (default-value 'mode-popup-menu) easy-menu-all-popups)
(when (featurep 'menubar)
- (unless (member menu easy-menu-all-popups)
- (push menu easy-menu-all-popups))
- (setq mode-popup-menu (if (> (length easy-menu-all-popups) 1)
- (cons (easy-menu-title)
- (reverse easy-menu-all-popups))
- (let ((same-as-menu
- (car easy-menu-all-popups)))
- (cons (normalize-menu-text
- (car same-as-menu))
- (cdr same-as-menu)))))
-
+ ;; Save the existing mode-popup-menu, if it's been changed.
+ (when (and (zerop (length easy-menu-all-popups))
+ (not (equal (default-value 'mode-popup-menu) mode-popup-menu)))
+ (push mode-popup-menu easy-menu-all-popups))
+ ;; Add the menu to our list of all the popups for the buffer.
+ (pushnew menu easy-menu-all-popups :test 'equal)
+ ;; If there are multiple popup menus available, make the popup menu
+ ;; normally shown with button-3 a menu of them. If there is just one,
+ ;; make that button show it, and no super-menu.
+ (setq mode-popup-menu (if (= 1 (length easy-menu-all-popups))
+ (car easy-menu-all-popups)
+ (cons (easy-menu-title)
+ (reverse easy-menu-all-popups))))
(cond ((null current-menubar)
;; Don't add it to a non-existing menubar.
nil)
@@ -202,16 +222,20 @@
(defun easy-menu-remove (menu)
"Remove MENU from the current menu bar."
(when (featurep 'menubar)
- (setq easy-menu-all-popups (delq menu easy-menu-all-popups)
- mode-popup-menu (if (> (length easy-menu-all-popups) 1)
- (cons (easy-menu-title)
- (reverse easy-menu-all-popups))
- (let ((same-as-menu
- (car easy-menu-all-popups)))
- (cons (normalize-menu-text
- (car same-as-menu))
- (cdr same-as-menu)))))
-
+ (setq
+ ;; Remove this menu from the list of popups we know about.
+ easy-menu-all-popups (delq menu easy-menu-all-popups)
+ ;; If there are multiple popup menus available, make the popup menu
+ ;; normally shown with button-3 a menu of them. If there is just one,
+ ;; make that button show it, and no super-menu.
+ mode-popup-menu (if (= 1 (length easy-menu-all-popups))
+ (car easy-menu-all-popups)
+ (cons (easy-menu-title)
+ (reverse easy-menu-all-popups))))
+ ;; If we've just set mode-popup-menu to an empty menu, change that menu
+ ;; to its default value (without intervention from easy-menu).
+ (if (zerop (length easy-menu-all-popups))
+ (setq mode-popup-menu (default-value 'mode-popup-menu)))
(and current-menubar
(assoc (car menu) current-menubar)
(delete-menu-item (list (car menu))))))
@@ -260,9 +284,6 @@
(when (featurep 'menubar)
(delete-menu-item (append path (list name))
(easy-menu-normalize menu))))
-
-
-
;; Think up a good title for the menu. Take the major-mode of the
;; buffer, strip the -mode part, convert hyphens to spaces, and
--
I AM IN JAIL AND ALLOWED SEND ONLY ONE CABLE SINCE WAS ARRESTED WHILE
MEASURING FIFTEEN FOOT WALL OUTSIDE PALACE AND HAVE JUST FINISHED COUNTING
THIRTY EIGHT THOUSAND FIVE HUNDERED TWENTY TWO NAMES WHOS WHO IN MIDEAST.