Currently Geany, unlike other editors, is using double colons (::) as comment_single. What is the reason? REM (with trailing space) is much more appropriate. A citation: " REM is the standards-compliant, documented statement to insert comments in batch files; double colons are a non-documented and non-compliant way to insert comments". I will give two examples when using "::" is problematic. First example: IF 1 equ 1 ( :: Comment line 1 ECHO Do something REM Comment line 2 :: Comment line 2 ) Here double colons give an error: ") was unexpected at this time." Second example: "C:\Program Files (x86)\WinSCP\WinSCP.com" ^ :: /log="%log_file%" ^ /command ^ "open %serverURL% -hostkey=* -privatekey=%keys%%ppk% -rawsettings TryAgent=0 AuthKI=0" ^ "put ""%file_send%""" ^ "exit" Because line continuation "^" is applicable to empty label (::), double colons here are commenting out all lines starting from the second to the very end, instead of commenting out only a single line. I believe comment_single should be "comment_single=REM "
The rationale for "::" can be found in the PR where the Batch filetype was added: https://github.com/geany/geany/pull/160/files/79fa6c32cf6c2534424d1729283e4a...
The author stated that `REM` would actually execute the command after but just suppresing its output. This contradicts what you cited above.
I don't know what is correct; https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp...) pretty much says the same as your citation.
So we can probably change the default to `REM\s`.
I am seriously doubting that "REM actually executes the command next to it, just disabling it's output." Does it mean that "rem del file" will silently delete the file? :) :: (an empty label) is just an unofficial workaround. It was a long story regarding performance issues with REM. But it happened in old Windowses ,probably in 9X. Then "::" workaround came up. :: is also faster to type. I am using it, too, when, poor me, I am coding windows batches. But, editors should use REM\s
I'm fine with changing the default to `REM `, see the PR #1932.
Closed #1912 via #1932.
github-comments@lists.geany.org