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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id A60D88239C for ; Thu, 23 Nov 2017 10:53:46 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mail@matej-kosik.net; spf=SoftFail smtp.mailfrom=mail@matej-kosik.net; spf=SoftFail smtp.helo=postmaster@matej-kosik.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mail@matej-kosik.net) identity=pra; client-ip=145.239.83.105; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@matej-kosik.net"; x-sender="mail@matej-kosik.net"; x-conformance=sidf_compatible Received-SPF: SoftFail (mail2-smtp-roc.national.inria.fr: domain of mail@matej-kosik.net is inclined to not designate 145.239.83.105 as permitted sender) identity=mailfrom; client-ip=145.239.83.105; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@matej-kosik.net"; x-sender="mail@matej-kosik.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: SoftFail (mail2-smtp-roc.national.inria.fr: domain of postmaster@matej-kosik.net is inclined to not designate 145.239.83.105 as permitted sender) identity=helo; client-ip=145.239.83.105; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@matej-kosik.net"; x-sender="postmaster@matej-kosik.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3AlqC97h8yxJOTm/9uRHKM819IXTAuvvDOBiVQ1KB+?= =?us-ascii?q?1OIcTK2v8tzYMVDF4r011RmSAtWdtqoMotGVmp6jcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47TeVDInX2z8TNXXzy3dU8s?= =?us-ascii?q?fry0ScbuiJG83uW2vpnSeBlghTynYLo0Ig/lgx/Ws5wziJdvKO4SzelMoTMcfu?= =?us-ascii?q?1XwUttLE6enVP/4dyx/9hl/jgG6KFpzNJJTaivJ/dwdrdfFjlzdjltvMA=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CvBgCwmRZa/2lT75FcGgEBAQICAQEBC?= =?us-ascii?q?QEBAYM9aWuEJosTj3cmlmoQggEHhT4ChH1CFgEBAQEBAQEBAQFqKII4JAGCQgE?= =?us-ascii?q?FIwRiCxgjBwICVxMIAQGKIqhXgW06iyMPgzqCW4JqKQuCd4RaDgESAYM0gmMFi?= =?us-ascii?q?jAHiTGFPokghEmCKJAxiW4khyWXciYMJoEDcoEFCkmCZYMQgU+JQII4AQEB?= X-IPAS-Result: =?us-ascii?q?A0CvBgCwmRZa/2lT75FcGgEBAQICAQEBCQEBAYM9aWuEJos?= =?us-ascii?q?Tj3cmlmoQggEHhT4ChH1CFgEBAQEBAQEBAQFqKII4JAGCQgEFIwRiCxgjBwICV?= =?us-ascii?q?xMIAQGKIqhXgW06iyMPgzqCW4JqKQuCd4RaDgESAYM0gmMFijAHiTGFPokghEm?= =?us-ascii?q?CKJAxiW4khyWXciYMJoEDcoEFCkmCZYMQgU+JQII4AQEB?= X-IronPort-AV: E=Sophos;i="5.44,441,1505772000"; d="asc'?scan'208";a="302159405" Received: from 105.ip-145-239-83.eu (HELO matej-kosik.net) ([145.239.83.105]) by mail2-smtp-roc.national.inria.fr with ESMTP; 23 Nov 2017 10:53:45 +0100 Received: from [192.168.1.10] (adsl-dyn76.78-99-102.t-com.sk [78.99.102.76]) by matej-kosik.net (Postfix) with ESMTPSA id B23E4230FE for ; Thu, 23 Nov 2017 10:53:44 +0100 (CET) To: caml-list@inria.fr References: <6c2af6b6-2f9f-7f12-2bbf-22b1286d29d5@matej-kosik.net> From: =?UTF-8?B?TWF0ZWogS2/FocOtaw==?= Openpgp: id=1CD41D0A52319DC7ABC1B79F50AFFA128CE48649; url=http://matej-kosik.net/doc/kosik.asc Message-ID: <3b5de67c-859b-27f6-9408-49cdb6285712@matej-kosik.net> Date: Thu, 23 Nov 2017 10:53:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="msdCfssAKuX22InARIl0teeWdVXVVDJ35" Subject: Re: [Caml-list] What is the right way to configure Tuareg to get the same indentation as in Batteries Included? This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --msdCfssAKuX22InARIl0teeWdVXVVDJ35 Content-Type: multipart/mixed; boundary="k8vq4dWG0raqnuTCAtS3ip1BX8PHxsJEV"; protected-headers="v1" From: =?UTF-8?B?TWF0ZWogS2/FocOtaw==?= To: caml-list@inria.fr Message-ID: <3b5de67c-859b-27f6-9408-49cdb6285712@matej-kosik.net> Subject: Re: [Caml-list] What is the right way to configure Tuareg to get the same indentation as in Batteries Included? References: <6c2af6b6-2f9f-7f12-2bbf-22b1286d29d5@matej-kosik.net> In-Reply-To: --k8vq4dWG0raqnuTCAtS3ip1BX8PHxsJEV Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Stefan, On 11/21/17 20:59, Stefan Monnier wrote: >> match BatEnum.peek enum with >> | None -> {re; im =3D multiplier} >> | Some (Kwd ".") >> | Some (Kwd "*") -> >> BatEnum.junk enum; >> parse_im ~multiplier re >> | Some _token -> >> parse_im ~multiplier re >> >> However, Tuareg, in my currenct configuration does instead this: >> >> match BatEnum.peek enum with >> | None -> {re; im =3D multiplier} >> | Some (Kwd ".") >> | Some (Kwd "*") -> >> BatEnum.junk enum; >> parse_im ~multiplier re >> | Some _token -> >> parse_im ~multiplier re >=20 > Here's how you can do it: > - Go to the first line that Tuareg indents wrong (i.e. `| Some (Kwd "*") = ->`) > - Change its indentation to match your expectation > - run `M-x smie-config-set-indent RET` > - this should suggest to set (:before "|-or") to 0, which you can accept. > - go to the next line (that Tuareg indents wrong) > - Change its indentation to match your expectation > - run `M-x smie-config-set-indent RET` > - this time it asks you which rule you want to change (because 2 rules > are used to determine this indentation): either (after "->") or > (before "->") depending on whether you want to also change >=20 > | Some (Kwd "*") > -> BatEnum.junk enum; >=20 > or not. >=20 > - once that is done, you should be able to do `M-x smie-config-save > RET`. To save the result into your Customize settings. So far so good. After following the above instructions, I was able to tweak the Emacs behav= ior in the desired way. Thank you! What puzzled me was that once I restart Eamcs, I get the old behavior. I am guessing that this is because I need to "save" the configuration someh= ow, which I failed to figure out. So, first, one must "save SMIE configuration" to "customize setting". And then one must "save customize settings" to ~/.emacs QUESTION: Is that right? MY ASSUMPTION WAS: Yes. I have tried two things (and I failed in both cases); the 1-st attempt: ----------------- After doing "M-x smie-config-save", I have tried to use "M-x customize-sa= ve-variable smie-config". Emacs responded: Wrote /home/mkosik/.emacs This sounded like a progress. After I looked at ~/.emacs, I can see this: (load "/home/mkosik/.opam/4.06.0/share/emacs/site-lisp/tuareg-site-file= ") (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(inhibit-startup-screen t) '(smie-config nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) This does not seem currect, does it? (At least I would expect "smie-config" variable to be set to something in= teresting, not "nil".) To confirm, I restarted Emacs and I can confirm, that the Emacs behaves a= gain in the original undesired way (defined in my first email) FAIL the 2-nd attempt After repreating your helpful instructions and doing "M-x smie-config-sav= e", I tried to use "M-x customize-save-customized" Emacs responded: Wrote /home/mkosik/.emacs That file changed in the following way: (load "/home/mkosik/.opam/4.06.0/share/emacs/site-lisp/tuareg-site-file= ") (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(inhibit-startup-screen t) '(smie-config (quote ((tuareg-mode (2 :after "->" 1) (0 :before "|-or" nil)))))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) This is more like it (I thought). I optimistically restarted Emacs and again, unfortunatelly, Emacs behaves= again in the original undesired way (defined in my first email). I find this strange because "M: (print smie-config)" gives me: (tuareg-mode (2 :after "->" 1) (0 :before "|-or" nil))) (tuareg-mode (2 :after "->" 1) (0 :before "|-or" nil))) FAIL Is this a bug? Is this the expected behavior and I merely do not understadn SMIE and shoul= d read some more documentation? If yes, then which one? I haven't noticed many questions about Ocaml indentation in Emacs, so I am = guessing that this works for everyone perfectly. Is that the case? --k8vq4dWG0raqnuTCAtS3ip1BX8PHxsJEV-- --msdCfssAKuX22InARIl0teeWdVXVVDJ35 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEHNQdClIxncerwbefUK/6EozkhkkFAloWmqcACgkQUK/6Eozk hkmSLA/9GSnDGJg5iX6bMPdryiqhu2KNwM62AxRjmEUUzkVWsaJ9pEhP9+yEoRGk ZE2SpKFr1hVD9tOII/s1MapYw21cD1Nm4mi4U43Ta31MgjihfDLmQDzI4XrOq2BM u2VobmtRfHPidD/y3YDMbaB/KC5JdX27E3yPe9rO5mhcyNmcwbE2nXh0nBY3dwp2 Phqlk2ehp/b4mOFiMM4aPRRF8hDPiG0L6tyneJn2QLPlZx2A9tEBqReCqtZxzGf5 6q/iiWOa41xAkyJ5PPRxIwlw0tnL1VnsVkVK1RBPtseI3i4CW7UURO5LPGqdK52F owWW5JMouOmCmD+hBWWFcVSVswrprI1fuBTaecGH3xC2+ODP5KRTlpTUpKtJUf5w nBbCygizVoTtLSTSmo3qyGaJ6CxqhwAj5PXApn93sw+JwzW/e+cVU06wBo68U4Ni iDmq4+4PJNPfVVofdAcSxeBX2yYBOFXM9Eb3vhoQlm0O22jpl60wYZEfO3XEAmkZ ohaehFGRIXuUurijkJouzO77vcWVj7X5lBXCIMxKuEm4Nw07Y9BBULzjTQay8O+6 eainjNqgrEJZ6FFMWIY7Dhkm+gDoViu/oUmQPvgJY7V8H3808yMXm/EL9mlvVS8I nI1V+6h6p/vxYQsJmQ5L/g51Udw0F1qHYEo6VceItCp6rLR2+Tg= =oaaS -----END PGP SIGNATURE----- --msdCfssAKuX22InARIl0teeWdVXVVDJ35--