wakatime-mode
wakatime-mode copied to clipboard
add proactive language reporting by using major-mode
Relates to solving the: https://github.com/wakatime/wakatime-mode/issues/37
master
algorythm currently provides no info on language, so wakatime
does the default - tries to autodetect the languages.
Since:
wakatime --help
...
--language LANGUAGE Optional language name. If valid, takes priority over
auto-detected language.
This patch adds that if case:
if major-mode name is a valid name to the `--language` option
then success - language detected
else waketime uses current default mechanism - tries to autodetect language by itself
What we do is simply: matching https://www.emacswiki.org/emacs/List_Of_Major_And_Minor_Modes#toc2 to https://github.com/wakatime/wakatime/blob/master/wakatime/languages/default.json
In other words:
Emacs does: c++-mode -> c++ -> wakatime
Wakatime does: c++ -> C++
Profit.
I recommend against merging this as it exists now because it lacks user configuration.
In particular because of https://github.com/wakatime/wakatime-mode/issues/37#issuecomment-702188769
In several situations this will be worse than the current pygments detection.
This major mode name language detection a good idea in general, the implementation just needs some polish to be able to work better.
@thomasf, please, don't be ridiculous.
Please, read the PR header and its comments in the code before blocking the PR.
Multiple major modes are not supported by Emacs project.
Nobody should support your unofficial hacking system, which officially deprecated by Emacs.
It is if I would launch a decompiler, open ASM, and hack Windows and then should and complain to Microsoft and about Microsoft that they are that they do not support me and my hacks.
I've responded to you in: https://github.com/wakatime/wakatime-mode/issues/37#issuecomment-702234203
Providing info proactively is a be way better and more precise than the use of autodetection.
It is the sole reason #37 exists.
Since in majority of cases this proactive reporting works way better then heuristic autodetection You state:
In several situations this will be worse than the current pygments detection.
Since I refuted one you provided, please can you show valid cases. Where actively sending info that gets checked works worse than sending no info.
@thomasf, please, don't be ridiculous.
Please, read the PR header and its comments in the code before blocking the PR.
if say js2-mode or one of the other examples with the same problem it won't work,. so you don't want to it to be able to work for , It's not a complete solution.
There is no complete solutions.
Ever.
@thomasf, please, don't be ridiculous. Please, read the PR header and its comments in the code before blocking the PR.
if say js2-mode or one of the other examples with the same problem it won't work,. so you don't want to it to be able to work for , It's not a complete solution.
Jesus, I already responded in https://github.com/wakatime/wakatime-mode/issues/37#issuecomment-702070724, it would ignore the js2
and others and would use the autodetection.
@thomasf, please, don't be ridiculous. Please, read the PR header and its comments in the code before blocking the PR.
if say js2-mode or one of the other examples with the same problem it won't work,. so you don't want to it to be able to work for , It's not a complete solution.
Jesus, I already responded in #37 (comment), it would ignore the
js2
and others and would use the autodetection.
Why not just always rely on auto detection then if you don't intend this feature which easily can gain extra features to handle this to have it?
Do you understand the words "--language LANGUAGE Optional language name. If valid, takes priority over auto-detected language.
" What part of it you do not understand?
What is "optional" name? Or the word "priority", or "If valid, takes priority".
Do you understand the words "
--language LANGUAGE Optional language name. If valid, takes priority over auto-detected language.
" What part of it you do not understand?
As I understand it this patch is trying to solve the issue where wakatime-cli fails to detect a language, if js2-mode is used and wakatime fails to detect the JS language it will still fail.
I mean it's super easy to add support for a defcustom, I have no idea why you are resisting a more robust internal detection in wakatime-mode.
I do not understand why you actively trying to block the valid effective solution over some imaginary code.
After this code gets merged - anybody can take this same code add patches with as many defcustom
s and functions as they want.
There are such people. Simple, working pragmatic nicely-documented code they do not bother to understand, and while code provided for them for free - that does not satisfies them, and moreover - they complain a lot and expect others to conform to their unreasonable demands.
There is no complete solutions.
I don't think is not complete enough to solve #37 in a way that does not force a new behavior onto users which they might not want and has limitations that it don't work for js2-mode, might even be more wrong than wakatime-cli in multi major mode situations etc.
Once more, look into basic statement that wakatime
makes. This PR does not change the current behaviour in case of js2-mode
or multi-major modes (which, once more, - are not supported by Emacs).
You definitely still not read the wakatime documentation and processes.
Statement about js2-mode
is a false, because js2
is not a recognized value by wakatime --language
option:
https://github.com/wakatime/wakatime/blob/master/wakatime/languages/default.json
And if one would take an effort of reading two lines of the official description of --language
option is - it explains itself.
Please, read the docs/code and stop repeatedly harassing me and threads and work with same false statements which were explained to you and disproved a number of times already.
I have provided a real world example for one of the most popular modes on melpa here https://github.com/wakatime/wakatime-mode/issues/37#issuecomment-702509731
I responded to you there.
Still not applicabel example. It does not have intersection with the code and process discussed.
Statement about
js2-mode
is a false, becausejs2
is not a recognized value bywakatime --language
option
WakaTime uses --language
without validation. Currently only Vim modelines are validated in wakatime-cli, otherwise the given --language
is sent only with case changes, for ex: c++
-> C++
.