Re: [Bug-apl] .apl.history file?

2016-07-20 Thread Juergen Sauermann
Hi David, yes, it is in place (despite of its name which was not changed when readline was removed, so that existing preferences files would still work). Maybe you want to check with apl -l 37 in which order the preferences files are read.

[Bug-apl] .apl.history file?

2016-07-19 Thread David B. Lamkins
Is the history file mechanism still in place? I have set READLINE_HISTORY_PATH in ~/.gnu-apl/preferences to /home/dlamkins/.apl.history . GNU APL doesn't create the history file, nor does it write to the file if I create it.

Re: [Bug-apl] .apl.history

2014-07-04 Thread Juergen Sauermann
Hi David et al., I believe your proposal below does not work in general. Often (if not to say normally) GNU APL is installed by root, so $HOME would be /root. I believe most system administrators would not like programs to install config files there (and it would not even be readable by

Re: [Bug-apl] .apl.history

2014-07-02 Thread Juergen Sauermann
Hi Blake, you can set the path in the preferences files: READLINE_HISTORY_PATH = /home/... /// Jürgen On 07/01/2014 11:14 PM, Blake McBride wrote: GNU APL creates a .apl.history in whatever directory APL is started up in. This is unlike all other system I've seen, and a problem when you

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
Dear Juergen, Thanks. I can do that, but every other Linux program I have ever used, although it may allow me to specify a config file location as you do, the default is always in the home directory. Thanks. Blake On Wed, Jul 2, 2014 at 6:24 AM, Juergen Sauermann

Re: [Bug-apl] .apl.history

2014-07-02 Thread Juergen Sauermann
Hi Blake, yes. The problem with that is that it requires the presence of a home directory. There are use cases like scripting where the interpreter cannot figure where the home directory is located and my strategy is to depend on as few environment variables (like $HOME or $PWD) as

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
Dear Juergen, If you have trouble reliably finding the home directory, how do you find the preferences file? I would say to find the .apl.history file in the same way and place you find the .gnu-apl directory. That would be consistent. The problem I am having is that since I use GNU APL from

Re: [Bug-apl] .apl.history

2014-07-02 Thread Elias Mårtenson
I have to agree with Blake here. Ideally there should be a call to getenv(HOME) and if that returns non-NULL, then use the .apl_history in $HOME/.apl/apl_history or something like that. If it returns NULL, well, then fall back to current directory I suppose. I could make the Emacs mode use the

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
I found this for Unix/Linux systems: #include unistd.h#include sys/types.h#include pwd.h struct passwd *pw = getpwuid(getuid()); const char *homedir = pw-pw_dir; On Wed, Jul 2, 2014 at 10:44 AM, Elias Mårtenson loke...@gmail.com wrote: I have to agree with Blake here. Ideally there should

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
What was recommended is to use PATH variable (as you suggest) and then fall back to the code I gave. On Wed, Jul 2, 2014 at 11:00 AM, Elias Mårtenson loke...@gmail.com wrote: Neat, although I believe directly looking at the PATH variable is more portable. It works on all Unices as well as

Re: [Bug-apl] .apl.history

2014-07-02 Thread Elias Mårtenson
Arguably, I can't think of a single situation where PATH isn't set while getpwuid would work. I could be wrong though. Regards, Elias On 3 July 2014 00:13, Blake McBride blake1...@gmail.com wrote: What was recommended is to use PATH variable (as you suggest) and then fall back to the code I

Re: [Bug-apl] .apl.history

2014-07-02 Thread Juergen Sauermann
Hi Blake, I don't have to. If I don't find $HOME then the preferences file in $HOME is not read and the /etc/gnu-apl.d/preferences file is read. If that file would use $HOME then its purpose of having a fallback in case $HOME is not working would be undermined. /// Jürgen On 07/02/2014

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
A note from http://stackoverflow.com/questions/2552416/how-can-i-find-the-users-home-dir-in-a-cross-platform-manner-using-c Important remark: *many people are assuming that HOME environment variable is always available on Unix but this is not true*, one good example would be OS X. On OS X when

Re: [Bug-apl] .apl.history

2014-07-02 Thread Elias Mårtenson
Are you sure of that? I'm 99% sure that PATH is always set on OSX. Regards, Elias On 3 July 2014 00:31, Blake McBride blake1...@gmail.com wrote: A note from http://stackoverflow.com/questions/2552416/how-can-i-find-the-users-home-dir-in-a-cross-platform-manner-using-c Important remark:

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
Dear Juergen, If $HOME is there, why don't you default to $HOME/.apl.history rather than just .apl.history? That would portably-enough solve the problem of not getting .apl.history files all over the place. Just use whatever algorithm you are using for the .gnu-apl directory. Thanks. Blake

Re: [Bug-apl] .apl.history

2014-07-02 Thread Blake McBride
I have a current Mac OS/X system with a default configuration. $HOME is set. On Wed, Jul 2, 2014 at 11:34 AM, Elias Mårtenson loke...@gmail.com wrote: Are you sure of that? I'm 99% sure that PATH is always set on OSX. Regards, Elias On 3 July 2014 00:31, Blake McBride

Re: [Bug-apl] .apl.history

2014-07-02 Thread Elias Mårtenson
Thanks for understanding what I was saying even though I apparently have a serious issue telling PATH and HOME apart. Whenever I say PATH, read HOME. Regards, Elias On 3 July 2014 00:40, Blake McBride blake1...@gmail.com wrote: I have a current Mac OS/X system with a default configuration.

Re: [Bug-apl] .apl.history

2014-07-02 Thread David B. Lamkins
While I agree that $HOME/.apl-history is more generally useful, I can also make a case for having the history file's location be relative to the working directory: Assume that you're a consultant or contractor working on APL projects for a number of clients. You cd to the directory for a client's