unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* NS do not set INFOPATH
@ 2009-05-03 13:47 Felix Mueller
  2009-05-16  5:08 ` Adrian Robert
  0 siblings, 1 reply; 6+ messages in thread
From: Felix Mueller @ 2009-05-03 13:47 UTC (permalink / raw)
  To: emacs-devel

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

Hi,

I would find it less intrusive, if Emacs.app did not set INFOPATH upon
start up if it was not set before. This would enable users to make
changes to Info-default-directory-list in their initialization files. I
am attaching changes that imitate w32's behavior in this regard, albeit
adding the info directory in the bundle at the beginning of the list. It
might be prudent to change that if Emacs is built non self-contained. I
am a complete newcomer to changing Emacs "internals", so please forgive
me if this does not conform to emacs dev conventions.

If you decide against changing the behavior, I would find it helpful if
you included a hint in the documentation. This would spare users from
searching through Emacs.app/Contents/Info.plist,
~/.MacOSX/environment.plist or launchd.conf files, looking for the
definition of the INFOPATH.

Thanks!

-- 
Felix Mueller


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nsterm.m.diff --]
[-- Type: text/x-patch, Size: 666 bytes --]

Index: src/nsterm.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsterm.m,v
retrieving revision 1.69
diff -u -r1.69 nsterm.m
--- src/nsterm.m	30 Apr 2009 16:52:19 -0000	1.69
+++ src/nsterm.m	3 May 2009 13:34:08 -0000
@@ -409,14 +409,6 @@
             setenv ("EMACSDOC", [resourcePath UTF8String], 1);
         }
     }
-
-  if (!getenv ("INFOPATH"))
-    {
-      resourcePath = [resourceDir stringByAppendingPathComponent: @"info"];
-      if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
-        if (isDir)
-          setenv ("INFOPATH", [resourcePath UTF8String], 1);
-    }
 }
 
 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: ns-win.el.diff --]
[-- Type: text/x-patch, Size: 1218 bytes --]

Index: lisp/term/ns-win.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/term/ns-win.el,v
retrieving revision 1.42
diff -u -r1.42 ns-win.el
--- lisp/term/ns-win.el	30 Apr 2009 18:01:40 -0000	1.42
+++ lisp/term/ns-win.el	3 May 2009 13:34:58 -0000
@@ -1266,6 +1266,20 @@
 (add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
 (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
 
+;;; Setup Info-default-directory-list to include the info directory
+;;; near where Emacs executable was installed.  We used to set INFOPATH,
+;;; but when this is set Info-default-directory-list is ignored.  We
+;;; also cannot rely upon what is set in paths.el because they assume
+;;; that configuration during build time is correct for runtime.
+;;; (copied from w32-fns.el)
+(defun ns-init-info ()
+  (let* ((instdir (file-name-directory invocation-directory))
+	 (dir1 (expand-file-name "../Resources/info/" instdir)))
+    (if (file-exists-p dir1)
+	(setq Info-default-directory-list
+	      (append (list dir1) Info-default-directory-list)))))
+
+(add-hook 'before-init-hook 'ns-init-info)
 
 (provide 'ns-win)
 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: macos.texi.diff --]
[-- Type: text/x-patch, Size: 1169 bytes --]

Index: doc/emacs/macos.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/emacs/macos.texi,v
retrieving revision 1.12
diff -u -r1.12 macos.texi
--- doc/emacs/macos.texi	2 May 2009 19:28:41 -0000	1.12
+++ doc/emacs/macos.texi	3 May 2009 13:32:33 -0000
@@ -31,7 +31,6 @@
 * Mac / GNUstep Customization:: Customizations under GNUstep or Mac OS.
 * Mac / GNUstep Events::        How window system events are handled.
 * GNUstep Support::             Details on status of GNUstep support
-* 
 @end menu
 
 @node Mac / GNUstep Basics, Mac / GNUstep Customization, , Mac OS / GNUstep
@@ -99,6 +98,10 @@
 of setting PATH is recommended on Mac OS X 10.5 and later, using the
 @file{/etc/paths} files and the @file{/etc/paths.d} directory.
 
+If the INFOPATH environment variable is not set during startup, Emacs
+sets it to @file{@var{invocation-directory}../Resources/info}, thus
+rendering any changes to @code{Info-default-directory-list} in the
+initialization files ineffective.
 
 @node Mac / GNUstep Customization, Mac / GNUstep Events, Mac / GNUstep Basics, Mac OS / GNUstep
 @section Mac / GNUstep Customization

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NS do not set INFOPATH
  2009-05-03 13:47 NS do not set INFOPATH Felix Mueller
@ 2009-05-16  5:08 ` Adrian Robert
  2009-05-16  8:15   ` Leo
  2009-05-16 11:06   ` Felix Mueller
  0 siblings, 2 replies; 6+ messages in thread
