[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108984: Stop ns builds setting the E
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108984: Stop ns builds setting the EMACSLOADPATH environment variable |
Date: |
Mon, 09 Jul 2012 21:04:28 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108984
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2012-07-09 21:04:28 -0400
message:
Stop ns builds setting the EMACSLOADPATH environment variable
Ref bugs 4309, 6401, etc.
This is the last environment variable (ab)used by the ns port in this way.
* src/nsterm.m (ns_load_path): Rename from ns_init_paths.
Now it does not set EMACSLOADPATH, just returns the load-path string.
* src/nsterm.h: Update accordingly.
* src/lread.c [HAVE_NS]: Include nsterm.h.
(init_lread) [HAVE_NS]: Use ns_load_path.
* src/emacs.c (main) [HAVE_NS]: No longer call ns_init_paths.
modified:
src/ChangeLog
src/emacs.c
src/lread.c
src/nsterm.h
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-09 23:23:59 +0000
+++ b/src/ChangeLog 2012-07-10 01:04:28 +0000
@@ -1,3 +1,13 @@
+2012-07-10 Glenn Morris <address@hidden>
+
+ Stop ns builds setting the EMACSLOADPATH environment variable.
+ * nsterm.m (ns_load_path): Rename from ns_init_paths.
+ Now it does not set EMACSLOADPATH, just returns the load-path string.
+ * nsterm.h: Update accordingly.
+ * lread.c [HAVE_NS]: Include nsterm.h.
+ (init_lread) [HAVE_NS]: Use ns_load_path.
+ * emacs.c (main) [HAVE_NS]: No longer call ns_init_paths.
+
2012-07-09 Glenn Morris <address@hidden>
* s/gnu.h (SIGNALS_VIA_CHARACTERS): No need to define it here,
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2012-07-09 16:38:45 +0000
+++ b/src/emacs.c 2012-07-10 01:04:28 +0000
@@ -1426,13 +1426,6 @@
init_ntproc (); /* must precede init_editfns. */
#endif
-#ifdef HAVE_NS
-#ifndef CANNOT_DUMP
- if (initialized)
-#endif
- ns_init_paths ();
-#endif
-
/* Initialize and GC-protect Vinitial_environment and
Vprocess_environment before set_initial_environment fills them
in. */
=== modified file 'src/lread.c'
--- a/src/lread.c 2012-07-07 19:33:28 +0000
+++ b/src/lread.c 2012-07-10 01:04:28 +0000
@@ -45,6 +45,10 @@
#include "msdos.h"
#endif
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
+
#include <unistd.h>
#include <math.h>
@@ -4125,8 +4129,16 @@
const char *normal;
#ifdef CANNOT_DUMP
+#ifdef HAVE_NS
+ const char *loadpath = ns_load_path ();
+#endif
+
normal = PATH_LOADSEARCH;
+#ifdef HAVE_NS
+ Vload_path = decode_env_path ("EMACSLOADPATH", loadpath ? loadpath : normal);
+#else
Vload_path = decode_env_path ("EMACSLOADPATH", normal);
+#endif
load_path_check ();
@@ -4135,7 +4147,12 @@
difference between initialized and !initialized in this case,
so we'll have to do it unconditionally when Vinstallation_directory
is non-nil. */
+#ifdef HAVE_NS
+ /* loadpath already includes the app-bundle's site-lisp. */
+ if (!no_site_lisp && !egetenv ("EMACSLOADPATH") && !loadpath)
+#else
if (!no_site_lisp && !egetenv ("EMACSLOADPATH"))
+#endif
{
Lisp_Object sitelisp;
sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
@@ -4171,7 +4188,12 @@
}
else
{
+#ifdef HAVE_NS
+ const char *loadpath = ns_load_path ();
+ Vload_path = decode_env_path (0, loadpath ? loadpath : normal);
+#else
Vload_path = decode_env_path (0, normal);
+#endif
if (!NILP (Vinstallation_directory))
{
Lisp_Object tem, tem1;
@@ -4274,7 +4296,12 @@
load_path_check ();
/* Add the site-lisp directories at the front. */
+#ifdef HAVE_NS
+ /* loadpath already includes the app-bundle's site-lisp. */
+ if (!no_site_lisp && !loadpath)
+#else
if (!no_site_lisp)
+#endif
{
Lisp_Object sitelisp;
sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
=== modified file 'src/nsterm.h'
--- a/src/nsterm.h 2012-07-09 21:28:39 +0000
+++ b/src/nsterm.h 2012-07-10 01:04:28 +0000
@@ -800,7 +800,7 @@
extern const char *ns_etc_directory (void);
extern const char *ns_exec_path (void);
-extern void ns_init_paths (void);
+extern const char *ns_load_path (void);
extern void syms_of_nsterm (void);
extern void syms_of_nsfns (void);
extern void syms_of_nsmenu (void);
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2012-07-09 21:28:39 +0000
+++ b/src/nsterm.m 2012-07-10 01:04:28 +0000
@@ -365,12 +365,11 @@
}
-void
-ns_init_paths (void)
-/* --------------------------------------------------------------------------
- Used to allow emacs to find its resources under Emacs.app
- Called from emacs.c at startup.
- --------------------------------------------------------------------------
*/
+const char *
+ns_load_path (void)
+/* If running as a self-contained app bundle, return as a path string
+ the filenames of the site-lisp, lisp and leim directories.
+ Ie, site-lisp:lisp:leim. Otherwise, return nil. */
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *resourceDir = [bundle resourcePath];
@@ -379,34 +378,30 @@
NSString *pathSeparator = onWindows ? @";" : @":";
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isDir;
-/*NSLog (@"ns_init_paths: '%@'address@hidden", [[NSBundle mainBundle]
bundlePath], [[NSBundle mainBundle] resourcePath]); */
-
- /* the following based on Andrew Choi's init_mac_osx_environment () */
- if (!getenv ("EMACSLOADPATH"))
- {
- NSArray *paths = [resourceDir stringsByAppendingPaths:
- [NSArray arrayWithObjects:
+ NSArray *paths = [resourceDir stringsByAppendingPaths:
+ [NSArray arrayWithObjects:
@"site-lisp", @"lisp", @"leim", nil]];
- NSEnumerator *pathEnum = [paths objectEnumerator];
- resourcePaths = @"";
- /* Hack to skip site-lisp. */
- if (no_site_lisp) resourcePath = [pathEnum nextObject];
- while (resourcePath = [pathEnum nextObject])
- {
- if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
- if (isDir)
- {
- if ([resourcePaths length] > 0)
- resourcePaths
- = [resourcePaths stringByAppendingString: pathSeparator];
- resourcePaths
- = [resourcePaths stringByAppendingString: resourcePath];
- }
- }
- if ([resourcePaths length] > 0)
- setenv ("EMACSLOADPATH", [resourcePaths UTF8String], 1);
-/*NSLog (@"loadPath: '%@'\n", resourcePaths); */
+ NSEnumerator *pathEnum = [paths objectEnumerator];
+ resourcePaths = @"";
+
+ /* Hack to skip site-lisp. */
+ if (no_site_lisp) resourcePath = [pathEnum nextObject];
+
+ while (resourcePath = [pathEnum nextObject])
+ {
+ if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
+ if (isDir)
+ {
+ if ([resourcePaths length] > 0)
+ resourcePaths
+ = [resourcePaths stringByAppendingString: pathSeparator];
+ resourcePaths
+ = [resourcePaths stringByAppendingString: resourcePath];
+ }
}
+ if ([resourcePaths length] > 0) return [resourcePaths UTF8String];
+
+ return NULL;
}
static void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108984: Stop ns builds setting the EMACSLOADPATH environment variable,
Glenn Morris <=