.emacs.d/init.el

2859 lines
107 KiB
EmacsLisp
Raw Normal View History

;;; Init.el --- Daniel's Emacs Configuration -*- lexical-binding: t -*-
2017-07-16 18:07:00 +02:00
;;; Commentary:
2017-11-11 11:44:20 +01:00
;; This is the main entry point for Emacs to load this configuration. The
;; structure is roughly as follows:
;; * first comes some preliminary setup, mostly setting up `package;
;; * the main activation of the configuration is done in the function
;; `db/run-init, which is installed in `after-init-hook; it is thus run
;; after init.el has been read
;; * then comes setting up all the packages that can be used by this
;; configuration; most of these packages are not loaded however, and only
;; configuration hooks are installed (using `use-package); this way a user
2019-12-20 20:28:26 +01:00
;; can choose in `db/run-init which configuration to activate without
2017-11-11 11:44:20 +01:00
;; changing much of the rest of the file.
;; * this file also introduces a new customization group `personal-settings
;; containing variables (mostly file paths) that must be set to enable some
2019-12-20 20:28:26 +01:00
;; of the provided functionality.
2017-11-11 11:44:20 +01:00
2017-07-16 18:07:00 +02:00
;;; Code:
2017-11-11 11:44:30 +01:00
;; * Constants
2017-07-16 18:07:00 +02:00
(defconst emacs-d (file-name-directory
(file-chase-links load-file-name))
"The giant turtle on which the world rests.")
2017-11-11 11:44:30 +01:00
(defconst on-windows (memq system-type '(windows-nt cygwin))
"Non-nil if and only if this instance of Emacs runs on Windows.")
;; * Packages
(when (< emacs-major-version 27)
;; Before Emacs 27.1, we had to do package initialization ourselves. In Emacs
;; 27.1 and later, it's done in early-init.el. See
;; https://www.gnu.org/software/emacs/news/NEWS.27.1
(load-file (expand-file-name "early-init.el" emacs-d))
(package-initialize))
2017-07-16 18:07:00 +02:00
(eval-when-compile
(setq use-package-enable-imenu-support t)
2020-08-11 17:38:23 +02:00
(dolist (package '(bind-key use-package))
(unless (package-installed-p package)
(package-install package))
(require package)))
2017-07-16 18:07:00 +02:00
2019-12-21 19:01:25 +01:00
(add-to-list 'package-pinned-packages '(use-package . "melpa-stable"))
(add-to-list 'package-pinned-packages '(bind-key . "melpa-stable"))
2019-12-21 18:52:50 +01:00
(put 'use-package 'lisp-indent-function 1)
(setq use-package-verbose t
use-package-minimum-reported-time 0.01)
2017-07-16 18:07:00 +02:00
(add-to-list 'load-path (expand-file-name "site-lisp" emacs-d))
2017-07-16 18:07:00 +02:00
;; * Mode activation
(defun db/run-init ()
"Run main initialization after everything is set up."
2018-11-03 16:18:00 +01:00
(message "Running main initialization ...")
;; Activate modes (builtin)
2017-07-16 18:07:00 +02:00
(show-paren-mode 1)
(transient-mark-mode 1)
(global-font-lock-mode 1)
(column-number-mode 1)
;; (display-time)
(delete-selection-mode 1)
(dolist (mode '(tool-bar-mode
scroll-bar-mode
menu-bar-mode
blink-cursor-mode
tooltip-mode))
2017-07-16 18:07:00 +02:00
(when (fboundp mode)
(funcall mode 0)))
(when (<= 24 emacs-major-version)
(electric-indent-mode -1))
(appt-activate +1)
(savehist-mode 1)
(size-indication-mode 1)
(display-battery-mode -1)
(electric-pair-mode +1)
2017-07-16 18:07:00 +02:00
(recentf-mode t)
(winner-mode 1)
(global-auto-revert-mode -1)
(which-function-mode +1)
(global-eldoc-mode +1)
2017-07-16 18:07:00 +02:00
;; Activate modes (packages)
(dolist (mode '(global-undo-tree-mode
ace-window-display-mode
key-chord-mode
ivy-mode
minions-mode
2018-11-02 20:57:34 +01:00
which-key-mode
eyebrowse-mode
2019-12-20 17:34:05 +01:00
projectile-mode
2019-12-20 17:39:13 +01:00
yas-global-mode
semantic-mode))
(with-demoted-errors "Cannot activate mode: %s"
2017-10-28 19:34:58 +02:00
(funcall mode +1)))
2017-07-16 18:07:00 +02:00
(unless on-windows
(with-demoted-errors "Cannot load `pdf-tools: %s"
(pdf-tools-install)))
(with-demoted-errors "Cannot activate moody: %s"
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
(with-demoted-errors "Cannot activate `vlf': %s"
(require 'vlf-setup))
;; Explicitly require helm, because autoloading is difficult with helm's
;; separate `helm-command-prefix-key' mechanism.
(require 'helm)
(when (package-installed-p 'org-roam)
(if (executable-find "sqlite3")
(org-roam-mode +1)
(warn "Cannot activate org-roam: sqlite3 not found.")))
2017-09-15 16:27:56 +02:00
;; Global Hooks
2017-07-16 18:07:00 +02:00
(add-hook 'minibuffer-setup-hook 'conditionally-enable-lispy)
(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode)
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
(add-hook 'prog-mode-hook 'page-break-lines-mode)
(add-hook 'lisp-mode-hook 'turn-on-lispy-when-available)
2017-07-16 18:07:00 +02:00
(when (<= 24 emacs-major-version)
(add-hook 'prog-mode-hook 'electric-indent-local-mode))
2019-03-02 11:15:28 +01:00
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook 'abbrev-mode)
2017-07-16 18:07:00 +02:00
;; Auto-Modes
(dolist (mode-spec '(("\\.clj\\'" . clojure-mode)
("\\.cl\\'" . lisp-mode)
("\\.lisp\\'" . lisp-mode)
("\\.plx\\" . cperl-mode)
("\\.hs\\'" . haskell-mode)
("\\.lhs\\'" . haskell-mode)
("\\.md\\'" . markdown-mode)
("\\.html\\'" . nxml-mode)
("\\.xml\\'" . nxml-mode)))
(add-to-list 'auto-mode-alist mode-spec))
2017-08-04 17:49:43 +02:00
;; Top-Level Keybindings
2017-07-16 18:07:00 +02:00
(bind-key "<XF86Back>" #'winner-undo)
(bind-key "<XF86Forward>" #'winner-redo)
(bind-key "<f10>" #'magit-status)
(bind-key "<f11>" #'org-capture)
(bind-key "<f12>" #'db/helm-shortcuts)
(bind-key "<f1>" #'db/run-or-hide-eshell)
(bind-key "<f2>" #'hydra-feature-shortcuts/body)
(bind-key "<f5>" #'rgrep)
2017-07-16 18:07:00 +02:00
(bind-key "<f6>" #'hydra-zoom/body)
(bind-key "<f7>" #'dictcc)
(bind-key "<f8>" #'counsel-locate)
(bind-key "<f9>" #'helm-org-agenda-files-headings)
(bind-key "C-," #'mc/skip-to-previous-like-this)
(bind-key "C-." #'mc/skip-to-next-like-this)
2017-09-29 21:25:41 +02:00
(bind-key "C-;" #'iedit-mode)
2017-07-16 18:07:00 +02:00
(bind-key "C-<" #'mc/mark-previous-like-this)
(bind-key "C->" #'mc/mark-next-like-this)
(bind-key "C-@" #'er/expand-region)
(bind-key "C-M-\\" #'crux-cleanup-buffer-or-region)
(bind-key "C-S-c C-S-c" #'mc/edit-lines)
(bind-key "C-Z" #'undo-tree-redo)
(bind-key "C-c C-<" #'mc/mark-all-like-this)
(bind-key "C-c C-r" #'ivy-resume)
(bind-key "C-c D" #'define-word)
(bind-key "C-c J" #'avy-goto-word-or-subword-1)
(bind-key "C-c P" #'ivy-pages)
(bind-key "C-c a" #'org-agenda)
(bind-key "C-c c" #'org-capture)
(bind-key "C-c d" #'define-word-at-point)
(bind-key "C-c e" #'crux-eval-and-replace)
(bind-key "C-c i" #'ispell-change-dictionary)
2017-07-16 18:07:00 +02:00
(bind-key "C-c j" #'avy-goto-char-timer)
(bind-key "C-c l" #'org-store-link)
(bind-key "C-c m" #'music-control/body)
(bind-key "C-c n I" #'org-roam-insert-immediate)
(bind-key "C-c n i" #'org-roam-insert)
2017-07-16 18:07:00 +02:00
(bind-key "C-c o" #'hydra-org-clock/body)
(bind-key "C-c s" #'synonyms)
(bind-key "C-h C-f" #'find-function)
(bind-key "C-h C-k" #'find-function-on-key)
(bind-key "C-x C-b" #'ibuffer)
2017-07-16 18:07:00 +02:00
(bind-key "C-x C-d" #'dired)
(bind-key "C-x C-r" #'revert-buffer)
(bind-key "C-x SPC" #'hydra-rectangle/body)
(bind-key "C-x g" #'db/helm-shortcuts)
(bind-key "C-x r E" #'db/bookmark-add-external)
(bind-key "C-x r M" #'db/bookmark-add-url)
2017-07-16 18:07:00 +02:00
(bind-key "C-x r v" #'list-registers)
(bind-key "C-x t" #'hydra-toggle/body)
2020-09-12 08:51:35 +02:00
(bind-key "C-z" #'goto-last-change)
2017-07-16 18:07:00 +02:00
(bind-key "M-/" #'hippie-expand)
(bind-key "M-:" #'pp-eval-expression)
(bind-key "M-=" #'count-words)
(bind-key "M-SPC" #'cycle-spacing)
(bind-key "M-Z" #'zap-to-char)
(bind-key "M-g j b" #'dumb-jump-back)
(bind-key "M-g j g" #'dumb-jump-go)
(bind-key "M-i" #'swiper-from-isearch isearch-mode-map)
2017-07-16 18:07:00 +02:00
(bind-key "M-j" #'(lambda () (interactive) (join-line -1)))
(bind-key "M-z" #'zap-up-to-char)
(bind-key [remap fill-paragraph] #'endless/fill-or-unfill)
(bind-key [remap keyboard-quit] #'keyboard-quit-context+)
(unbind-key "<insert>" global-map)
(unbind-key "<kp-insert>" global-map)
(unbind-key "C-x C-c" global-map)
(unbind-key "M-o" global-map)
;; Overwrite certain keybindings only if packages are avilable
(when (package-installed-p 'counsel)
2017-09-15 17:53:59 +02:00
(bind-key "M-x" #'counsel-M-x) ; gets nicer sorting with smex installed
(bind-key "C-c r" #'counsel-recentf)
(bind-key "C-x C-f" #'counsel-find-file)
(bind-key "C-h f" #'counsel-describe-function)
(bind-key "C-h v" #'counsel-describe-variable)
(bind-key "C-h b" #'counsel-descbinds)
(bind-key "C-S-s" #'counsel-grep-or-swiper)
(bind-key [remap bookmark-bmenu-list] #'counsel-bookmark))
(when (package-installed-p 'helm)
(bind-key "M-y" #'helm-show-kill-ring))
(when (package-installed-p 'crux)
(bind-key [remap kill-whole-line] #'crux-kill-whole-line)
(bind-key [remap open-line] #'crux-smart-open-line-above))
(when (package-installed-p 'ace-window)
(bind-key "C-x o" #'ace-window))
2017-07-16 18:07:00 +02:00
(when (executable-find "ag")
(bind-key "<f5>" #'counsel-ag))
(when (package-installed-p 'avy)
(bind-key "M-g M-g" #'avy-goto-line)
(bind-key "M-g g" #'avy-goto-line))
2017-07-16 18:07:00 +02:00
;; Environment Variables
(unless on-windows
(with-demoted-errors "Cannot import environment variables: %s"
(exec-path-from-shell-copy-envs '("SSH_AUTH_SOCK"
"SSH_AGENT_PID"
"PATH"
"TEXMFHOME"
"PERL5LIB"
"PERL_LOCAL_LIB_ROOT"
"PERL_MB_OPT"
"PERL_MM_OPT"))))
2017-08-12 10:53:17 +02:00
;; Start Server when not running already
2017-09-15 13:40:10 +02:00
;; The following condition should actually always be false, since we have
;; neither loaded the server package yet nor have explicitly started the
;; server process. Also the --daemon command line switches will start the
;; server only later, after initialization (and they do so unconditionally,
;; thus restarting the server we have started here). However, for robustness,
;; we keep the condition nevertheless, since when a server process is already
;; present, we really don't have to do anything. Furthermore, calling
;; `db/run-init' again in a running Emacs will not restart the server (but
;; then, why whould one want to do this?).
(if (and (boundp 'server-process) server-process)
(message "Server already running, not restarting.")
(require 'server)
(let ((server-file (expand-file-name server-name
(if server-use-tcp server-auth-dir server-socket-dir))))
(if (file-exists-p server-file)
(warn "Server file already exists, but no server process is running. Check %s and restart server manually."
server-file)
(server-start)
(ecase (server-running-p)
((t) t) ; server is running
(nil (warn "Server not running, check logs and restart manually."))
(t (warn "`server-running-p' returned neither nil nor t. Check and restart server manually if required."))))))
2017-09-15 13:40:10 +02:00
;; Load custom code
(dolist (file db/after-init-load-files)
(message "Loading %s" file)
(with-demoted-errors "Error loading file: %s"
(load-file file)))
2018-11-03 16:18:00 +01:00
;; Finish
(message "Running main initialization ... done")
2017-07-16 18:07:00 +02:00
t)
(add-hook 'after-init-hook #'db/run-init)
2017-10-17 22:21:28 +02:00
;; * Personal customization
2017-07-16 18:07:00 +02:00
(use-package db-customize
:defines (db/jabber-id
db/important-documents-path
db/path-to-onenote
db/path-to-outlook
db/cert-file-directory
org-working-task-id
org-break-task-id
org-home-task-id
db/org-clock-current-task-file
db/org-default-org-file
db/org-default-work-file
db/org-default-home-file
db/org-default-notes-file
db/org-default-refile-file
db/after-init-load-files))
2017-10-17 22:21:28 +02:00
2019-02-02 15:39:16 +01:00
;; * General configuration
2017-10-17 22:21:28 +02:00
;; Ensure that ~/.emacs.d/private exists, because we want to store data there
(let ((private-data-dir (expand-file-name "private/" emacs-d)))
(unless (file-directory-p private-data-dir)
(make-directory private-data-dir)))
(setq custom-file
(expand-file-name "private/custom.el" emacs-d))
2017-07-16 18:07:00 +02:00
(use-package cl-lib)
(use-package subr-x)
2017-07-16 18:07:00 +02:00
(use-package warnings
:config (cl-pushnew '(undo discard-info) warning-suppress-types
:test #'equal))
(set-default-coding-systems 'utf-8)
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq buffer-file-coding-system 'utf-8)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(setq inhibit-startup-message t
frame-inhibit-implied-resize t
2017-07-16 18:07:00 +02:00
initial-scratch-message nil
initial-major-mode 'fundamental-mode
2017-07-16 18:07:00 +02:00
ring-bell-function #'ignore
garbage-collection-messages nil
load-prefer-newer nil ; t breaks `org-reload'
auth-sources '("~/.authinfo.gpg"))
2017-07-16 18:07:00 +02:00
(fset 'yes-or-no-p 'y-or-n-p)
(setq-default fill-column 80)
(setq-default indent-tabs-mode nil)
(setq frame-title-format "emacs")
(setq select-enable-clipboard t
select-enable-primary t
save-interprogram-paste-before-kill t
mouse-yank-at-point t
require-final-newline nil
sentence-end-double-space t
recenter-positions '(top middle bottom)
scroll-conservatively 10
message-log-max t
inhibit-eol-conversion nil
tab-always-indent 'complete
enable-recursive-minibuffers t
set-mark-command-repeat-pop t
2018-02-22 16:28:44 +01:00
large-file-warning-threshold 10000000
2017-07-16 18:07:00 +02:00
echo-keystrokes 0.1
delete-by-moving-to-trash t
delete-trailing-lines nil
x-underline-at-descent-line t
search-whitespace-regexp "[ \t\r\n]+"
visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)
history-delete-duplicates t
track-eol t)
(when (memq system-type '(gnu gnu/linux gnu/kfreebsd))
(setq x-wait-for-event-timeout nil))
2017-07-16 18:07:00 +02:00
(when on-windows
;; treat memory for display time ... but hey, this is Windows, memory doesnt
;; matter!
(setq inhibit-compacting-font-caches t))
(setq-default cursor-type 'bar
cursor-in-non-selected-windows nil)
2017-07-27 13:08:05 +02:00
2017-07-16 18:07:00 +02:00
;; don't let the cursor go into minibuffer prompt
(setq minibuffer-prompt-properties '(read-only t
face minibuffer-prompt
cursor-intangible t))
;; Make M-v undo C-v
(setq scroll-preserve-screen-position 'always)
;; Backups and Autosave
(defvar backup-dir (expand-file-name "ebackup/" emacs-d))
(defvar autosave-dir (expand-file-name "eautosave/" emacs-d))
(setq make-backup-files t
backup-directory-alist (list (cons ".*" backup-dir))
auto-save-list-file-prefix autosave-dir
auto-save-file-name-transforms `((".*" ,autosave-dir t))
version-control t
kept-old-versions 2
kept-new-versions 4
delete-old-versions t
vc-make-backup-files t)
(setq undo-limit 80000000)
2017-07-16 18:07:00 +02:00
(setq-default async-shell-command-buffer 'new-buffer)
(add-to-list 'display-buffer-alist
'("^\*Async Shell Command*" . (display-buffer-no-window)))
(put 'set-goal-column 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(setq calendar-date-style 'iso
calendar-bahai-all-holidays-flag nil
calendar-chinese-all-holidays-flag nil
calendar-christian-all-holidays-flag t
calendar-islamic-all-holidays-flag nil
calendar-hebrew-all-holidays-flag nil
holiday-general-holidays '((holiday-fixed 1 1 "New Year's Day")
(holiday-fixed 2 14 "Valentine's Day")
(holiday-fixed 4 1 "April Fools' Day")
(holiday-fixed 5 1 "Labour Day")
(holiday-fixed 10 3 "German Unity Day")
(holiday-fixed 10 31 "Reformation Day")
(holiday-float 11 3 -1 "Day of Repentance and Prayer" 22)
(holiday-float 11 4 4 "Thanksgiving"))
holiday-other-holidays '((holiday-fixed 2 13 "Jahrestag Zerstörung Dresden 1945")
(holiday-fixed 5 25 "Towel Day")
(holiday-fixed 6 4 "Tiananmen Massacre 1989")
(holiday-fixed 6 5 "Snowden-Veröffentlichungen 2013")
(holiday-fixed 6 6 "D-Day 1944")
(holiday-fixed 6 8 "Yoneda Appreciation Day")
(holiday-fixed 6 10 "Jahrestag Zerstörung von Oradour-sur-Glane 1944")
(holiday-fixed 6 10 "Jahrestag Massaker von Distomo 1944")
(holiday-fixed 6 16 "Bloomsday")
(holiday-fixed 7 20 "Jahrestag Attentat auf Hitler 1944")
(holiday-fixed 7 21 "Jahrestag der 1. Mondlandung 1969")
(holiday-fixed 7 21 "Jahrestag Massaker von Vassieux-en-Vercors 1944")
(holiday-fixed 7 28 "Start WWI 1914")
(holiday-fixed 11 11 "End WWI 1918"))
diary-show-holidays-flag t
calendar-view-holidays-initially-flag nil)
2017-07-16 18:07:00 +02:00
(setq-default font-lock-maximum-decoration '((t . t)))
(setq-default savehist-file (expand-file-name "savehist" emacs-d))
(setq tramp-save-ad-hoc-proxies t)
2017-07-16 18:07:00 +02:00
(use-package re-builder
:commands (re-builder)
:init (setq reb-re-syntax 'string))
2017-07-16 18:07:00 +02:00
(setq lisp-indent-function #'lisp-indent-function)
2017-07-16 18:07:00 +02:00
(setq custom-theme-directory (expand-file-name "themes/" emacs-d))
;; https://florian.adamsky.it/2016/03/31/emacs-calc-for-programmers-and-cs.html
(setq math-additional-units
'((bit nil "Bit")
(byte "8 * bit" "Byte")
(bps "bit / s" "Bit per second"))
math-units-table nil)
(setq default-input-method "TeX")
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "firefox")
;; * Fixes
(with-eval-after-load 'enriched
(defun enriched-decode-display-prop (start end &optional params)
(ignore params)
(list start end)))
2017-07-16 18:07:00 +02:00
;; * Basic Builtin Packages
(use-package misc
:commands (zap-up-to-char zap-to-char))
(use-package grep
:commands (rgrep zrgrep)
:bind (:map grep-mode-map
("C-x C-q" . wgrep-change-to-wgrep-mode)
("C-c C-c" . wgrep-finish-edit)))
2017-07-16 18:07:00 +02:00
(use-package winner
:commands (winner-mode winner-undo winner-redo))
(use-package abbrev
:defer t
:init (progn
(setq save-abbrevs 'silently))
2017-07-16 18:07:00 +02:00
:diminish abbrev-mode)
(use-package appt
:commands (appt-activate)
:init (setq appt-display-mode-line nil))
2017-07-16 18:07:00 +02:00
(use-package ediff
2017-09-24 12:34:59 +02:00
:defer t
:init (setq ediff-diff-options "-w"
ediff-window-setup-function 'ediff-setup-windows-plain
ediff-split-window-function 'split-window-horizontally)
2017-07-16 18:07:00 +02:00
:config (progn
(add-hook 'ediff-keymap-setup-hook
'(lambda ()
(bind-key "j" #'ediff-next-difference ediff-mode-map)
(bind-key "k" #'ediff-previous-difference ediff-mode-map)))
2017-07-16 18:07:00 +02:00
(add-hook 'ediff-after-quit-hook-internal 'winner-undo)))
2020-09-11 17:10:02 +02:00
(use-package imenu
:init (setq imenu-use-markers t
imenu-auto-rescan t
imenu-auto-rescan-maxout 600000
imenu-max-item-length 100
imenu-use-popup-menu nil
imenu-eager-completion-buffer t))
2017-07-16 18:07:00 +02:00
(use-package ispell
2019-04-11 09:00:04 +02:00
:commands (ispell-change-directory))
2017-07-16 18:07:00 +02:00
(use-package mailcap
2017-09-24 12:34:59 +02:00
:defer t
2017-07-16 18:07:00 +02:00
:config (progn
2017-11-11 17:43:27 +01:00
;; Remove doc-view so pdf will open with default viewer
2017-07-16 18:07:00 +02:00
(setcdr
(assoc "application" mailcap-mime-data)
(remove '("pdf"
(viewer . doc-view-mode)
(type . "application/pdf")
(test eq window-system 'x))
(cdr (assoc "application" mailcap-mime-data))))))
(use-package quail
:defer t
:config (add-hook 'input-method-activate-hook
#'db/add-symbols-to-TeX-input-method))
2020-09-11 17:19:07 +02:00
(use-package isearch
:defer t
:init (setq isearch-allow-scroll t))
(use-package server
:commands (server-running-p server-start)
:init (setq server-log t))
(use-package bookmark
:init (setq bookmark-default-file (expand-file-name "private/bookmarks"
emacs-d)))
2017-07-16 18:07:00 +02:00
2017-10-21 09:08:15 +02:00
;; * Some essential packages
2017-07-16 18:07:00 +02:00
2019-12-21 18:52:50 +01:00
(use-package dash
:pin "melpa-stable")
2019-12-21 18:52:50 +01:00
(use-package hydra
:pin "melpa-stable")
2019-12-20 15:28:24 +01:00
2019-12-21 19:01:25 +01:00
;; `lv' is a dependency of `hydra'
(add-to-list 'package-pinned-packages '(lv . "melpa-stable"))
2017-07-16 18:07:00 +02:00
(use-package db-utils
:commands (endless/fill-or-unfill
db/delete-trailing-whitespace-maybe
db/run-or-hide-shell
db/gnus
db/org-agenda
db/scratch
db/find-user-init-file
2017-07-16 18:07:00 +02:00
db/run-or-hide-ansi-term
db/hex-to-ascii
db/text-to-hex
conditionally-enable-lispy
turn-on-lispy-when-available
db/sort-nsm-permanent-settings
endless/colorize-compilation
db/turn-off-local-electric-pair-mode
db/add-symbols-to-TeX-input-method
db/two-monitors-xrandr
2018-11-21 10:38:05 +01:00
db/one-monitor-xrandr
db/pretty-print-xml
db/bookmark-add-external
db/bookmark-add-url
db/lookup-smime-key
db/dired-from-shell-command
db/system-open
db/switch-to-dark-theme
db/switch-to-light-theme
keyboard-quit-context+))
(use-package db-hydras
:commands (hydra-toggle/body
hydra-zoom/body
hydra-rectangle/body
hydra-feature-shortcuts/body))
(use-package git-commit
:commands (global-git-commit-mode))
2017-07-16 18:07:00 +02:00
(use-package magit
:commands (magit-status)
:init (setq magit-diff-refine-hunk nil
magit-commit-show-diff nil
magit-popup-use-prefix-argument 'default)
2017-07-16 18:07:00 +02:00
:config (progn
2018-09-09 12:14:56 +02:00
(global-magit-file-mode -1)
(global-git-commit-mode +1)
2018-09-09 12:14:56 +02:00
(with-demoted-errors "Non-Fatal Error: %s"
(require 'projectile)
(setq magit-repository-directories
(mapcar
(lambda (dir)
(cons (substring dir 0 -1) 0))
(cl-remove-if-not
(lambda (project)
(unless (file-remote-p project)
(file-exists-p (concat project "/.git"))))
projectile-known-projects))))))
2017-07-16 18:07:00 +02:00
(use-package projectile
:commands (projectile-mode)
2017-08-12 00:18:42 +02:00
:defines (projectile-known-projects)
:bind (:map projectile-mode-map ("C-c p" . projectile-command-map))
:init (setq projectile-switch-project-action 'projectile-dired
projectile-completion-system 'helm
projectile-ignored-project-function #'file-remote-p
projectile-create-missing-test-files t
projectile-known-projects-file (expand-file-name "private/projectile-bookmarks.eld"
emacs-d))
2017-07-16 18:07:00 +02:00
:diminish projectile-mode)
2017-08-04 16:00:04 +02:00
(use-package counsel-projectile
:commands counsel-projectile)
(use-package exec-path-from-shell
2019-12-21 18:52:50 +01:00
:pin "melpa-stable"
:commands (exec-path-from-shell-copy-envs))
2017-07-16 18:07:00 +02:00
;; * Start Menu via Helm
(defun db/helm-shortcuts (arg)
"Open helm completion on common locations.
With given ARG, display files in `db/important-document-path."
(interactive "p")
(require 'helm-bookmark)
(require 'helm-for-files) ; for helm-source-recentf
(helm :sources (list
(helm-make-source "Frequently Used" 'helm-source-sync
:candidates (mapcar #'(lambda (entry)
(cons (car entry)
(caddr entry)))
db/frequently-used-features)
:action '(("Open" . call-interactively))
:filtered-candidate-transformer #'helm-adaptive-sort)
;; taken from `helm-buffers-list'
(helm-make-source "Buffers" 'helm-source-buffers)
helm-source-recentf
;; if prefix arg is given, extract files from
;; `db/important-documents-path and list them as well
(when (and (= arg 4)
(file-directory-p db/important-documents-path))
(let ((search-path (expand-file-name db/important-documents-path)))
(helm-make-source "Important files" 'helm-source-sync
:candidates (mapcar #'(lambda (file)
;; display only relative path,
;; but keep absolute path for
;; actions
(cons (string-remove-prefix search-path file)
file))
(directory-files-recursively search-path ""))
:action '(("Open externally" . db/system-open)
("Find file" . find-file)))))
helm-source-bookmarks
helm-source-buffer-not-found
helm-source-bookmark-set)))
;; * Org
(use-package db-org
:commands (db/check-special-org-files-in-agenda
db/verify-refile-target
org-reset-checkbox-state-maybe
db/find-parent-task
db/ensure-running-clock
db/save-current-org-task-to-file
db/org-update-frame-title-with-current-clock
db/org-clock-out
db/org-clock-in-break-task
db/org-clock-in-home-task