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

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

Re: Make command available accordnig to major mode


From: Heime
Subject: Re: Make command available accordnig to major mode
Date: Wed, 03 Apr 2024 12:00:37 +0000


On Wednesday, April 3rd, 2024 at 11:23 PM, Michael Albinus 
<michael.albinus@gmx.de> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> 
> Hi,
> 
> > I have a file gali.el and want to be able to call the command
> > gali-bash only when I am in sh-mode. What can I do.
> > 
> > ;; ----------------------------------------------------
> > 
> > File bovu/bovu-bash.el
> > 
> > (defconst bovu-bash-func
> > "FCNAME ()
> > {
> > ACTN
> > }")
> > 
> > (provide 'bovu-bash)
> > 
> > ;; -------------------------------------------------------
> > 
> > File gali.el
> > 
> > (defun gali-bash (actm)
> > (interactive)
> > (insert bovu-bash-func))
> 
> 
> (defun gali-bash (actm)
> (interactive nil 'sh-mode)
> (insert bovu-bash-func))
> 
> Best regards, Michael.

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 ?




reply via email to

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