Merge branch 'develop' into patch-1

This commit is contained in:
Henrik Lissner 2018-04-18 00:21:45 -04:00 committed by GitHub
commit 485d0dfd39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 209 additions and 54 deletions

View file

@ -96,9 +96,13 @@ missing) and shouldn't be deleted.")
package-user-dir (expand-file-name "elpa" doom-packages-dir) package-user-dir (expand-file-name "elpa" doom-packages-dir)
package-enable-at-startup nil package-enable-at-startup nil
package-archives package-archives
'(("gnu" . "https://elpa.gnu.org/packages/") (if (getenv "INSECURE")
("melpa" . "https://melpa.org/packages/") '(("gnu" . "http://elpa.gnu.org/packages/")
("org" . "https://orgmode.org/elpa/")) ("melpa" . "http://melpa.org/packages/")
("org" . "http://orgmode.org/elpa/"))
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
;; I omit Marmalade because its packages are manually submitted rather ;; I omit Marmalade because its packages are manually submitted rather
;; than pulled, so packages are often out of date with upstream. ;; than pulled, so packages are often out of date with upstream.

View file

@ -597,7 +597,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
((doom-real-buffer-p buf) ((doom-real-buffer-p buf)
(if (and buffer-file-name (if (and buffer-file-name
(buffer-modified-p buf) (buffer-modified-p buf)
(not (y-or-n-p "Buffer %s is modified; kill anyway?"))) (not (y-or-n-p
(format "Buffer %s is modified; kill anyway?" buf))))
(message "Aborted") (message "Aborted")
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(when (or ;; if there aren't more real buffers than visible buffers, (when (or ;; if there aren't more real buffers than visible buffers,

View file

@ -41,6 +41,7 @@
:tools :tools
dired ; making dired pretty [functional] dired ; making dired pretty [functional]
ein ; tame Jupyter notebooks with emacs
electric-indent ; smarter, keyword-based electric-indent electric-indent ; smarter, keyword-based electric-indent
eshell ; a consistent, cross-platform shell (WIP) eshell ; a consistent, cross-platform shell (WIP)
gist ; interacting with github gists gist ; interacting with github gists

View file

@ -1,4 +1,4 @@
FROM ${1:phusion/baseimage:latest} FROM ${1:phusion/baseimage:latest}
MAINTAINER ${2:Henrik Lissner <henrik@lissner.net>} MAINTAINER ${2:`user-full-name` <`user-mail-address`>}
$0 $0

View file

@ -361,7 +361,7 @@ end of the workspace list."
(index (cl-position current-name persps))) (index (cl-position current-name persps)))
(when (= perspc 1) (when (= perspc 1)
(user-error "No other workspaces")) (user-error "No other workspaces"))
(+workspace/switch-to (% (+ index n) perspc)) (+workspace/switch-to (% (+ index n perspc) perspc))
(unless (called-interactively-p 'interactive) (unless (called-interactively-p 'interactive)
(+workspace/display))) (+workspace/display)))
('user-error (+workspace-error (cadr ex) t)) ('user-error (+workspace-error (cadr ex) t))

View file

@ -8,6 +8,8 @@
("addbibresource" "[{") ("addbibresource" "[{")
;; Standard commands ;; Standard commands
("cite" "[{") ("cite" "[{")
("citep" "[{")
("citet" "[{")
("Cite" "[{") ("Cite" "[{")
("parencite" "[{") ("parencite" "[{")
("Parencite" "[{") ("Parencite" "[{")

View file

@ -26,28 +26,54 @@ Set these variables in your private configuration with:
#+END_SRC #+END_SRC
If the variables are not set, they are ignored. If the variables are not set, they are ignored.
** Choose View Program
You have four options to choose from for the viewer of your PDF rendered files.
*** Okular
Use Okular as default PDF viewer.
Activate with the flag '+okular' of the latex module in your private init.el.
#+BEGIN_SRC emacs_lisp
(latex +okular)
#+END_SRC
*** Skim
For Mac users. Use Skim to preview your PDFs.
Activate with the flag '+skim' of the latex module in your private init.el.
#+BEGIN_SRC emacs_lisp
(latex +skim)
#+END_SRC
*** PDF Tools
Use the PDF Tools package to preview your PDFs. Requires the tools module ~pdf~ enabled in your configuration.
#+BEGIN_SRC emacs_lisp
(:tools pdf)
#+END_SRC
Activate with the flag '+pdf-tools' of the latex module in your private init.el.
#+BEGIN_SRC emacs_lisp
(latex +pdf-tools=)
#+END_SRC
*** Preview Pane
You may wish to use the old school package ~latex-preview-pane~ instead of the
other alternatives. ~latex-preview-pane~ uses a ~DocView~ instead.
Activate with the flag '+preview-pane' of the latex module in your private init.el.
#+BEGIN_SRC emacs_lisp
(latex +preview-pane)
#+END_SRC
** LatexMk ** LatexMk
Use LatexMk instead of normal LaTeX to compile documents. LatexMk only needs to run once to get all references, bibliography and other things right. Use LatexMk instead of normal LaTeX to compile documents. LatexMk only needs to
run once to get all references, bibliography and other things right.
Activate with the flag '+latexmk' of the latex module in init.el. Activate with the flag '+latexmk' of the latex module in init.el.
#+BEGIN_SRC emacs_lisp #+BEGIN_SRC emacs_lisp
(latex +latexmk) (latex +latexmk)
#+END_SRC #+END_SRC
** Okular You can enable both a custom view program and LatexMk with a call such as:
Use Okular as default PDF viewer.
Activate with the flag '+okular' of the latex module in init.el.
#+BEGIN_SRC emacs_lisp #+BEGIN_SRC emacs_lisp
(latex +okular) (latex +latexmk +okular)
#+END_SRC
** Preivew-Pane
Instead of using an external program to display rendered .tex files, use an emacs window to display the rendered file.
This flag is incompatible with the ~+okular~ flag.
Activate with the flag '+preview-pane' of the latex module in init.el.
#+BEGIN_SRC emacs_lisp
(latex +preview-pane)
#+END_SRC #+END_SRC

View file

@ -103,21 +103,31 @@
LaTeX-indent-environment-list)))) LaTeX-indent-environment-list))))
(after! latex (after! latex
;; Use Okular is the user says so. ;; Use Okular if the user says so.
(when (featurep! +okular) (when (featurep! +okular)
;; Configure Okular as viewer. Including a bug fix ;; Configure Okular as viewer. Including a bug fix
;; (https://bugs.kde.org/show_bug.cgi?id=373855) ;; (https://bugs.kde.org/show_bug.cgi?id=373855)
(add-to-list 'TeX-view-program-list (add-to-list 'TeX-view-program-list
'("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a")))) '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
(add-to-list 'TeX-view-program-selection (add-to-list 'TeX-view-program-selection
'(output-pdf "Okular")))) '(output-pdf "Okular")))
(after! latex ;; Or Skim
(when (featurep! +skim) (when (featurep! +skim)
(add-to-list 'TeX-view-program-list (add-to-list 'TeX-view-program-list
'("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")) '("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
(add-to-list 'TeX-view-program-selection (add-to-list 'TeX-view-program-selection
'(output-pdf "Skim")))) '(output-pdf "Skim")))
;; Or PDF-tools, but only if the module is also loaded
(when (and (featurep! :tools pdf) (featurep! +pdf-tools))
(add-to-list 'TeX-view-program-list
'("PDF Tools" ("TeX-pdf-tools-sync-view")))
(add-to-list 'TeX-view-program-selection
'(output-pdf "PDF Tools"))
;; Enable auto reverting the PDF document with PDF Tools
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)))
(def-package! preview (def-package! preview
@ -136,6 +146,8 @@
reftex-toc-split-windows-fraction 0.3) reftex-toc-split-windows-fraction 0.3)
(unless (string-empty-p +latex-bibtex-file) (unless (string-empty-p +latex-bibtex-file)
(setq reftex-default-bibliography (list (expand-file-name +latex-bibtex-file)))) (setq reftex-default-bibliography (list (expand-file-name +latex-bibtex-file))))
(add-hook! (latex-mode LaTeX-mode) #'turn-on-reftex)
:config
;; Get ReTeX working with biblatex ;; Get ReTeX working with biblatex
;; http://tex.stackexchange.com/questions/31966/setting-up-reftex-with-biblatex-citation-commands/31992#31992 ;; http://tex.stackexchange.com/questions/31966/setting-up-reftex-with-biblatex-citation-commands/31992#31992
(setq reftex-cite-format (setq reftex-cite-format
@ -146,8 +158,6 @@
(?f . "\\footcite[]{%l}") (?f . "\\footcite[]{%l}")
(?n . "\\nocite{%l}") (?n . "\\nocite{%l}")
(?b . "\\blockcquote[]{%l}{}"))) (?b . "\\blockcquote[]{%l}{}")))
(add-hook! (latex-mode LaTeX-mode) #'turn-on-reftex)
:config
(map! :map reftex-mode-map (map! :map reftex-mode-map
:localleader :n ";" 'reftex-toc) :localleader :n ";" 'reftex-toc)
(add-hook! 'reftex-toc-mode-hook (add-hook! 'reftex-toc-mode-hook

View 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")~

View 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))))

View 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))

View file

@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; tools/ein/packages.el
(package! ein)

View 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))

View file

@ -7,27 +7,21 @@
(unless noninteractive (unless noninteractive
(pdf-tools-install)) (pdf-tools-install))
(map! :map pdf-view-mode-map (map! :map pdf-view-mode-map
"q" #'kill-this-buffer "q" #'kill-this-buffer
doom-leader-key nil) doom-leader-key nil)
(setq-default pdf-view-display-size 'fit-page) (setq-default pdf-view-display-size 'fit-page)
;; turn off cua so copy works ;; Turn off cua so copy works
(add-hook! 'pdf-view-mode-hook (cua-mode 0))) (add-hook! 'pdf-view-mode-hook (cua-mode 0))
;; Custom modeline that removes useless info and adds page numbers
(when (featurep! :ui doom-modeline)
(when (featurep! :lang latex) (load! +modeline)
(after! latex (add-hook! pdf-tools-enabled (doom-set-modeline 'pdf-tools-modeline)))
;; add to the program list ;; Handle PDF-tools related popups better
(add-to-list 'TeX-view-program-selection (set! :popup "^\\*Outline*" '((side . right) (size . 40)) '((select)))
'(output-pdf "PDF Tools")) ;; TODO: Add additional important windows that should be handled differently
(add-to-list 'TeX-view-program-list ;; TODO: These two next rules don't work (they should), investigate
'("PDF Tools" ("TeX-pdf-tools-sync-view"))) ;; (set! :popup "\\*Contents\\*" '((side . right) (size . 40)) nil)
;; (set! :popup "* annots\\*$" '((side . left) (size . 40)) '((select)))
;; 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)))

View file

@ -37,8 +37,8 @@ Some might want my modeline without the DOOM config altogether. I've tried to ma
+ Replace ~def-package!~ calls with ~use-package~. + Replace ~def-package!~ calls with ~use-package~.
+ Replace ~doom-project-root~ calls with ~projectile-project-root~. + Replace ~doom-project-root~ calls with ~projectile-project-root~.
+ The ~+doom-modeline--make-xpm~ function is memoized with the ~def-memoized!~ macro. Change ~def-memoized!~ to ~defun~. + The ~+doom-modeline--make-xpm~ function is memoized with the ~def-memoized!~ macro. Change ~def-memoized!~ to ~defun~.
+ Copy the ~add-hook!~ macro definition from [[/master/core/core-lib.el][core/core-lib.el]]. + Copy the ~add-hook!~ macro definition from [[/core/core-lib.el][core/core-lib.el]].
+ Copy the following macros and functions from [[/master/core/core-ui.el][core/core-ui.el]]: + Copy the following macros and functions from [[/core/core-ui.el][core/core-ui.el]]:
+ ~def-modeline-segment!~ + ~def-modeline-segment!~
+ ~def-modeline!~ + ~def-modeline!~
+ ~doom--prepare-modeline-segments~ + ~doom--prepare-modeline-segments~