[Github-comments] [geany/geany] Filetype is not redetected on reload, even when current filetype is None (Issue #2996)

elextr notifications at xxxxx
Sat Nov 13 04:14:54 UTC 2021


To be very clear, Geany keeping the filetype fixed after opening, or first save of a new file, is a _feature_ not a fault.  

The presumption is that the majority of files recognise their filetype correctly either because of the shebang, or the XML marker, or an extracted filetype, or the extension, or the user has deliberately set the filetype to something different.  This is why you have to close the file to forget the filetype, closing Geany or the project with the file still open will remember the current filetype when the session is reloaded.

If a file is not detected correctly I totally agree the user needs to edit the file (or change the extension), but that is likely to be rare and breaking the filetype guarantee on reload is not an acceptable tradeoff for the few times the workaround of "close&save, reload last" is needed.

Its not clear you understand that "shebang" is a well known term, not just a function in Geany.  In case you havn't encountered it outside the name of the `find_shebang()` function in Geany, see [here](https://en.wikipedia.org/wiki/Shebang_(Unix)#Syntax).

So using "shebang" for all the ways Geany detects a filetype was therefore confusing, its only one of them. A better term for the whole gamut of methods is "internal filetype detection" (even if `filetypes_detect_from_file_internal()` also checks the extension, sigh).

I think I returned the confusion by using the term "filetype regex" to mean "the filetype extracted by the regex", so (assuming the default regex) I was meaning for example the user should edit the comment in the file to say "-*-Python-*-" if their shebang is `#!pypy`, not that they should edit the regex, sorry for the confusion.

> Alt+R does nothing on my computer.

Ahh sorry thats a keybinding I set myself for the "Re-open last closed tab" action.  You can bind it yourself, then it will allow you to avoid the ... menu!!! (gasps of horror).  



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2996#issuecomment-967776648
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211112/3112c98f/attachment.htm>


More information about the Github-comments mailing list