From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: [patch] showing menu bar temporarily when f10 is pressed Date: Wed, 20 Jun 2012 03:41:16 +0900 (JST) Organization: Red Hat Japan, Inc. Message-ID: <20120620.034116.1379090244202488621.yamato@redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340131287 24995 80.91.229.3 (19 Jun 2012 18:41:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2012 18:41:27 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 19 20:41:27 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sh3Mj-0003yo-Ah for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2012 20:41:25 +0200 Original-Received: from localhost ([::1]:54857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh3Mj-0007HV-81 for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2012 14:41:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh3Mg-0007HD-4b for emacs-devel@gnu.org; Tue, 19 Jun 2012 14:41:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh3Md-0002u4-VF for emacs-devel@gnu.org; Tue, 19 Jun 2012 14:41:21 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:41926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh3Md-0002tn-MV for emacs-devel@gnu.org; Tue, 19 Jun 2012 14:41:19 -0400 Original-Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5JIfIlr006317 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Jun 2012 14:41:18 -0400 Original-Received: from localhost (vpn-233-202.phx2.redhat.com [10.3.233.202]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5JIfHf0027833 for ; Tue, 19 Jun 2012 14:41:17 -0400 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151029 Archived-At: 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 + + * 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 * 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))) === 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 + + * 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 * .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; 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