jed-users mailing list

[2022 Date Index] [2022 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [jed-users] Re: #!/usr/bin/python3 does not trigger python mode


It's been a very long time since I've last used Jed, so this might not
work, but you could try it anyway.

Put this function in your defaults.sl:

define python3_mode ()
{
   python_mode();
}

Marko

On Wed, Dec 7, 2022 at 8:46 AM Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx>
wrote:

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