[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make command available accordnig to major mode
From: |
Michael Albinus |
Subject: |
Re: Make command available accordnig to major mode |
Date: |
Wed, 03 Apr 2024 14:14:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Heime <heimeborgia@protonmail.com> writes:
Hi,
>> > File gali.el
>> >
>> > (defun gali-bash (actm)
>> > (interactive)
>> > (insert bovu-bash-func))
>>
>> (defun gali-bash (actm)
>> (interactive nil 'sh-mode)
>> (insert bovu-bash-func))
>
> Thank you for the answer.
>
> Because I have a number of files for each specific mode.
>
> bovu-elisp
> bovu-bash
> bovu-c
> bovu-cpp
> bovu-python
> bovu-latex
>
> Am trying to load the specific file only when needed, using hooks perhaps.
> Or are there more convenient ways ?
If you want to load the file always when you enter a given mode, you can
use the mode specific hooks. Like this (untested):
(defun gali-bash ()
(require 'avus-bash))
(add-hook 'sh-mode-hook 'gali-bash)
Best regards, Michael.