aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2020-10-30 21:47:44 +0000
committerJoão Távora2020-10-30 22:31:20 +0000
commit3758be484e0a3f54eab968a0ee8bec31b9cd92c3 (patch)
treeca57d43079f4367db3b5740aa03ab00cfd67b826
parent2e1ab3e583d911afc7e263922f0672d0299bd515 (diff)
downloademacs-3758be484e0a3f54eab968a0ee8bec31b9cd92c3.tar.gz
emacs-3758be484e0a3f54eab968a0ee8bec31b9cd92c3.zip
Don't make ElDoc doc buffer visible in buffer list by default
Fixes: bug#44334 * lisp/emacs-lisp/eldoc.el (eldoc-doc-buffer): No longer take INTERACTIVE arg. Show buffer if invisible. (eldoc--format-doc-buffer): Don't change buffer visibility. (eldoc-display-in-buffer): Show buffer if invisible if by calling eldoc-doc-buffer.
-rw-r--r--lisp/emacs-lisp/eldoc.el48
1 files changed, 30 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 922de18743d..10dc3be44da 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -450,20 +450,27 @@ directly from the user or from ElDoc's automatic mechanisms'.")
450 450
451(defvar eldoc--doc-buffer-docs nil "Documentation items in `eldoc--doc-buffer'.") 451(defvar eldoc--doc-buffer-docs nil "Documentation items in `eldoc--doc-buffer'.")
452 452
453(defun eldoc-doc-buffer (&optional interactive) 453(defun eldoc-doc-buffer ()
454 (interactive (list t))
455 "Display ElDoc documentation buffer. 454 "Display ElDoc documentation buffer.
455
456This holds the results of the last documentation request." 456This holds the results of the last documentation request."
457 (interactive)
457 (unless (buffer-live-p eldoc--doc-buffer) 458 (unless (buffer-live-p eldoc--doc-buffer)
458 (setq eldoc--doc-buffer (get-buffer-create "*eldoc*"))) 459 (user-error (format
459 (when interactive 460 "ElDoc buffer doesn't exist, maybe `%s' to produce one."
460 (display-buffer eldoc--doc-buffer))) 461 (substitute-command-keys "\\[eldoc]"))))
462 (with-current-buffer eldoc--doc-buffer
463 (rename-buffer (replace-regexp-in-string "^ *" ""
464 (buffer-name)))
465 (display-buffer (current-buffer))))
461 466
462(defun eldoc--format-doc-buffer (docs) 467(defun eldoc--format-doc-buffer (docs)
463 "Ensure DOCS are displayed in an *eldoc* buffer." 468 "Ensure DOCS are displayed in an *eldoc* buffer."
464 (interactive (list t)) 469 (interactive (list t))
465 (eldoc-doc-buffer) ;; ensure buffer exists 470 (with-current-buffer (if (buffer-live-p eldoc--doc-buffer)
466 (with-current-buffer eldoc--doc-buffer 471 eldoc--doc-buffer
472 (setq eldoc--doc-buffer
473 (get-buffer-create " *eldoc*")))
467 (unless (eq docs eldoc--doc-buffer-docs) 474 (unless (eq docs eldoc--doc-buffer-docs)
468 (setq-local eldoc--doc-buffer-docs docs) 475 (setq-local eldoc--doc-buffer-docs docs)
469 (let ((inhibit-read-only t) 476 (let ((inhibit-read-only t)
@@ -482,14 +489,19 @@ This holds the results of the last documentation request."
482 ": " 489 ": "
483 this-doc)) 490 this-doc))
484 do (insert this-doc) 491 do (insert this-doc)
485 when rest do (insert "\n")) 492 when rest do (insert "\n")
486 ;; Maybe rename the buffer. 493 finally (goto-char (point-min)))
487 (rename-buffer (if things-reported-on 494 ;; Rename the buffer, taking into account whether it was
488 (format "*eldoc for %s*" 495 ;; hidden or not
489 (mapconcat (lambda (s) (format "%s" s)) 496 (rename-buffer (format "%s*eldoc%s*"
490 things-reported-on 497 (if (string-match "^ " (buffer-name)) " " "")
491 ", ")) 498 (if things-reported-on
492 "*eldoc*"))))) 499 (format " for %s"
500 (mapconcat
501 (lambda (s) (format "%s" s))
502 things-reported-on
503 ", "))
504 ""))))))
493 eldoc--doc-buffer) 505 eldoc--doc-buffer)
494 506
495(defun eldoc--echo-area-substring (available) 507(defun eldoc--echo-area-substring (available)
@@ -595,9 +607,9 @@ Honor `eldoc-echo-area-use-multiline-p' and
595(defun eldoc-display-in-buffer (docs interactive) 607(defun eldoc-display-in-buffer (docs interactive)
596 "Display DOCS in a dedicated buffer. 608 "Display DOCS in a dedicated buffer.
597If INTERACTIVE is t, also display the buffer." 609If INTERACTIVE is t, also display the buffer."
598 (let ((buf (eldoc--format-doc-buffer docs))) 610 (eldoc--format-doc-buffer docs)
599 (when interactive 611 (when interactive
600 (display-buffer buf)))) 612 (eldoc-doc-buffer)))
601 613
602(defun eldoc-documentation-default () 614(defun eldoc-documentation-default ()
603 "Show first doc string for item at point. 615 "Show first doc string for item at point.