[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ess da413b8bd1 05/12: Carefully check for disabled bg e
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ess da413b8bd1 05/12: Carefully check for disabled bg eval |
Date: |
Sat, 15 Apr 2023 13:58:06 -0400 (EDT) |
branch: externals/ess
commit da413b8bd14205890c087f56b2cf7445adc18cc6
Author: Lionel Henry <lionel.hry@gmail.com>
Commit: Lionel Henry <lionel.hry@gmail.com>
Carefully check for disabled bg eval
---
lisp/ess-inf.el | 15 +++++++--
lisp/ess-r-completion.el | 88 ++++++++++++++++++++++--------------------------
2 files changed, 53 insertions(+), 50 deletions(-)
diff --git a/lisp/ess-inf.el b/lisp/ess-inf.el
index 486baabb9b..cf1a28d357 100644
--- a/lisp/ess-inf.el
+++ b/lisp/ess-inf.el
@@ -931,6 +931,16 @@ no such process has been found."
(inferior-ess-available-p proc)))
(throw 'found proc))))))))
+(defun ess-get-next-available-bg-process (&optional proc dialect ignore-busy)
+ "Returns first avaiable process only if background evaluations are allowed.
+Same as `ess-get-next-available-process' but checks for
+`ess-can-eval-in-background' carefully."
+ ;; Don't check for availability if background evals were disabled
+ (when ess-can-eval-in-background
+ (when-let ((proc (or proc (ess-get-next-available-process dialect
ignore-busy))))
+ (when (ess-can-eval-in-background proc)
+ proc))))
+
;;*;;; Commands for switching to the process buffer
@@ -2190,9 +2200,8 @@ any. This makes it possible to disable background evals
for a
specific process, for instance in case it was not initialized
properly."
(when ess-can-eval-in-background
- (if-let ((proc (or proc (ess-get-current-process))))
- (not (process-get proc 'bg-eval-disabled))
- t)))
+ (when-let ((proc (or proc (ess-get-current-process))))
+ (not (process-get proc 'bg-eval-disabled)))))
;;;*;;; Hot key commands
diff --git a/lisp/ess-r-completion.el b/lisp/ess-r-completion.el
index b06e1b613f..da7c7abe6a 100644
--- a/lisp/ess-r-completion.el
+++ b/lisp/ess-r-completion.el
@@ -53,37 +53,36 @@
"Return the doc string, or nil.
If an ESS process is not associated with the buffer, do not try
to look up any doc strings."
- (when (and eldoc-mode (ess-can-eval-in-background))
- (let* ((proc (ess-get-next-available-process))
- (funname (and proc (or (and ess-eldoc-show-on-symbol ;; Aggressive
completion
- (thing-at-point 'symbol))
- (car (ess--fn-name-start))))))
- (when funname
- (let* ((args (ess-function-arguments funname proc))
- (bargs (cadr args))
- (doc (mapconcat (lambda (el)
- (if (equal (car el) "...")
- "..."
- (concat (car el) "=" (cdr el))))
- bargs ", "))
- (margs (nth 2 args))
- (W (- (window-width (minibuffer-window)) (+ 4 (length
funname))))
- (multiline (eq t eldoc-echo-area-use-multiline-p))
- doc1)
- (when doc
- (setq doc (ess-eldoc-docstring-format funname doc (not multiline)))
- (when (or multiline (and margs (< (length doc1) W)))
- (setq doc1 (concat doc (propertize " || " 'face
font-lock-function-name-face)))
- (while (and margs (< (length doc1) W))
- (let ((head (pop margs)))
- (unless (assoc head bargs)
- (setq doc doc1
- doc1 (concat doc1 head "=, ")))))
- (when (equal (substring doc -2) ", ")
- (setq doc (substring doc 0 -2)))
- (when (and margs (< (length doc) W))
- (setq doc (concat doc " {--}"))))
- doc))))))
+ (when eldoc-mode
+ (when-let ((proc (ess-get-next-available-bg-process))
+ (funname (or (and ess-eldoc-show-on-symbol ;; Aggressive
completion
+ (thing-at-point 'symbol))
+ (car (ess--fn-name-start)))))
+ (let* ((args (ess-function-arguments funname proc))
+ (bargs (cadr args))
+ (doc (mapconcat (lambda (el)
+ (if (equal (car el) "...")
+ "..."
+ (concat (car el) "=" (cdr el))))
+ bargs ", "))
+ (margs (nth 2 args))
+ (W (- (window-width (minibuffer-window)) (+ 4 (length funname))))
+ (multiline (eq t eldoc-echo-area-use-multiline-p))
+ doc1)
+ (when doc
+ (setq doc (ess-eldoc-docstring-format funname doc (not multiline)))
+ (when (or multiline (and margs (< (length doc1) W)))
+ (setq doc1 (concat doc (propertize " || " 'face
font-lock-function-name-face)))
+ (while (and margs (< (length doc1) W))
+ (let ((head (pop margs)))
+ (unless (assoc head bargs)
+ (setq doc doc1
+ doc1 (concat doc1 head "=, ")))))
+ (when (equal (substring doc -2) ", ")
+ (setq doc (substring doc 0 -2)))
+ (when (and margs (< (length doc) W))
+ (setq doc (concat doc " {--}"))))
+ doc)))))
(defun ess-eldoc-docstring-format (funname doc &optional truncate)
(save-match-data
@@ -325,7 +324,7 @@ To be used instead of ESS' completion engine for R versions
>= 2.7.0."
(defun ess-r-get-object-help-string (sym)
"Help string for ac."
- (let ((proc (ess-get-next-available-process)))
+ (let ((proc (ess-get-next-available-bg-process)))
(if (null proc)
"No free ESS process found"
(let ((buf (get-buffer-create " *ess-command-output*")))
@@ -342,7 +341,7 @@ To be used instead of ESS' completion engine for R versions
>= 2.7.0."
(defun ess-r-get-arg-help-string (sym &optional proc)
"Help string for ac."
(setq sym (replace-regexp-in-string " *= *\\'" "" sym))
- (let ((proc (or proc (ess-get-next-available-process))))
+ (let ((proc (ess-get-next-available-bg-process proc)))
(if (null proc)
"No free ESS process found"
(let ((fun (car ess--fn-name-start-cache)))
@@ -364,11 +363,9 @@ To be used instead of ESS' completion engine for R
versions >= 2.7.0."
(let ((start (ess-symbol-start)))
(when start
(buffer-substring-no-properties start (point))))))
- (candidates (when (ess-can-eval-in-background)
- (let ((proc (ess-get-next-available-process)))
- (when proc
- (with-current-buffer (process-buffer proc)
- (all-completions arg (ess--get-cached-completions
arg)))))))
+ (candidates (when-let ((proc (ess-get-next-available-bg-process)))
+ (with-current-buffer (process-buffer proc)
+ (all-completions arg (ess--get-cached-completions arg)))))
(doc-buffer (company-doc-buffer (ess-r-get-object-help-string arg)))))
(defun company-R-args (command &optional arg &rest ignored)
@@ -383,21 +380,18 @@ To be used instead of ESS' completion engine for R
versions >= 2.7.0."
(cons prefix (>= (length prefix)
ess-company-arg-prefix-length))
prefix))))))
- (candidates (when (ess-can-eval-in-background)
- (let* ((proc (ess-get-next-available-process))
- (args (delete "..." (nth 2 (ess-function-arguments
+ (candidates (when-let ((proc (ess-get-next-available-bg-process)))
+ (let* ((args (delete "..." (nth 2 (ess-function-arguments
(car
ess--fn-name-start-cache) proc))))
(args (mapcar (lambda (a) (concat a
ess-R-argument-suffix))
args)))
(all-completions arg args))))
;; Displaying help for the argument in the echo area is disabled
;; by default for performance reasons. It causes delays or hangs (#1062).
- (meta (when (and (ess-can-eval-in-background)
- (bound-and-true-p ess-r--company-meta))
- (let ((proc (ess-get-next-available-process)))
- (when (and proc
- (with-current-buffer (process-buffer proc)
- (not (file-remote-p default-directory))))
+ (meta (when (bound-and-true-p ess-r--company-meta)
+ (when-let ((proc (ess-get-next-available-bg-process)))
+ (when (with-current-buffer (process-buffer proc)
+ (not (file-remote-p default-directory)))
;; fixme: ideally meta should be fetched with args
(let ((doc (ess-r-get-arg-help-string arg proc)))
(replace-regexp-in-string "^ +\\| +$" ""
- [elpa] externals/ess updated (19724bbe35 -> 2a8c385d20), ELPA Syncer, 2023/04/15
- [elpa] externals/ess bc81e67f92 04/12: Add `inferior-ess-current-process`, ELPA Syncer, 2023/04/15
- [elpa] externals/ess a9100c1938 02/12: Inspect `bg-eval-disabled` process property, ELPA Syncer, 2023/04/15
- [elpa] externals/ess de7dbecf4b 01/12: Make `ess-can-eval-in-background` a function, ELPA Syncer, 2023/04/15
- [elpa] externals/ess 47875fe1ac 03/12: Disable background commands when ESSR failed to load, ELPA Syncer, 2023/04/15
- [elpa] externals/ess da413b8bd1 05/12: Carefully check for disabled bg eval,
ELPA Syncer <=
- [elpa] externals/ess ce557f8425 06/12: Don't check for availability if bg evals are disabled, ELPA Syncer, 2023/04/15
- [elpa] externals/ess cbebb1f655 08/12: Merge pull request #1244 from emacs-ess/proc-background-eval-guard, ELPA Syncer, 2023/04/15
- [elpa] externals/ess 3b15d0efd9 09/12: Propagate ESSR init errors to elisp side, ELPA Syncer, 2023/04/15
- [elpa] externals/ess 47f86dbe09 11/12: Merge branch 'ess-command-propagate-error', ELPA Syncer, 2023/04/15
- [elpa] externals/ess 190ad9d0fb 07/12: Fix detection of stale background processes, ELPA Syncer, 2023/04/15
- [elpa] externals/ess 2a8c385d20 12/12: Don't enable enriched `ess-command` too early, ELPA Syncer, 2023/04/15
- [elpa] externals/ess 9b5f800026 10/12: Propagate `ess-command` errors to elisp side, ELPA Syncer, 2023/04/15