| [ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] | 
Sometimes it is useful to make menu items that use the “same” command but 
with different enable conditions.  The best way to do this in Emacs now is 
with extended menu items; before that feature existed, it could be done by 
defining alias commands and using them in menu items.  Here's an example 
that makes two aliases for toggle-read-only and gives them different 
enable conditions:
| (defalias 'make-read-only 'toggle-read-only) (put 'make-read-only 'menu-enable '(not buffer-read-only)) (defalias 'make-writable 'toggle-read-only) (put 'make-writable 'menu-enable 'buffer-read-only) | 
When using aliases in menus, often it is useful to display the equivalent 
key bindings for the “real” command name, not the aliases (which typically 
don't have any key bindings except for the menu itself).  To request this, 
give the alias symbol a non-nil menu-alias property.  Thus,
| (put 'make-read-only 'menu-alias t) (put 'make-writable 'menu-alias t) | 
causes menu items for make-read-only and make-writable to show 
the keyboard bindings for toggle-read-only.
 
  Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.