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

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tmux-users+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/20220813161939.134819-1-thomas%40xteddy.org.

Reply via email to