unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Matej Košík" <mail@matej-kosik.net>
To: 29414@debbugs.gnu.org
Cc: monnier@IRO.UMontreal.CA
Subject: bug#29414: 24.5; failure to configure a particular Ocaml indentation parameter (via SMIE)
Date: Thu, 23 Nov 2017 16:59:20 +0100	[thread overview]
Message-ID: <d8ed5a65-e4ce-2e50-6f08-144ca6665501@matej-kosik.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 7458 bytes --]

Hi,

I would like to configure Emacs, while editing Ocaml code, so that it
indents the code consistently with the way how "Ocaml Batteries Included" is indented.
(or any kind of sane convention --- I don't care particularly which one
 as long as I can override the default behavior which I find distracting)

However, my attempts to do this failed.

This is what I have tried to do:

------------------------------------------------------------------------------

- I have "tuareg 2.1.0" installed

- My "~/.emacs" file contains only the following line:

    (load "/home/mkosik/.opam/4.06.0/share/emacs/site-lisp/tuareg-site-file")

  It is the line that was printed as a suggestion at the end of the Tuareg installation (via OPAM).

- NOTE: The designated file

    /home/mkosik/.opam/4.06.0/share/emacs/site-lisp/tuareg-site-file

  does not exist. Is that to be expected?

- I go to this line:

    https://github.com/ocaml-batteries-team/batteries-included/blob/e069e28678a0d15d338721e1ff5e480fe0ad26c5/src/batComplex.ml#L82-L83

- change the indentation to a non-default value (e.g. moving that line 4 more spaces to the right)
  (NOTE: at this point, I have just randomly chosen any non-default value)

- I run the following command:

    M-x smie-config-set-indent

  I see the following question

    Adjust rule (:before "|-or" -> nil) to (default 4)

  I press ENTER.

  Then I see a message:

    Added rule :before "|-or" -> 4 (via nil)

- I run the following command:

    smie-config-save

  I see a message:

    Local rules saved in `smie-config`

- I run the following command:

    M-: (print smie-config)

  I see

    ((tuareg-mode (4 :before "|-or" nil)))
    ((tuareg-mode (4 :before "|-or" nil)))

  I have no idea whether this an expected or unexpected value. :-/

- I run the following command:

    M-x customize-save-customized

  I see a message:

    Wrote /home/mkosik/.emacs

- Now my ~/.emacs file looks like 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 (quote ((tuareg-mode (4 :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.
     )

  NOTE: I have no idea whether this is an expected value or not.
        I do not understand the meaning of "smie-config" variable.

I am now going to test whether my setting had any effect, so:

- I close my Emacs window.

- I launch Emacs again with the same file and I place the cursor to the same line as before:

    https://github.com/ocaml-batteries-team/batteries-included/blob/e069e28678a0d15d338721e1ff5e480fe0ad26c5/src/batComplex.ml#L82-L83

- I press TAB.

  What I see is that the whole line is shifted to the right by 2 columns.

I don't understand why by 2 columns to the right?

Why wasn't the line indented by 4 columns to the right
(this is what I defined above as desired indentation).

Incidentally, whatever value I set as a desired indentation,
after I restart Emacs and press TAB on a given line,
the line always moves by 2 places to the right. Why?

------------------------------------------------------------------------------

In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-12 on hullmann, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11902000
System Description:	Debian GNU/Linux 9.2 (stretch)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --without-gnutls --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --without-gnutls --with-x=yes --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs24-24.5+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall -fno-PIE' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-z,relro -no-pie''

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Tuareg

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...
Loading cjk-enc...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done
Loading /etc/emacs/site-start.d/50noweb.el (source)...done
Loading /home/mkosik/.opam/4.06.0/share/emacs/site-lisp/tuareg-site-file...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Auto-saving...done
Quit
Saving file /home/mkosik/git/other/batteries-included/src/batComplex.ml...
Wrote /home/mkosik/git/other/batteries-included/src/batComplex.ml

Load-path shadows:
/usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils vc-git tuareg speedbar sb-image ezimage
dframe compile comint ansi-color ring smie easymenu package epg-config
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2017-11-23 15:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 15:59 Matej Košík [this message]
2017-11-23 19:26 ` bug#29414: 24.5; failure to configure a particular Ocaml indentation parameter (via SMIE) Stefan Monnier
2017-11-23 21:52   ` Matej Košík

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8ed5a65-e4ce-2e50-6f08-144ca6665501@matej-kosik.net \
    --to=mail@matej-kosik.net \
    --cc=29414@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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.
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).