emacs-ess / ESS

Emacs Speaks Statistics: ESS
https://ess.r-project.org/
GNU General Public License v3.0
620 stars 162 forks source link

Can't display help on Windows #1246

Closed ShuguangSun closed 1 year ago

ShuguangSun commented 1 year ago

How to reproduce, set R_DISABLE_HTTPD=0

Warning in tools::startDynamicHelp(NA) :
  httpd server disabled by R_DISABLE_HTTPD
getOption("help_type")
## [1] "html"
getOption("pager")
## [1] "d:/scoop/apps/r/current/bin/pager"

It seems the options "help_type" and "pager" were not set correctly. Actually, there is no 'pager' in Windows R.

System: Windows 11 Emacs: GNU Emacs 30.0.50 (build 1, x86_64-w64-mingw32) of 2023-04-18 ESS: ess-20230416.1504 R: 4.2.3 & 4.2.0 Enviroment: R_DISABLE_HTTPD=0

ShuguangSun commented 1 year ago

It is due the change to ess-r-mode.el in commit https://github.com/emacs-ess/ESS/commit/27e5af801aa04c200905ce62cff14f0e5b6ab187

(ess-r--opt-if-unset "pager"
                                         "file.path(R.home(), 'bin', 'pager')"
                                         (format "'%s'" inferior-ess-pager))

is different to the original

(format
                        "if (identical(getOption('pager'), file.path(R.home(), 'bin', 'pager')))
                             options(pager = '%s')\n"
                        inferior-ess-pager)

In windows, if it is not set, the default pager options is 'console' if we comment those code out. So that the original code, set pager to 'console' if pager is 'R.home()/bin/pager' because of (the pager) is not exist.

However the commit https://github.com/emacs-ess/ESS/commit/27e5af801aa04c200905ce62cff14f0e5b6ab187 make the pager to 'R.home()/bin/pager' no mattter what.