unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@gnu.org>
To: Adrian Robert <adrian.b.robert@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: a little feedback on Cocoa Emacs.app
Date: Mon, 4 Aug 2008 06:15:50 -0400	[thread overview]
Message-ID: <9F4D1718-BBB2-489C-8124-35189C98775E@gnu.org> (raw)
In-Reply-To: <F05B4A4D-DF90-4600-AC15-90C3BC58F92D@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3698 bytes --]

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


[-- Attachment #2: dockmenu-patch.txt --]
[-- Type: text/plain, Size: 3153 bytes --]

2008-08-04  Ken Raeburn  <raeburn@raeburn.org>

	* 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 <http
 @end
 
 extern NSArray *ns_send_types, *ns_return_types;
-extern EmacsMenu *mainMenu, *svcsMenu;
+extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
 
 /* Apple removed the declaration, but kept the implementation */
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 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;
+}
 
 
 /* ==========================================================================

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



  reply	other threads:[~2008-08-04 10:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-26  2:11 a little feedback on Cocoa Emacs.app Ken Raeburn
2008-07-27  2:29 ` Adrian Robert
2008-07-27  2:56   ` Stefan Monnier
2008-07-27 16:45   ` Ken Raeburn
2008-07-28  2:34     ` Adrian Robert
2008-08-04 10:15       ` Ken Raeburn [this message]
2008-08-04 12:42         ` mituharu
2008-08-04 13:08           ` Adrian Robert
2008-08-04 12:50         ` Adrian Robert
2008-08-04 16:56           ` Ken Raeburn
2008-08-04 17:04             ` Dan Nicolaescu
2008-08-04 17:23               ` Justin Bogner
2008-08-04 17:27                 ` Dan Nicolaescu
2008-08-04 19:28               ` Ken Raeburn
2008-08-04 21:53                 ` Dan Nicolaescu
2008-08-04 23:43             ` Adrian Robert
2008-08-05  3:05               ` Adrian Robert
2008-08-05  4:01                 ` Ken Raeburn
2008-08-05 16:17                   ` Adrian Robert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9F4D1718-BBB2-489C-8124-35189C98775E@gnu.org \
    --to=raeburn@gnu.org \
    --cc=adrian.b.robert@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).