all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [patch] showing menu bar temporarily when f10 is pressed
@ 2012-06-19 18:41 Masatake YAMATO
  2012-06-19 20:31 ` Lluís
  2012-06-19 21:42 ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: Masatake YAMATO @ 2012-06-19 18:41 UTC (permalink / raw)
  To: emacs-devel

Hi,

Are you using menu bar?

Menu bar is useful to know what kind of major commands are available.
M-x [tab] shows too many commands.:-P 

As you may know you can activate menu bar with `menu-bar-open'.  In
addition These days, as far as I know \C-n, \C-p, \C-f, \C-b, and \C-g
are available in choosing menu items. So even if you don't use mouse,
menu bar is still useful.

However, menu bar occupies one line. If menu bar is turend off, emacs
can show one more text line for editing or viewing.  I guess you,
experts of Emacs, may turn off menu bar. I know many of you may be
eager for more area to show source code lines. Me, too. However,
sometimes I want to use menu bar. Especially in gud mode.

This patch enhances the behavior of f10(`menu-bar-open').
With this patch, `menu-bar-open' shows menu bar temporarily
even if menu-bar-mode is turned off. After choosing something
menu item or \C-g, the menu bar is hidden automatically.

Even without this patch, you can choose menu item with tmm.  you can
choose a menu item with specifying the first character of menu item
you want to choose recursively. But I would like to choose a menu item
with positionally/geometrically operation. I guess you would, too.


Masatake YAMATO


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-06-14 14:22:37 +0000
+++ lisp/ChangeLog	2012-06-19 17:52:08 +0000
@@ -1,3 +1,8 @@
+2012-06-19  Masatake YAMATO  <yamato@redhat.com>
+
+	* term/x-win.el (x-menu-temorary-visibility): New custom var.
+	(x-menu-bar-open): Show menu bar temporarily if `x-menu-temorary-visibility'.
+
 2012-06-14  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* play/doctor.el (doctor-doc): Remove parameter and use

=== modified file 'lisp/term/x-win.el'
--- lisp/term/x-win.el	2012-04-27 05:40:46 +0000
+++ lisp/term/x-win.el	2012-06-19 17:50:31 +0000
@@ -1190,6 +1190,15 @@
 		      (const TEXT)))
   :group 'killing)
 
+(defcustom x-menu-temorary-visibility t
+  "Control whether use menu bar or `tmm-menubar' when `x-menu-bar-open' is invoked.
+Non-nil means showing menu bar temporarily even if `menu-bar-mode' is turned off.
+If nil, the behavior is changed whether `menu-bar-mode' is on or off. See `x-menu-bar-open'
+for more detail."
+  :type 'boolean
+  :group 'x
+  :version "24.2")
+
 ;; Get a selection value of type TYPE by calling x-get-selection with
 ;; an appropriate DATA-TYPE argument decided by `x-select-request-type'.
 ;; The return value is already decoded.  If x-get-selection causes an
@@ -1305,11 +1314,28 @@
 (declare-function accelerate-menu "xmenu.c" (&optional frame) t)
 
 (defun x-menu-bar-open (&optional frame)
-  "Open the menu bar if `menu-bar-mode' is on, otherwise call `tmm-menubar'."
+  "Open the menu bar if `menu-bar-mode' is on or `x-menu-temorary-visibility' is non-nil, otherwise call `tmm-menubar'."
   (interactive "i")
