unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: <richard.wiseman@bt.com>
To: <npostavs@users.sourceforge.net>, <24848@debbugs.gnu.org>
Subject: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?
Date: Mon, 11 Sep 2017 09:53:50 +0000	[thread overview]
Message-ID: <1505123630318.10795@bt.com> (raw)
In-Reply-To: <1505115881331.63387@bt.com>

I've added the code to an unzipped version of smie.el and to sh-script.el and byte-compiled both.  Emacs loads without errors now, but to be honest, I'm unsure how to check that it now loads smie-config properly!  I load a script file and check the value of smie-config and it says it's set for the current session only but its value is nil.

________________________________________
From: Wiseman,R,Richard,TUK2 R
Sent: 11 September 2017 08:44
To: npostavs@users.sourceforge.net; 24848@debbugs.gnu.org
Subject: Re: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?

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

<richard.wiseman@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)





  reply	other threads:[~2017-09-11  9:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 15:07 bug#24848: 24.5; "Local rules set" richard.wiseman
2017-08-24 11:39 ` bug#24848: Any progress? richard.wiseman
2017-08-24 12:41   ` bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent? npostavs
2017-08-24 13:44     ` richard.wiseman
2017-08-25  1:12       ` npostavs
2017-08-25  8:11         ` richard.wiseman
2017-08-25  8:37           ` richard.wiseman
2017-08-25 12:07           ` npostavs
2017-08-25 13:44             ` richard.wiseman
2017-08-25 14:31               ` richard.wiseman
2017-08-26 20:08                 ` Noam Postavsky
2017-08-29  7:43                   ` richard.wiseman
2017-08-30 23:49               ` npostavs
2017-09-04  8:30                 ` richard.wiseman
2017-09-08 23:15                   ` npostavs
2017-09-11  7:44                     ` richard.wiseman
2017-09-11  9:53                       ` richard.wiseman [this message]
2017-09-11 18:48                         ` npostavs
2017-09-12  7:09                           ` richard.wiseman
2017-09-22 22:46                         ` Noam Postavsky
2017-09-25 11:10                           ` richard.wiseman
2017-09-25 12:19                             ` Noam Postavsky
2017-09-25 13:06                               ` richard.wiseman
2017-09-25 23:41                                 ` Noam Postavsky

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=1505123630318.10795@bt.com \
    --to=richard.wiseman@bt.com \
    --cc=24848@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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).