Move config files to XDG-compatible path
Move config files to XDG-compatible path: `$HOME/.config/emacs`.
This commit is contained in:
parent
05ad81c631
commit
7df5b0e507
19 changed files with 3 additions and 3 deletions
9
.config/emacs/config/backups.el
Normal file
9
.config/emacs/config/backups.el
Normal file
|
@ -0,0 +1,9 @@
|
|||
;; configure backups
|
||||
(setq backup-directory-alist '(("." . "~/.config/emacs/backups/")
|
||||
("/dev/shm" . "/dev/null"))
|
||||
backup-by-copying t
|
||||
delete-old-versions t
|
||||
kept-new-versions 16
|
||||
kept-old-versions 8
|
||||
version-control t
|
||||
tramp-backup-directory-alist backup-directory-alist)
|
88
.config/emacs/config/base.el
Normal file
88
.config/emacs/config/base.el
Normal file
|
@ -0,0 +1,88 @@
|
|||
;; use UTF-8 for file name encoding
|
||||
(setq file-name-coding-system 'utf-8)
|
||||
(prefer-coding-system 'utf-8)
|
||||
|
||||
;; enable some commands disabled by default
|
||||
(put 'narrow-to-region 'disabled nil)
|
||||
(put 'upcase-region 'disabled nil)
|
||||
(put 'downcase-region 'disabled nil)
|
||||
|
||||
;; no fancy graphic stuff, you don't want to use the mouse anyway, do
|
||||
;; you?
|
||||
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
|
||||
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
|
||||
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
|
||||
(setq use-dialog-box nil)
|
||||
|
||||
;; add key sequences
|
||||
(global-set-key "\C-c\l" 'goto-line)
|
||||
|
||||
;; syntax coloring
|
||||
(global-font-lock-mode t)
|
||||
|
||||
;; show end of fill-column length
|
||||
(global-display-fill-column-indicator-mode t)
|
||||
|
||||
;; paren matching
|
||||
(show-paren-mode t)
|
||||
|
||||
;; display of current function (which-function-mode)
|
||||
(which-function-mode 1)
|
||||
|
||||
;; VC is mostly useless for modern DVCSs
|
||||
(setq vc-handled-backends nil)
|
||||
|
||||
;; configure the browser
|
||||
(setq browse-url-browser-function 'browse-url-generic
|
||||
browse-url-generic-program "firefox")
|
||||
|
||||
;; use space instead of tabs
|
||||
(setq-default indent-tabs-mode nil)
|
||||
|
||||
;; yank at cursor not mouse pointer
|
||||
(setq mouse-yank-at-point t)
|
||||
|
||||
;; make the screen go down with one line & mouse wheel support
|
||||
(setq scroll-conservatively 1000)
|
||||
(mouse-wheel-mode t)
|
||||
|
||||
;; clipboard yanking is possible with middle mouse button now
|
||||
(setq x-select-enable-clipboard t
|
||||
x-select-enable-primary t)
|
||||
|
||||
;; enhanced buffer switching with shift + arrows
|
||||
(windmove-default-keybindings)
|
||||
|
||||
;; resize cursor to character
|
||||
(setq x-stretch-cursor t)
|
||||
|
||||
;; set tab width to 4 whitespaces
|
||||
(setq tab-width 4)
|
||||
(setq-default cperl-indent-level tab-width)
|
||||
|
||||
;; More history
|
||||
(setq-default history-length 1000)
|
||||
|
||||
;; delete trailing whitespaces before saving
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
|
||||
;; add newlines at eof
|
||||
(setq require-final-newline t)
|
||||
|
||||
;; enable number-modes
|
||||
(setq line-number-mode t)
|
||||
(setq column-number-mode t)
|
||||
|
||||
;; show paren mode
|
||||
(setq show-paren-mode t)
|
||||
|
||||
;; no am/pm in timestamps
|
||||
(setq display-time-24hr-format t)
|
||||
|
||||
;; configure theme
|
||||
(custom-set-variables
|
||||
'(custom-enabled-themes (quote (tango-dark))))
|
||||
|
||||
;; configure authinfo file
|
||||
(setq auth-sources
|
||||
'((:source "~/.authinfo.gpg")))
|
8
.config/emacs/config/c.el
Normal file
8
.config/emacs/config/c.el
Normal file
|
@ -0,0 +1,8 @@
|
|||
;; set c style to linux and indention to 2
|
||||
(setq c-default-style "linux"
|
||||
c-basic-offset 2)
|
||||
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:hook
|
||||
(c-mode . lsp-deferred))
|
5
.config/emacs/config/calendar.el
Normal file
5
.config/emacs/config/calendar.el
Normal file
|
@ -0,0 +1,5 @@
|
|||
;; calender week starts with mo
|
||||
(setq european-calender-style t)
|
||||
|
||||
;; start with monday
|
||||
(setq calendar-week-start-day 1)
|
64
.config/emacs/config/dev.el
Normal file
64
.config/emacs/config/dev.el
Normal file
|
@ -0,0 +1,64 @@
|
|||
(use-package paredit
|
||||
:ensure t
|
||||
:config
|
||||
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
|
||||
:hook
|
||||
(emacs-lisp-mode . enable-paredit-mode)
|
||||
(eval-expression-minibuffer-setup enable-paredit-mode)
|
||||
(ielm-mode . enable-paredit-mode)
|
||||
(lisp-mode . enable-paredit-mode)
|
||||
(lisp-interaction-mode . enable-paredit-mode)
|
||||
(scheme-mode . enable-paredit-mode))
|
||||
|
||||
(use-package highlight-parentheses
|
||||
:ensure t
|
||||
:config
|
||||
(global-highlight-parentheses-mode t))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:ensure t
|
||||
:hook
|
||||
(prog-mode . rainbow-delimiters-mode)
|
||||
:custom-face
|
||||
(rainbow-delimiters-depth-2-face ((t (:inherit rainbow-delimiters-base-face :foreground "cornflower blue"))))
|
||||
(rainbow-delimiters-depth-3-face ((t (:inherit rainbow-delimiters-base-face :foreground "sandy brown"))))
|
||||
(rainbow-delimiters-depth-4-face ((t (:inherit rainbow-delimiters-base-face :foreground "yellow green"))))
|
||||
(rainbow-delimiters-depth-5-face ((t (:inherit rainbow-delimiters-base-face :foreground "powder blue"))))
|
||||
(rainbow-delimiters-depth-6-face ((t (:inherit rainbow-delimiters-base-face :foreground "orchid"))))
|
||||
(rainbow-delimiters-depth-7-face ((t (:inherit rainbow-delimiters-base-face :foreground "lemon chiffon"))))
|
||||
(rainbow-delimiters-depth-8-face ((t (:inherit rainbow-delimiters-base-face :foreground "goldenrod"))))
|
||||
(rainbow-delimiters-depth-9-face ((t (:inherit rainbow-delimiters-base-face :foreground "dark cyan")))))
|
||||
|
||||
;; Hack to show only files known to git inside dired; needs the
|
||||
;; `git-find' shell script shim (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el)
|
||||
(defun git-dired (dir)
|
||||
(interactive (list (read-directory-name "Find files in directory: " nil "" t)))
|
||||
(let ((find-program "git-find"))
|
||||
(find-dired dir "")))
|
||||
|
||||
;; enable flyspell checks for comments in code
|
||||
(add-hook 'prog-mode-hook #'flyspell-prog-mode)
|
||||
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:config
|
||||
(setq lsp-completion-default-behaviour ':insert))
|
||||
|
||||
(use-package lsp-ui
|
||||
:ensure t
|
||||
:bind
|
||||
("C-c i" . lsp-ui-doc-show)
|
||||
:config
|
||||
(setq lsp-ui-doc-position 'at-point)
|
||||
(setq lsp-ui-doc-show-with-mouse nil)
|
||||
(setq lsp-ui-sideline-show-diagnostics nil))
|
||||
|
||||
(use-package yasnippet
|
||||
:ensure t)
|
||||
|
||||
(use-package company
|
||||
:ensure t
|
||||
:bind (:map company-active-map
|
||||
("RET" . nil)
|
||||
("<return>" . nil)
|
||||
("M-RET" . company-complete-selection)))
|
10
.config/emacs/config/ediff.el
Normal file
10
.config/emacs/config/ediff.el
Normal file
|
@ -0,0 +1,10 @@
|
|||
(use-package ediff
|
||||
:config
|
||||
(setq diff-switches "-u"
|
||||
ediff-custom-diff-options "-U3"
|
||||
ediff-split-window-function 'split-window-horizontally
|
||||
ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||
:hook
|
||||
(ediff-startup . ediff-toggle-wide-display)
|
||||
(ediff-cleanup . ediff-toggle-wide-display)
|
||||
(ediff-suspend . ediff-toggle-wide-display))
|
64
.config/emacs/config/functions.el
Normal file
64
.config/emacs/config/functions.el
Normal file
|
@ -0,0 +1,64 @@
|
|||
;; additional functions
|
||||
;; taken from https://r0tty.org/git/dotfiles/emacs
|
||||
(defvar revert-some-buffers-action-alist
|
||||
'((?\C-r
|
||||
(lambda (buf)
|
||||
(view-buffer buf
|
||||
(lambda (ignore)
|
||||
(exit-recursive-edit)))
|
||||
(recursive-edit)
|
||||
;; Return nil to ask about BUF again.
|
||||
nil)
|
||||
"view this buffer")
|
||||
(?d (lambda (buf)
|
||||
(save-window-excursion
|
||||
(diff-buffer-with-file buf))
|
||||
(view-buffer (get-buffer-create "*Diff*")
|
||||
(lambda (ignore) (exit-recursive-edit)))
|
||||
(recursive-edit)
|
||||
nil)
|
||||
"view changes in this buffer"))
|
||||
"ACTION-ALIST argument used in call to `map-y-or-n-p'.")
|
||||
|
||||
;; Code/docstring taken from Emacs' `save-some-buffers' and hacked.
|
||||
(defun revert-some-buffers (&optional arg pred)
|
||||
"Revert some modified file-visiting buffers. Asks user about each one.
|
||||
You can answer `y' to revert, `n' not to revert, `C-r' to look at the
|
||||
buffer in question with `view-buffer' before deciding or `d' to
|
||||
view the differences using `diff-buffer-with-file'.
|
||||
|
||||
Optional argument (the prefix) non-nil means revert all with no questions.
|
||||
Optional second argument PRED determines which buffers are considered:
|
||||
If PRED is nil, all the file-visiting buffers are considered.
|
||||
If PRED is t, then certain non-file buffers will also be considered.
|
||||
If PRED is a zero-argument function, it indicates for each buffer whether
|
||||
to consider it or not when called with that buffer current."
|
||||
(interactive "P")
|
||||
(save-window-excursion
|
||||
(let (queried files-done)
|
||||
;; Ask about those buffers that merit it,
|
||||
;; and record the number thus reverted.
|
||||
(setq files-done
|
||||
(map-y-or-n-p
|
||||
(function
|
||||
(lambda (buffer)
|
||||
(and (not (buffer-modified-p buffer))
|
||||
(not (buffer-base-buffer buffer))
|
||||
(buffer-file-name buffer)
|
||||
(not (verify-visited-file-modtime buffer))
|
||||
(file-exists-p (buffer-file-name buffer))
|
||||
(or (not (functionp pred))
|
||||
(with-current-buffer buffer (funcall pred)))
|
||||
(if arg
|
||||
t
|
||||
(setq queried t)
|
||||
(format "Revert file %s? " (buffer-file-name buffer))))))
|
||||
(function
|
||||
(lambda (buffer)
|
||||
(set-buffer buffer)
|
||||
(revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)))
|
||||
(buffer-list)
|
||||
'("buffer" "buffers" "save")
|
||||
revert-some-buffers-action-alist))
|
||||
(or queried (> files-done 0)
|
||||
(message "(No files need reverting)")))))
|
20
.config/emacs/config/git.el
Normal file
20
.config/emacs/config/git.el
Normal file
|
@ -0,0 +1,20 @@
|
|||
(use-package magit
|
||||
:ensure t
|
||||
:init
|
||||
;; (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el)
|
||||
(defun vcsh (repo)
|
||||
"Invoke magit on a vcsh repo. This requires an appropriate entry in `tramp-methods'."
|
||||
(interactive (let ((repos (delq nil
|
||||
(mapcar #'(lambda (name)
|
||||
(if (string-match ".git$" name)
|
||||
(substring name 0 -4)
|
||||
nil))
|
||||
(directory-files "~/.config/vcsh/repo.d")))))
|
||||
(list (completing-read "Repository: " repos nil t))))
|
||||
(magit-status-internal (format "/vcsh:%s:" repo)))
|
||||
:config
|
||||
;; Turn on flyspell when writing commit messages
|
||||
(add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell))
|
||||
|
||||
(use-package git-timemachine
|
||||
:ensure t)
|
3
.config/emacs/config/gpg.el
Normal file
3
.config/emacs/config/gpg.el
Normal file
|
@ -0,0 +1,3 @@
|
|||
(use-package pinentry
|
||||
:init
|
||||
(setq epa-pinentry-mode 'loopback))
|
5
.config/emacs/config/man.el
Normal file
5
.config/emacs/config/man.el
Normal file
|
@ -0,0 +1,5 @@
|
|||
(use-package man
|
||||
:ensure t
|
||||
:config
|
||||
(set-face-attribute 'Man-overstrike nil :inherit font-lock-type-face :bold t)
|
||||
(set-face-attribute 'Man-underline nil :inherit font-lock-keyword-face :underline t))
|
7
.config/emacs/config/multiple-cursors.el
Normal file
7
.config/emacs/config/multiple-cursors.el
Normal file
|
@ -0,0 +1,7 @@
|
|||
(use-package multiple-cursors
|
||||
:ensure t
|
||||
:bind
|
||||
("C-c m" . mc/mark-more-like-this-extended)
|
||||
("C-c a" . mc/edit-lines)
|
||||
("C->" . mc/mark-next-like-this)
|
||||
("C-<" . mc/mark-previous-like-this))
|
4
.config/emacs/config/org.el
Normal file
4
.config/emacs/config/org.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
(use-package org
|
||||
:ensure t
|
||||
:init (setq org-export-backends '(ascii html icalendar latex odt beamer))
|
||||
:config (setq org-directory "~/org"))
|
6
.config/emacs/config/pass.el
Normal file
6
.config/emacs/config/pass.el
Normal file
|
@ -0,0 +1,6 @@
|
|||
(use-package ivy-pass
|
||||
:ensure t
|
||||
:init
|
||||
(setq password-store-password-length 32)
|
||||
:bind
|
||||
("C-x p" . ivy-pass))
|
12
.config/emacs/config/python.el
Normal file
12
.config/emacs/config/python.el
Normal file
|
@ -0,0 +1,12 @@
|
|||
(add-hook 'python-mode-hook 'python-flake8)
|
||||
(add-hook 'python-mode-hook 'python-pylint)
|
||||
|
||||
(use-package flycheck-mypy
|
||||
:ensure t
|
||||
:hook
|
||||
(python-mode . flycheck-mode))
|
||||
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:hook
|
||||
(python-mode . lsp-deferred))
|
3
.config/emacs/config/ripgrep.el
Normal file
3
.config/emacs/config/ripgrep.el
Normal file
|
@ -0,0 +1,3 @@
|
|||
(use-package deadgrep
|
||||
:ensure t
|
||||
:bind ("M-s d" . deadgrep))
|
20
.config/emacs/config/rust.el
Normal file
20
.config/emacs/config/rust.el
Normal file
|
@ -0,0 +1,20 @@
|
|||
(use-package cargo
|
||||
:ensure t
|
||||
:hook
|
||||
;; enable cargo keybindings
|
||||
(rust-mode . cargo-minor-mode))
|
||||
|
||||
(use-package rust-mode
|
||||
:ensure t
|
||||
:config
|
||||
;; format code when saving
|
||||
(setq rust-format-on-save t))
|
||||
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:hook
|
||||
(rust-mode . lsp-deferred)
|
||||
(toml-mode . lsp-deferred))
|
||||
|
||||
(use-package flycheck-rust :ensure t)
|
||||
(use-package toml-mode :ensure t)
|
9
.config/emacs/config/tramp.el
Normal file
9
.config/emacs/config/tramp.el
Normal file
|
@ -0,0 +1,9 @@
|
|||
(use-package tramp
|
||||
:config
|
||||
(setq tramp-default-method "ssh")
|
||||
(add-to-list 'tramp-methods '("vcsh"
|
||||
(tramp-login-program "vcsh")
|
||||
(tramp-login-args (("enter")
|
||||
("%h")))
|
||||
(tramp-remote-shell "/bin/sh")
|
||||
(tramp-remote-shell-args ("-c")))))
|
2
.config/emacs/config/yaml.el
Normal file
2
.config/emacs/config/yaml.el
Normal file
|
@ -0,0 +1,2 @@
|
|||
(use-package yaml-mode :ensure t)
|
||||
(use-package flycheck-yamllint :ensure t)
|
100
.config/emacs/init.el
Normal file
100
.config/emacs/init.el
Normal file
|
@ -0,0 +1,100 @@
|
|||
;;;;
|
||||
;;;;;; -*- Mode: Emacs-Lisp -*-
|
||||
;;;;
|
||||
;; package config
|
||||
;; We want certificate verification for the repositories, see
|
||||
;; <https://glyph.twistedmatrix.com/2015/11/editor-malware.html> for
|
||||
;; the issues involved. Note that on Debian, `gnutls-trustfiles' has
|
||||
;; reasonable settings, so we don't need to customize that.
|
||||
(setq tls-checktrust t)
|
||||
(setq gnutls-verify-error t)
|
||||
|
||||
(setq tls-program
|
||||
'("gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p %p %h"))
|
||||
|
||||
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
|
||||
|
||||
;; Do package initialization now, so we can require packages from config snippets
|
||||
(setq package-enable-at-startup nil)
|
||||
(require 'package)
|
||||
(setq package-archives
|
||||
'(("gnu" . "https://elpa.gnu.org/packages/")
|
||||
("melpa" . "https://melpa.org/packages/")))
|
||||
|
||||
;; package list to install
|
||||
(setq package-list '(use-package))
|
||||
|
||||
;; activate packages
|
||||
(package-initialize)
|
||||
|
||||
;; fetch list of available packages
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
|
||||
;; install missing packages
|
||||
(dolist (package package-list)
|
||||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
|
||||
;; configure packages (taken from https://r0tty.org/git/dotfiles/emacs)
|
||||
(require 'use-package)
|
||||
|
||||
;; file used for storing customization information
|
||||
(setq custom-file "~/.config/emacs/custom.el")
|
||||
(load custom-file)
|
||||
|
||||
;; set auth-sources
|
||||
(setq auth-sources '("~/.authinfo.gpg"))
|
||||
|
||||
;; Config snippets loading; this provides an easy way to define
|
||||
;; 'configuration snippets' for use with a specific package (that may
|
||||
;; be not installed), and enable loading that snippet when its
|
||||
;; basename (specified as a symbol) is part of the variable
|
||||
;; config-snippets.
|
||||
(defgroup config-snippets nil
|
||||
"Configuration snippets -- elisp files that are loaded at startup.")
|
||||
|
||||
(defcustom config-snippets '()
|
||||
"Specifies the config snippets to be loaded at startup.
|
||||
Elements may be strings (interpreted as literal filenames) or
|
||||
symbols, which are converted to strings, and suffixed with \".el\"."
|
||||
:group 'config-snippets
|
||||
:type '(repeat (choice symbol string)))
|
||||
|
||||
(defcustom config-snippet-path '("~/.config/emacs/config/")
|
||||
"Specifies the path in which config snippets are searched"
|
||||
:group 'config-snippets
|
||||
:type '(repeat directory))
|
||||
|
||||
(setq config-snippets '(base
|
||||
backups
|
||||
c
|
||||
calendar
|
||||
dev
|
||||
ediff
|
||||
functions
|
||||
git
|
||||
gpg
|
||||
man
|
||||
multiple-cursors
|
||||
org
|
||||
pass
|
||||
python
|
||||
ripgrep
|
||||
rust
|
||||
tramp
|
||||
wl
|
||||
yaml))
|
||||
|
||||
(message "Loading\nconfig-snippets: %s\nconfig-snippets-path: %s" config-snippets config-snippet-path)
|
||||
(dolist (snippet config-snippets)
|
||||
(message "snippet: %s" snippet)
|
||||
(dolist (dir config-snippet-path)
|
||||
(message "dir: %s" dir)
|
||||
(let ((file-name (expand-file-name (concat dir (if (symbolp snippet)
|
||||
(concat (symbol-name snippet) ".el")
|
||||
snippet)))))
|
||||
(message "loading file")
|
||||
(if (file-readable-p file-name)
|
||||
(load-file file-name)
|
||||
(message "Config snippet not found: %s" snippet)))))
|
Loading…
Add table
Add a link
Reference in a new issue