diff options
author | Tianxiang Xiong <tianxiang.xiong@gmail.com> | 2017-07-17 21:41:34 -0700 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2017-07-19 07:53:22 +0300 |
commit | 04cad1315b14f9dc24bd7dffa8dc718a676b79e6 (patch) | |
tree | 51ce2063fc19e3048fe1a138c88e3bdb5a0bc49f /cider-util.el | |
parent | 01d4ac835b4ce68918688c0add5efef4af38c80a (diff) |
Factor out back/forward button parts from `cider--doc-make-xrefs`
Diffstat (limited to 'cider-util.el')
-rw-r--r-- | cider-util.el | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/cider-util.el b/cider-util.el index 2e391858..497f863f 100644 --- a/cider-util.el +++ b/cider-util.el @@ -473,6 +473,26 @@ the buffer." (declare-function cider-doc-lookup "cider-doc") (declare-function cider--eldoc-remove-dot "cider-eldoc") +;; Taken from: https://github.com/emacs-mirror/emacs/blob/65c8c7cb96c14f9c6accd03cc8851b5a3459049e/lisp/help-mode.el#L551-L565 +(defun cider--make-back-forward-xrefs (&optional buffer) + "Insert special references `back' and `forward', as in `help-make-xrefs'" + (with-current-buffer (or buffer (current-buffer)) + (insert "\n") + (when (or help-xref-stack help-xref-forward-stack) + (insert "\n")) + ;; Make a back-reference in this buffer if appropriate. + (when help-xref-stack + (help-insert-xref-button help-back-label 'help-back + (current-buffer))) + ;; Make a forward-reference in this buffer if appropriate. + (when help-xref-forward-stack + (when help-xref-stack + (insert "\t")) + (help-insert-xref-button help-forward-label 'help-forward + (current-buffer))) + (when (or help-xref-stack help-xref-forward-stack) + (insert "\n")))) + ;; Similar to https://github.com/emacs-mirror/emacs/blob/65c8c7cb96c14f9c6accd03cc8851b5a3459049e/lisp/help-mode.el#L404 (defun cider--doc-make-xrefs () "Parse and hyperlink documentation cross-references in current buffer. @@ -495,23 +515,7 @@ through a stack of help buffers. Variables `help-back-label' and 'type 'help-xref 'help-function (apply-partially #'cider-doc-lookup (cider--eldoc-remove-dot symbol)))))) - - ;; create back and forward buttons if appropiate - (insert "\n") - (when (or help-xref-stack help-xref-forward-stack) - (insert "\n")) - ;; Make a back-reference in this buffer if appropriate. - (when help-xref-stack - (help-insert-xref-button help-back-label 'help-back - (current-buffer))) - ;; Make a forward-reference in this buffer if appropriate. - (when help-xref-forward-stack - (when help-xref-stack - (insert "\t")) - (help-insert-xref-button help-forward-label 'help-forward - (current-buffer))) - (when (or help-xref-stack help-xref-forward-stack) - (insert "\n"))) + (cider--make-back-forward-xrefs)) ;;; Words of inspiration |