From: Adrian Robert @ 2009-05-16  5:08 UTC (permalink / raw)
  To: emacs-devel

Felix Mueller <felix <at> enqueue.eu> writes:

> 
> Hi,
>
> I would find it less intrusive, if Emacs.app did not set INFOPATH upon
> start up if it was not set before. This would enable users to make
> changes to Info-default-directory-list in their initialization
> files. I am attaching changes that imitate w32's behavior in this
> regard, albeit adding the info directory in the bundle at the
> beginning of the list.

Hi,

Thanks for this patch.  It looks like it improves the behavior from
before, even if it's not perfect.  I will look at incorporating it.


> It might be prudent to change that if Emacs is built non
> self-contained.

Does the new method cause a failure to find the right info directory in
this case?  If so, is it any worse than the case before?



> If you decide against changing the behavior, I would find it helpful
> if you included a hint in the documentation.

Do I take it the macos.texi portion of your patch should ONLY be applied
if the other parts are NOT applied, or is that describing a shortcoming
that will still exist with your new code?


thanks,
Adrian






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NS do not set INFOPATH
  2009-05-16  5:08 ` Adrian Robert
@ 2009-05-16  8:15   ` Leo
  2009-05-16 11:06   ` Felix Mueller
  1 sibling, 0 replies; 6+ messages in thread
From: Leo @ 2009-05-16  8:15 UTC (permalink / raw)
  To: emacs-devel

On 2009-05-16 06:08 +0100, Adrian Robert wrote:
> Felix Mueller <felix <at> enqueue.eu> writes:
>
>> 
>> Hi,
>>
>> I would find it less intrusive, if Emacs.app did not set INFOPATH upon
>> start up if it was not set before. This would enable users to make
>> changes to Info-default-directory-list in their initialization
>> files. I am attaching changes that imitate w32's behavior in this
>> regard, albeit adding the info directory in the bundle at the
>> beginning of the list.
>
> Hi,
>
> Thanks for this patch.  It looks like it improves the behavior from
> before, even if it's not perfect.  I will look at incorporating it.

Actually from the documentation, it looks like
Info-default-directory-list is not for users to customise,
Info-additional-directory-list is.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NS do not set INFOPATH
  2009-05-16  5:08 ` Adrian Robert
  2009-05-16  8:15   ` Leo
@ 2009-05-16 11:06   ` Felix Mueller
  2009-05-16 23:26     ` Adrian Robert
  1 sibling, 1 reply; 6+ messages in thread
From: Felix Mueller @ 2009-05-16 11:06 UTC (permalink / raw)
  To: emacs-devel

Hi,

* Adrian Robert -- [2009-05-16] writes:
> Felix Mueller <felix <at> enqueue.eu> writes:
>> I would find it less intrusive, if Emacs.app did not set INFOPATH upon
>> start up if it was not set before. This would enable users to make
>> changes to Info-default-directory-list in their initialization
>> files.
> 
> Thanks for this patch.  It looks like it improves the behavior from
> before, even if it's not perfect.  I will look at incorporating it.

I think, setting an environment variable on startup is not a good idea,
but an easier alternative would be to simply add a colon to resourcePath
in nsterm.m (~ line 418). This way, contents of INFOPATH and
Info-default-directory-list are merged when invoking info.

>> It might be prudent to change that if Emacs is built non
>> self-contained.
>
> Does the new method cause a failure to find the right info directory in
> this case?  

I only tested it using the default prefix (/usr/local). This works fine.

>> If you decide against changing the behavior, I would find it helpful
>> if you included a hint in the documentation.
>
> Do I take it the macos.texi portion of your patch should ONLY be applied
> if the other parts are NOT applied

Yes.

* Leo -- [2009-05-16] writes:
> Actually from the documentation, it looks like
> Info-default-directory-list is not for users to customise,
> Info-additional-directory-list is.

OK, but would you not find it more useful if this variable /could/ be
changed to effectively add info directories (e.g. in the system wide
initialization file to include fink info directories)?

I would typically not expect most of the programs I use to set an
environment variable by themselves, and I spent a couple of minutes
figuring out what was happening and checking for other places that might
be responsible for the INFOPATH environment variable. That's why I wrote
the email :-)

Thanks!

-- 
Felix Mueller
felix@enqueue.eu




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NS do not set INFOPATH
  2009-05-16 11:06   ` Felix Mueller
