Thomas Adam
unread,Aug 13, 2022, 12:19:54 PM8/13/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tmux-...@googlegroups.com, Thomas Adam
Currently, the #{config_files} format can only show files started by the
tmux server. Calls to source-file won't update this list.
This patch fixes this by updating the list via source-file.
---
cmd-source-file.c | 8 ++++++++
tmux.c | 3 ---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/cmd-source-file.c b/cmd-source-file.c
index 255d443e5..2676becc6 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -196,6 +196,14 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
if (cdata->nfiles != 0) {
file_read(c, cdata->files[0], cmd_source_file_done, cdata);
+
+ /* Keep a list of the names of the config files which have
+ * been read. This is used for the #{config_files} format.
+ */
+ cfg_files = xreallocarray(cfg_files, cfg_nfiles + 1,
+ sizeof *cfg_files);
+ cfg_files[cfg_nfiles++] = xstrdup(cdata->files[0]);
+
retval = CMD_RETURN_WAIT;
} else
cmd_source_file_complete(c, cdata);
diff --git a/tmux.c b/tmux.c
index b9f2be30b..81b30b224 100644
--- a/tmux.c
+++ b/tmux.c
@@ -385,9 +385,6 @@ main(int argc, char **argv)
free(cfg_files[i]);
cfg_nfiles = 0;
}
- cfg_files = xreallocarray(cfg_files, cfg_nfiles + 1,
- sizeof *cfg_files);
- cfg_files[cfg_nfiles++] = xstrdup(optarg);
cfg_quiet = 0;
break;
case 'V':
--
2.37.1