unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* easy-menu subtlety
@ 2008-02-20 16:01 Dan Nicolaescu
  2008-02-20 16:32 ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Nicolaescu @ 2008-02-20 16:01 UTC (permalink / raw)
  To: emacs-devel


The last 3 lines of this code sequence in lisp/progmodes/verilog-mode.el:

    ("Move"
     ,(if (featurep 'xemacs)
          (progn 
            ["Beginning of function"            verilog-beg-of-defun t]
            ["End of function"                  verilog-end-of-defun t]
            ["Mark function"                    verilog-mark-defun t])
        ["Beginning of function"                beginning-of-defun t]
        ["End of function"                      end-of-defun t]
        ["Mark function"                        mark-defun t])

work fine on emacs-22.1 (and later), but do not work on emacs-21. 
emacs-21 throws an error when loading this file:
   Wrong type argument: listp, ["Mark function" mark-defun t]

Does anyone know how to rewrite that code so that it works both in
emacs-21 and emacs-22?  It's not obvious to me... 





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: easy-menu subtlety
  2008-02-20 16:01 easy-menu subtlety Dan Nicolaescu
@ 2008-02-20 16:32 ` Andreas Schwab
  2008-02-20 17:20   ` Dan Nicolaescu
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2008-02-20 16:32 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:

> The last 3 lines of this code sequence in lisp/progmodes/verilog-mode.el:
>
>     ("Move"
>      ,(if (featurep 'xemacs)
>           (progn 
>             ["Beginning of function"            verilog-beg-of-defun t]
>             ["End of function"                  verilog-end-of-defun t]
>             ["Mark function"                    verilog-mark-defun t])
>         ["Beginning of function"                beginning-of-defun t]
>         ["End of function"                      end-of-defun t]
>         ["Mark function"                        mark-defun t])

That looks completely bogus to me.  The result of the evaluation of the
form is a single vector, with the other two just thrown away.  I think
the intention was to write this:

    ("Move"
     ,@(if (featurep 'xemacs)
	   '(["Beginning of function"		verilog-beg-of-defun t]
	     ["End of function"			verilog-end-of-defun t]
	     ["Mark function"			verilog-mark-defun t])
	'(["Beginning of function"		beginning-of-defun t]
	  ["End of function"			end-of-defun t]
	  ["Mark function"			mark-defun t]))

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: easy-menu subtlety
  2008-02-20 16:32 ` Andreas Schwab
@ 2008-02-20 17:20   ` Dan Nicolaescu
  2008-02-20 18:02     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Nicolaescu @ 2008-02-20 17:20 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Andreas Schwab <schwab@suse.de> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > 
  > > The last 3 lines of this code sequence in lisp/progmodes/verilog-mode.el:
  > >
  > >     ("Move"
  > >      ,(if (featurep 'xemacs)
  > >           (progn 
  > >             ["Beginning of function"            verilog-beg-of-defun t]
  > >             ["End of function"                  verilog-end-of-defun t]
  > >             ["Mark function"                    verilog-mark-defun t])
  > >         ["Beginning of function"                beginning-of-defun t]
  > >         ["End of function"                      end-of-defun t]
  > >         ["Mark function"                        mark-defun t])
  > 
  > That looks completely bogus to me.  The result of the evaluation of the
  > form is a single vector, with the other two just thrown away.  I think
  > the intention was to write this:
  > 
  >     ("Move"
  >      ,@(if (featurep 'xemacs)
  > 	   '(["Beginning of function"		verilog-beg-of-defun t]
  > 	     ["End of function"			verilog-end-of-defun t]
  > 	     ["Mark function"			verilog-mark-defun t])
  > 	'(["Beginning of function"		beginning-of-defun t]
  > 	  ["End of function"			end-of-defun t]
  > 	  ["Mark function"			mark-defun t]))

Thanks, but it doesn't work with emacs-21: "Invalid menu item in easymenu"




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: easy-menu subtlety
  2008-02-20 17:20   ` Dan Nicolaescu
@ 2008-02-20 18:02     ` Stefan Monnier
  2008-02-20 18:20       ` Dan Nicolaescu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2008-02-20 18:02 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Andreas Schwab, emacs-devel

>> > The last 3 lines of this code sequence in lisp/progmodes/verilog-mode.el:
>> >
>> >     ("Move"
>> >      ,(if (featurep 'xemacs)
>> >           (progn 
>> >             ["Beginning of function"            verilog-beg-of-defun t]
>> >             ["End of function"                  verilog-end-of-defun t]
>> >             ["Mark function"                    verilog-mark-defun t])
>> >         ["Beginning of function"                beginning-of-defun t]
>> >         ["End of function"                      end-of-defun t]
>> >         ["Mark function"                        mark-defun t])
>> 
>> That looks completely bogus to me.  The result of the evaluation of the
>> form is a single vector, with the other two just thrown away.  I think
>> the intention was to write this:
>> 
>> ("Move"
>> ,@(if (featurep 'xemacs)
>> '(["Beginning of function"		verilog-beg-of-defun t]
>> ["End of function"			verilog-end-of-defun t]
>> ["Mark function"			verilog-mark-defun t])
>> '(["Beginning of function"		beginning-of-defun t]
>> ["End of function"			end-of-defun t]
>> ["Mark function"			mark-defun t]))

> Thanks, but it doesn't work with emacs-21: "Invalid menu item in easymenu"

I don't see any good reason for it not to work.  Most likely it's some
silly detail somewhere.  This said, I'd recommend you just remove the
test and use the XEmacs side of the code, and make sure that
verilog-beg-of-defun is always defined (and make it an alias to
beginning-of-defun under Emacs).


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: easy-menu subtlety
  2008-02-20 18:02     ` Stefan Monnier
@ 2008-02-20 18:20       ` Dan Nicolaescu
  2008-02-20 19:17         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Nicolaescu @ 2008-02-20 18:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Andreas Schwab, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > >> > The last 3 lines of this code sequence in lisp/progmodes/verilog-mode.el:
  > >> >
  > >> >     ("Move"
  > >> >      ,(if (featurep 'xemacs)
  > >> >           (progn 
  > >> >             ["Beginning of function"            verilog-beg-of-defun t]
  > >> >             ["End of function"                  verilog-end-of-defun t]
  > >> >             ["Mark function"                    verilog-mark-defun t])
  > >> >         ["Beginning of function"                beginning-of-defun t]
  > >> >         ["End of function"                      end-of-defun t]
  > >> >         ["Mark function"                        mark-defun t])
  > >> 
  > >> That looks completely bogus to me.  The result of the evaluation of the
  > >> form is a single vector, with the other two just thrown away.  I think
  > >> the intention was to write this:
  > >> 
  > >> ("Move"
  > >> ,@(if (featurep 'xemacs)
  > >> '(["Beginning of function"		verilog-beg-of-defun t]
  > >> ["End of function"			verilog-end-of-defun t]
  > >> ["Mark function"			verilog-mark-defun t])
  > >> '(["Beginning of function"		beginning-of-defun t]
  > >> ["End of function"			end-of-defun t]
  > >> ["Mark function"			mark-defun t]))
  > 
  > > Thanks, but it doesn't work with emacs-21: "Invalid menu item in easymenu"
  > 
  > I don't see any good reason for it not to work.  Most likely it's some
  > silly detail somewhere.  This said, I'd recommend you just remove the
  > test and use the XEmacs side of the code, and make sure that
  > verilog-beg-of-defun is always defined (and make it an alias to
  > beginning-of-defun under Emacs).

The only problem with that is that C-M-a and C-M-e won't appear in the
"Beginning of function" and "End of function" menu entries.  They would
appear if the explicit C-M-a and C-M-e bindings for
verilog-beg-of-defun/verilog-end-of-defun are also enabled for emacs.
But that is ugly... 




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: easy-menu subtlety
  2008-02-20 18:20       ` Dan Nicolaescu
@ 2008-02-20 19:17         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2008-02-20 19:17 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Andreas Schwab, emacs-devel

> The only problem with that is that C-M-a and C-M-e won't appear in the
> "Beginning of function" and "End of function" menu entries.  They would
> appear if the explicit C-M-a and C-M-e bindings for
> verilog-beg-of-defun/verilog-end-of-defun are also enabled for emacs.
> But that is ugly... 

Of course, you'd change the keymap accordingly as well.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-20 19:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 16:01 easy-menu subtlety Dan Nicolaescu
2008-02-20 16:32 ` Andreas Schwab
2008-02-20 17:20   ` Dan Nicolaescu
2008-02-20 18:02     ` Stefan Monnier
2008-02-20 18:20       ` Dan Nicolaescu
2008-02-20 19:17         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).