Skip to content

template menu not populated #20

@plantarum

Description

@plantarum

Hi,

I think my problem may be related to #6. After opening an .Rmd file, and starting an R process via M-x R, the RMarkdown menu shows a single entry for "Templates", but there's nothing else listed there.

I installed the tufte package in R to make sure I had some templates that should be available. That didn't change anything. I tried to run the function poly-r-rmarkdown-templates by hand, and got the following error:

Error: Timeout during background ESS command ’local({list_templates <- function(user_dirs) {    user_dirs <- c(user_dirs, unlist(lapply(user_dirs, list.dirs, recursive = FALSE)))    list_from_dir <- function(dir, pkg = NULL) {      pkg_name <- if(is.null(pkg)) 'USER' else pkg      if (dir.exists(dir)) {        dirs <- list.dirs(dir, recursive = FALSE)        for (d in dirs) {          yaml_file <- file.path(d, 'template.yaml')          if (file.exists(yaml_file)) {            yaml <- yaml::yaml.load(readLines(yaml_file, encoding = 'UTF-8'))            if (is.null(desc <- yaml$description)) desc <- 'nil'            if (!is.null(pkg)) d <- basename(d)            cat(sprintf('("%s" "%s" "%s" "%s")', pkg_name, d, yaml$name, desc))          }        }      }    }    cat('(')    for (user_dir in user_dirs) {      files <- list.files(user_dir,  '\\.[Rr]md$', full.names = TRUE)      for (f in files) {        name <- sub('\\.[^.]+$','', basename(f))        cat(sprintf('("USER" "%s" "%s")', f, name))      }      list_from_dir(user_dir)    }    packages <- sort(unlist(lapply(.libPaths(), dir)))    for (pkg in packages) {      template_folder <- system.file('rmarkdown', 'templates', package = pkg)      list_from_dir(template_folder, pkg)    }    cat(')')  }list_templates(c())})’

Is there something else I need to do to configure templates, or is there a bug in poly-R?

I'm using poly-R from MELPA, which appears to match the latest commit to the repo: 20200316.1315 (melpa).

Emacs version 28.0.50, compiled form source

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out", from Ubuntu repositories

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions