- Subject: [jed-users] Re: #!/usr/bin/python3 does not trigger python mode
- From: Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 7 Dec 2022 08:46:14 +0100
On Tue 2022-12-06 (18:57), Guenter Milde wrote:
> Am 5.12.22 schrieb Ulli Horlacher:
>
> > I have file starting with
> > #!/usr/bin/python3
> > but this does not trigger jed python mode, it is still text mode.
> > Where/what is the hook for it?
>
> In a config/setup file (e.g. .jedrc):
>
> Void add_mode_for_extension (String mode, String ext);
>
> or extend the "_jed_set_mode_hooks", e.g.
>
> % set modes based on filename or more complicated patterns
> static define set_modes_hook(ext)
> {
> switch (path_basename(buffer_filename()))
> { case ".pycmailrc": python_mode(); return 1; }
> { case "Makefile": make_mode(); return 1; }
> { case ".bashrc": sh_mode(); return 1; }
> return(0);
> }
> append_to_hook("_jed_set_mode_hooks", &set_modes_hook);
This helps only for specific file names.
I want to switch to python mode based on the first line (shebang).
I could write it by myself, is there a read_file_hook function?
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart E-Mail: horlacher@xxxxxxxxxxxxxxxxxxxx
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
REF:<Y4+CgHWCvBOJnMke@heinz.mythennetz>
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
[2022 date index]
[2022 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]