unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* New easymenu behavior
@ 2004-11-03 11:36 David Ponce
  2004-11-03 12:13 ` David Kastrup
  0 siblings, 1 reply; 8+ messages in thread
From: David Ponce @ 2004-11-03 11:36 UTC (permalink / raw)


Hi,

It appears that this change:

2004-11-02  Richard M. Stallman  <rms@gnu.org>

	* emacs-lisp/easymenu.el (easy-menu-intern):
	Don't downcase; rather, case-flip the first letter of each word.

Introduced some incompatibility with the previous version of
easymenu. For example, now recentf creates a new "files" entry in the
menu bar instead of adding an entry in the "File" menu.

I think I can easily fix that by using the "Files" path instead of the
"files" one to locate the "File" menu.  Unfortunately, that change
also broke other code I have, and probably other existing code that
uses easymenu to locate menu items.

So my question: should I fix recentf or is the new easymenu behavior a
bug?  What about compatibility with existing code that uses easymenu?

I must confess, that I don't see why this change is necessary.

Any thoughts will be welcome.
Thank you in advance for your time.

David

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

* Re: New easymenu behavior
  2004-11-03 11:36 New easymenu behavior David Ponce
@ 2004-11-03 12:13 ` David Kastrup
  2004-11-03 14:04   ` David Ponce
  0 siblings, 1 reply; 8+ messages in thread
From: David Kastrup @ 2004-11-03 12:13 UTC (permalink / raw)
  Cc: emacs-devel

David Ponce <david.ponce@wanadoo.fr> writes:

> It appears that this change:
>
> 2004-11-02  Richard M. Stallman  <rms@gnu.org>
>
> 	* emacs-lisp/easymenu.el (easy-menu-intern):
> 	Don't downcase; rather, case-flip the first letter of each word.
>
> Introduced some incompatibility with the previous version of
> easymenu. For example, now recentf creates a new "files" entry in the
> menu bar instead of adding an entry in the "File" menu.

This change makes menu entries that differ only in case different.
For example, AUCTeX has a "Greek" and a "greek" menu.  More
importantly, it has menu entries
γ \gamma
and
Γ \Gamma
and those now get differentiated again (though their names now get
swapped).

Menus that differed only in case were already given different names in
21.3.  Smudging them together only occured because of Richard
downcasing the menu names (with easy-menu-intern) at some time during
21.4 development.

> I think I can easily fix that by using the "Files" path instead of
> the "files" one to locate the "File" menu.  Unfortunately, that
> change also broke other code I have, and probably other existing
> code that uses easymenu to locate menu items.

What does your code do that did not already break in Emacs 21.3?

> So my question: should I fix recentf or is the new easymenu behavior
> a bug?

The new behavior is certainly no bug: it is entirely easymenu's choice
what symbols to use for some menu, that's some internal decision.  I
can't rule out, however, that maybe easy-menu-intern is used in more
or less places than required, which could cause such mismatches.

Can you go into details about the usage patterns that cause this
problem?  If they do not have similar problems with Emacs-21.3
already, there might be some bug.

> What about compatibility with existing code that uses easymenu?

It should not be tampering with internals.  If your problem is not due
to that, you should provide examples of what happens.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: New easymenu behavior
  2004-11-03 14:04   ` David Ponce
@ 2004-11-03 13:56     ` David Kastrup
  2004-11-03 15:28       ` David Ponce
  0 siblings, 1 reply; 8+ messages in thread
From: David Kastrup @ 2004-11-03 13:56 UTC (permalink / raw)
  Cc: emacs-devel

David Ponce <david.ponce@wanadoo.fr> writes:

