help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: with-eval-after-load with sh-mode


From: Emanuel Berg
Subject: Re: with-eval-after-load with sh-mode
Date: Fri, 02 Jul 2021 08:58:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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
do

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

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

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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