Merge branch 'develop' into patch-1
This commit is contained in:
commit
485d0dfd39
15 changed files with 209 additions and 54 deletions
39
modules/tools/ein/README.org
Normal file
39
modules/tools/ein/README.org
Normal file
|
@ -0,0 +1,39 @@
|
|||
#+TITLE: :tools ein
|
||||
|
||||
* EIN -- Emacs IPython Notebook
|
||||
|
||||
Tool to work with Jupyter notebooks within emacs.
|
||||
|
||||
* Table of Contents :TOC:
|
||||
- [[EIN -- Emacs IPython Notebook][EIN -- Emacs IPython Notebook]]
|
||||
- [[Install][Install]]
|
||||
- [[Usage][Usage]]
|
||||
- [[Configuration][Configuration]]
|
||||
|
||||
* Install
|
||||
Add =:tool ein= to your ~doom!~ call in your private ~init.el~.
|
||||
|
||||
* Usage
|
||||
Three functions are available to start EIN:
|
||||
1. ~ein:jupyter-server-start~ --- Start a jupyter server within emacs
|
||||
2. ~ein:notebooklist-login~ --- Login to an existing jupyter server
|
||||
3. ~ein:notebooklist-open~ --- Open the list of jupyter notebooks
|
||||
|
||||
These functions do not have default key bindings.
|
||||
|
||||
When ~ein:jupyter-server-start~ is called, after successfully finishing,
|
||||
~ein:notebooklist-login~ and ~ein:notebooklist-open~ will be automatically
|
||||
called.
|
||||
|
||||
When in the ~Notebook List~ buffer, the key ~o~ calls ~ace-link~ to speed up the
|
||||
process of selecting links in the buffer.
|
||||
|
||||
If ~company-mode~ is enabled as a module, ~company-ein~ will be used for
|
||||
completion purposes.
|
||||
|
||||
* Configuration
|
||||
Specify the default directory where EIN searches for notebooks using:
|
||||
|
||||
~(set! :ein-notebook-dir "~/my-notebooks")~
|
||||
|
||||
|
26
modules/tools/ein/autoload.el
Normal file
26
modules/tools/ein/autoload.el
Normal file
|
@ -0,0 +1,26 @@
|
|||
;;; tools/ein/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +ein/ace-link-ein ()
|
||||
"Ace jump to links in ein notebooklist."
|
||||
(interactive)
|
||||
(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)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ein--collect-ein-buffer-links ()
|
||||
(interactive)
|
||||
(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))))
|
||||
|
38
modules/tools/ein/config.el
Normal file
38
modules/tools/ein/config.el
Normal file
|
@ -0,0 +1,38 @@
|
|||
;;; tools/ein/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +ein-notebook-dir "~/"
|
||||
"Default directory from where Jupyter notebooks are to be opened.")
|
||||
|
||||
(def-setting! :ein-notebook-dir (dir)
|
||||
"Set the default directory from where to open Jupyter notebooks."
|
||||
`(setq +ein-notebook-dir ,dir))
|
||||
|
||||
|
||||
(def-package! ein
|
||||
:commands (ein:notebooklist-open ein:notebooklist-login ein:jupyter-server-start)
|
||||
:init
|
||||
(set! :popup "\\*ein:*" :ignore)
|
||||
(set! :popup "\\*ein:notebooklist *" '((side . left)) '((size . 40) (select)))
|
||||
;; Ace-link on notebook list buffers
|
||||
(add-hook! 'ein:notebooklist-mode-hook
|
||||
(map! :map ein:notebooklist-mode-map
|
||||
"o" #'+ein/ace-link-ein))
|
||||
;; Ein uses request to store http cookies. Store them in the cache dir.
|
||||
(setq request-storage-directory (concat doom-cache-dir "/request"))
|
||||
;; Auto complete with company
|
||||
(set! :company-backend '(ein:notebook-multilang-mode ein:notebook-python-mode ein:notebook-plain-mode)
|
||||
'ein:company-backend)
|
||||
:config
|
||||
;; Manually load the autoloads of EIN. This takes time...
|
||||
(load "ein-loaddefs.el" nil t t)
|
||||
(setq
|
||||
;; Slide images into rows so that we can navigate buffers with images more easily
|
||||
ein:slice-image t
|
||||
ein:jupyter-default-notebook-directory +ein-notebook-dir
|
||||
ein:jupyter-default-server-command "/usr/bin/jupyter"
|
||||
ein:jupyter-server-args '("--no-browser")
|
||||
ein:notebook-modes
|
||||
'(ein:notebook-multilang-mode ein:notebook-python-mode ein:notebook-plain-mode))
|
||||
;; Avy is required for showing links in the notebook list with ace-link.
|
||||
(require 'avy))
|
||||
|
4
modules/tools/ein/packages.el
Normal file
4
modules/tools/ein/packages.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/ein/packages.el
|
||||
|
||||
(package! ein)
|
10
modules/tools/pdf/+modeline.el
Normal file
10
modules/tools/pdf/+modeline.el
Normal file
|
@ -0,0 +1,10 @@
|
|||
;;; tools/pdf/+modeline.el -*- lexical-binding: t; -*-
|
||||
|
||||
|
||||
(def-modeline-segment! +pdf-tools-pages
|
||||
"Current and total page indicator for PDF documents."
|
||||
(format " P %d/%d" (pdf-view-current-page) (pdf-cache-number-of-pages)))
|
||||
|
||||
(def-modeline! pdf-tools-modeline
|
||||
(bar matches " " buffer-info +pdf-tools-pages)
|
||||
(major-mode vcs))
|
|
@ -6,28 +6,22 @@
|
|||
:config
|
||||
(unless noninteractive
|
||||
(pdf-tools-install))
|
||||
|
||||
(map! :map pdf-view-mode-map
|
||||
"q" #'kill-this-buffer
|
||||
doom-leader-key nil)
|
||||
|
||||
|
||||
(map! :map pdf-view-mode-map
|
||||
"q" #'kill-this-buffer
|
||||
doom-leader-key nil)
|
||||
|
||||
(setq-default pdf-view-display-size 'fit-page)
|
||||
;; turn off cua so copy works
|
||||
(add-hook! 'pdf-view-mode-hook (cua-mode 0)))
|
||||
|
||||
|
||||
(when (featurep! :lang latex)
|
||||
(after! latex
|
||||
;; add to the program list
|
||||
(add-to-list 'TeX-view-program-selection
|
||||
'(output-pdf "PDF Tools"))
|
||||
(add-to-list 'TeX-view-program-list
|
||||
'("PDF Tools" ("TeX-pdf-tools-sync-view")))
|
||||
|
||||
;; enable document revert
|
||||
(add-hook 'TeX-after-compilation-finished-functions
|
||||
#'TeX-revert-document-buffer)
|
||||
|
||||
;; correlated mode
|
||||
(setq TeX-source-correlate-start-server t
|
||||
TeX-source-correlate-mode t)))
|
||||
;; Turn off cua so copy works
|
||||
(add-hook! 'pdf-view-mode-hook (cua-mode 0))
|
||||
;; Custom modeline that removes useless info and adds page numbers
|
||||
(when (featurep! :ui doom-modeline)
|
||||
(load! +modeline)
|
||||
(add-hook! pdf-tools-enabled (doom-set-modeline 'pdf-tools-modeline)))
|
||||
;; Handle PDF-tools related popups better
|
||||
(set! :popup "^\\*Outline*" '((side . right) (size . 40)) '((select)))
|
||||
;; TODO: Add additional important windows that should be handled differently
|
||||
;; TODO: These two next rules don't work (they should), investigate
|
||||
;; (set! :popup "\\*Contents\\*" '((side . right) (size . 40)) nil)
|
||||
;; (set! :popup "* annots\\*$" '((side . left) (size . 40)) '((select)))
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue