[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 16f4f26: Fix startup working dir bug on NeXTSTEP
From: |
Paul Eggert |
Subject: |
emacs-27 16f4f26: Fix startup working dir bug on NeXTSTEP |
Date: |
Thu, 13 Aug 2020 18:44:06 -0400 (EDT) |
branch: emacs-27
commit 16f4f266324077f5a50090bd1c8147c7cbe37e0e
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
Fix startup working dir bug on NeXTSTEP
* src/emacs.c (main) [NS_IMPL_COCOA]: Update emacs_wd
after a NS GUI chdirs successfully (Bug#42836).
---
src/emacs.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/emacs.c b/src/emacs.c
index 1dcf195..11dcdb3 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1638,23 +1638,27 @@ Using an Emacs configured with --with-x-toolkit=lucid
does not have this problem
{
#ifdef NS_IMPL_COCOA
/* Started from GUI? */
- /* FIXME: Do the right thing if get_homedir returns "", or if
- chdir fails. */
- if (! inhibit_window_system && ! isatty (STDIN_FILENO) && ! ch_to_dir)
- chdir (get_homedir ());
+ bool go_home = (!ch_to_dir && !inhibit_window_system
+ && !isatty (STDIN_FILENO));
if (skip_args < argc)
{
if (!strncmp (argv[skip_args], "-psn", 4))
{
skip_args += 1;
- if (! ch_to_dir) chdir (get_homedir ());
+ go_home |= !ch_to_dir;
}
else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn",
4))
{
skip_args += 2;
- if (! ch_to_dir) chdir (get_homedir ());
+ go_home |= !ch_to_dir;
}
}
+ if (go_home)
+ {
+ char const *home = get_homedir ();
+ if (*home && chdir (home) == 0)
+ emacs_wd = emacs_get_current_dir_name ();
+ }
#endif /* COCOA */
}
#endif /* HAVE_NS */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 16f4f26: Fix startup working dir bug on NeXTSTEP,
Paul Eggert <=