Python mode failures with xemacs

Stephen J. Turnbull stephen at xemacs.org
Tue Aug 23 03:32:47 EDT 2011


Mats Lidell writes:

 > I'm thinking if we should implement the :help keyword as a nop and
 > ignore it.

FWIW, I don't like it.  The :help keyword is probably not that hard to
implement, and temporariliy implementing it as a no-op wouldn't be
backward compatible to existing XEmacs installations because easymenu
is a core library.  For future-proofing, I think that we should relax
the requirement that menu keywords be restricted to a hard-coded set.
And move easymenu to xemacs-base.

David's approach is one way to achieve backward compatibility.  I used
the following more brute-force method:

------------------------------------------------------------------------
@@ -989,8 +991,10 @@
 This menu will get created automatically if you have the `easymenu'
 package.  Note that the latest X/Emacs releases contain this
 package.")
 
+(defvar py-easymenu-with-help-p (not (featurep 'xemacs)))
 (defvar py-mode-map nil)
 (setq py-mode-map
+  (flet ((ifemwhp (&rest args) (if py-easymenu-with-help-p args nil)))
   (let ((map (make-sparse-keymap)))
     ;; electric keys
     (define-key map ":" 'py-electric-colon)
@@ -1051,58 +1055,58 @@
     (define-key map [(control return)] 'py-newline-and-dedent)
     (easy-menu-define py-menu map "Python Mode menu"
       `("Python"
-:help "Python-specific Features"
+       ,@(ifemwhp :help "Python-specific Features")
        ["Shift region left" py-shift-left :active mark-active
-:help "Shift by a single indentation step"]
+        ,@(ifemwhp :help "Shift by a single indentation step")]
        ["Shift region right" py-shift-right :active mark-active
-:help "Shift by a single indentation step"]
+        ,@(ifemwhp :help "Shift by a single indentation step")]
------------------------------------------------------------------------

etc. etc.

The point is that if the user knows they have a :help-compatible
XEmacs they can set py-easymenu-with-help-p non-nil.  Very ugly, of
course, but David's more elegant approach can be adapted to use the
`py-easymenu-with-help-p' variable, too.



More information about the XEmacs-Beta mailing list