Revision: 116837 https://trac.macports.org/changeset/116837 Author: hum@macports.org Date: 2014-02-08 04:44:48 -0800 (Sat, 08 Feb 2014) Log Message: ----------- emacs-app: add patchfiles for Mavericks; see #41224 and #42383. Modified Paths: -------------- trunk/dports/aqua/emacs-app/Portfile Added Paths: ----------- trunk/dports/aqua/emacs-app/files/patch-mavericks-home.diff trunk/dports/aqua/emacs-app/files/patch-mavericks-memleak.diff Modified: trunk/dports/aqua/emacs-app/Portfile =================================================================== --- trunk/dports/aqua/emacs-app/Portfile 2014-02-08 12:34:59 UTC (rev 116836) +++ trunk/dports/aqua/emacs-app/Portfile 2014-02-08 12:44:48 UTC (rev 116837) @@ -5,7 +5,7 @@ name emacs-app version 24.3 -revision 1 +revision 2 categories aqua editors maintainers hum css openmaintainer @@ -38,6 +38,11 @@ patchfiles patch-src_emacs.c.diff +if {${os.platform} == "darwin" && ${os.major} >= 13} { + patchfiles-append patch-mavericks-home.diff \ + patch-mavericks-memleak.diff +} + post-patch { reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/src/emacs.c } Added: trunk/dports/aqua/emacs-app/files/patch-mavericks-home.diff =================================================================== --- trunk/dports/aqua/emacs-app/files/patch-mavericks-home.diff (rev 0) +++ trunk/dports/aqua/emacs-app/files/patch-mavericks-home.diff 2014-02-08 12:44:48 UTC (rev 116837) @@ -0,0 +1,19 @@ +--- src/emacs.c.orig 2011-01-09 02:45:14.000000000 +0900 ++++ src/emacs.c 2011-09-09 23:13:44.000000000 +0900 +@@ -1156,10 +1156,13 @@ + if (!noninteractive) + { + #ifdef NS_IMPL_COCOA +- if (skip_args < argc) ++ /* Started from GUI? */ ++ /* FIXME: Do the right thing if getenv returns NULL, or if ++ chdir fails. */ ++ if (! inhibit_window_system && ! isatty (0)) ++ chdir (getenv ("HOME")); ++ if (skip_args < argc) + { +- /* FIXME: Do the right thing if getenv returns NULL, or if +- chdir fails. */ + if (!strncmp (argv[skip_args], "-psn", 4)) + { + skip_args += 1; Added: trunk/dports/aqua/emacs-app/files/patch-mavericks-memleak.diff =================================================================== --- trunk/dports/aqua/emacs-app/files/patch-mavericks-memleak.diff (rev 0) +++ trunk/dports/aqua/emacs-app/files/patch-mavericks-memleak.diff 2014-02-08 12:44:48 UTC (rev 116837) @@ -0,0 +1,82 @@ +--- src/nsterm.h ++++ src/nsterm.h +@@ -55,6 +55,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ + /* We override sendEvent: as a means to stop/start the event loop */ + @interface EmacsApp : NSApplication + { ++#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 ++ BOOL shouldKeepRunning; ++ BOOL isFirst; ++#endif + } + - (void)logNotification: (NSNotification *)notification; + - (void)sendEvent: (NSEvent *)theEvent; +diff --git a/src/nsterm.m b/src/nsterm.m +index a57e744..324f065 100644 +--- src/nsterm.m ++++ src/nsterm.m +@@ -3373,7 +3373,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) + if ([NSApp modalWindow] != nil) + return -1; + +- if (hold_event_q.nr > 0) ++ if (hold_event_q.nr > 0) + { + int i; + for (i = 0; i < hold_event_q.nr; ++i) +@@ -3447,7 +3447,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, + + /* NSTRACE (ns_select); */ + +- if (hold_event_q.nr > 0) ++ if (hold_event_q.nr > 0) + { + /* We already have events pending. */ + kill (0, SIGIO); +@@ -4270,6 +4270,46 @@ ns_term_shutdown (int sig) + + @implementation EmacsApp + ++#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 ++- (id)init ++{ ++ if (self = [super init]) ++ self->isFirst = YES; ++ ++ return self; ++} ++ ++- (void)run ++{ ++ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ++ ++ if (isFirst) [self finishLaunching]; ++ isFirst = NO; ++ ++ shouldKeepRunning = YES; ++ do ++ { ++ [pool release]; ++ pool = [[NSAutoreleasePool alloc] init]; ++ ++ NSEvent *event = ++ [self nextEventMatchingMask:NSAnyEventMask ++ untilDate:[NSDate distantFuture] ++ inMode:NSDefaultRunLoopMode ++ dequeue:YES]; ++ [self sendEvent:event]; ++ [self updateWindows]; ++ } while (shouldKeepRunning); ++ ++ [pool release]; ++} ++ ++- (void)stop: (id)sender ++{ ++ shouldKeepRunning = NO; ++} ++#endif ++ + - (void)logNotification: (NSNotification *)notification + { + const char *name = [[notification name] UTF8String];
participants (1)
-
hum@macports.org