diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2020-12-09 00:09:32 +0200 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2020-12-09 00:16:18 +0200 |
commit | bb625ea36d56191fe421b6a2790ec4bedad3b06f (patch) | |
tree | fa8396649c5f57a8daac8bcc6a444ccb704890f5 | |
parent | 5844ad6c38b05ec26aea33cfa7cb8b175f539cb1 (diff) | |
download | emacs-feature/etags_update_v2.tar.gz |
Only update when file is newer than TAGS and .etagsfeature/etags_update_v2
(Hopefully?)
-rw-r--r-- | lib-src/etags.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 84598faa1da..e233d942578 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -1473,6 +1473,8 @@ validate_arguments (const struct parsed_options *options) } } +static struct timespec tags_file_time; + int main (int argc, char **argv) { @@ -1533,6 +1535,12 @@ main (int argc, char **argv) linebuffer_init (&filebuf); linebuffer_init (&token_name); + struct stat st; + + /* If no TAGS file, nothing to do here. */ + if (stat (tagfile, &st) == 0) + tags_file_time = get_stat_mtime (&st); + if (find_mode) read_dot_etags (); @@ -7971,7 +7979,6 @@ static void maybe_set_update_mode (void) { struct stat st; - struct timespec mtime; update = false; @@ -7980,8 +7987,7 @@ maybe_set_update_mode (void) return; /* If the TAGS file is newer than the .etags file, just update. */ - mtime = get_stat_mtime (&st); - if (time_newer (&mtime, &dot_etags_time)) + if (time_newer (&tags_file_time, &dot_etags_time)) update = true; } @@ -8118,7 +8124,8 @@ walk_directory (const char *dirname) { struct timespec t = get_stat_mtime (&st); - if (update && time_newer (&dot_etags_time, &t)) + if (update && time_newer (&tags_file_time, &t) + && time_newer (&dot_etags_time, &t)) { /* Nothing - .etags is newer. */ } |