[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: with-eval-after-load with sh-mode
From: |
Arthur Miller |
Subject: |
Re: with-eval-after-load with sh-mode |
Date: |
Fri, 02 Jul 2021 10:56:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
lisa-asket@perso.be writes:
>>From: Arthur Miller <arthur.miller@live.com>
>>To: lisa-asket@perso.be
>>Subject: Re: with-eval-after-load with sh-mode
>>Date: 02/07/2021 10:42:38 Europe/Paris
>>Cc: help-gnu-emacs@gnu.org
>
>>lisa-asket@perso.be writes:
>
>>> How can I use `with-eval-after-load` with sh-mode?
>>>
>>> Basically I want to defer call to sh-mode-map until sh-mode is loaded
>>>
>>> (with-eval-after-load 'sh
>
>>Try this:
>
>>(with-eval-after-load 'sh-script
>>(message "My cool one-time config follows here ..."))
>
>>sh-mode is defined in lisp/progmodes/sh-script.el.
>
> What is the difference between
>
> (with-eval-after-load 'sh-script
> (myfun))
>
> and
>
> (add-hook 'sh-mode-hook #'myfun)
Obviously sh-mode-hook gets executed every time you load sh-mode, i.e,
when you open a shell file.
eval after load will kick in when feature is loaded, i.e. when you read
in (load or require) sh-script.el, so it least in theory it should get
executed only once, unless you unload feature 'sh-script for some reason.
- Re: with-eval-after-load with sh-mode, (continued)
- with-eval-after-load with sh-mode, lisa-asket, 2021/07/02
- Re: with-eval-after-load with sh-mode, Arthur Miller, 2021/07/02
- Re: with-eval-after-load with sh-mode, Emanuel Berg, 2021/07/02
- Re: with-eval-after-load with sh-mode, Arthur Miller, 2021/07/02
- with-eval-after-load with sh-mode, lisa-asket, 2021/07/02
with-eval-after-load with sh-mode, lisa-asket, 2021/07/02
Re: with-eval-after-load with sh-mode, Arthur Miller, 2021/07/02