all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 36539@debbugs.gnu.org
Subject: bug#36539: elec-pair.elc gets surreptitiously loaded (almost) unconditionally at start up.
Date: Sun, 7 Jul 2019 18:29:41 +0000	[thread overview]
Message-ID: <20190707182941.GA4053@ACM> (raw)
In-Reply-To: <87wogt3hqr.fsf@gmail.com>

Hello, Noam.

On Sun, Jul 07, 2019 at 12:57:16 -0400, Noam Postavsky wrote:
> tags 36539 + patch
> quit

> Alan Mackenzie <acm@muc.de> writes:

> > A decision should be taken as to whether elec-pair.elc should be loaded
> > at start up, and if so, it should be part of the dump.  If not, the
> > `require' form in elisp-mode.el should be replaced by an
> > `eval-after-load' form.

> I think it's clear that elec-pair should not be part of the dump, since
> electric-pair-mode is not turned on by default.  Looking at the git log,
> it seems I added the require to avoid some bootstrapping problems with
> Bug#24901, but we can move the electric-pair-text-pairs manipulation to
> a hook instead:

Just as a matter of interest, I commented out the pertinent form in
emacs-lisp-mode, did a make bootstrap, emacs -Q, and elec-pair.elc was
still present in my Emacs.  :-(

I don't know why, or how, but it is.  With your patch (below), have you
tested whether or not elec-pair.elc hasn't been loaded on starting
Emacs?  If it hasn't been loaded, you've found some trick that eludes
me.

> >>From cf6057cb5bf6a44d718349776e370b225bc7079f Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Sun, 7 Jul 2019 12:22:37 -0400
> Subject: [PATCH] Don't load elec-pair in elisp-mode (Bug#36539)
> 
> * lisp/progmodes/elisp-mode.el (emacs-lisp-set-electric-text-pairs):
> New function.
> (emacs-lisp-mode): Add it to electric-pair-mode-hook.
> ---
>  lisp/progmodes/elisp-mode.el | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
> index c86277a309..7c77c34b50 100644
> --- a/lisp/progmodes/elisp-mode.el
> +++ b/lisp/progmodes/elisp-mode.el
> @@ -233,6 +233,12 @@ emacs-lisp-mode-hook
>    :type 'hook
>    :group 'lisp)
>  
> +(defun emacs-lisp-set-electric-text-pairs ()
> +  (defvar electric-pair-text-pairs)
> +  (setq-local electric-pair-text-pairs
> +              (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs))
> +  (remove-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs t))
> +
>  ;;;###autoload
>  (define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp"
>    "Major mode for editing Lisp code to run in Emacs.
> @@ -245,12 +251,8 @@ emacs-lisp-mode
>    (defvar project-vc-external-roots-function)
>    (lisp-mode-variables nil nil 'elisp)
>    (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers)
> -  (unless noninteractive
> -    (require 'elec-pair)
> -    (defvar electric-pair-text-pairs)
> -    (setq-local electric-pair-text-pairs
> -                (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs))
> -    (setq-local electric-quote-string t))
> +  (add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs t)

Shouldn't that be .....-text pairs nil t), to make a local value of the
                                   ^^^
hook?  The remove-hook (above) seems to be expecting a local value.

> +  (setq-local electric-quote-string t)
>    (setq imenu-case-fold-search nil)
>    (add-function :before-until (local 'eldoc-documentation-function)
>                  #'elisp-eldoc-documentation-function)
> -- 
> 2.11.0
> 

As a matter of interest, what is that 2.11.0 that I keep seeing at the
bottom of patches?

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2019-07-07 18:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-07 14:14 bug#36539: elec-pair.elc gets surreptitiously loaded (almost) unconditionally at start up Alan Mackenzie
2019-07-07 16:57 ` Noam Postavsky
2019-07-07 18:29   ` Alan Mackenzie [this message]
2019-07-07 18:45     ` Eli Zaretskii
2019-07-07 19:14       ` Alan Mackenzie
2019-07-07 18:47     ` Noam Postavsky
2019-07-07 19:10       ` Alan Mackenzie
2019-07-07 19:17         ` Eli Zaretskii
2019-07-13 11:54         ` Eli Zaretskii
2019-07-13 22:41           ` Noam Postavsky
2019-07-19  0:09             ` 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

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

  git send-email \
    --in-reply-to=20190707182941.GA4053@ACM \
    --to=acm@muc.de \
    --cc=36539@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.