Klimi's new dotfiles with stow.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

581 wiersze
23 KiB

4 lat temu
  1. ;;; ess-r-package.el --- Package development mode for R. -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2011-2015 Lionel Henry, Vitalie Spinu, A.J. Rossini, Richard
  3. ;; M. Heiberger, Martin Maechler, Kurt Hornik, Rodney Sparapani, and
  4. ;; Stephen Eglen.
  5. ;; Author: Lionel Henry, Vitalie Spinu
  6. ;; Maintainer: ESS-core <ESS-core@r-project.org>
  7. ;; Keywords: languages, tools
  8. ;; This file is part of ESS.
  9. ;; This file is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.
  13. ;; This file is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;; GNU General Public License for more details.
  17. ;; A copy of the GNU General Public License is available at
  18. ;; https://www.r-project.org/Licenses/
  19. ;;; Commentary:
  20. ;; see appropriate documentation section of ESS user manual
  21. ;;; Code:
  22. (require 'cl-lib)
  23. (require 'ess-inf)
  24. (eval-when-compile
  25. (require 'subr-x)
  26. (require 'tramp))
  27. ;; Silence the byte compiler, OK because this file is only loaded by
  28. ;; ess-r-mode and has no autoloads.
  29. (defvar ess-r-customize-alist)
  30. (declare-function inferior-ess-r-force "ess-r-mode")
  31. (declare-function ess-r-get-evaluation-env "ess-r-mode")
  32. (declare-function ess-r-set-evaluation-env "ess-r-mode")
  33. (declare-function tramp-dissect-file-name "tramp" (name &optional nodefault))
  34. ;; This can be drop after dropping support for Emacs 25:
  35. (declare-function tramp-file-name-localname "tramp" (cl-x))
  36. (defvar ess-r-prompt-for-attached-pkgs-only nil
  37. "If nil provide completion for all installed R packages.
  38. If non-nil, only look for attached packages.")
  39. (define-obsolete-variable-alias 'ess-r-package-auto-set-evaluation-env 'ess-r-package-auto-enable-namespaced-evaluation "18.04")
  40. (define-obsolete-variable-alias 'ess-r-package-auto-set-evaluation-env 'ess-r-package-auto-enable-namespaced-evaluation "18.04")
  41. (defcustom ess-r-package-auto-enable-namespaced-evaluation t
  42. "If non-nil, evaluation env is set to package env automatically.
  43. See also `ess-r-set-evaluation-env' and `ess-r-evaluation-env'."
  44. :group 'ess-r-package
  45. :type 'boolean)
  46. (defvar-local ess-r-package--info-cache nil
  47. "Current package info cache.
  48. See `ess-r-package-info' for its structure.")
  49. (define-obsolete-variable-alias 'ess-r-package-library-path 'ess-r-package-library-paths "v18.04")
  50. (defcustom ess-r-package-library-paths nil
  51. "Default path to find user packages.
  52. Can be either a string specifying a directory or a list of directories."
  53. :group 'ess-r-package-library-paths
  54. :type `(choice string (repeat string)))
  55. (defvar ess-r-package-root-file "DESCRIPTION"
  56. "Presence of this file indicates the project's root.")
  57. (defvar ess-r-package-dirs
  58. '(("R" . 1)
  59. ("r" . 1)
  60. ("tests" . 1)
  61. ("testthat" . 2)
  62. ("inst" . 1)
  63. ("include" . 2)
  64. ("src" . 1))
  65. "Alist of directories names and their depth in R package hierarchy.
  66. This list is used to figure out whether the current file belongs
  67. to an R package. If the file specified in `ess-r-package-root-file'
  68. \(DESCRIPTION by default) is found at the presumed root directory
  69. of the package, the current directory is considered to be part of
  70. a R package.")
  71. (defvar ess-r-package-source-roots
  72. '("R" "src" "tests" "inst/include")
  73. "List of sub-directories within R package where source files are located.
  74. All children of these directories are also considered source
  75. containing directories. Use `ess-r-package-source-dirs' to get
  76. all source dirs recursively within the current package.")
  77. ;;;*;;; Package Detection
  78. (defun ess-r-package-project (&optional dir)
  79. "Return the current package as an Emacs project instance.
  80. A project instance is a cons cell of the project type as symbol
  81. and the project path as string. If DIR is provided, the package
  82. is searched from that directory instead of `default-directory'."
  83. (let ((pkg-info (ess-r-package-info dir)))
  84. (when (car pkg-info)
  85. (cons 'ess-r-package (plist-get pkg-info :root)))))
  86. (cl-defmethod project-roots ((project (head ess-r-package)))
  87. "Return the project root for ESS R packages"
  88. (list (cdr project)))
  89. (defun ess-r-package-name (&optional dir)
  90. "Return the name of the current package as a string."
  91. (plist-get (ess-r-package-info dir) :name))
  92. (defun ess-r-package-info (&optional dir)
  93. "Get the description of the R project in directory DIR.
  94. Return an plist with the keys :name and :root. When not in a
  95. package return '(nil). This value is cached buffer-locally for
  96. efficiency reasons."
  97. (if (and (null dir) (car ess-r-package--info-cache))
  98. ess-r-package--info-cache
  99. (let* ((path (ess-r-package--find-package-path (or dir default-directory)))
  100. (name (when path
  101. (ess-r-package--find-package-name path)))
  102. (info (if name
  103. (list :name name
  104. :root path)
  105. '(nil))))
  106. ;; If DIR was supplied we cannot cache in the current buffer.
  107. (if dir
  108. info
  109. (setq-local ess-r-package--info-cache info)))))
  110. (defun ess-r-package--all-source-dirs (dir)
  111. (when (file-directory-p dir)
  112. (cl-loop for f in (directory-files-and-attributes dir t "^[^.]")
  113. if (cadr f)
  114. append (cons (car f) (ess-r-package--all-source-dirs (car f))))))
  115. (defun ess-r-package-source-dirs ()
  116. "Get paths within current R package with source files.
  117. Return nil if not in a package. Search sub-directories listed in
  118. `ess-r-package-source-roots' are searched recursively and
  119. return all physically present directories."
  120. (let ((pkg-root (plist-get (ess-r-package-info) :root)))
  121. (when pkg-root
  122. (let ((files (directory-files-and-attributes pkg-root t "^[^.]")))
  123. (cl-loop for f in files
  124. if (and (cadr f)
  125. (cl-some (lambda (el) (string-match-p (concat "/" el "$") (car f)))
  126. ess-r-package-source-roots))
  127. append (cons (car f)
  128. (ess-r-package--all-source-dirs (car f))))))))
  129. (defun ess-r--select-package-name ()
  130. (inferior-ess-r-force)
  131. (let ((pkgs (ess-get-words-from-vector
  132. (format "print(.packages(%s), max = 1e6)\n"
  133. (if ess-r-prompt-for-attached-pkgs-only "FALSE" "TRUE"))))
  134. (current-pkg (ess-r-package-name)))
  135. (let ((env (ess-r-get-evaluation-env)))
  136. (when env
  137. (setq pkgs (append '("*none*") pkgs))
  138. (when (equal env current-pkg)
  139. (setq current-pkg "*none*"))))
  140. (ess-completing-read "Package" pkgs nil nil nil nil current-pkg)))
  141. (defun ess-r-package--find-package-path (&optional dir)
  142. "Get the root of R package in directory DIR.
  143. DIR defaults to the current buffer's file name (if non-nil) or
  144. `default-directory'. Root is determined by locating
  145. `ess-r-package-root-file'. If the path looks like a tramp file,
  146. remove the remote information."
  147. (when-let ((path (cond
  148. (dir)
  149. ((buffer-file-name)
  150. (file-name-directory (buffer-file-name)))
  151. (t
  152. default-directory)))
  153. (pkg-path
  154. (when path
  155. (or
  156. ;; First check current directory
  157. (and (file-exists-p (expand-file-name ess-r-package-root-file path))
  158. path)
  159. ;; Check for known directories in current path
  160. (let ((current-dir (file-name-nondirectory (directory-file-name path)))
  161. known-pkg-dir known-path presumptive-path)
  162. (while (and path (not presumptive-path))
  163. (setq current-dir (file-name-nondirectory (directory-file-name path)))
  164. (if (and (setq known-pkg-dir (assoc current-dir ess-r-package-dirs))
  165. (setq known-path (ess--parent-dir path (cdr known-pkg-dir)))
  166. (file-exists-p (expand-file-name ess-r-package-root-file known-path)))
  167. (setq presumptive-path known-path)
  168. (setq path (ess--parent-dir path 1))))
  169. presumptive-path)))))
  170. (if (file-remote-p pkg-path)
  171. (tramp-file-name-localname (tramp-dissect-file-name pkg-path))
  172. (directory-file-name pkg-path))))
  173. (defun ess-r-package--find-package-name (path)
  174. (let ((file (expand-file-name ess-r-package-root-file path))
  175. (case-fold-search t))
  176. (when (file-exists-p file)
  177. (with-temp-buffer
  178. (insert-file-contents-literally file)
  179. (goto-char (point-min))
  180. (when (re-search-forward "package: \\(.*\\)" nil t)
  181. (match-string 1))))))
  182. ;;;*;;; UI
  183. (defun ess-r-package-use-dir ()
  184. "Set process directory to current package directory."
  185. (interactive)
  186. (let ((pkg-root (plist-get (ess-r-package-info) :root)))
  187. (if pkg-root
  188. (ess-set-working-directory (abbreviate-file-name pkg-root))
  189. (user-error "Not in a project"))))
  190. ;;;*;;; Evaluation
  191. (defun ess-r-package-enable-namespaced-evaluation ()
  192. "Enable namespaced evaluation in current buffer.
  193. Namespaced evaluation is enabled if
  194. `ess-r-package-auto-enable-namespaced-evaluation' is non-nil."
  195. (when ess-r-package-auto-enable-namespaced-evaluation
  196. (let ((root (plist-get (ess-r-package-info) :root)))
  197. ;; Check that we are in a file within R/
  198. (when (and root
  199. default-directory
  200. (> (length default-directory) (1+ (length root)))
  201. (let ((subpath (substring default-directory
  202. (1+ (length root))
  203. (length default-directory))))
  204. (string= (directory-file-name subpath) "R")))
  205. (ess-r-set-evaluation-env (ess-r-package-name))))))
  206. (add-hook 'ess-r-mode-hook 'ess-r-package-enable-namespaced-evaluation)
  207. (defun ess-r-package-eval-linewise (command &optional msg p actions)
  208. "Send COMMAND to R process.
  209. COMMAND is a command string with %s placeholder for the
  210. arguments. MSG is the message displayed in minibuffer with %s
  211. placeholder for the package name. P is the value of universal
  212. argument usually received from the upstream command and indicates
  213. which action in ACTIONS list to perform; if 0 or nil, first
  214. action, if 1 or (4) second if 2 or (16) third etc. ACTIONS is a
  215. list of strings (R arguments), or functions which return R
  216. arguments, or expressions which return R arguments."
  217. (inferior-ess-r-force)
  218. (let ((pkg-info (ess-r-package-info))
  219. (args (ess-r-command--build-args p actions)))
  220. (unless (car pkg-info)
  221. (user-error "Not in a package"))
  222. (ess-project-save-buffers)
  223. (message msg (plist-get pkg-info :name))
  224. (display-buffer (ess-get-process-buffer))
  225. (let ((pkg-path (concat "'" (abbreviate-file-name (plist-get pkg-info :root)) "'")))
  226. (ess-eval-linewise (format command (concat pkg-path args))))))
  227. (defun ess-r-command--build-args (ix &optional actions)
  228. (let* ((n (cond ((null ix) 0)
  229. ((listp ix) (round (log (car ix) 4)))
  230. ((integerp ix) ix)
  231. (t (error "Invalid index"))))
  232. (action (nth n actions))
  233. (args (cond ((null action) "")
  234. ((stringp action) action)
  235. ((functionp action) (funcall action))
  236. ((listp action) (eval action))
  237. (t (error "Invalid action")))))
  238. (if (string= "" args)
  239. args
  240. (concat ", " args))))
  241. ;;;*;;; Devtools Integration
  242. (defun ess-r-devtools-load-package (&optional arg)
  243. "Interface for `devtools::load_all()'.
  244. With prefix ARG ask for extra args."
  245. (interactive "P")
  246. (ess-r-package-eval-linewise
  247. "devtools::load_all(%s)\n" "Loading %s" arg
  248. '("" (read-string "Arguments: " "recompile = TRUE"))))
  249. (defun ess-r-devtools-unload-package ()
  250. "Interface to `devtools::unload()'."
  251. (interactive)
  252. (ess-r-package-eval-linewise
  253. "devtools::unload(%s)\n" "Unloading %s"))
  254. (defun ess-r-devtools-check-package (&optional arg)
  255. "Interface for `devtools::check()'.
  256. With prefix ARG ask for extra args."
  257. (interactive "P")
  258. (ess-r-package-eval-linewise
  259. "devtools::check(%s)\n" "Checking %s" arg
  260. '("" (read-string "Arguments: " "vignettes = FALSE"))))
  261. (defun ess-r-devtools-check-with-winbuilder (&optional arg)
  262. "Interface for `devtools::buildwin()'.
  263. With prefix ARG build with R-devel instead of R-patched."
  264. (interactive "P")
  265. (ess-r-package-eval-linewise
  266. "devtools::build_win(%s)\n" "Checking %s on CRAN's Windows server" arg
  267. '("" "version = 'R-devel'")))
  268. (defvar ess-r-rhub--history nil)
  269. (declare-function ess-r-check-install-package "ess-r-mode.el")
  270. (defun ess-r-rhub-check-package (&optional arg)
  271. "Interface for `rhub::check()'.
  272. With prefix ARG run with `valgrind = TRUE'."
  273. (interactive "P")
  274. (inferior-ess-r-force)
  275. (ess-r-check-install-package "rhub")
  276. (let* ((platforms (ess-get-words-from-vector "rhub::platforms()$name\n"))
  277. (platform (completing-read "Platform: " platforms nil t nil
  278. ess-r-rhub--history (car ess-r-rhub--history)))
  279. (cmd (format "rhub::check_for_cran(%%s, platform = '%s')\n" platform))
  280. (msg (format "Checking %%s on RHUB (%s)" platform)))
  281. (ess-r-package-eval-linewise cmd msg arg '("" "valgrind = TRUE"))))
  282. (defun ess-r-devtools-build (&optional arg)
  283. "Interface for `devtools::build()'.
  284. With prefix ARG, build with 'vignettes = FALSE'."
  285. (interactive "P")
  286. (ess-r-package-eval-linewise
  287. "devtools::build(%s)\n" "Building %s" arg
  288. '("" "vignettes = FALSE")))
  289. (defun ess-r-devtools-test-package (&optional arg)
  290. "Interface for `devtools::test()'.
  291. With prefix argument ARG, run tests on current file only."
  292. (interactive "P")
  293. (ess-r-package-eval-linewise
  294. "devtools::test(%s)\n" "Testing %s" arg
  295. '("" ess-r-devtools--cur-file-filter)))
  296. (defun ess-r-devtools--cur-file-filter ()
  297. (let ((file (or (and buffer-file-name
  298. (file-name-nondirectory buffer-file-name))
  299. (error "Buffer not visiting a file"))))
  300. (format "filter = \"%s\""
  301. (if (string-match "test-\\([[:alnum:]_-]+\\)\\.[rR]" file)
  302. (match-string-no-properties 1 file)
  303. (file-name-base buffer-file-name)))))
  304. (defvar ess-r-devtools-revdep-check-cmd
  305. "local({
  306. pkg_path <- %s
  307. res <- devtools::revdep_check(pkg_path)
  308. if (file.exists(file.path(pkg_path, 'revdep'))) {
  309. save_path <- file.path(pkg_path, 'revdep')
  310. } else {
  311. save_path <- file.path(pkg_path, '.metadata', 'revdep')
  312. }
  313. devtools::revdep_check_save_summary(res, save_path)
  314. logs_path <- file.path(save_path, 'logs')
  315. if (!dir.exists(logs_path)) {
  316. dir.create(logs_path)
  317. }
  318. devtools::revdep_check_save_logs(res, logs_path)
  319. })
  320. ")
  321. (defun ess-project-save-buffers ()
  322. "Offer to save modified files in the current project.
  323. Respects `ess-save-silently', which see."
  324. (let ((cur-proj ess-r-package--info-cache))
  325. (dolist (buf (buffer-list))
  326. (when-let ((file (buffer-file-name buf))
  327. (buf-proj (buffer-local-value 'ess-r-package--info-cache buf)))
  328. (when (equal cur-proj buf-proj)
  329. (ess-save-file file))))))
  330. (defun ess-r-devtools-document-package (&optional arg)
  331. "Interface for `devtools::document()'.
  332. With prefix ARG ask for extra arguments."
  333. (interactive "P")
  334. (ess-r-package-eval-linewise
  335. "devtools::document(%s)\n" "Documenting %s" arg
  336. '("" (read-string "Arguments: "))))
  337. (defun ess-r-devtools-install-package (&optional arg)
  338. "Interface to `devtools::install()'.
  339. By default the installation is \"quick\" with arguments quick =
  340. TRUE, upgrade = FALSE, build = FALSE. On prefix ARG
  341. \\[universal-argument] install with the default
  342. `devtools::install()' arguments."
  343. (interactive "P")
  344. (ess-r-package-eval-linewise
  345. "devtools::install(%s)\n" "Installing %s" arg
  346. '("quick = TRUE, build = FALSE, upgrade = FALSE, keep_source = TRUE"
  347. (read-string "Arguments: " "keep_source = TRUE, force = TRUE"))))
  348. (defvar ess-r-devtools--install-github-history nil)
  349. (defun ess-r-devtools-install-github (&optional arg)
  350. "Interface to `devtools::install_github()'.
  351. Asks for GitHub repository in the form of user/repo. Force
  352. re-installation when called with a prefix ARG."
  353. (interactive "P")
  354. (let ((command "devtools::install_github(%s%s)")
  355. (repo (format "'%s'"
  356. (read-string "User/Repo: " nil
  357. 'ess-r-devtools--install-github-history
  358. (car ess-r-devtools--install-github-history))))
  359. (args (if arg
  360. (ess-r-command--build-args 0 '((read-string "Arguments: " "force = TRUE")))
  361. "")))
  362. (inferior-ess-r-force)
  363. (unless (derived-mode-p 'inferior-ess-mode)
  364. (display-buffer (ess-get-process-buffer)
  365. '(nil . ((inhibit-same-window . t)))))
  366. (message "Installing %s from github" repo)
  367. (ess-eval-linewise (format command repo args))))
  368. (defun ess-r-devtools-create-package ()
  369. "Interface to `devtools::create()'.
  370. Default location is determined by the first element of
  371. `ess-r-package-library-paths'."
  372. (interactive)
  373. (let* ((command "devtools::create(\"%s\")")
  374. (default-path (if (stringp ess-r-package-library-paths)
  375. ess-r-package-library-paths
  376. (car ess-r-package-library-paths)))
  377. (path (read-directory-name "Path: " default-path)))
  378. (ess-eval-linewise (format command path))))
  379. (defun ess-r-devtools-execute-command (&optional arg)
  380. "Asks with completion for a devtools command.
  381. When called with prefix ARG asks for additional arguments."
  382. (interactive "P")
  383. (inferior-ess-r-force)
  384. (let* ((devtools-funs (ess-get-words-from-vector ".ess_devtools_functions()\n"))
  385. (fun (completing-read "Function: " devtools-funs))
  386. (command (format "devtools::%s(%%s)\n" fun)))
  387. (ess-r-package-eval-linewise
  388. command (format "Running %s" fun) arg
  389. '("" (read-string "Arguments: ")))))
  390. ;;;*;;; Minor Mode
  391. (defcustom ess-r-package-auto-activate t
  392. "If non-nil, `ess-r-package-mode' is turned on within R packages.
  393. If 't' the minor mode auto-activates in R packages. See
  394. `ess-r-package-exclude-modes' if you wish to inhibit
  395. `ess-r-package-mode' in specific buffers."
  396. :group 'ess-r-package
  397. :type 'boolean)
  398. (defcustom ess-r-package-exclude-modes '(fundamental-mode)
  399. "A list of modes where `ess-r-package' must not be activated.
  400. The check is done with `derived-mode-p'."
  401. :group 'ess-r-package
  402. :type '(repeat symbol)
  403. :package-version '(ess "18.10"))
  404. (defcustom ess-r-package-enter-hook nil
  405. "Normal hook run on entering `ess-r-package-mode'."
  406. :group 'ess-r-package
  407. :type 'hook)
  408. (defcustom ess-r-package-exit-hook nil
  409. "Normal hook run on exiting `ess-r-package-mode'."
  410. :group 'ess-r-package
  411. :type 'hook)
  412. (defcustom ess-r-package-mode-line
  413. ;; FIXME Emacs 25.1: Use `when-let'
  414. '(:eval (let ((pkg-name (ess-r-package-name)))
  415. (when pkg-name
  416. (format " [pkg:%s]" pkg-name))))
  417. "Mode line for ESS developer.
  418. Set this variable to nil to disable the mode line entirely."
  419. :group 'ess-r-package
  420. :type 'sexp
  421. :risky t)
  422. (defvar ess-r-package-mode-map
  423. (let ((ess-r-package-mode-map (make-sparse-keymap)))
  424. (define-key ess-r-package-mode-map "\C-c\C-w" 'ess-r-package-dev-map)
  425. ess-r-package-mode-map))
  426. (define-minor-mode ess-r-package-mode
  427. "Minor mode for enabling R package development features.
  428. \\{ess-r-package-mode-map}"
  429. :init-value nil
  430. :keymap ess-r-package-mode-map
  431. :lighter ess-r-package-mode-line
  432. (if ess-r-package-mode
  433. (progn
  434. ;; Forward relevant R settings for interacting with inferior
  435. ;; processes from any mode
  436. (let ((vars '(ess-dialect
  437. ess-setwd-command
  438. ess-getwd-command
  439. ess-quit-function
  440. inferior-ess-reload-function)))
  441. (mapc (lambda (var)
  442. (set (make-local-variable var)
  443. (eval (cdr (assq var ess-r-customize-alist)))))
  444. vars))
  445. (add-hook 'project-find-functions #'ess-r-package-project)
  446. (run-hooks 'ess-r-package-enter-hook))
  447. (remove-hook 'project-find-functions #'ess-r-package-project)
  448. (run-hooks 'ess-r-package-exit-hook)))
  449. (add-hook 'after-change-major-mode-hook 'ess-r-package-auto-activate)
  450. ;;;*;;; Activation
  451. (defun ess-r-package-auto-activate ()
  452. "Activate developer if current file is part of a package."
  453. (when (and ess-r-package-auto-activate
  454. (or (buffer-name) default-directory)
  455. (not (eq major-mode 'minibuffer-inactive-mode))
  456. (or
  457. ;; users probably have these in fundamental mode
  458. (member (buffer-name) '("DESCRIPTION" "NAMESPACE"))
  459. (if ess-r-package-exclude-modes
  460. (not (apply #'derived-mode-p ess-r-package-exclude-modes))
  461. t)))
  462. (when (car (ess-r-package-info))
  463. (ess-r-package-mode 1))))
  464. (defun ess-r-package-re-activate ()
  465. "Restart `ess-r-package-mode'.
  466. First, deactivate package mode if active, and activate if in
  467. package mode. Use this function if state of the buffer such as
  468. `default-directory' has changed."
  469. (when ess-r-package-mode
  470. (ess-r-package-mode -1))
  471. (setq ess-r-package--info-cache nil)
  472. (ess-r-package-auto-activate))
  473. (defvar-local ess-r--old-default-dir nil)
  474. (defun ess-r-package-default-directory-tracker (&rest _)
  475. (unless (equal ess-r--old-default-dir default-directory)
  476. (setq ess-r--old-default-dir default-directory)
  477. (ess-r-package-re-activate)))
  478. (defun ess-r-package-activate-directory-tracker ()
  479. (add-hook 'after-change-functions 'ess-r-package-default-directory-tracker t t))
  480. (add-hook 'shell-mode-hook 'ess-r-package-activate-directory-tracker t)
  481. (add-hook 'eshell-mode-hook 'ess-r-package-activate-directory-tracker t)
  482. (when (fboundp 'advice-add)
  483. (require 'shell)
  484. (advice-add 'shell-resync-dirs :after 'ess-r-package-re-activate))
  485. ;;;*;;; Deprecated variables and functions
  486. (defun ess-developer (&optional _val)
  487. (error "As of ESS 16.04, `ess-developer' is deprecated. Use `ess-r-set-evaluation-env' instead"))
  488. (defalias 'ess-toggle-developer 'ess-developer)
  489. (define-obsolete-function-alias 'ess-r-devtools-check-package-buildwin 'ess-r-devtools-check-with-winbuilder)
  490. (define-obsolete-function-alias 'ess-r-devtools-ask 'ess-r-devtools-execute-command "18.04")
  491. (make-obsolete-variable 'ess-developer "Please use `ess-developer-select-package' and `ess-r-set-evaluation-env' instead." "16.04")
  492. (make-obsolete-variable 'ess-developer-root-file "Please use `ess-r-package-root-file' instead." "16.04")
  493. (make-obsolete-variable 'ess-developer-packages "Please use `ess-r-package-set-package' and `ess-r-set-evaluation-env' instead." "16.04")
  494. (make-obsolete-variable 'ess-developer-load-on-add-commands "Please use `ess-r-package-set-package' and `ess-r-set-evaluation-env' instead." "16.04")
  495. (make-obsolete-variable 'ess-developer-activate-in-package "Please use `ess-r-package-auto-activate' instead." "16.04")
  496. (make-obsolete-variable 'ess-developer-enter-hook "Please use `ess-r-package-enter-hook' instead." "16.04")
  497. (make-obsolete-variable 'ess-developer-exit-hook "Please use `ess-r-package-exit-hook' instead." "16.04")
  498. (provide 'ess-r-package)
  499. ;;; ess-r-package.el ends here