From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 88F2281792 for ; Wed, 19 Jun 2013 18:49:50 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of ivg@ieee.org) identity=pra; client-ip=74.125.149.211; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of ivg@ieee.org designates 74.125.149.211 as permitted sender) identity=mailfrom; client-ip=74.125.149.211; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@na3sys009aog114.obsmtp.com) identity=helo; client-ip=74.125.149.211; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="postmaster@na3sys009aog114.obsmtp.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkUBAOTfwVFKfZXTk2dsb2JhbABagzoBrUKSIYEWDgEBAQEHCwsJFAUjgiMBAQEDAQ8BXgsFCwsYDSEhEwEFAQoSBhMSCYdhAwkGBAieHIsKAQGJUAMKiFKMXYIyMweDAGEDiRqMQIFngSmEeIV/gz8/hDo X-IPAS-Result: AkUBAOTfwVFKfZXTk2dsb2JhbABagzoBrUKSIYEWDgEBAQEHCwsJFAUjgiMBAQEDAQ8BXgsFCwsYDSEhEwEFAQoSBhMSCYdhAwkGBAieHIsKAQGJUAMKiFKMXYIyMweDAGEDiRqMQIFngSmEeIV/gz8/hDo X-IronPort-AV: E=Sophos;i="4.87,898,1363129200"; d="scan'208";a="18325555" Received: from na3sys009aog114.obsmtp.com ([74.125.149.211]) by mail3-smtp-sop.national.inria.fr with SMTP; 19 Jun 2013 18:49:48 +0200 Received: from mail-la0-f46.google.com ([209.85.215.46]) (using TLSv1) by na3sys009aob114.postini.com ([74.125.148.12]) with SMTP ID DSNKUcHhKxSKkirE+XIcdfnwtr2+RaP/B9sS@postini.com; Wed, 19 Jun 2013 09:49:48 PDT Received: by mail-la0-f46.google.com with SMTP id eg20so4876774lab.33 for ; Wed, 19 Jun 2013 09:49:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=DlOvPDZDsK9B5OPpx0dZiQ4Z8+4sUumXtKPYQSZbYKE=; b=QUZQVAPRWoI/aEhFRuybiRr81UaOxG+L0eRIO0qKXs9UrXP1yOc32zNO8G97+DLloG XtDPvKuG6VJn8Nl1AynUsjKU54NboLr7/756qqp8oN+oGyUcE/nWdVhSzV4q0Cyi3XAr ZyOBVSbnkFAhA3/Pj3hJjrIp7iPUarRMWeZdWd8TYuoaJi/ofIPBe8GBMW8qzW9A1ZOU 0IF5pF8zo1x6PxROqSxVTh/Dgr0YBHQ18PzNt6n7LJhhcGEZwUQ4i02LRDIlCE8ncs7o yR6089xEmXs7KgDkggZbLQlDUeO7gSAspqYzc7WUT3puCmk00xz7gK13y32nTDebp9VY eHuQ== X-Received: by 10.152.5.227 with SMTP id v3mr1781821lav.31.1371660585926; Wed, 19 Jun 2013 09:49:45 -0700 (PDT) X-Received: by 10.152.5.227 with SMTP id v3mr1781808lav.31.1371660585772; Wed, 19 Jun 2013 09:49:45 -0700 (PDT) Received: from [192.168.0.64] (ip-46-73-149-67.bb.netbynet.ru. [46.73.149.67]) by mx.google.com with ESMTPSA id b8sm9075231lah.0.2013.06.19.09.49.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 09:49:45 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) From: Ivan Gotovchits In-Reply-To: Date: Wed, 19 Jun 2013 20:49:44 +0400 Cc: caml users , Wojciech Meyer , Christophe TROESTLER , Leo White Content-Transfer-Encoding: quoted-printable Message-Id: References: <87li6z8x0m.fsf@ieee.org> <20130528.102112.1182989008075506917.Christophe.Troestler@umons.ac.be> <878v2qj57l.fsf@kingston.cl.cam.ac.uk> To: Gabriel Scherer X-Mailer: Apple Mail (2.1508) X-Gm-Message-State: ALoCoQnKPUvuQ5RhRKu1kEJ2KRvDi3vbxWSru2vu6ejgkA4fB1PJgKEF43tjlOu0UiVseysrCtSNB9pob3kQxqun1FTiY/cA2MNdy/7JhmgjCysKe1ML39TNKHZEUTOnIqcEYKmxjXwHmWA/RFvBUUpNOtMgDQXhAA== Subject: Re: [Caml-list] Setting up OPAM in emacs I've chosen the simplest solution, that is not very versatile, but it work= s. Though there were provided some elegant solutions, I cannot found one that = would mix well=20 with a typerex 2.0, which enforces its own rules. So, my working scheme (works on linux and mac (with issues on the later)) 0. clean up the system (remove old typerex, tuareg and whatever you've trie= d=85) 1. install typerex from opam: `$ opam install typerex` 2. setup the environment=20=20=20 `$ opam config setup -a` 3. setup the typerex `$ ocp-edit-mode install -emacs`=20 4. relogin (or reboot) Then start emacs in such way, that it can benefit from the configured setup. In linux I just start emacs as a server: `$ emacs --daemon` and start frames with `$ emacsclient -c` All commands works fine. Though after switching compilers it is needed to r= estart emacs server. On mac os I've installed Emacs.App from ports. All of the opam setup works = fine, when I start from Terminal with: `$ open -a Emacs` Nothing works if emacs is started from finder or dock. P.S. I hope that this will help, and I've not missed anything. P.P.S. For full experience one should use ocp-build. I'm experimenting with= it. It looks very nice,=20 but I still can't find how to enable syntax preprocessing. May be some clue= s?=20 =20=20=20 On Jun 15, 2013, at 16:07, Gabriel Scherer wrot= e: > I don't (want to) understand the details of why opam switches don't > work well with Emacs right now, or of any of the proposed solutions. > Is there a solution integrated in OPAM by now? If not, is there a > consensus on what simple users like me should use to solve the > problem? Could you (the thread participants) decide on something, and > send that to the OPAM upstream, so that future versions solve this > issue? >=20 > (The immediate problem I observe is that compile-command does not use > the OCaml versions I would expect it to, in general defaulting to my > system OCaml -- that may depend on the way Emacs is launched. More > sophisticated things such as being able to call "opam switch" from > inside Emacs are probably secondary needs, and I would be fine with a > basic integration not supporting that, and letting people hone their > emacs-lisp skills for that.) >=20 > On Tue, Jun 4, 2013 at 4:55 PM, Leo White wrote: >> My personal solution for Tuareg mode is to put: >>=20 >> ;; Use OPAM's ocaml >> (setq tuareg-interactive-program "opam config exec ocaml") >>=20 >> in my .emacs. >>=20 >> Regards, >>=20 >> Leo >>=20 >> Wojciech Meyer writes: >>=20 >>> Christophe's function hook is probably much better and elegant solution, >>> but this works for me: >>>=20 >>>>>=20 >>> (defun dm-opam-switch-root (ocaml-version opam-root) >>> (interactive "sOCaml version: \nsOPAM root: ") >>> (let* ((path (if (string-match "\\.opam" (car exec-path)) (cdr exec-pa= th) exec-path)) >>> (entry >>> (replace-regexp-in-string >>> "\n" "" >>> (shell-command-to-string >>> (format "opam switch --root %s %s > /dev/null && opam config= env | sed -n 's/^PATH=3D\\([^:]\\+\\):.*$/\\1/p'" opam-root ocaml-version)= ))) >>> (env-path (replace-regexp-in-string "\n" "" (shell-command-to-s= tring (format "opam config env --root %s | sed -n 's/^PATH=3D\\(.*\\)/\\1/p= '" opam-root))))) >>> (setq exec-path (cons entry path)) >>> (setenv "PATH" env-path))) >>>=20 >>> (defun dm-opam-switch (ocaml-version) >>> (interactive "sOCaml version: ") >>> (dm-opam-switch-root ocaml-version "~/.opam")) >>> << >>>=20 >>> I wouldn't say myself it's a perfect script, but it works. Note that I >>> use a lot of shell trickery instead of Emacs buffers, which is probably >>> not a good idea. >>>=20 >>> You just say M-x dm-opam-switch, and indicate which version you would >>> like. >>>=20 >>> Best, >>> Wojciech >>>=20 >>> Christophe TROESTLER writes: >>>=20 >>>> On Tue, 28 May 2013 09:59:53 +0400, Ivan Gotovchits wrote: >>>>>=20 >>>>> 2. Use =ABeval `opam env config`=BB in the begining of a compile-comm= and. >>>>> This works fine when you switch compiler, but other commands, such = as >>>>> =ABC-c C-s=BB doesn't use new environment. >>>>=20 >>>> I use this for the compilation: >>>>=20 >>>> ;; OPAM compilation =97 one must update to the current compiler >>>> ;; before launching the compilation. >>>> (defadvice compile (before compile-opam activate) >>>> "Run opam to update environment variables" >>>> (set (make-local-variable 'compilation-environment) >>>> (with-temp-buffer >>>> (ignore-errors (call-process "opam" nil t nil "config" "-env"= )) >>>> (goto-char (point-min)) >>>> (while (re-search-forward "; *export.*$" nil t) >>>> (replace-match "" nil nil)) >>>> (split-string (buffer-substring 1 (point-max))) >>>> ))) >>>>=20 >>>> For the toplevel, I am afraid one needs to restart it. I guess a >>>> similar trick is possible to automatically select the right one. >>>>=20 >>>> Hope it helps, >>>> C. >>=20 >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs