2
I'm trying to figure out where the comment block style is defined in Geany for C files.
By this I mean when I select a block of text and hit ctrl-e, each line in the block of text
is pre-pended (at it's indentation level) by a //~
A problem comes from the extra space. On blank lines I get //~
but I also have trim-trailing white-space enabled when I save the files, so I get the following sequence.
void aprinter(uint8_t * buf) {
uint16_t length = sizeof(*buf) / sizeof(buf[0]);
printf("len: %d;\n", length);
uint16_t i;
for (i = 0; i < length; i++) {
printf("buf[%d]: 0x%02x;\n", i, buf[i]);
}
}
I want to comment out the guts of this function so I select it and hit ctrl-e
void aprinter(uint8_t * buf) {
//~ uint16_t length = sizeof(*buf) / sizeof(buf[0]);
//~
//~ printf("len: %d;\n", length);
//~
//~ uint16_t i;
//~ for (i = 0; i < length; i++) {
//~ printf("buf[%d]: 0x%02x;\n", i, buf[i]);
//~ }
}
I save the code in this state and later come back to uncomment the lines, ctrl-e again gives me this
void aprinter(uint8_t * buf) {
uint16_t length = sizeof(*buf) / sizeof(buf[0]);
//~ //~
printf("len: %d;\n", length);
//~ //~
uint16_t i;
for (i = 0; i < length; i++) {
printf("buf[%d]: 0x%02x;\n", i, buf[i]);
}
}
I'd really like to get Geany to use the same syntax as eclipse (prepend //
), since I flip back and forth between the two and have no way to uncomment blocks in one that were created by the other.
I'd be happy to just remove the trailing space however, to get rid of these bogus //~ //~
lines.
Another ugly feature of the geany code block comments is that if you have a block of commented code inside a larger block that you are now commenting out, it will uncomment the internal block.
I grep'd the configuration file paths (/usr/share/geany and ~/.config/geany) and didn't find //~
EDIT:
after all of that searching I just stumbled onto the 'comment toggle marker' option under
Edit -> Preferences -> Editor -> Features
I would still be interested in a way to have the comments added to the beginning of the line rather than at the indent level.
good information. However if you will see my EDIT, despite how often I've been pointed to the
Filetype definition files
the~
part of the comment block was not defined there but was accessible through the guiEdit -> Preferences -> Editor -> Features -> comment toggle marker
– user3817250 – 2014-12-05T16:48:47.970"I would still be interested in a way to have the comments added to the beginning of the line rather than at the indent level." - try using
comment_use_indent=false
as described in my answer. – DavidPostill – 2014-12-05T16:51:41.913Excellent. I should have taken a little more time absorbing that info. – user3817250 – 2014-12-05T16:55:52.033
1Can I have multiple block comments defined - for
/*
*/
and{*
*}
? – Michal Przybylowicz – 2015-06-05T12:24:55.8601@MichałPrzybyłowicz Not as far as I know, but then most languages would only have one kind of block comment ... – DavidPostill – 2015-06-05T17:19:29.890
I agree. But tpl files are a mix of html and smarty syntax, so basically it has two kinds of block comments. – Michal Przybylowicz – 2015-06-05T18:52:21.807
so there is no way to comment blocks of code?
/* */
– t q – 2015-11-03T22:23:02.680@tq Yes, you can, see the answer.
comment_open
andcomment_close
– DavidPostill – 2015-11-03T22:31:24.460@DavidPostill I am in
Edit -> Preferences -> Editor -> Features
and i dont seecomment_open
orcomment_close
– t q – 2015-11-03T22:45:21.4031@tq "filetype specific settings are stored in the filetype definition files." – DavidPostill – 2015-11-03T22:47:24.123
@DavidPostill I see in
filetypes.php
there iscomment_open=/* comment_close=*/
but when i comment lines in a php file I still get single line//
comments – t q – 2015-11-03T23:12:31.090@tq Single-line comments are used in priority over multiline comments to comment a line, e.g. with the Comment/Uncomment line command. – DavidPostill – 2015-11-03T23:27:19.920
Let us continue this discussion in chat.
– t q – 2015-11-03T23:29:32.157@tq I don't have anything to add. Please ask a new question. – DavidPostill – 2015-11-03T23:31:51.347