From: Stefano Zacchiroli <zack@cs.unibo.it>
To: Inria Ocaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] [request] look for .ocamlinit also in home dir
Date: Thu, 24 Oct 2002 18:07:08 +0200 [thread overview]
Message-ID: <20021024160708.GA16806@cs.unibo.it> (raw)
[-- Attachment #1: Type: text/plain, Size: 541 bytes --]
It would be nice if the ocaml toplevel look for .ocamlinit not only in
the current directory but also in the home directory of the user, is it
possible to add such a feature?
Attched there is a patch for toplevel/toploop.ml that implements it.
Cheers.
--
Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy
zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro
"I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!" -- G.Romney
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 813 bytes --]
--- toploop.ml.orig 2002-10-24 17:29:41.000000000 +0200
+++ toploop.ml 2002-10-24 17:38:20.000000000 +0200
@@ -347,7 +347,25 @@
Compile.init_path()
let load_ocamlinit ppf =
- if Sys.file_exists ".ocamlinit" then ignore(use_silently ppf ".ocamlinit")
+ let homedir =
+ try Some (Sys.getenv "HOME")
+ with Not_found -> None
+ in
+ let initfile =
+ if Sys.file_exists ".ocamlinit" then
+ Some ".ocamlinit"
+ else
+ (match homedir with
+ | Some d ->
+ if Sys.file_exists (d ^ "/.ocamlinit") then
+ Some (d ^ "/.ocamlinit")
+ else
+ None
+ | None -> None)
+ in
+ match initfile with
+ | Some f -> ignore(use_silently ppf f)
+ | None -> ()
let set_paths () =
(* Add whatever -I options have been specified on the command line,
reply other threads:[~2002-10-24 16:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021024160708.GA16806@cs.unibo.it \
--to=zack@cs.unibo.it \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox