@b4n commented on this pull request.


>  
-       if (g_utf8_strchr(needles, -1, 'f') != NULL && strstr(haystack->str, 
"%f")) {
-               g_string_append(errormsg, " %%f");
+       /* %p is the project base path, if any */
+       if (placeholder == 'p' && app->project)
+               r = project_get_base_path();
+       else if (! doc || ! doc->file_name)
+       {
+               ui_set_statusbar(FALSE, _("failed to substitute %%%c: document 
has no path"), placeholder);
+               /* TODO: Shouldn't we rather return an empty string for known 
placeholders?

For printing it might not be hard.  For build commands it might, as we save 
before executing them.

Either way, the question of whether to substitute unknown placeholders or not 
is valid in both cases:
* when it would usually be a supported one, it's potentially a consistency 
question (what should happen when that valid placeholder is used in an invalid 
situation)
* when it would be an *unsupported* placeholder in all cases (e.g. currently 
`%z` for example), it has pros and cons: replacing with nothing helps noticing 
cases where one meant a literal `%` (which can be a problem with forward 
compatibility if we choose to add more placeholders in the future), but keeping 
the placeholder as-is can help with debugging a misspelled placeholder (and not 
leaving an invalid placeholder getting unnoticed as it doesn't expand at all…).

However, I don't think the previous statusbar behavior of removing the `%` but 
keeping the format character makes much sense.

Here I don't really have an opinion, as if we hit this it's just not gonna be 
very useful anyway. But if we *do*, empty is probably more "correct* I guess.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4318#discussion_r2134116356
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/4318/review/[email protected]>

Reply via email to