Tooks me a while to realize what GEANY_DEFAULT_FILETYPE_REGEX and `-*-\s*([^\s]+)\s*-*-` are, even though I was told ahead of time what it is. Adding an example might help. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/2947
-- Commit Summary --
* <a href="https://github.com/geany/geany/pull/2947/commits/f4509e8630e055e6c545696ce1f94a25295306bf">Add example to illustrate use of emacs filetype regex</a>
-- File Changes --
M doc/geany.txt (5)
-- Patch Links --
https://github.com/geany/geany/pull/2947.patch https://github.com/geany/geany/pull/2947.diff
Good idea! Maybe adding also a more exotic example like `% -*- Matlab/Octave -*-` to show that also rather complex names work.
@eht16 I'll add your example. Are there any rules for choosing filetype strings? Would `emacs` recognize `Matlab/Octave`?
@eht16 I'll add your example. Are there any rules for choosing filetype strings? Would `emacs` recognize `Matlab/Octave`?
The rule is that the name in https://github.com/geany/geany/blob/master/data/filetype_extensions.conf must match. Since we are talking about that detail, would you mind adding this as well?
I don't know if `emacs` would recognize `Matlab/Octave` but since we are about documenting Geany's behaviour here, I don't mind :D.
Since we are talking about that detail, would you mind adding this as well?
Yes, I will add it also.
I don't know if emacs would recognize Matlab/Octave but since we are about documenting Geany's behaviour here, I don't mind :D.
I've only used `emacs` a couple times to try. I was just curious how compatible it is with `emacs`.
I just tried putting two formats on a line: ``` // -*- Fortran -*- C++ -*- ``` Geany recognizes the first one (non-greedy matching?). So it *might* be possible to have a different string for other editors to recognize if needed. (I know the regex can also be edited.)
@xiota pushed 2 commits.
4049921ce5cff68eb74b71d55a47de748d21ba2b Add example to illustrate use of emacs filetype regex 82d0b44294b3a97aa5ddc71b87d7e15e2712d0be Explain source of filetypes for matching
@eht16
Force push to rebase.
Couldn't fit in the exact example you mentioned, but using another that should get the point across.
Great.
@elextr would you mind re-reading the description?
@eht16 @elextr Does anything else need to be done for this?
Not sure a complex description and examples are all that useful when describing the _default_ value.
I would have thought it would be better to improve the description of the preference [in this section](https://www.geany.org/manual/current/index.html#various-preferences) (sorry there doesn't seem to be a link any closer) which is the description of the setting the user edits.
So I would add a section below the table the same as is done for Statusbar Templates, maybe `Filetype Regex`. Most of your description and examples using the default value and the importance of whatever is extracted matching the extensions file would go there with minimal changes. Then the table entry can say "See below" like Statusbar Templates does and would no longer need a link to the compile time default.
@xiota pushed 1 commit.
5ba1941e40469dbf9f0b9c26e268411b13e10a45 Move description and examples to "Various preferences" section
@xiota pushed 1 commit.
7684c8e39d2f3c872523ba7c65380e3b18a37252 Move to subsection, Filetype Regex
@elextr I've made the changes you suggested, as I understood them. Please let me know if you have any further suggestions.
@eht16 @elextr Is there anything else to do for this?
@eht16 commented on this pull request.
@@ -2674,6 +2674,29 @@ Placeholder Description
useful if you're debugging color schemes or related code. ============ ===========================================================
+ +Filetype Regex +`````````````` + +The ``extract_filetype_regex`` setting contains the regex that is used +to extract the filetype name from the file with the first capture group. +The default value finds filetypes contained in Emacs-style tags. +See `def_ft_regex`_.
Maybe we can add a title for the link here? Currently it looks like: ![Screenshot_2021-11-28_12-48-13](https://user-images.githubusercontent.com/617017/143766418-2899e666-7f76-472...)
Except the minor remark for the link text, I think this is fine. Thanks!
@xiota apart from @eht16's comment the other thing needed is patience.
Its really great that you are engaged and want to contribute, and the last thing I want is to dampen that, but please please remember the people who have to review, test and merge your PRs are doing it in their spare time, they are not paid and certainly are not full time. Many only have time on weekends, which is why I have been delaying merges a week so at least one weekend goes by, which gives then a chance post if they notice a problem.
Every post you make requires those same people who process PRs to read and think about the post and maybe reply, all of which reduces the time they have to consider PRs, both yours and other. Instead of spamming your PRs and issues and directly pinging people it would be great if you helped with other PRs, as well as of course doing a _few_ of your own PRs.
In progress at the moment is ctags parser upgrades which need testing, at least for languages you have even the slightest idea about (even with my limited knowledge of Perl I found a bug in the perl parser which is reported upstream), or previously the scintilla upgrades. That way your PRs will be processed in turn without stealing effort from other work, especially such basic efforts as Scintilla and ctags that are fundamental to Geany capabilities.
@xiota pushed 1 commit.
ebadb7702d03bafa6a8bae0c25e193bece130392 Link to named section keyfile.c, put default value directly in table
@xiota commented on this pull request.
@@ -2674,6 +2674,29 @@ Placeholder Description
useful if you're debugging color schemes or related code. ============ ===========================================================
+ +Filetype Regex +`````````````` + +The ``extract_filetype_regex`` setting contains the regex that is used +to extract the filetype name from the file with the first capture group. +The default value finds filetypes contained in Emacs-style tags. +See `def_ft_regex`_.
Changed to refer to the keyfile.c section. Also put the default regex and link back to Filetype Regex directly in the table.
github-comments@lists.geany.org