GNU bug report logs - #29414
24.5; failure to configure a particular Ocaml indentation parameter (via SMIE)

Previous Next

Package: emacs;

Reported by: Matej Košík <mail <at> matej-kosik.net>

Date: Thu, 23 Nov 2017 17:15:01 UTC

Severity: minor

Tags: fixed, patch

Merged with 24848

Found in version 24.5

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 29414 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Matej Košík <mail <at> matej-kosik.net>
Cc: 29414 <at> debbugs.gnu.org, monnier <at> IRO.UMontreal.CA
Subject: Re: bug#29414: 24.5;
 failure to configure a particular Ocaml indentation parameter (via
 SMIE)
Date: Thu, 23 Nov 2017 14:26:57 -0500
forcemerge 24848 29414
thanks

> - 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. :-/

Yes, it's expected because M-: already prints the result of the
evaluation, and `print` returns its argument.  IOW better just use
M-: smie-config RET

> - Now my ~/.emacs file looks like this:
[...]
>      '(smie-config (quote ((tuareg-mode (4 :before "|-or" nil))))))

Looks good.

> - I press TAB.
>   What I see is that the whole line is shifted to the right by 2 columns.

Which is what happens by default, so it shows that the setting didn't
take effect.  I tracked this down and this happens to be a known bug
which was recently fixed in smie.el.  More specifically, it
should be fixed in the current Emacs-26 pretest.

I reproduced the corresponding patch below,


        Stefan


commit a58d0c590a777be98e58cd8c92ee1381e07e9b2d
Author: Noam Postavsky <npostavs <at> gmail.com>
Date:   Wed Aug 30 19:31:48 2017 -0400

    Fix loading of smie-config rules (Bug#24848)
    
    * lisp/emacs-lisp/smie.el (smie-config--setter): Use `set-default'
    instead of `setq-default'.
    (smie-config): Use `custom-initialize-set' instead of
    `custom-initialize-default' as the :initialize argument.
    
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 87c4782e21..da1e12b140 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1956,7 +1956,7 @@ smie-config--mode-hook
 (defvar smie-config--modefuns nil)
 
 (defun smie-config--setter (var value)
-  (setq-default var value)
+  (set-default var value)
   (let ((old-modefuns smie-config--modefuns))
     (setq smie-config--modefuns nil)
     (pcase-dolist (`(,mode . ,rules) value)
@@ -1982,7 +1982,7 @@ smie-config
   ;; FIXME improve value-type.
   :type '(choice (const nil)
                  (alist :key-type symbol))
-  :initialize 'custom-initialize-default
+  :initialize 'custom-initialize-set
   :set #'smie-config--setter)
 
 (defun smie-config-local (rules)




This bug report was last modified 7 years and 177 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.