2017-05-28 12:32:48 +02:00
|
|
|
;;; Emacs config
|
2016-10-14 14:03:30 +02:00
|
|
|
|
2012-06-15 16:54:02 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; Prerequisites
|
2013-06-07 20:17:26 +02:00
|
|
|
|
2018-06-01 11:09:36 +02:00
|
|
|
(let ((minver "26.1"))
|
2017-06-18 19:05:50 +02:00
|
|
|
(when (version< emacs-version minver)
|
|
|
|
(error "Your Emacs is too old -- this config requires v%s or higher" minver)))
|
|
|
|
|
2017-06-18 19:40:38 +02:00
|
|
|
;;; Speed up init.
|
|
|
|
;;; Temporarily reduce garbage collection during startup. Inspect `gcs-done'.
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/reset-gc-cons-threshold ()
|
2017-06-18 19:06:09 +02:00
|
|
|
(setq gc-cons-threshold (car (get 'gc-cons-threshold 'standard-value))))
|
|
|
|
(setq gc-cons-threshold (* 64 1024 1024))
|
2018-02-13 13:42:11 +01:00
|
|
|
(add-hook 'after-init-hook 'ambrevar/reset-gc-cons-threshold)
|
2017-06-18 19:40:38 +02:00
|
|
|
;;; Temporarily disable the file name handler.
|
|
|
|
(setq default-file-name-handler-alist file-name-handler-alist)
|
|
|
|
(setq file-name-handler-alist nil)
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/reset-file-name-handler-alist ()
|
2018-09-24 16:34:38 +02:00
|
|
|
(setq file-name-handler-alist
|
|
|
|
(append default-file-name-handler-alist
|
2018-09-28 16:24:26 +02:00
|
|
|
file-name-handler-alist))
|
|
|
|
(cl-delete-duplicates file-name-handler-alist :test 'equal))
|
2018-02-13 13:42:11 +01:00
|
|
|
(add-hook 'after-init-hook 'ambrevar/reset-file-name-handler-alist)
|
2017-06-18 19:06:09 +02:00
|
|
|
|
2018-04-10 21:18:48 +02:00
|
|
|
;;; Avoid the "loaded old bytecode instead of newer source" pitfall.
|
|
|
|
(setq load-prefer-newer t)
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; Store additional config in a 'lisp' subfolder and add it to the load path so
|
|
|
|
;;; that `require' can find the files.
|
2018-02-16 23:08:18 +01:00
|
|
|
;;; This must be done before moving `user-emacs-directory'.
|
2017-10-16 19:21:24 +02:00
|
|
|
(add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory))
|
|
|
|
|
2018-02-16 23:08:18 +01:00
|
|
|
;;; Move user-emacs-directory so that user files don't mix with cache files.
|
|
|
|
(setq user-emacs-directory "~/.cache/emacs/")
|
|
|
|
|
2019-02-27 16:02:13 +01:00
|
|
|
;; Tor / Proxy: set up before package initialization.
|
2020-03-06 08:18:24 +01:00
|
|
|
(require 'functions) ; Needed for `ambrevar/toggle-proxy'.
|
2020-03-04 17:33:00 +01:00
|
|
|
(ambrevar/toggle-proxy)
|
2019-02-27 16:02:13 +01:00
|
|
|
|
2017-11-26 18:08:17 +01:00
|
|
|
(when (require 'package nil t)
|
2018-10-25 20:11:32 +02:00
|
|
|
;; Different Emacs versions have different byte code. If a versioned ELPA
|
2018-03-01 19:10:37 +01:00
|
|
|
;; directory is found, use it.
|
|
|
|
(let ((versioned-dir (format "elpa-%s.%s" emacs-major-version emacs-minor-version)))
|
|
|
|
(when (member versioned-dir (directory-files (expand-file-name ".." package-user-dir)))
|
|
|
|
(setq package-user-dir (expand-file-name (concat "../" versioned-dir) package-user-dir))))
|
2018-10-25 20:11:32 +02:00
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
2018-02-07 10:28:29 +01:00
|
|
|
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
|
2017-11-26 18:08:17 +01:00
|
|
|
(package-initialize))
|
|
|
|
|
2017-10-16 19:21:24 +02:00
|
|
|
;;; Site Lisp folder for local packages and development.
|
2018-01-19 09:12:13 +01:00
|
|
|
;; We need to roll it out manually since we want it first in the `load-path',
|
|
|
|
;; while `normal-top-level-add-subdirs-to-load-path' appends it to the very end.
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/package-refresh-load-path (path)
|
2017-10-16 19:21:24 +02:00
|
|
|
"Add every non-hidden sub-folder of PATH to `load-path'."
|
|
|
|
(when (file-directory-p path)
|
|
|
|
(dolist (dir (directory-files path t "^[^\\.]"))
|
|
|
|
(when (file-directory-p dir)
|
2018-04-06 15:28:09 +02:00
|
|
|
(setq load-path (add-to-list 'load-path dir))
|
|
|
|
(dolist (subdir (directory-files dir t "^[^\\.]"))
|
|
|
|
(when (file-directory-p subdir)
|
|
|
|
(setq load-path (add-to-list 'load-path subdir))))))))
|
2018-02-16 23:08:18 +01:00
|
|
|
(let ((site-lisp (expand-file-name "site-lisp/" "~/.local/share/emacs/")))
|
2017-10-16 19:21:24 +02:00
|
|
|
(add-to-list 'load-path site-lisp)
|
2018-02-13 13:42:11 +01:00
|
|
|
(ambrevar/package-refresh-load-path site-lisp))
|
2012-10-12 13:47:10 +02:00
|
|
|
|
2017-12-25 12:36:31 +01:00
|
|
|
;;; Local config. See below for an example usage.
|
|
|
|
(load "local-before" t)
|
|
|
|
|
2019-03-03 13:31:16 +01:00
|
|
|
(require 'hook-functions)
|
2017-09-02 12:10:55 +02:00
|
|
|
(require 'main)
|
2014-02-12 17:48:29 +01:00
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-03-08 11:48:35 +01:00
|
|
|
|
2020-03-11 12:53:20 +01:00
|
|
|
(add-to-list 'auto-mode-alist (cons "\\.adoc\\'" 'adoc-mode)):w
|
|
|
|
|
|
|
|
|
2014-12-16 10:10:41 +01:00
|
|
|
(add-to-list 'load-path "/usr/share/asymptote")
|
2017-07-27 00:08:58 +02:00
|
|
|
(autoload 'asy-mode "asy-mode" "Asymptote major mode." t)
|
|
|
|
(autoload 'lasy-mode "asy-mode" "Hybrid Asymptote/Latex major mode." t)
|
|
|
|
(autoload 'asy-insinuate-latex "asy-mode" "Asymptote insinuate LaTeX." t)
|
2014-12-16 10:10:41 +01:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))
|
|
|
|
|
2017-05-25 11:18:34 +02:00
|
|
|
(setq bibtex-entry-format '(opts-or-alts required-fields numerical-fields whitespace realign last-comma delimiters braces sort-fields))
|
|
|
|
(setq bibtex-field-delimiters 'double-quotes)
|
2018-02-13 13:42:11 +01:00
|
|
|
(add-hook 'bibtex-mode-hook 'ambrevar/turn-off-indent-tabs)
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2018-11-19 10:37:01 +01:00
|
|
|
;; TODO: Fix gtk-look to support in-buffer documentation display with eww
|
|
|
|
;; instead of just with w3m.
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'cc-mode (require 'init-cc))
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(when (require 'company nil t)
|
|
|
|
(setq company-idle-delay nil))
|
|
|
|
|
2017-09-02 12:11:43 +02:00
|
|
|
(with-eval-after-load 'debbugs
|
2018-02-16 23:08:18 +01:00
|
|
|
(setq debbugs-gnu-all-severities t))
|
2017-06-18 18:50:31 +02:00
|
|
|
|
2017-10-24 18:09:36 +02:00
|
|
|
;;; TODO: In diff-mode, both `[[` and `C-M-a` do not go back to previous index
|
|
|
|
;;; once they are at the beginning of an index.
|
2017-08-03 15:34:22 +02:00
|
|
|
|
2019-03-03 13:15:02 +01:00
|
|
|
;; dired-du is mostly superseeded by disk-usage.el
|
|
|
|
;; See https://github.com/calancha/dired-du/issues/2.
|
2017-07-28 16:19:49 +02:00
|
|
|
;;; Dired is loaded after init.el, so configure it only then.
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'dired (require 'init-dired))
|
|
|
|
|
2017-06-25 12:57:14 +02:00
|
|
|
(with-eval-after-load 'emms (require 'init-emms))
|
2017-06-20 20:38:59 +02:00
|
|
|
|
2018-06-18 22:21:55 +02:00
|
|
|
(when (require 'engine-mode nil t)
|
|
|
|
(require 'init-engine))
|
|
|
|
|
2018-10-03 08:59:01 +02:00
|
|
|
(setq evil-want-keybinding nil
|
|
|
|
evil-want-integration t)
|
2017-06-18 18:50:31 +02:00
|
|
|
(when (require 'evil nil t) (require 'init-evil))
|
|
|
|
|
|
|
|
(with-eval-after-load 'eshell (require 'init-eshell))
|
2020-05-23 10:47:41 +02:00
|
|
|
(with-eval-after-load 'shell (require 'init-shell))
|
2017-06-18 18:50:31 +02:00
|
|
|
|
2018-02-12 12:55:59 +01:00
|
|
|
(with-eval-after-load 'eww (require 'init-eww))
|
|
|
|
|
2018-02-15 19:32:13 +01:00
|
|
|
(when (require 'expand-region nil t)
|
|
|
|
(global-set-key (kbd "C-=") 'er/expand-region))
|
|
|
|
|
2020-04-18 10:55:49 +02:00
|
|
|
(with-eval-after-load 'gnus (require 'init-gnus))
|
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'go-mode (require 'init-go))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2019-11-02 13:19:42 +01:00
|
|
|
;;; Graphviz-dot-mode: The view command is broken but the preview command works
|
|
|
|
;;; (it displays the PNG in a new window), which is enough and probably not
|
|
|
|
;;; worth a fix.
|
2014-02-13 16:30:05 +01:00
|
|
|
|
2019-11-02 13:19:42 +01:00
|
|
|
(with-eval-after-load 'gud (require 'init-gud)) ; Also GDB.
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2018-04-11 13:12:25 +02:00
|
|
|
(when (executable-find "guix")
|
2018-07-24 09:41:31 +02:00
|
|
|
(require 'init-guix))
|
2018-04-11 13:12:25 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(when (require 'helm-config nil t) (require 'init-helm))
|
|
|
|
|
2018-12-18 09:12:18 +01:00
|
|
|
(when (require 'helpful nil t)
|
|
|
|
(global-set-key (kbd "C-h f") #'helpful-callable)
|
|
|
|
(global-set-key (kbd "C-h v") #'helpful-variable)
|
|
|
|
(global-set-key (kbd "C-h o") #'helpful-at-point)
|
|
|
|
(global-set-key (kbd "C-h F") #'helpful-function)
|
2019-02-11 19:39:57 +01:00
|
|
|
(global-set-key (kbd "C-h c") #'helpful-key))
|
2018-12-18 09:12:18 +01:00
|
|
|
|
2018-07-12 17:29:41 +02:00
|
|
|
(when (require 'hl-todo nil t)
|
2018-07-17 11:01:59 +02:00
|
|
|
(add-to-list 'hl-todo-keyword-faces `("REVIEW" . ,(alist-get "TODO" hl-todo-keyword-faces nil nil 'equal)))
|
2018-07-12 17:29:41 +02:00
|
|
|
(global-hl-todo-mode)
|
|
|
|
;; (global-set-key (kbd "M-s M-o") 'hl-todo-occur)
|
2018-07-13 17:42:47 +02:00
|
|
|
(define-key hl-todo-mode-map (kbd "M-s t") 'hl-todo-occur))
|
2018-07-12 17:29:41 +02:00
|
|
|
|
2018-02-13 23:25:12 +01:00
|
|
|
(when (require 'iedit nil t)
|
|
|
|
(global-set-key (kbd "C-;") 'iedit-mode))
|
|
|
|
|
2017-10-14 20:24:44 +02:00
|
|
|
;;; Image
|
2017-10-15 14:55:49 +02:00
|
|
|
;;; TODO: Disable white frame.
|
|
|
|
;;; I think it's the cursor.
|
|
|
|
;;; Evil-mode reverts cursor changes.
|
2018-02-15 13:28:49 +01:00
|
|
|
;; (set-face-foreground 'cursor "black")
|
2017-10-15 14:55:49 +02:00
|
|
|
;;; TODO: Implement other sxiv features:
|
|
|
|
;;; - Gamma
|
|
|
|
;;; - Marks
|
|
|
|
;;; - Gallery
|
|
|
|
;;; TODO: Is it possible to display an image fullscreen?
|
2019-03-03 13:18:38 +01:00
|
|
|
;;; TODO: Image+: Do no auto-adjust animated files
|
2017-10-15 14:55:49 +02:00
|
|
|
;;; https://github.com/mhayashi1120/Emacs-imagex/issues/10
|
|
|
|
;;; TODO: Image+: Restore animation state
|
|
|
|
;;; https://github.com/mhayashi1120/Emacs-imagex/issues/9
|
2017-10-14 20:24:44 +02:00
|
|
|
(with-eval-after-load 'image
|
|
|
|
(setq image-animate-loop t)
|
|
|
|
(add-hook 'image-mode-hook 'image-toggle-animation)
|
|
|
|
(require 'image+ nil t))
|
|
|
|
|
2018-07-12 17:30:11 +02:00
|
|
|
(when (require 'info-colors nil t)
|
|
|
|
(add-hook 'Info-selection-hook 'info-colors-fontify-node))
|
2020-07-06 19:02:45 +02:00
|
|
|
(when (require 'helm-selector nil :noerror)
|
|
|
|
(global-set-key (kbd "C-h i") 'helm-selector-info))
|
2018-07-12 17:30:11 +02:00
|
|
|
|
2017-08-14 11:16:17 +02:00
|
|
|
(add-hook 'js-mode-hook (lambda () (defvaralias 'js-indent-level 'tab-width)))
|
|
|
|
|
2018-03-24 17:02:25 +01:00
|
|
|
(with-eval-after-load 'lisp-mode (require 'init-lisp))
|
2019-03-10 11:28:23 +01:00
|
|
|
(with-eval-after-load 'scheme (require 'init-scheme))
|
2019-10-24 18:32:10 +02:00
|
|
|
(with-eval-after-load 'racket-mode (require 'init-racket))
|
2020-01-06 20:00:47 +01:00
|
|
|
(with-eval-after-load 'clojure-mode (require 'init-clojure))
|
2020-07-06 19:02:45 +02:00
|
|
|
|
2018-06-21 16:08:13 +02:00
|
|
|
(setq geiser-repl-history-filename (expand-file-name "geiser_history" user-emacs-directory))
|
2020-08-06 20:16:25 +02:00
|
|
|
(setq geiser-guile-debug-show-bt-p t)
|
2019-03-08 09:37:34 +01:00
|
|
|
;; Emacs Lisp
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'ambrevar/turn-on-complete-filename)
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'ambrevar/turn-on-tab-width-to-8) ; Because some existing code uses tabs.
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'ambrevar/turn-off-indent-tabs) ; Should not use tabs.
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'ambrevar/init-lispy)
|
|
|
|
(when (fboundp 'rainbow-delimiters-mode)
|
|
|
|
(add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode))
|
|
|
|
(ambrevar/define-keys emacs-lisp-mode-map
|
|
|
|
"<f5>" 'package-lint-current-buffer
|
|
|
|
;; Do not use `recompile' since we want to change the compilation folder for the current buffer.
|
|
|
|
"<f6>" (lambda () (interactive) (async-byte-recompile-directory (file-name-directory (buffer-file-name)))))
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'lua-mode (require 'init-lua))
|
|
|
|
|
2017-06-25 14:37:15 +02:00
|
|
|
;;; Magit can be loaded just-in-time.
|
|
|
|
(with-eval-after-load 'magit
|
2017-06-30 18:23:15 +02:00
|
|
|
(setq auto-revert-mode-text "")
|
2017-06-18 18:50:31 +02:00
|
|
|
(set-face-foreground 'magit-branch-remote "orange red")
|
|
|
|
(setq git-commit-summary-max-length fill-column)
|
2018-02-12 12:57:34 +01:00
|
|
|
;; Customize what to fold by default.
|
|
|
|
;; (push (cons [* commitbuf] 'hide) magit-section-initial-visibility-alist)
|
2017-07-26 22:41:32 +02:00
|
|
|
;; Avoid conflict with WM.
|
|
|
|
(define-key magit-mode-map (kbd "s-<tab>") nil)
|
2018-08-01 13:07:51 +02:00
|
|
|
(setq magit-diff-refine-hunk 'all)
|
2019-03-05 11:56:07 +01:00
|
|
|
(setq magit-repository-directories '(("~/common-lisp" . 1) ; TODO: Sync with homesync / homeinit?
|
|
|
|
("~/projects" . 1)
|
|
|
|
("~/.local/share/emacs/site-lisp" . 1)))
|
2020-05-29 19:31:42 +02:00
|
|
|
;; magit-todos can be slow on big projects. Use it manually.
|
|
|
|
;; (when (require 'magit-todos nil 'noerror)
|
|
|
|
;; (magit-todos-mode))
|
2019-11-13 14:43:41 +01:00
|
|
|
(require 'forge nil 'noerror))
|
2017-06-25 14:37:15 +02:00
|
|
|
(when (fboundp 'magit-status)
|
2017-06-18 18:50:31 +02:00
|
|
|
(global-set-key (kbd "C-x g") 'magit-status))
|
2019-03-04 19:30:47 +01:00
|
|
|
(with-eval-after-load 'orgit
|
|
|
|
(setq orgit-store-repository-id t))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2017-07-19 17:17:24 +02:00
|
|
|
;;; Mail
|
2019-03-17 09:27:18 +01:00
|
|
|
;; (with-eval-after-load 'mu4e
|
|
|
|
;; ;; mu4e-conversation must be enabled here.
|
|
|
|
;; ;; REVIEW: https://github.com/djcb/mu/issues/1258
|
|
|
|
;; (when (require 'mu4e-conversation nil t)
|
|
|
|
;; (global-mu4e-conversation-mode)
|
|
|
|
;; ;; (setq mu4e-debug t)
|
|
|
|
;; (setq mu4e-headers-show-threads nil
|
|
|
|
;; mu4e-headers-include-related nil)
|
|
|
|
;; ;; Tree is better to detect thread-jacks.
|
|
|
|
;; (setq mu4e-conversation-print-function 'mu4e-conversation-print-tree)
|
|
|
|
;; (add-hook 'mu4e-conversation-hook 'flyspell-mode)
|
|
|
|
;; (defun ambrevar/mu4e-conversation-sync ()
|
|
|
|
;; (let ((mu4e-get-mail-command "mbsync mail-sent atlas-sent"))
|
|
|
|
;; (mu4e-update-mail-and-index 'run-in-background)))
|
|
|
|
;; (add-hook 'mu4e-conversation-after-send-hook #'ambrevar/mu4e-conversation-sync)
|
|
|
|
;; (add-hook 'mu4e-view-mode-hook 'auto-fill-mode))
|
|
|
|
;; (require 'init-mu4e))
|
|
|
|
;; (autoload 'helm-mu4e-switch "mu4e")
|
|
|
|
|
2019-03-18 10:13:56 +01:00
|
|
|
(with-eval-after-load 'notmuch (require 'init-notmuch))
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'make-mode (require 'init-makefile))
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'markdown-mode (require 'init-markdown))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2018-11-09 08:37:43 +01:00
|
|
|
;; (add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode)) ; matlab, but conflicts with obj-c.
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/octave-set-comment-start ()
|
2017-05-28 14:15:51 +02:00
|
|
|
"Set comment character to '%' to be Matlab-compatible."
|
|
|
|
(set (make-local-variable 'comment-start) "% "))
|
2018-02-13 13:42:11 +01:00
|
|
|
(add-hook 'octave-mode-hook 'ambrevar/octave-set-comment-start)
|
2017-05-25 11:18:34 +02:00
|
|
|
|
|
|
|
(autoload 'maxima-mode "maxima" "Maxima mode" t)
|
|
|
|
(autoload 'maxima "maxima" "Maxima interaction" t)
|
2017-06-04 13:53:01 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.mac" . maxima-mode))
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2017-06-04 13:53:01 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.wiki\\'" . mediawiki-mode))
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'mediawiki (require 'init-mediawiki))
|
2014-02-13 16:30:05 +01:00
|
|
|
|
2017-10-22 16:06:43 +02:00
|
|
|
(with-eval-after-load 'elfeed (require 'init-elfeed))
|
2017-07-17 08:59:36 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'org (require 'init-org))
|
|
|
|
|
2017-07-12 23:51:14 +02:00
|
|
|
;;; pdf-tools requires poppler built with cairo support.
|
2017-10-10 16:19:22 +02:00
|
|
|
;;; We cannot defer loading as `pdf-tools-install' is required for PDF
|
|
|
|
;;; association.
|
2017-10-11 17:18:23 +02:00
|
|
|
;;; REVIEW: `save-place' does not seem to work with pdf-tools.
|
|
|
|
;;; See https://github.com/politza/pdf-tools/issues/18.
|
2017-07-02 20:07:19 +02:00
|
|
|
(when (require 'pdf-tools nil t)
|
2017-10-22 15:24:43 +02:00
|
|
|
;; (setq pdf-view-midnight-colors '("#ffffff" . "#000000"))
|
|
|
|
(setq pdf-view-midnight-colors '("#ff9900" . "#0a0a12" )) ; Amber
|
|
|
|
(add-hook 'pdf-view-mode-hook 'pdf-view-midnight-minor-mode)
|
2017-08-14 11:16:17 +02:00
|
|
|
(pdf-tools-install t t t))
|
2017-05-25 11:18:34 +02:00
|
|
|
|
2017-08-30 17:42:46 +02:00
|
|
|
(when (require 'rainbow-mode nil t)
|
|
|
|
(dolist (hook '(css-mode-hook html-mode-hook sass-mode-hook))
|
|
|
|
(add-hook hook 'rainbow-mode)))
|
|
|
|
|
2020-04-06 10:33:18 +02:00
|
|
|
(with-eval-after-load 'restclient
|
|
|
|
(define-key restclient-mode-map (kbd "M-s f") 'helm-restclient)
|
|
|
|
(add-to-list 'helm-source-names-using-follow "Sources")
|
|
|
|
(with-eval-after-load 'company-restclient
|
|
|
|
(add-to-list 'company-backends 'company-restclient)
|
|
|
|
(add-hook 'restclient-mode-hook 'company-mode)
|
|
|
|
(define-key restclient-mode-map (kbd "M-<tab>") (if (require 'helm-company nil t)
|
|
|
|
'helm-company
|
|
|
|
'company-complete))))
|
|
|
|
|
2018-02-18 11:42:09 +01:00
|
|
|
;;; Screencast
|
|
|
|
(with-eval-after-load 'camcorder
|
2019-11-28 18:58:58 +01:00
|
|
|
(setq camcorder-output-directory (expand-file-name "Downloads" "~")
|
2018-02-18 11:42:09 +01:00
|
|
|
camcorder-gif-output-directory camcorder-output-directory)
|
|
|
|
(setq camcorder-recording-command '("recordmydesktop" " --fps 10 --no-sound --windowid " window-id " -o " file))
|
|
|
|
(add-to-list 'camcorder-gif-conversion-commands '("ffmpeg-slow" "ffmpeg -i " input-file " -vf 'fps=10,scale=1024:-1:flags=lanczos' " gif-file)))
|
2018-03-01 18:41:57 +01:00
|
|
|
(with-eval-after-load 'gif-screencast
|
|
|
|
(define-key gif-screencast-mode-map (kbd "<f8>") 'gif-screencast-toggle-pause)
|
|
|
|
(define-key gif-screencast-mode-map (kbd "<f9>") 'gif-screencast-stop))
|
2018-02-18 11:42:09 +01:00
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; Shell
|
2017-06-18 18:50:31 +02:00
|
|
|
(with-eval-after-load 'sh-script (require 'init-sh))
|
2016-10-11 17:33:36 +02:00
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; Srt (subtitles)
|
2017-05-25 11:18:34 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.srt\\'" . text-mode))
|
|
|
|
|
2017-12-27 11:38:29 +01:00
|
|
|
;;; System packages
|
2018-01-15 12:17:50 +01:00
|
|
|
(global-set-key (kbd "C-x c #") 'helm-system-packages)
|
2017-12-27 11:38:29 +01:00
|
|
|
|
2017-08-11 10:41:49 +02:00
|
|
|
(with-eval-after-load 'term
|
2017-11-08 09:13:27 +01:00
|
|
|
;; (require 'init-term)
|
2017-08-11 10:41:49 +02:00
|
|
|
(setq term-buffer-maximum-size 0))
|
|
|
|
|
2018-01-19 16:56:18 +01:00
|
|
|
(with-eval-after-load 'tex (require 'init-tex))
|
|
|
|
;; LaTeX is defined in the same file as TeX. To separate the loading, we add it
|
|
|
|
;; to the hook.
|
2017-06-18 18:50:31 +02:00
|
|
|
(add-hook 'latex-mode-hook (lambda () (require 'init-latex)))
|
2017-05-16 21:02:51 +02:00
|
|
|
|
2017-12-23 10:09:12 +01:00
|
|
|
(with-eval-after-load 'transmission
|
2017-12-27 11:38:24 +01:00
|
|
|
;; `transmission' will fail to start and will not run any hook if the daemon
|
|
|
|
;; is not up yet.
|
|
|
|
;; We need to advice the function :before to guarantee it starts.
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/transmission-start-daemon ()
|
2017-12-27 11:38:24 +01:00
|
|
|
(unless (member "transmission-da"
|
|
|
|
(mapcar
|
|
|
|
(lambda (pid) (alist-get 'comm (process-attributes pid)))
|
|
|
|
(list-system-processes)))
|
|
|
|
(call-process "transmission-daemon")
|
|
|
|
(sleep-for 1)))
|
2018-02-13 13:42:11 +01:00
|
|
|
(advice-add 'transmission :before 'ambrevar/transmission-start-daemon)
|
2017-07-12 23:51:57 +02:00
|
|
|
(setq transmission-refresh-modes '(transmission-mode transmission-files-mode transmission-info-mode transmission-peers-mode)
|
|
|
|
transmission-refresh-interval 1))
|
2017-06-18 16:21:38 +02:00
|
|
|
|
2020-01-15 11:23:46 +01:00
|
|
|
;;; Theme
|
|
|
|
(if (ignore-errors (load-theme 'cyberpunk 'no-confirm))
|
2020-01-15 12:18:33 +01:00
|
|
|
(progn
|
2020-06-08 18:12:52 +02:00
|
|
|
;; REVIEW: Backport unmerged changes. See
|
|
|
|
;; https://github.com/n3mo/cyberpunk-theme.el/issues/46.
|
2020-05-30 12:21:10 +02:00
|
|
|
(set-face-attribute 'lazy-highlight nil
|
|
|
|
:underline '(:color "yellow")
|
|
|
|
:foreground 'unspecified
|
|
|
|
:background 'unspecified)
|
2020-01-15 12:18:33 +01:00
|
|
|
(with-eval-after-load 'magit
|
2020-06-08 18:12:52 +02:00
|
|
|
(let ((cyberpunk-green-2 "#006400"))
|
2020-01-15 12:18:33 +01:00
|
|
|
(set-face-background 'diff-refine-added cyberpunk-green-2)))
|
|
|
|
(with-eval-after-load 'org
|
|
|
|
(set-face-attribute 'org-level-1 nil :height 1.1)
|
|
|
|
(set-face-attribute 'org-level-2 nil :height 1.0)
|
|
|
|
(set-face-attribute 'org-level-3 nil :height 1.0)))
|
2020-01-15 11:23:46 +01:00
|
|
|
(require 'theme-ambrevar))
|
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
;;; Translator
|
2018-02-04 22:01:15 +01:00
|
|
|
(when (require 'google-translate nil t)
|
|
|
|
(require 'google-translate-default-ui)
|
|
|
|
;; (global-set-key "\C-ct" 'google-translate-at-point)
|
|
|
|
;; (global-set-key "\C-cT" 'google-translate-query-translate)
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/google-translate-line ()
|
2018-02-04 22:01:15 +01:00
|
|
|
"Translate current line and insert result after it, separated by ' = '."
|
|
|
|
(interactive)
|
|
|
|
(let* ((langs (google-translate-read-args nil nil))
|
|
|
|
(source-language (car langs))
|
|
|
|
(target-language (cadr langs))
|
|
|
|
text
|
|
|
|
result)
|
|
|
|
(end-of-line)
|
|
|
|
(just-one-space)
|
|
|
|
(setq text (buffer-substring-no-properties
|
|
|
|
(line-beginning-position) (line-end-position)))
|
|
|
|
(setq result (with-temp-buffer
|
|
|
|
(google-translate-translate
|
|
|
|
source-language target-language
|
|
|
|
text
|
|
|
|
'current-buffer)
|
|
|
|
(buffer-string))
|
|
|
|
(insert "= " result)))))
|
2017-06-18 18:50:31 +02:00
|
|
|
|
|
|
|
(when (require 'wgrep nil t)
|
2017-08-01 20:55:50 +02:00
|
|
|
;; TODO: wgrep-face is not so pretty.
|
2017-06-18 18:50:31 +02:00
|
|
|
(set-face-attribute 'wgrep-face nil :inherit 'ediff-current-diff-C :foreground 'unspecified :background 'unspecified :box nil))
|
|
|
|
|
2017-07-26 18:39:19 +02:00
|
|
|
;;; Window manager
|
2018-05-11 11:37:58 +02:00
|
|
|
(with-eval-after-load 'pulseaudio-control
|
2019-03-03 12:30:47 +01:00
|
|
|
(setq pulseaudio-control-use-default-sink t
|
2018-06-28 18:53:22 +02:00
|
|
|
pulseaudio-control-volume-step "2%"))
|
2019-03-27 19:10:25 +01:00
|
|
|
(with-eval-after-load 'exwm
|
|
|
|
(require 'init-exwm))
|
2017-07-26 18:39:19 +02:00
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; XML / SGML
|
2018-02-13 13:42:11 +01:00
|
|
|
(defun ambrevar/sgml-setup ()
|
2017-05-28 14:15:51 +02:00
|
|
|
(setq sgml-xml-mode t)
|
|
|
|
;; (toggle-truncate-lines) ; This seems to slow down Emacs.
|
|
|
|
(turn-off-auto-fill))
|
2018-02-13 13:42:11 +01:00
|
|
|
(add-hook 'sgml-mode-hook 'ambrevar/sgml-setup)
|
2017-06-23 15:41:22 +02:00
|
|
|
(with-eval-after-load 'nxml-mode
|
2017-06-28 17:02:50 +02:00
|
|
|
(set-face-foreground 'nxml-element-local-name "gold1")
|
2017-06-23 15:41:22 +02:00
|
|
|
(defvaralias 'nxml-child-indent 'tab-width))
|
|
|
|
;;; Because XML is hard to read.
|
2018-02-13 13:42:11 +01:00
|
|
|
(add-hook 'nxml-mode-hook 'ambrevar/turn-on-tab-width-to-4)
|
2014-09-16 09:02:33 +02:00
|
|
|
|
2018-09-12 11:03:06 +02:00
|
|
|
(with-eval-after-load 'youtube-dl
|
2019-11-28 12:14:24 +01:00
|
|
|
(setq youtube-dl-directory "~/Downloads"))
|
2018-09-12 11:03:06 +02:00
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; Finalization
|
2016-10-14 14:03:30 +02:00
|
|
|
|
2018-12-18 00:33:01 +01:00
|
|
|
(load "~/personal/hackpool/hacks.el" 'noerror)
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
;;; Don't let `customize' clutter my config.
|
2017-07-27 14:56:19 +02:00
|
|
|
(setq custom-file
|
|
|
|
(if (boundp 'server-socket-dir)
|
|
|
|
(expand-file-name "custom.el" server-socket-dir)
|
|
|
|
(expand-file-name (format "emacs-custom-%s.el" (user-uid)) temporary-file-directory)))
|
2017-06-18 16:21:08 +02:00
|
|
|
(load custom-file t)
|
2017-05-21 23:49:20 +02:00
|
|
|
|
2017-06-18 18:50:31 +02:00
|
|
|
;;; Local config. You can use it to set system specific variables, such as the
|
2017-07-27 14:50:55 +02:00
|
|
|
;;; external web browser or the geographical coordinates:
|
2017-05-28 12:32:48 +02:00
|
|
|
;;
|
2017-07-27 14:50:55 +02:00
|
|
|
;; (setq calendar-latitude 20.2158)
|
|
|
|
;; (setq calendar-longitude 105.938)
|
2017-12-25 12:36:31 +01:00
|
|
|
(load "local-after" t)
|