diff --git a/core/core-packages.el b/core/core-packages.el index f08790f65..e03eaba50 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -96,9 +96,13 @@ missing) and shouldn't be deleted.") package-user-dir (expand-file-name "elpa" doom-packages-dir) package-enable-at-startup nil package-archives - '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/")) + (if (getenv "INSECURE") + '(("gnu" . "http://elpa.gnu.org/packages/") + ("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 ;; than pulled, so packages are often out of date with upstream. diff --git a/core/core-ui.el b/core/core-ui.el index 3e278d926..89568bd20 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -597,7 +597,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ((doom-real-buffer-p buf) (if (and buffer-file-name (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") (set-buffer-modified-p nil) (when (or ;; if there aren't more real buffers than visible buffers, diff --git a/init.example.el b/init.example.el index ad85c66ce..e6a24f692 100644 --- a/init.example.el +++ b/init.example.el @@ -41,6 +41,7 @@ :tools dired ; making dired pretty [functional] + ein ; tame Jupyter notebooks with emacs electric-indent ; smarter, keyword-based electric-indent eshell ; a consistent, cross-platform shell (WIP) gist ; interacting with github gists diff --git a/modules/feature/file-templates/templates/dockerfile-mode/__ b/modules/feature/file-templates/templates/dockerfile-mode/__ index 0bd4b7a1a..9d1f81ed9 100644 --- a/modules/feature/file-templates/templates/dockerfile-mode/__ +++ b/modules/feature/file-templates/templates/dockerfile-mode/__ @@ -1,4 +1,4 @@ FROM ${1:phusion/baseimage:latest} -MAINTAINER ${2:Henrik Lissner } +MAINTAINER ${2:`user-full-name` <`user-mail-address`>} $0 \ No newline at end of file diff --git a/modules/feature/workspaces/autoload/workspaces.el b/modules/feature/workspaces/autoload/workspaces.el index 8550ad07e..35d615ccb 100644 --- a/modules/feature/workspaces/autoload/workspaces.el +++ b/modules/feature/workspaces/autoload/workspaces.el @@ -361,7 +361,7 @@ end of the workspace list." (index (cl-position current-name persps))) (when (= perspc 1) (user-error "No other workspaces")) - (+workspace/switch-to (% (+ index n) perspc)) + (+workspace/switch-to (% (+ index n perspc) perspc)) (unless (called-interactively-p 'interactive) (+workspace/display))) ('user-error (+workspace-error (cadr ex) t)) diff --git a/modules/lang/latex/+fontification.el b/modules/lang/latex/+fontification.el index fa853e726..627931543 100644 --- a/modules/lang/latex/+fontification.el +++ b/modules/lang/latex/+fontification.el @@ -8,6 +8,8 @@ ("addbibresource" "[{") ;; Standard commands ("cite" "[{") + ("citep" "[{") + ("citet" "[{") ("Cite" "[{") ("parencite" "[{") ("Parencite" "[{") diff --git a/modules/lang/latex/README.org b/modules/lang/latex/README.org index 620669f40..7bdc815e7 100644 --- a/modules/lang/latex/README.org +++ b/modules/lang/latex/README.org @@ -26,28 +26,54 @@ Set these variables in your private configuration with: #+END_SRC 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 -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. #+BEGIN_SRC emacs_lisp (latex +latexmk) #+END_SRC -** Okular -Use Okular as default PDF viewer. - -Activate with the flag '+okular' of the latex module in init.el. +You can enable both a custom view program and LatexMk with a call such as: #+BEGIN_SRC emacs_lisp -(latex +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) +(latex +latexmk +okular) #+END_SRC diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index f0a85e9d0..61b877c43 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -103,21 +103,31 @@ LaTeX-indent-environment-list)))) (after! latex - ;; Use Okular is the user says so. + ;; Use Okular if the user says so. (when (featurep! +okular) ;; Configure Okular as viewer. Including a bug fix ;; (https://bugs.kde.org/show_bug.cgi?id=373855) (add-to-list 'TeX-view-program-list '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a")))) (add-to-list 'TeX-view-program-selection - '(output-pdf "Okular")))) + '(output-pdf "Okular"))) -(after! latex + ;; Or Skim (when (featurep! +skim) (add-to-list 'TeX-view-program-list '("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")) (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 @@ -136,6 +146,8 @@ reftex-toc-split-windows-fraction 0.3) (unless (string-empty-p +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 ;; http://tex.stackexchange.com/questions/31966/setting-up-reftex-with-biblatex-citation-commands/31992#31992 (setq reftex-cite-format @@ -146,8 +158,6 @@ (?f . "\\footcite[]{%l}") (?n . "\\nocite{%l}") (?b . "\\blockcquote[]{%l}{}"))) - (add-hook! (latex-mode LaTeX-mode) #'turn-on-reftex) - :config (map! :map reftex-mode-map :localleader :n ";" 'reftex-toc) (add-hook! 'reftex-toc-mode-hook diff --git a/modules/tools/ein/README.org b/modules/tools/ein/README.org new file mode 100644 index 000000000..bd54c8474 --- /dev/null +++ b/modules/tools/ein/README.org @@ -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")~ + + diff --git a/modules/tools/ein/autoload.el b/modules/tools/ein/autoload.el new file mode 100644 index 000000000..d30f5119e --- /dev/null +++ b/modules/tools/ein/autoload.el @@ -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)))) + diff --git a/modules/tools/ein/config.el b/modules/tools/ein/config.el new file mode 100644 index 000000000..273358a29 --- /dev/null +++ b/modules/tools/ein/config.el @@ -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)) + diff --git a/modules/tools/ein/packages.el b/modules/tools/ein/packages.el new file mode 100644 index 000000000..19ab85d38 --- /dev/null +++ b/modules/tools/ein/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; tools/ein/packages.el + +(package! ein) diff --git a/modules/tools/pdf/+modeline.el b/modules/tools/pdf/+modeline.el new file mode 100644 index 000000000..eb0acb7bd --- /dev/null +++ b/modules/tools/pdf/+modeline.el @@ -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)) diff --git a/modules/tools/pdf/config.el b/modules/tools/pdf/config.el index 3e7115f39..0dd7c0fc9 100644 --- a/modules/tools/pdf/config.el +++ b/modules/tools/pdf/config.el @@ -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))) + ) diff --git a/modules/ui/doom-modeline/README.org b/modules/ui/doom-modeline/README.org index fcb8f4685..28590ef8f 100644 --- a/modules/ui/doom-modeline/README.org +++ b/modules/ui/doom-modeline/README.org @@ -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 ~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~. -+ Copy the ~add-hook!~ macro definition from [[/master/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 ~add-hook!~ macro definition from [[/core/core-lib.el][core/core-lib.el]]. ++ Copy the following macros and functions from [[/core/core-ui.el][core/core-ui.el]]: + ~def-modeline-segment!~ + ~def-modeline!~ + ~doom--prepare-modeline-segments~