>  > What does your code do that did not already break in Emacs 21.3?
>
> recentf simply uses (easy-menu-add-item nil '("files") ...) to add
> the recentf menu into the "File" menu which is identified with the
> 'files key symbol. This worked well in 21.3 because the code just
> interned "files" to get the key symbol.

That appears very shaky.

> Notice that XEmacs directly use menu item names to locate them.  For
> example you can use '("File") to locate the "File" menu in the menu
> bar. Maybe is it a better mechanism to use in external libraries?

Actually, that is all that I ever used with regard to easymenu.  It is
probably a bad idea to create and manage menus by a mixture of direct
accesses and easymenu.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: New easymenu behavior
  2004-11-03 12:13 ` David Kastrup
@ 2004-11-03 14:04   ` David Ponce
  2004-11-03 13:56     ` David Kastrup
  0 siblings, 1 reply; 8+ messages in thread
From: David Ponce @ 2004-11-03 14:04 UTC (permalink / raw)
  Cc: emacs-devel

 > What does your code do that did not already break in Emacs 21.3?

recentf simply uses (easy-menu-add-item nil '("files") ...) to add the
recentf menu into the "File" menu which is identified with the 'files
key symbol. This worked well in 21.3 because the code just interned
"files" to get the key symbol.

 > The new behavior is certainly no bug: it is entirely easymenu's
 > choice what symbols to use for some menu, that's some internal
 > decision.  I can't rule out, however, that maybe easy-menu-intern is
 > used in more or less places than required, which could cause such
 > mismatches.
 >
 > Can you go into details about the usage patterns that cause this
 > problem?  If they do not have similar problems with Emacs-21.3
 > already, there might be some bug.

In 21.4, before the last change to easy-menu-intern, that worked too
because the code interned the downcased strings in the menu path.

Now it fails because "files" returns the symbol 'Files as the key to
locate the menu item.

IMHO, the 21.3 version looks better because it doesn't change the
meaning of strings given to locate a menu item.  So it should be able
to locate "Greek" as a different menu item from "greek".

 >>What about compatibility with existing code that uses easymenu?
 >
 >
 > It should not be tampering with internals.  If your problem is not
 > due to that, you should provide examples of what happens.
 >

Notice that XEmacs directly use menu item names to locate them.  For
example you can use '("File") to locate the "File" menu in the menu
bar. Maybe is it a better mechanism to use in external libraries?

Thanks
David

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

* Re: New easymenu behavior
  2004-11-03 15:28       ` David Ponce
@ 2004-11-03 14:27         ` David Kastrup
  2004-11-03 15:37           ` David Ponce
  2004-11-04  9:52         ` Richard Stallman
  1 sibling, 1 reply; 8+ messages in thread
From: David Kastrup @ 2004-11-03 14:27 UTC (permalink / raw)
  Cc: emacs-devel

David Ponce <david.ponce@wanadoo.fr> writes:

>>> > What does your code do that did not already break in Emacs 21.3?
>>>
>>>recentf simply uses (easy-menu-add-item nil '("files") ...) to add
>>>the recentf menu into the "File" menu which is identified with the
>>>'files key symbol. This worked well in 21.3 because the code just
>>>interned "files" to get the key symbol.
>> That appears very shaky.
>
> I agree.
>
>>>Notice that XEmacs directly use menu item names to locate them.  For
>>>example you can use '("File") to locate the "File" menu in the menu
>>>bar. Maybe is it a better mechanism to use in external libraries?
>> Actually, that is all that I ever used with regard to easymenu.  It
>> is
>> probably a bad idea to create and manage menus by a mixture of direct
>> accesses and easymenu.
>
> recentf only uses easymenu not a mixture of direct access and
> easymenu.

If the menus were not created using easymenu, this amounts to a
mixture of direct access and easymenu.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: New easymenu behavior
  2004-11-03 13:56     ` David Kastrup
@ 2004-11-03 15:28       ` David Ponce
  2004-11-03 14:27         ` David Kastrup
  2004-11-04  9:52         ` Richard Stallman
  0 siblings, 2 replies; 8+ messages in thread
From: David Ponce @ 2004-11-03 15:28 UTC (permalink / raw)
  Cc: emacs-devel

>> > What does your code do that did not already break in Emacs 21.3?
>>
>>recentf simply uses (easy-menu-add-item nil '("files") ...) to add
>>the recentf menu into the "File" menu which is identified with the
>>'files key symbol. This worked well in 21.3 because the code just
>>interned "files" to get the key symbol.
> 
> 
> That appears very shaky.

I agree.

>>Notice that XEmacs directly use menu item names to locate them.  For
>>example you can use '("File") to locate the "File" menu in the menu
>>bar. Maybe is it a better mechanism to use in external libraries?
> 
> 
> Actually, that is all that I ever used with regard to easymenu.  It is
> probably a bad idea to create and manage menus by a mixture of direct
> accesses and easymenu.

recentf only uses easymenu not a mixture of direct access and easymenu.

How do you tell easy-menu-add-item to use menu item names instead of 
internal names?  The following works with XEmacs but not with Emacs:

(easy-menu-add-item
  nil
  '("File")
  '("Submmenu"
    ["item1" ignore]
    ["item2" ignore]))

In Emacs it replaces all the "File" menu items with "Submenu", and 
create another empty "File" entry in the menu bar.

But the following works as expected.

(easy-menu-add-item
  nil
  '("Files")
  '("Submmenu"
    ["item1" ignore]
    ["item2" ignore]))

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

* Re: New easymenu behavior
  2004-11-03 14:27         ` David Kastrup
@ 2004-11-03 15:37           ` David Ponce
  0 siblings, 0 replies; 8+ messages in thread
From: David Ponce @ 2004-11-03 15:37 UTC (permalink / raw)
  Cc: emacs-devel

> If the menus were not created using easymenu, this amounts to a
> mixture of direct access and easymenu.
> 

Here is how the recentf menu is created:

           (easy-menu-add-item
            (recentf-menu-bar) recentf-menu-path
            (easy-menu-create-menu recentf-menu-title
                                   (recentf-make-menu-items))
            recentf-menu-before)

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

* Re: New easymenu behavior
  2004-11-03 15:28       ` David Ponce
  2004-11-03 14:27         ` David Kastrup
@ 2004-11-04  9:52         ` Richard Stallman
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2004-11-04  9:52 UTC (permalink / raw)
  Cc: emacs-devel

    How do you tell easy-menu-add-item to use menu item names instead of 
    internal names?  The following works with XEmacs but not with Emacs:

    (easy-menu-add-item
      nil
      '("File")
      '("Submmenu"
	["item1" ignore]
	["item2" ignore]))

The bug here was caused by the fact that the standard menu
whose name is File used `files' as the symbol.  They do not correspond.

I changed it to `file' in menu-bar.el so that it corresponds.
Now that example does work correctly.


Meanwhile, reverting to the 21.1 definition of easy-menu-intern would
work correctly if we also change all the menu-bar symbols that are
specified explicitly to look just like the menu item string.

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

end of thread, other threads:[~2004-11-04  9:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-03 11:36 New easymenu behavior David Ponce
2004-11-03 12:13 ` David Kastrup
2004-11-03 14:04   ` David Ponce
2004-11-03 13:56     ` David Kastrup
2004-11-03 15:28       ` David Ponce
2004-11-03 14:27         ` David Kastrup
2004-11-03 15:37           ` David Ponce
2004-11-04  9:52         ` Richard Stallman

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).