From bff4d42b27889dc33f302b9a81b5d3038855b6f9 Mon Sep 17 00:00:00 2001 From: Tod Morrison Date: Fri, 22 May 2026 15:14:44 -0600 Subject: [PATCH 1/2] Search for latexmk in more places --- nvimcom/R/interlace.R | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/nvimcom/R/interlace.R b/nvimcom/R/interlace.R index 6029afda..fe2e070a 100644 --- a/nvimcom/R/interlace.R +++ b/nvimcom/R/interlace.R @@ -323,15 +323,20 @@ nvim.interlace.rnoweb <- function( } if (!file.exists(logf)) { - if (latexcmd == "latexmk" && file.exists("~/.latexmkrc")) { - lmk <- readLines("~/.latexmkrc") - idx <- grep("\\$out_dir\\s*=", lmk) - if (length(idx) == 1) { - logf <- paste0( - sub(".*\\$out_dir\\s*=\\s*['\"](.*)['\"].*", "\\1", lmk[idx]), - "/", - sub("\\....$", ".log", rnwf) - ) + paths <- c("~/.latexmkrc", ".latexmkrc", paste0(rnwdir, "/.latexmkrc")) + found <- file.exists(paths) + if (latexcmd == "latexmk" && any(found)) { + foundlmks <- paths[found] + for (lmkfile in foundlmks) { + lmk <- readLines(lmkfile) + idx <- grep("\\$out_dir\\s*=", lmk) + if (length(idx) == 1) { + logf <- paste0( + sub(".*\\$out_dir\\s*=\\s*['\"](.*)['\"].*", "\\1", lmk[idx]), + "/", + sub("\\....$", ".log", rnwf) + ) + } } } else { idx <- grep("-output-directory=", latexargs) From fe2b1a5432ee18a627f4148c9ca345df186d3275 Mon Sep 17 00:00:00 2001 From: Tod Morrison Date: Fri, 5 Jun 2026 23:24:23 -0600 Subject: [PATCH 2/2] Add other possible locations and break on first found Added all locations latexmk searches for the *user* rc file. Then, since we're only grabbing a single variable/entry, reversed the search to look at the highest priority first and break/terminate the search when found. --- nvimcom/R/interlace.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nvimcom/R/interlace.R b/nvimcom/R/interlace.R index fe2e070a..cdfd3d47 100644 --- a/nvimcom/R/interlace.R +++ b/nvimcom/R/interlace.R @@ -323,7 +323,13 @@ nvim.interlace.rnoweb <- function( } if (!file.exists(logf)) { - paths <- c("~/.latexmkrc", ".latexmkrc", paste0(rnwdir, "/.latexmkrc")) + paths <- c( + paste0(rnwdir, "/.latexmkrc"), + ".latexmkrc", + "~/.latexmkrc", + file.path(Sys.getenv("XDG_CONFIG_HOME"), "latexmk/latexmkrc"), + "~/.config/latexmk/latexmkrc" + ) found <- file.exists(paths) if (latexcmd == "latexmk" && any(found)) { foundlmks <- paths[found] @@ -336,6 +342,7 @@ nvim.interlace.rnoweb <- function( "/", sub("\\....$", ".log", rnwf) ) + break } } } else {