commit dab70d06ed00c13f09e66f57385873e5fede3dd2
parent 8993c363666390d9a4ce677a57b358217753d1b8
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 21 Aug 2016 14:19:44 +0200
linting: when no is said to a file, remove all corresponding entries
When the user chooses not to open a file that some message refers to,
remove all messages for that file from the linting results, so the user
does not get asked about that same file again.
This fixes https://savannah.gnu.org/bugs/?47130.
Diffstat:
M | src/text.c | | | 34 | +++++++++++++++++++++++++++++----- |
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -3267,15 +3267,39 @@ void do_linter(void)
SET(MULTIBUFFER);
open_buffer(curlint->filename, FALSE);
} else {
- char *dontwantfile = curlint->filename;
+ char *dontwantfile = mallocstrcpy(NULL, curlint->filename);
+ lintstruct *restlint = NULL;
+
+ while (curlint != NULL) {
+ if (strcmp(curlint->filename, dontwantfile) == 0) {
+ if (curlint == lints)
+ lints = curlint->next;
+ else
+ curlint->prev->next = curlint->next;
+ if (curlint->next != NULL)
+ curlint->next->prev = curlint->prev;
+ tmplint = curlint;
+ curlint = curlint->next;
+ free(tmplint->msg);
+ free(tmplint->filename);
+ free(tmplint);
+ } else {
+ if (restlint == NULL)
+ restlint = curlint;
+ curlint = curlint->next;
+ }
+ }
- while (curlint != NULL && !strcmp(curlint->filename, dontwantfile))
- curlint = curlint->next;
- if (curlint == NULL) {
+ if (restlint == NULL) {
statusbar(_("No more errors in unopened files, cancelling"));
+ napms(2400);
break;
- } else
+ } else {
+ curlint = restlint;
goto new_lint_loop;
+ }
+
+ free(dontwantfile);
}
} else
openfile = tmpof;