- Subject: Re: [jed-users] Re: #!/usr/bin/python3 does not trigger python mode
- From: Guenter Milde <milde@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Dec 2022 10:46:48 +0100
Am 7.12.22 schrieb Morten Bo Johansen:
> Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx> wrote:
> > I have also files beginning with
> >
> > #!/usr/bin/python3.6
> Can't you just change it to #!/usr/bin/python and then reload?
> On my system:
> ~/ % ls -l /usr/bin/python
> lrwxrwxrwx 1 root root 7 1 nov 15:18 /usr/bin/python -> python3
> ~/ % ls -l /usr/bin/python3
> lrwxrwxrwx 1 root root 10 1 nov 15:18 /usr/bin/python3 -> python3.10
Here, for backwards compatibility, it is
/usr/bin/python -> python2
> If that's not palatable, then maybe something like this?
> define no_mode_hook ()
> {
> if (re_fsearch("#!.*python[0-9]"))
> python_mode();
> }
IMV, the _jed_set_mode_hooks chain is the right place
(cf. Help>Browse Docs>hooks).
static define set_python_mode_from_shebang(ext)
{
if (re_fsearch("^#!.*python[0-9.]*$")) {
python_mode();
return 1;
}
return 0;
}
append_to_hook("_jed_set_mode_hooks", &set_python_mode_from_shebang);
Günter
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
[2022 date index]
[2022 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]