[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

with-eval-after-load with sh-mode

From: lisa-asket
Subject: with-eval-after-load with sh-mode
Date: Fri, 2 Jul 2021 09:32:50 +0200 (CEST)

>From: Emanuel Berg via Users list for the GNU Emacs text editor 
>Subject: Re: with-eval-after-load with sh-mode
>Date: 02/07/2021 08:58:36 Europe/Paris

>lisa-asket wrote:

>> Basically I want to defer call to sh-mode-map until sh-mode
>> is loaded

>First try

>(require 'sh-script)

>Then set the keys in `sh-mode-map' (which is a variable BTW) ...

>If that doesn't work keep the first line but turn the second
>line to into a function (just enclose it in a `defun'), then

>(defun sh-mode-hook-f ()
>;; call your key setting function here
>(add-hook 'sh-mode-hook #'sh-mode-hook-f)

So I don't use `with-eval-after-load`?  Just do `add-hook`?

>I don't know why some modes need the more elaborate and in
>theory less efficient hook solution (less efficient since it
>gets called every time), do they themselves reset the their
>keymaps after they have been `require'd? This has puzzled me
>for several years... I guess one could just compare the source
>for two in this sense opposing modes!

>You shouldn't be afraid of sensible use of hooks tho, they
>aren't the ones to slow down the interactive feel, having TONS
>of buffers open is the chief culprit, rather...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]