R object browser for ESS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6KB

  1. ;;; r-object-browser.el --- Summary
  2. ;; Copyright (C) 2019 Maxime Wack
  3. ;; Author: Maxime Wack <maximewack@free.fr>
  4. ;; Version: 0.1
  5. ;; This file is not part of GNU Emacs.
  6. ;; This program is free software: you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation, either version 3 of the License, or
  9. ;; (at your option) any later version.
  10. ;; This program is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;; GNU General Public License for more details.
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;; This package is intended to emulate Nvim-R's object browser, for ESS.
  18. ;;; Code:
  19. (defvar robj-buffer "*R object browser*"
  20. "Name of buffer for displaying R objects.")
  21. (defun r-object-browser ()
  22. "Show an R object explorer."
  23. (interactive)
  24. (unless (and (string= "R" ess-dialect)
  25. ess-local-process-name)
  26. (error "Not in an R buffer with attached process"))
  27. (let ((proc ess-local-process-name))
  28. (pop-to-buffer (get-buffer-create robj-buffer))
  29. (setq ess-local-process-name proc)
  30. (r-object-browser-mode)))
  31. (defun r-object-browser-mode ()
  32. "Run R object browser mode.")
  33. (provide 'r-object-browser)
  34. ;;; r-object-browser.el ends here
  35. ;;; Test zone
  36. (ess-force-buffer-current) ;; get current R process buffer
  37. (ess-command "ls()\n" (get-buffer robj-buffer))