[Rd] overriding built in Rbuildignore values

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Sun Aug 10 15:46:20 CEST 2025


On Thu, 7 Aug 2025 16:57:20 -0500
Dirk Eddelbuettel <edd using debian.org> wrote:

> I trust you checked that 'perl = TRUE' applies also to these entries
> from tools:::get_exclude_patterns() ?

It does: tools:::inRbuildignore() uses perl = TRUE and I've tested the
pattern in an .Rbuildignore file with an older version of R.

For completeness, this should cover all swap files that Vim could
create with the 'shortname' option unset:

Index: src/library/tools/R/build.R
===================================================================
--- src/library/tools/R/build.R	(revision 88556)
+++ src/library/tools/R/build.R	(working copy)
@@ -54,8 +54,11 @@
     c("^\\.Rbuildignore$",
       "(^|/)\\.DS_Store$",
       "^\\.(RData|Rhistory)$",
-      "~$", "\\.bak$", "\\.sw.$",
+      "~$", "\\.bak$",
       "(^|/)\\.#[^/]*$", "(^|/)#[^/]*#$",
+      ## Vim
+      "(^|/)([.][^/]+|_)?[.]sw[a-p]$",
+      "(^|/)([.][^/]+|_)?[.]s[a-v][a-z]$",
       ## Outdated ...
       "^TITLE$", "^data/00Index$",
       "^inst/doc/00Index\\.dcf$",

On Windows, swapfiles for unnamed buffers are named _.swp (and so on)
instead of .swp (and so on), even with the 'shortname' option unset.

This gives us test cases:

.swp
.foo.txt.swo
src/.bar.c.swn
inst/not-a-swapfile.swc
inst/.not-a-swapfile.swc.swc
.saa
_.saa

With the 'shortname' option set, collisions are possible: a swapfile
could be named foo_txt.swc. Hopefully nobody develops R packages using
Vim on an 8.3 filesystem.

-- 
Best regards,
Ivan



More information about the R-devel mailing list