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

@@ -1,6 +1,6 @@
;;; ess-inf.el --- Support for running S as an inferior Emacs process -*- lexical-binding: t; -*-
;; Copyright (C) 1989-2020 Free Software Foundation, Inc.
;; Copyright (C) 1989-2022 Free Software Foundation, Inc.
;; Author: David Smith <dsmith@stats.adelaide.edu.au>
;; Created: 7 Jan 1994
@@ -169,9 +169,7 @@ This may be useful for debugging."
dialect)
dialect))
(inf-buf (inferior-ess--get-proc-buffer-create temp-dialect))
(proc-name (buffer-local-value 'ess-local-process-name inf-buf))
(cur-dir (inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect))
(default-directory cur-dir))
(proc-name (buffer-local-value 'ess-local-process-name inf-buf)))
(with-current-buffer inf-buf
;; TODO: Get rid of this, we should rely on modes to set the
;; variables they need.
@@ -179,7 +177,8 @@ This may be useful for debugging."
(inferior-ess--set-major-mode ess-dialect)
;; Set local variables after changing mode because they might
;; not be permanent
(setq default-directory cur-dir)
(setq default-directory
(inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect))
(setq inferior-ess--local-data (cons inferior-ess-program start-args))
;; Read the history file
(when ess-history-file
@@ -204,7 +203,7 @@ This may be useful for debugging."
(unless (and proc (eq (process-status proc) 'run))
(error "Process %s failed to start" proc-name))
(when ess-setwd-command
(ess-set-working-directory cur-dir))
(ess-set-working-directory default-directory))
(setq-local font-lock-fontify-region-function #'inferior-ess-fontify-region)
(setq-local ess-sl-modtime-alist nil)
(run-hooks 'ess-post-run-hook)
@@ -395,7 +394,7 @@ Return non-nil if the process is in a ready (not busy) state."
;; When "\n" inserted from inferior-ess-available-p, delete the prompt.
(when (and ready
(process-get proc 'availability-check)
(string-match-p (concat "^" inferior-ess-primary-prompt "\\'") string))
(string-match-p (concat inferior-ess-primary-prompt "\\'") string))
(process-put proc 'suppress-next-output? t))
(process-put proc 'availability-check nil)
(when ready
@@ -513,7 +512,7 @@ inserted in the process buffer instead of the command buffer."
(error (message "%s" (error-message-string err))))))))
(defun ess--if-verbose-write-process-state (proc string &optional filter)
"Write informaiton about PROC, STRING, and FILTER to the dribble buffer."
"Write information about PROC, STRING, and FILTER to the dribble buffer."
(ess-if-verbose-write
(format "\n%s:
--> busy:%s busy-end:%s sec-prompt:%s interruptable:%s <--
@@ -621,29 +620,25 @@ process-less buffer because it was created with
;;*;; Requester functions called at startup
;; FIXME EMACS 25.1:
;; Deprecate `ess-directory-function' in favor of `project-find-functions'?
(defun inferior-ess--get-startup-directory ()
"Return a startup directory."
(let ((dir (or (and ess--enable-experimental-projects
(fboundp 'project-current)
(cdr (project-current)))
(and ess-directory-function
(funcall ess-directory-function))
ess-startup-directory
(let ((dir (or (when (boundp 'ess-startup-directory)
(if (symbolp ess-startup-directory)
(symbol-value ess-startup-directory)
ess-startup-directory))
(and ess-startup-directory-function
(funcall ess-startup-directory-function))
(when-let ((proj (project-current)))
(ess--project-root proj))
default-directory)))
(directory-file-name dir)))
(defun inferior-ess--maybe-prompt-startup-directory (procname dialect)
(defun inferior-ess--maybe-prompt-startup-directory (procname _dialect)
"Possibly prompt for a startup directory.
When `ess-ask-for-ess-directory' is non-nil, prompt. PROCNAME is
the name of the inferior process (e.g. \"R:1\"), and DIALECT is
the language dialect (e.g. \"R\")."
(let ((default-dir (if (fboundp 'inferior-ess-r--adjust-startup-directory)
(inferior-ess-r--adjust-startup-directory
(inferior-ess--get-startup-directory) dialect)
(inferior-ess--get-startup-directory))))
(let ((default-dir (inferior-ess--get-startup-directory)))
(if ess-ask-for-ess-directory
(let ((prompt (format "%s starting project directory? " procname)))
(ess-prompt-for-directory default-dir prompt))
@@ -661,18 +656,6 @@ the language dialect (e.g. \"R\")."
;;*;; General process handling code
(defmacro with-ess-process-buffer (no-error &rest body)
"Execute BODY in the process buffer of `ess-current-process-name'.
If NO-ERROR is t don't trigger error when there is not current
process. Symbol *proc* is bound to the current process during the
evaluation of BODY."
(declare (indent 1) (debug t))
`(let ((*proc* (and ess-local-process-name (get-process ess-local-process-name))))
(if *proc*
(with-current-buffer (process-buffer *proc*)
,@body)
(unless ,no-error
(error "No current ESS process")))))
(defmacro ess-with-current-buffer (buffer &rest body)
"Like `with-current-buffer' but with transfer of some essential
@@ -1033,7 +1016,7 @@ and `ess-load-command', in that order."
(format ess-load-command file)))
(defun ess-wait-for-process (&optional proc sec-prompt wait force-redisplay timeout)
"Wait for 'busy property of the process to become nil.
"Wait for \\='busy property of the process to become nil.
If SEC-PROMPT is non-nil return if secondary prompt is detected
regardless of whether primary prompt was detected or not. If WAIT
is non-nil wait for WAIT seconds for process output before the
@@ -1071,32 +1054,33 @@ Returns nil if TIMEOUT was reached, non-nil otherwise."
(let* ((cmd-buf (process-get proc 'cmd-buffer))
(cmd-delim (process-get proc 'cmd-output-delimiter))
(early-exit t))
(unwind-protect
(progn
(with-current-buffer cmd-buf
(goto-char (point-max))
(insert string))
(when-let ((info (if cmd-delim
(ess--command-delimited-output-info cmd-buf cmd-delim)
(ess--command-output-info cmd-buf))))
(let ((new-output (ess--command-set-status proc cmd-buf info)))
(when (not (process-get proc 'busy))
;; Store new output until restoration
(when new-output
(process-put proc 'pending-output new-output))
;; Restore the user's process filter as soon as process is
;; available
(funcall (process-get proc 'cmd-restore-function))
;; Run callback with command output
(when (process-get proc 'callbacks)
(inferior-ess-run-callback proc (with-current-buffer cmd-buf
(buffer-string)))))))
(setq early-exit nil))
;; Be defensive when something goes wrong. Restore process to a
;; usable state.
(when early-exit
(process-put proc 'busy nil)
(funcall (process-get proc 'cmd-restore-function))))))
(when (buffer-live-p cmd-buf)
(unwind-protect
(progn
(with-current-buffer cmd-buf
(goto-char (point-max))
(insert string))
(when-let ((info (if cmd-delim
(ess--command-delimited-output-info cmd-buf cmd-delim)
(ess--command-output-info cmd-buf))))
(let ((new-output (ess--command-set-status proc cmd-buf info)))
(when (not (process-get proc 'busy))
;; Store new output until restoration
(when new-output
(process-put proc 'pending-output new-output))
;; Restore the user's process filter as soon as process is
;; available
(funcall (process-get proc 'cmd-restore-function))
;; Run callback with command output
(when (process-get proc 'callbacks)
(inferior-ess-run-callback proc (with-current-buffer cmd-buf
(buffer-string)))))))
(setq early-exit nil))
;; Be defensive when something goes wrong. Restore process to a
;; usable state.
(when early-exit
(process-put proc 'busy nil)
(funcall (process-get proc 'cmd-restore-function)))))))
(defvar ess-presend-filter-functions nil
"List of functions to call before sending the input string to the process.
@@ -1125,7 +1109,7 @@ process buffer is appended to the hook from the current buffer.")
;; also run proc buffer local hooks
(functions (unless (eq pbuf (current-buffer))
(buffer-local-value 'ess-presend-filter-functions pbuf))))
(setq functions (append (delq t (copy-sequence functions)) ;; even in let, delq distructs
(setq functions (append (delq t (copy-sequence functions)) ;; even in let, delq destructs
ess-presend-filter-functions))
(while (and functions string)
;; cannot use run-hook-with-args here because string must be passed from one
@@ -1189,8 +1173,8 @@ Hide all the junk output in temporary buffer."
"ESS wrapper for `process-send-string'.
Run `comint-input-filter-functions' and current buffer's and
PROCESS' `ess-presend-filter-functions' hooks on the input
STRING. VISIBLY can be nil, t, 'nowait or a string. If string
the behavior is as with 'nowait with the differences that
STRING. VISIBLY can be nil, t, \\='nowait or a string. If string
the behavior is as with \\='nowait with the differences that
inserted string is VISIBLY instead of STRING (evaluated command
is still STRING). In all other cases the behavior is as
described in `ess-eval-visibly'. STRING need not end with
@@ -1322,7 +1306,7 @@ All elements are optional.
(defvar ess--command-default-timeout most-positive-fixnum)
;; NOTE: We might want to switch to somethig like `cl-defun' with
;; NOTE: We might want to switch to something like `cl-defun' with
;; keyword arguments given the length of the signature. Would also
;; make it easier to deprecate arguments.
(defun ess-command (cmd &optional out-buffer _sleep no-prompt-check wait proc
@@ -1345,7 +1329,7 @@ seconds. The process is interrupted with `interrupt-process' when
the timeout is reached or when an error occurs.
PROC should be a process, if nil the process name is taken from
`ess-local-process-name'. This command doesn't set 'last-eval
`ess-local-process-name'. This command doesn't set \\='last-eval
process variable.
Note: for critical, or error prone code you should consider
@@ -1376,7 +1360,7 @@ wrapping the code into:
(unwind-protect
(progn
;; The process is restored from the filter once it's
;; available again (i.e. a prompt or delimeter is
;; available again (i.e. a prompt or delimiter is
;; detected). This handles the synchronous case when the
;; command runs to completion, as well as the
;; asynchronous case when an early exit occurs. The most
@@ -1433,7 +1417,7 @@ wrapping the code into:
(process-put proc 'cmd-output-delimiter nil)
(process-put proc 'cmd-buffer nil)
(when-let ((pending (process-get proc 'pending-output)))
(process-put proc 'pending nil)
(process-put proc 'pending-output nil)
(funcall old-pf proc pending)))))
;; TODO: Needs some Julia tests as well
@@ -1515,7 +1499,7 @@ of `ess-async-command' with an explicit interrupt-callback."
(defun ess-load-library ()
"Prompt and load dialect specific library/package/module.
Note that in R these are called 'packages' and the name of this
Note that in R these are called `packages' and the name of this
function has nothing to do with R package mechanism, but it
rather serves a generic, dialect independent purpose. It is also
similar to `load-library' Emacs function."
@@ -1547,7 +1531,7 @@ arg EOB is non-nil, display ESS process buffer after evaluation.
If optional 4th arg EVEN-EMPTY is non-nil, also send empty
text (e.g. an empty line). If 5th arg WAIT-LAST-PROMPT is
non-nil, also wait for the prompt after the last line; if 6th arg
SLEEP-SEC is a number, ESS will call '(\\[sleep-for] SLEEP-SEC)
SLEEP-SEC is a number, ESS will call `(\\[sleep-for] SLEEP-SEC)'
at the end of this function. If the 7th arg WAIT-SEC is set, it
will be used instead of the default .001s and be passed to
\\[ess-wait-for-process].
@@ -1618,7 +1602,8 @@ they might throw off the debugger."
(ess-blink-region start end))
(goto-char end)
(skip-chars-backward "\n\t ")
(setq end (point))))
(setq end (point))
(cons start end)))
(defun ess-eval-region (start end vis &optional message type)
"Send the region from START to END to the inferior ESS process.
@@ -1645,15 +1630,17 @@ the lines of the rectangle separately to the inferior process."
(defun ess--eval-region (start end vis &optional message type)
"Helper function for `ess-eval-region', which see.
START, END, VIS, MESSAGE, and TYPE described there."
(ess-eval-region--normalise-region start end)
(let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly))
(message (or message "Eval region"))
(proc (ess-get-process)))
(save-excursion
(ess-send-region proc start end visibly message type)))
(when ess-eval-deactivate-mark
(ess-deactivate-mark))
(list start end))
(let* ((se (ess-eval-region--normalise-region start end))
(start (car se))
(end (cdr se)))
(let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly))
(message (or message "Eval region"))
(proc (ess-get-process)))
(save-excursion
(ess-send-region proc start end visibly message type)))
(when ess-eval-deactivate-mark
(ess-deactivate-mark))
(list start end)))
(defun ess-eval-buffer (&optional vis)
"Send the current buffer to the inferior ESS process.
@@ -1725,8 +1712,8 @@ Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'."
"Send the current function if \\[point] is inside one.
Otherwise send the current paragraph to the inferior ESS process.
Prefix arg VIS toggles visibility of ess-code as for
`ess-eval-region'. Returns 'function if a function was evaluated
or 'paragraph if a paragraph."
`ess-eval-region'. Returns \\='function if a function was evaluated
or \\='paragraph if a paragraph."
(interactive "P")
(condition-case nil
(progn (ess-eval-function vis)
@@ -2206,8 +2193,8 @@ A negative prefix argument gets the objects for that position
(ess-execute the-command invert "S objects" the-message)))
(defun ess-execute-search (invert)
"Send the `inferior-ess-search-list-command' command to the `ess-language' process.
[search(..) in S]"
"Send the `inferior-ess-search-list-command' command.
INVERT is as in `ess-execute'. E.g. search(..) in S."
(interactive "P")
(ess-execute inferior-ess-search-list-command invert "S search list"))
@@ -2242,8 +2229,9 @@ in `ess-r-post-run-hook' or `ess-S+-post-run-hook'."
(defun ess-calculate-width (opt)
"Calculate width command given OPT.
OPT can be 'window, 'frame, or an integer. Return a command
suitable to send to the inferior process (e.g. \"options(width=80, length=999999)\")."
OPT can be \\='window, \\='frame, or an integer. Return a command
suitable to send to the inferior process (e.g.
\"options(width=80, length=999999)\")."
(when (null ess-execute-screen-options-command)
(error "Not implemented for %s" ess-dialect))
(let (command)
@@ -2293,7 +2281,7 @@ buffers."
"Send a command to the ESS process.
A newline is automatically added to COMMAND. Prefix arg (or second arg
INVERT) means invert the meaning of
`ess-execute-in-process-buffer'. If INVERT is 'buffer, output is
`ess-execute-in-process-buffer'. If INVERT is \\='buffer, output is
forced to go to the process buffer. If the output is going to a
buffer, name it *BUFF*. This buffer is erased before use. Optional
fourth arg MESSAGE is text to print at the top of the buffer (defaults
@@ -2433,7 +2421,7 @@ START-ARGS gets passed to the dialect-specific
;; Make sure we don't ask for directory again
;; Use current working directory as default
(let ((project-find-functions nil)
(ess-directory-function nil)
(ess-startup-directory-function nil)
(ess-startup-directory (ess-get-process-variable 'default-directory))
(ess-ask-for-ess-directory nil))
(ess-quit 'no-save)
@@ -2502,7 +2490,7 @@ Returns nil if that file cannot be found, i.e., for R or any non-S language!"
(defun ess-get-object-list (name &optional exclude-first)
"Return a list of current S object names associated with process NAME.
Uses `ess-object-list' if that is non-nil. If EXCLUDE-FIRST is
non-nil, don't return objects in first positon (.GlobalEnv)."
non-nil, don't return objects in first position (.GlobalEnv)."
(or ess-object-list ;; <<- MM: this is now always(?) nil; we cache the *-modtime-alist
(with-current-buffer (process-buffer (ess-get-process name))
(ess-make-buffer-current)
@@ -2538,7 +2526,7 @@ Return the elements of the result of COMMAND as an alist of
strings. COMMAND should have a terminating newline.
NO-PROMPT-CHECK, WAIT, PROC, and TIMEOUT are passed to `ess-command'.
FILTER may be the keyword 'non-... or nil. To avoid truncation of
FILTER may be the keyword \\='non-... or nil. To avoid truncation of
long vectors, wrap your command (%s) like this, or a version with
explicit options(max.print=1e6): \"local({ out <- try({%s});
print(out, max=1e6) })\n\"."
@@ -2713,7 +2701,7 @@ directory in the `load-path'."
(setq ess-object-name-db temp-object-name-db)))
(defun ess-resynch nil
"Reread all directories/objects in variable `ess-search-list' to form completions."
"Reread all directories and objects in `ess-search-list' for completions."
(interactive)
(if (ess-make-buffer-current) nil
(error "Not an ESS process buffer"))
@@ -2854,7 +2842,7 @@ don't recompile first object in the search list."
(defun ess-search-path-tracker (str)
"Check if input STR changed the search path.
This function monitors user input to the inferior ESS process so
that Emacs can keep the process variable 'search-list' up to
that Emacs can keep the process variable `search-list' up to
date. `ess-completing-read' in \\[ess-read-object-name] uses this
list indirectly when it prompts for help or for an object to
dump. From ESS 12.09 this is not necessary anymore, as the search