From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: a little feedback on Cocoa Emacs.app Date: Mon, 4 Aug 2008 06:15:50 -0400 Message-ID: <9F4D1718-BBB2-489C-8124-35189C98775E@gnu.org> References: <4358E889-E5D2-4E68-83D3-E6AB9C03F7B5@gnu.org> <508B5967-EAA1-4DEA-8533-19E4C0CD4ECF@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v928.1) Content-Type: multipart/mixed; boundary=Apple-Mail-28--980418027 X-Trace: ger.gmane.org 1217845037 32305 80.91.229.12 (4 Aug 2008 10:17:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Aug 2008 10:17:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: Adrian Robert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 04 12:18:08 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KPx8c-0002zj-Qu for ged-emacs-devel@m.gmane.org; Mon, 04 Aug 2008 12:18:03 +0200 Original-Received: from localhost ([127.0.0.1]:36650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPx7g-0004aq-HR for ged-emacs-devel@m.gmane.org; Mon, 04 Aug 2008 06:17:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPx6y-0004SY-3C for emacs-devel@gnu.org; Mon, 04 Aug 2008 06:16:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPx6t-0004Qh-N3 for emacs-devel@gnu.org; Mon, 04 Aug 2008 06:16:18 -0400 Original-Received: from [199.232.76.173] (port=45852 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPx6t-0004QF-4D for emacs-devel@gnu.org; Mon, 04 Aug 2008 06:16:15 -0400 Original-Received: from raeburn.org ([69.25.196.97]:20007) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KPx6i-0006St-4W; Mon, 04 Aug 2008 06:16:11 -0400 Original-Received: from squish.raeburn.org (squish.raeburn.org [69.25.196.102]) by raeburn.org (8.14.1/8.14.1) with ESMTP id m74AFofH011987; Mon, 4 Aug 2008 06:15:51 -0400 (EDT) In-Reply-To: X-Mailer: Apple Mail (2.928.1) X-detected-kernel: by monty-python.gnu.org: NetBSD 3.0 (DF) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102029 Archived-At: --Apple-Mail-28--980418027 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jul 27, 2008, at 22:34, Adrian Robert wrote: > On Jul 27, 2008, at 12:45 PM, Ken Raeburn wrote: >> >>>> 4) under Spaces, I found it kind of annoying not to have a >>>> "new window" option in the dock menu >>> >>> This seems like something it would be better if Apple fixed, since >>> it >>> affects all applications. Have you reported it to them? It could >>> be >>> added to Emacs.app pretty easily I think, though right now >>> priorities >>> are on bug-fixing and code cleanup. >> >> "New window" isn't something all applications support. For those >> that do support creating new windows, like Mail, sometimes you have >> to create specific types of windows (new message, new message >> viewer). I'm not sure what Apple could do in the generic case, > > Ah, OK, I added it to FOR-RELEASE. Would you like to work on it? ;) (back in the country now, and with just a few cycles to spare...) I haven't yet waded through enough of the menu handling code to figure out if it's easy to make it dynamic and updated from lisp, but I threw together code to add a fixed one-element menu, not conditionalized on which flavor of NS support is used. It says "new frame", not "new window" like some other apps use, for consistency with the other Emacs menus and terminology. My first, very small foray into Objective C.... I've attached the current patch for feedback. This seems kind of like a new (though minor) feature to me, and we're in feature freeze now, though this did get into nextstep/FOR-RELEASE. Does it belong in Emacs 23.1? (If so, I think I'd just put in the fixed menu, not the lisp-based version I haven't figured out yet, unless that's *really* easy and straightforward.) >>>> Actually, in my experience, the close button or equivalent on the >>>> last Emacs window causes Emacs to quit, in X, Carbon, and Windows >>>> versions; the Cocoa version is behaving differently by ignoring it. > > This must have changed.. it used to do nothing and say "attempted to > delete last or sole visible frame" or something like that. On the > other hand, I can't find any code in the NS port that seems to > pertain to this, so I'm not sure where the special behavior is > coming from. Hmm.. Using the keyboard commands to delete a frame get that result; clicking on buttons with the mouse can make the application go away. I've also noticed another odd thing in the UI (in my unpatched build from around July 22nd or 24th, as well as my new executable): "Quit" from the dock menu gets me a prompt asking if I want to quit. Many (most?) Mac apps don't ask, at least if I don't have unsaved work. Emacs 22 didn't with C-x C-c, nor did CVS Emacs when I built the Cocoa version a week or so ago. (Current CVS Emacs crashes if I try to build it on the Mac without the NS support.) Once that dialog comes up, it and the menu bar seem to be the only things that respond to input. The buttons in the dialog blink if I click on them. The menu bar menus come up, and go away when I select something. But I can't type into the buffer windows, and the process doesn't go away, even if I confirm in the dialog a bunch of times or select "Exit Emacs" from the File menu. The dialog will go away if I select another application and then switch back to Emacs, but it doesn't seem to help me regain control. It could jump right into save-buffers-kill-emacs, but I haven't played with the multi-tty stuff yet; if we support tty+nextstep then maybe it shouldn't kill a connected tty session. C-x C-c is bound to save- buffers-kill-terminal, not save-buffers-kill-emacs, so perhaps that's what it should do. Ken --Apple-Mail-28--980418027 Content-Disposition: attachment; filename=dockmenu-patch.txt Content-Type: text/plain; x-unix-mode=0644; name="dockmenu-patch.txt" Content-Transfer-Encoding: 7bit 2008-08-04 Ken Raeburn * nsterm.h (dockMenu): Declare variable. * nsmenu.m (dockMenu): Define it. * nsterm.m (ns_term_init): Initialize it to a new menu. (applicationDockMenu, newFrame): New EmacsApp methods. Index: nsmenu.m =================================================================== RCS file: /cvsroot/emacs/emacs/src/nsmenu.m,v retrieving revision 1.8 diff -p -u -r1.8 nsmenu.m --- nsmenu.m 1 Aug 2008 14:01:07 -0000 1.8 +++ nsmenu.m 4 Aug 2008 09:26:25 -0000 @@ -63,7 +63,7 @@ extern Lisp_Object Voverriding_local_map Qoverriding_local_map, Qoverriding_terminal_local_map; extern long context_menu_value; -EmacsMenu *mainMenu, *svcsMenu; +EmacsMenu *mainMenu, *svcsMenu, *dockMenu; /* NOTE: toolbar implementation is at end, following complete menu implementation. */ Index: nsterm.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/nsterm.h,v retrieving revision 1.9 diff -p -u -r1.9 nsterm.h --- nsterm.h 1 Aug 2008 16:29:50 -0000 1.9 +++ nsterm.h 4 Aug 2008 09:26:25 -0000 @@ -355,7 +355,7 @@ along with GNU Emacs. If not, see = MAC_OS_X_VERSION_10_4 Index: nsterm.m =================================================================== RCS file: /cvsroot/emacs/emacs/src/nsterm.m,v retrieving revision 1.21 diff -p -u -r1.21 nsterm.m --- nsterm.m 3 Aug 2008 20:34:00 -0000 1.21 +++ nsterm.m 4 Aug 2008 09:26:25 -0000 @@ -3884,6 +3884,7 @@ ns_term_init (Lisp_Object display_name) appMenu = [[EmacsMenu alloc] initWithTitle: @"Emacs"]; [appMenu setAutoenablesItems: NO]; mainMenu = [[EmacsMenu alloc] initWithTitle: @""]; + dockMenu = [[EmacsMenu alloc] initWithTitle: @""]; [appMenu insertItemWithTitle: @"About Emacs" action: @selector (orderFrontStandardAboutPanel:) @@ -3922,6 +3923,10 @@ ns_term_init (Lisp_Object display_name) keyEquivalent: @"" atIndex: 0]; [mainMenu setSubmenu: appMenu forItem: item]; + [dockMenu insertItemWithTitle: @"New Frame" + action: @selector (newFrame:) + keyEquivalent: @"" + atIndex: 0]; [NSApp setMainMenu: mainMenu]; [NSApp setAppleMenu: appMenu]; @@ -4029,6 +4034,11 @@ ns_term_shutdown (int sig) [prefsController showForFrame: SELECTED_FRAME ()]; } +- (void)newFrame: (id)sender +{ + Feval (Fcons (intern ("make-frame"), Qnil)); +} + /* Open a file (used by below, after going into queue read by ns_read_socket) */ - (BOOL) openFile: (NSString *)fileName @@ -4150,6 +4160,11 @@ fprintf (stderr, "res = %d\n", EQ (res, ns_send_appdefined (-1); } +/* Handle dock menu requests. */ +- (NSMenu *)applicationDockMenu: (NSApplication *) sender +{ + return dockMenu; +} /* ========================================================================== --Apple-Mail-28--980418027 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-28--980418027--