From: Alan Third <alan@idiocy.org>
To: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs 26 MacOS bugs
Date: Sun, 11 Feb 2018 11:47:31 +0000 [thread overview]
Message-ID: <20180211114731.GA45075@breton.holly.idiocy.org> (raw)
In-Reply-To: <20180210224516.GA33099@breton.holly.idiocy.org>
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
On Sat, Feb 10, 2018 at 10:45:16PM +0000, Alan Third wrote:
> On Tue, Feb 06, 2018 at 09:49:16AM -0500, Richard Stallman wrote:
> > C.10 :
> > - - (p 520) neither -T=title nor --title=title appear to work on macOS
> > (Sierra), although --name=title does.
>
> I believe this is caused by the way macOS handles filenames in the
> titlebar.
Fix attached. It seems to work for me, but I only learned today that
the macOS ‘proxy icon’ is anything other than just an icon, so if it
breaks anything subtle I probably wouldn’t notice.
--
Alan Third
[-- Attachment #2: 0001-Remove-NS-special-handling-of-frame-title-format.patch --]
[-- Type: text/plain, Size: 7011 bytes --]
From c89bfa7e6fc634a6da01ca37abb9e726bea83c3b Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sun, 11 Feb 2018 11:34:49 +0000
Subject: [PATCH] Remove NS special handling of 'frame-title-format'
* lisp/term/ns-win.el (frame-title-format, icon-title-format): Change
default format to just the filename.
* src/nsfns.m (ns-use-proxy-icon): New variable.
(ns_set_name_as_filename): Remove function.
(x_implicitly_set_name): Get rid of special handling of
frame-title-format.
* src/nsterm.h (ns_set_represented_filename): Use new definition.
* src/nsterm.m (ns_set_represented_filename): Move some of the logic
from ns_set_name_as_filename into this function.
---
etc/NEWS | 5 +++
lisp/term/ns-win.el | 4 +--
src/nsfns.m | 91 +++++------------------------------------------------
src/nsterm.h | 2 +-
src/nsterm.m | 30 +++++++++++++++++-
5 files changed, 45 insertions(+), 87 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 8fed15af5b..005f177a27 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -289,6 +289,11 @@ Previously it was supported only in the Cygwin-w32 build.
** Emacs now handles key combinations involving the macOS "command"
and "option" modifier keys more correctly.
+** The special handling of `frame-title-format' on NS where setting it
+to `t' would enable the macOS proxy icon has been replaced with a
+separate variable, `ns-use-proxy-icon'. `frame-title-format' will now
+work as on other platforms.
+
\f
----------------------------------------------------------------------
This file is part of GNU Emacs.
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index eab95e02d8..ea9991ba36 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -807,8 +807,8 @@ ns-suspend-error
;; Set some options to be as Nextstep-like as possible.
-(setq frame-title-format t
- icon-title-format t)
+(setq frame-title-format "%b"
+ icon-title-format "%b")
(defvar ns-initialized nil
diff --git a/src/nsfns.m b/src/nsfns.m
index 0f60bb8107..bbb6644ce0 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -61,7 +61,6 @@ Updated by Christian Limpach (chris@nice.ch)
static ptrdiff_t image_cache_refcount;
static struct ns_display_info *ns_display_info_for_name (Lisp_Object);
-static void ns_set_name_as_filename (struct frame *);
/* ==========================================================================
@@ -483,17 +482,10 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
{
NSTRACE ("x_implicitly_set_name");
- Lisp_Object frame_title = buffer_local_value
- (Qframe_title_format, XWINDOW (f->selected_window)->contents);
- Lisp_Object icon_title = buffer_local_value
- (Qicon_title_format, XWINDOW (f->selected_window)->contents);
+ if (! NILP (ns_use_proxy_icon))
+ ns_set_represented_filename (f);
- /* Deal with NS specific format t. */
- if (FRAME_NS_P (f) && ((FRAME_ICONIFIED_P (f) && EQ (icon_title, Qt))
- || EQ (frame_title, Qt)))
- ns_set_name_as_filename (f);
- else
- ns_set_name (f, arg, 0);
+ ns_set_name (f, arg, 0);
}
@@ -520,78 +512,6 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
ns_set_name_internal (f, name);
}
-
-static void
-ns_set_name_as_filename (struct frame *f)
-{
- NSView *view;
- Lisp_Object name, filename;
- Lisp_Object buf = XWINDOW (f->selected_window)->contents;
- const char *title;
- NSAutoreleasePool *pool;
- Lisp_Object encoded_name, encoded_filename;
- NSString *str;
- NSTRACE ("ns_set_name_as_filename");
-
- if (f->explicit_name || ! NILP (f->title))
- return;
-
- block_input ();
- pool = [[NSAutoreleasePool alloc] init];
- filename = BVAR (XBUFFER (buf), filename);
- name = BVAR (XBUFFER (buf), name);
-
- if (NILP (name))
- {
- if (! NILP (filename))
- name = Ffile_name_nondirectory (filename);
- else
- name = build_string ([ns_app_name UTF8String]);
- }
-
- encoded_name = ENCODE_UTF_8 (name);
-
- view = FRAME_NS_VIEW (f);
-
- title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String]
- : [[[view window] title] UTF8String];
-
- if (title && (! strcmp (title, SSDATA (encoded_name))))
- {
- [pool release];
- unblock_input ();
- return;
- }
-
- str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
- if (str == nil) str = @"Bad coding";
-
- if (FRAME_ICONIFIED_P (f))
- [[view window] setMiniwindowTitle: str];
- else
- {
- NSString *fstr;
-
- if (! NILP (filename))
- {
- encoded_filename = ENCODE_UTF_8 (filename);
-
- fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
- if (fstr == nil) fstr = @"";
- }
- else
- fstr = @"";
-
- ns_set_represented_filename (fstr, f);
- [[view window] setTitle: str];
- fset_name (f, name);
- }
-
- [pool release];
- unblock_input ();
-}
-
-
void
ns_set_doc_edited (void)
{
@@ -3311,6 +3231,11 @@ - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename
doc: /* Toolkit version for NS Windowing. */);
Vns_version_string = ns_appkit_version_str ();
+ DEFVAR_BOOL ("ns-use-proxy-icon", ns_use_proxy_icon,
+ doc: /* When non-nil display a proxy icon in the titlebar.
+Default is t. */);
+ ns_use_proxy_icon = Qt;
+
defsubr (&Sns_read_file_name);
defsubr (&Sns_get_resource);
defsubr (&Sns_set_resource);
diff --git a/src/nsterm.h b/src/nsterm.h
index cc4c6d5e91..8b985930ec 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1237,7 +1237,7 @@ extern void ns_finish_events (void);
#ifdef __OBJC__
/* Needed in nsfns.m. */
extern void
-ns_set_represented_filename (NSString *fstr, struct frame *f);
+ns_set_represented_filename (struct frame *f);
#endif
diff --git a/src/nsterm.m b/src/nsterm.m
index f017d8d152..c694544b07 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -469,10 +469,38 @@ - (NSColor *)colorUsingDefaultColorSpace
========================================================================== */
void
-ns_set_represented_filename (NSString *fstr, struct frame *f)
+ns_set_represented_filename (struct frame *f)
{
+ NSView *view;
+ Lisp_Object filename, encoded_filename;
+ Lisp_Object buf = XWINDOW (f->selected_window)->contents;
+ NSAutoreleasePool *pool;
+ NSString *fstr;
+
+ NSTRACE ("ns_set_represented_filename");
+
+ if (f->explicit_name || ! NILP (f->title))
+ return;
+
+ block_input ();
+ pool = [[NSAutoreleasePool alloc] init];
+ filename = BVAR (XBUFFER (buf), filename);
+
+ if (! NILP (filename))
+ {
+ encoded_filename = ENCODE_UTF_8 (filename);
+
+ fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
+ if (fstr == nil) fstr = @"";
+ }
+ else
+ fstr = @"";
+
represented_filename = [fstr retain];
represented_frame = f;
+
+ [pool release];
+ unblock_input ();
}
void
--
2.16.1
next prev parent reply other threads:[~2018-02-11 11:47 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 14:49 Emacs 26 MacOS bugs Richard Stallman
2018-02-06 17:30 ` Noam Postavsky
2018-02-06 23:28 ` Paul Eggert
2018-02-07 3:37 ` Eli Zaretskii
2018-02-10 14:55 ` Uwe Brauer
2018-02-10 15:18 ` Noam Postavsky
2018-02-07 3:52 ` Eli Zaretskii
2018-02-06 19:05 ` Ben McGinnes
2018-02-06 20:30 ` Noam Postavsky
2018-02-06 22:27 ` Ben McGinnes
2018-02-06 22:30 ` Ben McGinnes
2018-02-06 22:50 ` Noam Postavsky
2018-02-07 0:43 ` Ben McGinnes
2018-02-07 1:33 ` Noam Postavsky
2018-02-07 2:13 ` Ben McGinnes
2018-02-07 22:55 ` Alan Third
2018-02-09 16:35 ` Ben McGinnes
2018-02-09 16:57 ` Noam Postavsky
2018-02-09 17:22 ` Ben McGinnes
2018-02-09 18:13 ` Noam Postavsky
2018-02-10 1:46 ` Ben McGinnes
2018-02-10 1:47 ` Alan Third
2018-02-11 13:53 ` Philipp Stephani
2018-02-11 21:06 ` Alan Third
2018-02-07 20:01 ` Alan Third
2018-02-10 15:01 ` Alan Third
2018-02-10 22:45 ` Alan Third
2018-02-11 11:47 ` Alan Third [this message]
2018-02-11 15:52 ` Eli Zaretskii
2018-02-11 20:57 ` Alan Third
2018-02-13 19:41 ` Ben McGinnes
2018-02-13 19:46 ` Noam Postavsky
2018-02-11 20:43 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180211114731.GA45075@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=emacs-devel@gnu.org \
--cc=rms@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 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.