feat: Lookup docs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
;;; emacs-lisp.el -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'syd-handle-repl)
|
||||
(require 'syd-handle-lookup)
|
||||
;; (require 'handle)
|
||||
|
||||
;; Don't `use-package' `ielm', since it's loaded by Emacs. You'll get weird
|
||||
;; autoload errors if you do.
|
||||
@@ -20,7 +22,25 @@
|
||||
(bury-buffer b)
|
||||
b)))))
|
||||
|
||||
(add-to-list '+syd-major-mode-repl-alist
|
||||
'(emacs-lisp-mode syd/open-emacs-lisp-repl))
|
||||
(defun syd-emacs-lisp-lookup-documentation (identifier)
|
||||
"Lookup IDENTIFIER with `describe-symbol'"
|
||||
;; HACK: Much to my frustration, `describe-symbol' has no defined
|
||||
;; return value. To test if the call was successful or not, we
|
||||
;; check if any window is displaying the help buffer. This probably
|
||||
;; breaks if `syd-emacs-lisp-lookup-documentation' is called while
|
||||
;; the help buffer is already open.
|
||||
(describe-symbol (intern identifier))
|
||||
(let ((buffer (get-buffer (help-buffer))))
|
||||
(and (get-buffer-window-list buffer)
|
||||
buffer)))
|
||||
|
||||
(set-repl-handler! 'emacs-lisp-mode
|
||||
#'syd/open-emacs-lisp-repl)
|
||||
|
||||
(defun syd-emacs-set-handlers ()
|
||||
(setq-local syd-lookup-documentation-handlers
|
||||
(list #'syd-emacs-lisp-lookup-documentation)))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook #'syd-emacs-set-handlers)
|
||||
|
||||
(provide 'syd-lang-emacs-lisp)
|
||||
|
||||
Reference in New Issue
Block a user