-  (if (and menu-bar-mode
-	   (fboundp 'accelerate-menu))
-      (accelerate-menu frame)
+  (if (fboundp 'accelerate-menu)
+      (cond
+       (menu-bar-mode
+	(accelerate-menu frame))
+       (x-menu-temorary-visibility
+	(let ((visible menu-bar-mode)
+	      r)
+	  (unless visible
+	    (menu-bar-mode 1))
+	  (setq r (accelerate-menu frame))
+	  (unless visible
+	    (letrec ((turn-the-mode (lambda ()
+				      (remove-hook 'deactivate-menubar-hook
+						   'turn-off-menu-bar-mode)
+				      (menu-bar-mode -1))))
+	      (add-hook 'deactivate-menubar-hook
+			turn-the-mode)))
+	  r))
+       (t
+	(tmm-menubar)))
     (tmm-menubar)))
 
 \f

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-06-14 04:02:35 +0000
+++ src/ChangeLog	2012-06-19 17:57:06 +0000
@@ -1,3 +1,11 @@
+2012-06-19  Masatake YAMATO  <yamato@redhat.com>
+
+	* xmenu.c (popup_deactivate_callback): Run Qdeactivate_menubar_hook.
+
+	* keyboard.c (Qdeactivate_menubar_hook): Define a new hook.
+
+	* keyboard.c (Qdeactivate_menubar_hook): Declare the new hook.
+
 2012-06-14  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* .gdbinit (xgetint): Fix recently-introduced paren typo.

=== modified file 'src/keyboard.c'
--- src/keyboard.c	2012-06-02 19:21:34 +0000
+++ src/keyboard.c	2012-06-19 17:10:11 +0000
@@ -257,6 +257,7 @@
 static Lisp_Object Qdeactivate_mark;
 
 Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
+Lisp_Object Qdeactivate_menubar_hook;
 
 static Lisp_Object Qecho_area_clear_hook;
 
@@ -11535,6 +11536,7 @@
 
   DEFSYM (Qrecompute_lucid_menubar, "recompute-lucid-menubar");
   DEFSYM (Qactivate_menubar_hook, "activate-menubar-hook");
+  DEFSYM (Qdeactivate_menubar_hook, "deactivate-menubar-hook");
 
   DEFSYM (Qpolling_period, "polling-period");
 

=== modified file 'src/keyboard.h'
--- src/keyboard.h	2012-02-10 18:58:48 +0000
+++ src/keyboard.h	2012-06-19 17:08:30 +0000
@@ -212,6 +212,7 @@
 extern Lisp_Object internal_last_event_frame;
 \f
 extern Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
+extern Lisp_Object Qdeactivate_menubar_hook;
 
 /* This holds a Lisp vector that holds the properties of a single
    menu item while decoding it in parse_menu_item.

=== modified file 'src/xmenu.c'
--- src/xmenu.c	2012-02-10 18:58:48 +0000
+++ src/xmenu.c	2012-06-19 17:07:58 +0000
@@ -686,12 +686,14 @@
 static void
 popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
 {
+  safe_run_hooks (Qdeactivate_menubar_hook);
   popup_activated_flag = 0;
 }
 #else
 static void
 popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
 {
+  safe_run_hooks (Qdeactivate_menubar_hook);
   popup_activated_flag = 0;
 }
 #endif




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

end of thread, other threads:[~2012-08-10 14:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-19 18:41 [patch] showing menu bar temporarily when f10 is pressed Masatake YAMATO
2012-06-19 20:31 ` Lluís
2012-06-19 21:42 ` Stefan Monnier
2012-06-20  6:17   ` [patch v2] " Masatake YAMATO
2012-07-18 11:29     ` [patch v3] " Masatake YAMATO
2012-07-19  6:54       ` Stefan Monnier
2012-07-19  8:32         ` Where the menu should be appeared when C-mouse-3 is triggered (Was: [patch v3] showing menu bar temporarily when f10 is pressed) Masatake YAMATO
2012-07-19  9:07           ` Where the menu should be appeared when C-mouse-3 is triggered Stefan Monnier
2012-07-20  4:55             ` Masatake YAMATO
2012-07-20 11:38               ` Stefan Monnier
2012-07-20 11:56                 ` Masatake YAMATO
2012-07-28  9:31                   ` Masatake YAMATO
2012-08-09 11:13                     ` Masatake YAMATO
2012-08-10 12:44                       ` Stefan Monnier
2012-08-10 13:21                         ` Drew Adams
2012-08-10 13:52                         ` Masatake YAMATO
2012-08-10 14:47                         ` Stefan Monnier
2012-07-20 12:48                 ` Masatake YAMATO

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.