@ 2009-05-16 23:26     ` Adrian Robert
  2009-05-31  8:49       ` Felix Mueller
  0 siblings, 1 reply; 6+ messages in thread
From: Adrian Robert @ 2009-05-16 23:26 UTC (permalink / raw)
  To: emacs-devel

Felix Mueller <felix <at> enqueue.eu> writes:

> an easier alternative would be to simply add a colon to resourcePath
> in nsterm.m (~ line 418). This way, contents of INFOPATH and
> Info-default-directory-list are merged when invoking info.

I'm less familiar with this area than you, but it seems strange that
emacs expects a user env setting for INFOPATH to have a path-separator
already appended to it.  Shouldn't the code that  as you say merges
INFOPATH and Info-default-directory-list take care of this?


 
> I would typically not expect most of the programs I use to set an
> environment variable by themselves, and I spent a couple of minutes
> figuring out what was happening and checking for other places that
> might be responsible for the INFOPATH environment variable. That's why
> I wrote the email

So it seems the problem is not with INFOPATH per se, but the whole
approach used by ns-init-paths.  Would it be possible to use the
alternative you posted for all of these other variables as well, or
would they be adjusted too late?






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NS do not set INFOPATH
  2009-05-16 23:26     ` Adrian Robert
@ 2009-05-31  8:49       ` Felix Mueller
  0 siblings, 0 replies; 6+ messages in thread
From: Felix Mueller @ 2009-05-31  8:49 UTC (permalink / raw)
  To: emacs-devel

Hi,

* Adrian Robert -- [2009-05-17] writes:
> Felix Mueller <felix <at> enqueue.eu> writes:
>
>> an easier alternative would be to simply add a colon to resourcePath
>> in nsterm.m (~ line 418). This way, contents of INFOPATH and
>> Info-default-directory-list are merged when invoking info.
>
> I'm less familiar with this area than you, but it seems strange that
> emacs expects a user env setting for INFOPATH to have a path-separator
> already appended to it.  Shouldn't the code that  as you say merges
> INFOPATH and Info-default-directory-list take care of this?

I think, this is a deliberate choice (see texinfo manual): either merge
or overwrite.

>> I would typically not expect most of the programs I use to set an
>> environment variable by themselves, and I spent a couple of minutes
>> figuring out what was happening and checking for other places that
>> might be responsible for the INFOPATH environment variable. That's why
>> I wrote the email
>
> So it seems the problem is not with INFOPATH per se, but the whole
> approach used by ns-init-paths.  Would it be possible to use the
> alternative you posted for all of these other variables as well, or
> would they be adjusted too late?

I tried looking into this, but I am simply not familiar enough with
Emacs' startup. It seems to me, that this mechanism would not work
without additional, heavier changes to nsterm.m, unless you are ruling
out users moving their application bundle (bad idea, in my
opinion). While I do consider setting paths within a program via
environment variables "unexpected", the other variables have not been
problematic for me, so far. As far as I can tell, w32 uses a similar
approach (w32.c init_environment), and only excludes INFOPATH.

Thanks!

-- 
Felix Mueller
felix@enqueue.eu




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-31  8:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-03 13:47 NS do not set INFOPATH Felix Mueller
2009-05-16  5:08 ` Adrian Robert
2009-05-16  8:15   ` Leo
2009-05-16 11:06   ` Felix Mueller
2009-05-16 23:26     ` Adrian Robert
2009-05-31  8:49       ` Felix Mueller

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).