2018-04-11 12:31:33 +02:00
|
|
|
;;; tools/ein/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
|
2018-06-24 17:13:23 +02:00
|
|
|
;; FIXME obsolete :ein-notebook-dir
|
2018-05-25 00:46:11 +02:00
|
|
|
;;;###autoload
|
|
|
|
(def-setting! :ein-notebook-dir (dir)
|
|
|
|
"Set the default directory from where to open Jupyter notebooks."
|
|
|
|
`(setq ein:jupyter-default-notebook-directory ,dir))
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;; Library
|
|
|
|
;;
|
|
|
|
|
|
|
|
(defun +ein--collect-ein-buffer-links ()
|
|
|
|
(let ((end (window-end))
|
|
|
|
points)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (window-start))
|
|
|
|
(while (re-search-forward "~?/.+\\|\s\\[" end t)
|
|
|
|
(push (+ (match-beginning 0) 1) points))
|
|
|
|
(nreverse points))))
|
|
|
|
|
2018-04-11 12:31:33 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun +ein/ace-link-ein ()
|
|
|
|
"Ace jump to links in ein notebooklist."
|
|
|
|
(interactive)
|
2018-05-25 00:46:11 +02:00
|
|
|
(require 'avy)
|
2018-04-11 12:31:33 +02:00
|
|
|
(let ((res (avy-with +ein/ace-link-ein
|
|
|
|
(avy--process
|
|
|
|
(+ein--collect-ein-buffer-links)
|
|
|
|
#'avy--overlay-pre))))
|
|
|
|
;(avy--style-fn avy-style)))))
|
|
|
|
(when (numberp res)
|
|
|
|
(goto-char (1+ res))
|
|
|
|
(widget-button-press (point)))))
|
|
|
|
|
|
|
|
|