pkg update and first config fix

org-brain not working, add org-roam
This commit is contained in:
2022-12-19 23:02:34 +01:00
parent 02b3e07185
commit 82f05baffe
885 changed files with 356098 additions and 36993 deletions

View File

@@ -64,7 +64,7 @@ use `ess-r-mode-hook' instead.")
(defcustom ess-r-fetch-ESSR-on-remotes nil
"If non-nil, when loading ESSR, fetch it from the GitHub repository.
Otherwise source from local ESS installation. When the value is
'ess-remote, fetch only with ess-remote's and not with TRAMP
\\='ess-remote, fetch only with ess-remote's and not with TRAMP
connections. When t, always fetch from remotes. Change this
variable when loading ESSR code on remotes fails for you.
@@ -73,7 +73,7 @@ in ~/.config/ESSR/ESSRv[VERSION].rds file. You can download and
place it there manually if the remote has restricted network
access."
:type '(choice (const nil :tag "Never")
(const 'ess-remote :tag "With ess-remote only")
(const ess-remote :tag "With ess-remote only")
(const t :tag "Always"))
:group 'ess-R)
@@ -558,8 +558,10 @@ will be prompted to enter arguments interactively."
"\n(R): ess-dialect=%s, buf=%s, start-arg=%s\n current-prefix-arg=%s\n"
ess-dialect (current-buffer) start-args current-prefix-arg))
(unless (or (file-remote-p default-directory)
(and ess-startup-directory
(file-remote-p ess-startup-directory))
(when ess-startup-directory
(file-remote-p (if (symbolp ess-startup-directory)
(symbol-value ess-startup-directory)
ess-startup-directory)))
;; TODO: Once we drop Emacs 26 support, can probably
;; just use the REMOTE argument of `executable-find'.
(executable-find inferior-ess-r-program))
@@ -605,7 +607,7 @@ will be prompted to enter arguments interactively."
;; Trigger the callback
(process-send-string (get-buffer-process inf-buf) "r\n"))
(ess-wait-for-process)
(R-initialize-on-start)
(ess-r-initialize-on-start)
(comint-goto-process-mark))
(ess-write-to-dribble-buffer
(format "(R): inferior-ess-language-start=%s\n"
@@ -618,23 +620,8 @@ will be prompted to enter arguments interactively."
;; FIXME: Current ob-R expects current buffer set to process buffer
(set-buffer (run-ess-r start-args)))
(defun inferior-ess-r--adjust-startup-directory (dir dialect)
"Adjust startup directory DIR if DIALECT is R.
If in a package project, prefer the tests directory but only if
the package directory was selected in the first place."
(if (string= dialect "R")
(let* ((project-dir (cdr (ess-r-package-project)))
(tests-dir (expand-file-name (file-name-as-directory "tests")
project-dir)))
(if (and project-dir
(string= project-dir dir)
(string= default-directory tests-dir))
tests-dir
dir))
dir))
(defun inferior-ess-r--init-callback (_proc _name)
(R-initialize-on-start))
(ess-r-initialize-on-start))
(defmacro ess-r--without-format-command (&rest body)
(declare (indent 0)
@@ -647,9 +634,11 @@ the package directory was selected in the first place."
,@body)
(setq ess-format-command-alist old-alist)))))
(defun R-initialize-on-start ()
(define-obsolete-function-alias 'R-initialize-on-start 'ess-r-initialize-on-start "ESS 19.04")
(defun ess-r-initialize-on-start ()
"This function is run after the first R prompt.
Executed in process buffer."
(interactive)
(ess-r--without-format-command
(ess-command (format
"if (identical(getOption('pager'), file.path(R.home(), 'bin', 'pager')))
@@ -796,6 +785,7 @@ top level functions only."
(add-hook 'completion-at-point-functions #'ess-r-package-completion nil 'local)
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
(add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local)
(add-hook 'project-find-functions #'ess-r-project nil 'local)
(if (fboundp 'ess-add-toolbar) (ess-add-toolbar))
;; imenu is needed for `which-function'
@@ -822,11 +812,69 @@ top level functions only."
;;;###autoload
(add-to-list 'auto-mode-alist '("CITATION\\'" . ess-r-mode))
;;;*;;; Project detection
(defvar-local ess-r-project--info-cache nil
"Current package info cache.
See `ess-r-project-info' for its structure.")
(defun ess-r-project (&optional dir)
"Return the current project as an Emacs project instance.
R project is a directory XYZ containing either .Rprofile,
DESCRIPTION or XYZ.Rproj file. Return a list of the form (:name
\"XYZ\" :root \"/path/to/project\"). If DIR is provided, the
project is searched from that directory instead of
`default-directory'."
(let ((info (ess-r-project-info dir)))
(when (car info)
(cons 'ess-r-project (plist-get info :root)))))
;; FIXME: remove when emacs 27 is dropped
(unless (eval-when-compile
(get 'project-roots 'byte-obsolete-info))
(cl-defmethod project-roots ((project (head ess-r-project)))
"Return the project root for ESS R projects."
(list (cdr project))))
(cl-defmethod project-root ((project (head ess-r-project)))
"Return the project root for ESS R projects."
(cdr project))
(defun ess-r-project-info (&optional dir)
"Get the description of the R project in directory DIR.
Return an plist with the keys :name and :root. When not in a
project return \\='(nil). This value is cached buffer-locally for
efficiency reasons."
(let ((do-cache (null dir)))
(if (and do-cache ess-r-project--info-cache)
ess-r-project--info-cache
(setq dir (or dir (buffer-file-name) default-directory))
(let ((out (or
(unless (file-remote-p dir)
(let ((dir (locate-dominating-file
dir
(lambda (dir)
(or (file-exists-p (expand-file-name ".Rprofile" dir))
(file-exists-p (expand-file-name "DESCRIPTION" dir))
(let ((nm (file-name-nondirectory (directory-file-name dir))))
(file-exists-p (expand-file-name (concat nm ".Rproj") dir))))))))
(when dir
(let ((dir (directory-file-name dir)))
(unless (member dir (list "~" (getenv "HOME")))
(list :name (file-name-nondirectory dir)
:root (expand-file-name dir)))))))
'())))
(when do-cache
(setq ess-r-project--info-cache out))
out))))
;;*;; Miscellaneous
(defun ess-R-arch-2-bit (arch)
"Translate R's architecture shortcuts/directory names to 'bits'.
"Translate R's architecture shortcuts/directory names to `bits'.
ARCH \"32\" or \"64\" (for now)."
(if (string= arch "i386") "32"
;; else:
@@ -839,8 +887,8 @@ Returns either Name, a string, or a (Name . Path) cons, such as
(\"R-2.12.1-64bit\" . \"C:/Program Files/R/R-2.12.1/bin/x64/Rterm.exe\")
\"R-x.y.z/bin/Rterm.exe\" will return \"R-x.y.z\", for R-2.11.x and older.
\"R-x.y.z/bin/i386/Rterm.exe\" will return \"R-x.y.z-32bit\", for R-2.12.x and newer.
\"R-x.y.z/bin/x64/Rterm.exe\" will return \"R-x.y.z-64bit\", for R-2.12.x and newer."
\"R-x.y.z/bin/i386/Rterm.exe\" return \"R-x.y.z-32bit\", for R-2.12.x and newer.
\"R-x.y.z/bin/x64/Rterm.exe\" return \"R-x.y.z-64bit\", for R-2.12.x and newer."
(let* ((dir (directory-file-name (file-name-directory long-path)))
(dir2 (directory-file-name (file-name-directory dir)))
(v-1up (file-name-nondirectory dir));; one level up
@@ -896,7 +944,8 @@ as `ess-r-created-runners' upon ESS initialization."
(defun ess-r-redefine-runners (&optional verbose)
"Regenerate runners, i.e. `M-x R-*` possibilities.
Call `fmakunbound' on all elements of `ess-r-created-runners', then define new runners."
Call `fmakunbound' on all elements of `ess-r-created-runners',
then define new runners."
(interactive "P")
(dolist (f ess-r-created-runners)
(fmakunbound (intern f)))
@@ -987,7 +1036,7 @@ returned."
rver)
" --version"))))
(when (string-match
"R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?)"
"R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?"
ver-string)
(setq date (match-string 2 ver-string)))
(cons date rver)))
@@ -1082,7 +1131,7 @@ use \"bin/Rterm.exe\"."
(fset 'r-transcript-mode 'ess-r-transcript-mode)
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Rr]out" . ess-r-transcript-mode))
(add-to-list 'auto-mode-alist '("\\.[Rr]out\\'" . ess-r-transcript-mode))
;;;###autoload
(add-to-list 'interpreter-mode-alist '("Rscript" . ess-r-mode))
;;;###autoload
@@ -1176,7 +1225,7 @@ Placed into `ess-presend-filter-functions' for R dialects."
(cl-defmethod ess-installed-packages (&context (ess-dialect "R"))
;;; FIXME? .packages() does not cache; installed.packages() does but is slower first time
(ess-get-words-from-vector--foreground "print(.packages(T), max=1e6)\n"))
(ess-get-words-from-vector--foreground "print(.packages(TRUE), max=1e6)\n"))
(cl-defmethod ess-load-library--override (pack &context (ess-dialect "R"))
"Load an R package."
@@ -1417,7 +1466,7 @@ documented, returns nil."
"^\\([^ \t\n]+::[^ \t\n]+\\)[ \t\n]+"
(format "*ess-apropos[%s](%s)*"
ess-current-process-name (match-string 1 help-?-match))
'appropos))
'apropos))
((string-match "^ *\\? *\\([^ \t]+\\)$" help-?-match)
(ess-display-help-on-object (match-string 1 help-?-match)))
;; Anything else we send to process almost unchanged
@@ -1447,6 +1496,7 @@ On remotes, when `ess-r-fetch-ESSR-on-remotes' is non-nil we
fetch ESSR environment from github to the remote machine.
Otherwise (the default) we source ESSR files into the remote
process."
(interactive)
;; `.ess.command()` is not defined until ESSR is loaded so disable
;; it temporarily. Would be helpful to implement an `inferior-ess-let'
;; macro .
@@ -1504,9 +1554,14 @@ environment from GitHub and attaches it to the search path. If
the file already exists on disk from a previous download then the
download step is omitted. This function returns t if the ESSR
load is successful, and nil otherwise."
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory))))
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory)))
(essr (or essr-version
;; FIXME: Hack: on MELPA essr-version is not set
(lm-with-file (expand-file-name "ess.el" ess-lisp-directory)
(lm-header "ESSR-Version"))
(error "`essr-version' could not be automatically inferred from ess.el file"))))
(or (with-temp-message "Fetching and loading ESSR into the remote ..."
(ess-boolean-command (format loader essr-version)))
(ess-boolean-command (format loader essr)))
(let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))))
(message (format "Couldn't load or download ESSR.rds on the remote.\n Error: %s\n Injecting local copy of ESSR." errmsg))
nil))))
@@ -2112,14 +2167,12 @@ Returns nil if line starts inside a string, t if in a comment."
;; Unroll arguments to a single line until closing marker is found.
(defun ess-fill--unroll-lines (bounds &optional jump-cont)
(let* ((last-pos (point-min))
(containing-sexp (ess-containing-sexp-position))
prefix-break)
(containing-sexp (ess-containing-sexp-position)))
(goto-char (car bounds))
(goto-char (ess-code-end-position))
(while (and (/= (point) last-pos)
(< (line-end-position)
(cadr bounds))
(not prefix-break))
(cadr bounds)))
(setq last-pos (point))
;; Check whether we ended up in a sub call. In this case, jump
;; over it, otherwise, join lines.
@@ -2406,6 +2459,7 @@ state.")
(add-hook 'completion-at-point-functions 'ess-r-object-completion nil 'local)
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
(add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local)
(add-hook 'project-find-functions #'ess-r-project nil 'local)
;; eldoc
(ess--setup-eldoc #'ess-r-eldoc-function)
;; auto-complete
@@ -2415,8 +2469,8 @@ state.")
(setq comint-get-old-input #'inferior-ess-get-old-input)
(add-hook 'comint-input-filter-functions 'ess-search-path-tracker nil 'local))
;;;*;;; R Help mode
(defvar ess-r-help-mode-map
@@ -2824,9 +2878,9 @@ given field. Options should be separated by value of
"Sort by: "
'(("score" 1) ("date:late" 2) ("date:early" 3)
("field:subject:ascending" 4)
("field:subject:decending" 5)
("field:from:ascending" 6) ("field:from:decending" 7)
("field:size:ascending" 8) ("field:size:decending" 9))
("field:subject:descending" 5)
("field:from:ascending" 6) ("field:from:descending" 7)
("field:size:ascending" 8) ("field:size:descending" 9))
nil t "score" nil "score")))
(restrict (concat
"&idxname="