GNU bug report logs - #24848
[sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?

Previous Next

Package: emacs;

Reported by: <richard.wiseman <at> bt.com>

Date: Tue, 1 Nov 2016 15:37:01 UTC

Severity: minor

Tags: fixed, patch

Merged with 29414

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 #54 received at 24848 <at> debbugs.gnu.org (full text, mbox):

From: <richard.wiseman <at> bt.com>
To: <npostavs <at> users.sourceforge.net>, <24848 <at> debbugs.gnu.org>
Subject: Re: bug#24848: [sh-script] How to save "Local rules set" result from
 sh-learn-buffer-indent?
Date: Mon, 11 Sep 2017 07:44:41 +0000
You're quite right: my smie library is gzipped.  I had no idea that might be the case!

I tried your suggestion of putting the code into my .emacs file but it didn't seem to like that...


Warning (initialization): An error occurred while loading `/home/richard/.emacs':

Symbol's value as variable is void: smie-config--modefuns

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.


(I put it right at the end: I assumed that was safest.)

I'll try and apply the patch to an unzipped version of smie.el.gz instead, and let you know how that goes.

Regards,

Richard


________________________________________
From: Noam Postavsky <npostavs <at> gmail.com> on behalf of npostavs <at> users.sourceforge.net <npostavs <at> users.sourceforge.net>
Sent: 09 September 2017 00:15
To: Wiseman,R,Richard,TUK2 R
Cc: 24848 <at> debbugs.gnu.org
Subject: Re: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?

<richard.wiseman <at> bt.com> writes:

> Thanks Noam.  I'm not sure I've got any way to test this patch,
> though...  I don't seem to have an smie.el file anywhere.  I've
> installed the emacs24-el package expecting that to contain it but it
> doesn't -- at least, I've searched my entire hard drive for it (using
> sudo, just in case) and it wasn't found.

What does M-x find-library RET smie RET give you?

I see /usr/share/emacs/24.5/lisp/emacs-lisp/smie.el.gz listed in
https://packages.ubuntu.com/zesty/all/emacs24-el/filelist.  If you have
the gzipped version, you might have to unzip before you can apply the
patch.

Alternatively, I'm fairly sure if you just drop the patched definitions
of smie-config--setter and smie-config into your .emacs it will have the
same effect:

    (defun smie-config--setter (var value)
      (set-default var value)
      (let ((old-modefuns smie-config--modefuns))
        (setq smie-config--modefuns nil)
        (pcase-dolist (`(,mode . ,rules) value)
          (let ((modefunname (intern (format "smie-config--modefun-%s" mode))))
            (fset modefunname (lambda () (smie-config--mode-hook rules)))
            (push modefunname smie-config--modefuns)
            (add-hook (intern (format "%s-hook" mode)) modefunname)))
        ;; Neuter any left-over previously installed hook.
        (dolist (modefun old-modefuns)
          (unless (memq modefun smie-config--modefuns)
            (fset modefun #'ignore)))))

    (defcustom smie-config nil
      ;; FIXME: there should be a file-local equivalent.
      "User configuration of SMIE indentation.
    This is a list of elements (MODE . RULES), where RULES is a list
    of elements describing when and how to change the indentation rules.
    Each RULE element should be of the form (NEW KIND TOKEN NORMAL),
    where KIND and TOKEN are the elements passed to `smie-rules-function',
    NORMAL is the value returned by `smie-rules-function' and NEW is the
    value with which to replace it."
      :version "24.4"
      ;; FIXME improve value-type.
      :type '(choice (const nil)
                     (alist :key-type symbol))
      :initialize 'custom-initialize-set
      :set #'smie-config--setter)




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.