unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29414: 24.5; failure to configure a particular Ocaml indentation parameter (via SMIE)
@ 2017-11-23 15:59 Matej Košík
  2017-11-23 19:26 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Matej Košík @ 2017-11-23 15:59 UTC (permalink / raw)
  To: 29414; +Cc: monnier


[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-23 21:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-23 15:59 bug#29414: 24.5; failure to configure a particular Ocaml indentation parameter (via SMIE) Matej Košík
2017-11-23 19:26 ` Stefan Monnier
2017-11-23 21:52   ` Matej Košík

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).