.emacs.d/init.el

785 lines
24 KiB
EmacsLisp

;;; init.el --- tastytea's Emacs init file.
;;; Time-stamp: <2019-04-04 12:52:16 CEST>
;;; Commentary:
;;; I am using this file with Emacs 26, but most of it will probably work with
;;; Emacs 24 and above.
;;; Code:
;;;;;;;;;;;;;;;;;;;; Packages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(setq package-archive-priorities '(("gnu" . 1)
("melpa-stable" . 2)
("melpa" . 3)))
(package-initialize)
;; Add path for custom packages.
(add-to-list 'load-path "~/.emacs.d/custom-packages/")
;; Install use-package if necessary.
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; Always install packages if they are not present.
(require 'use-package-ensure)
(setq use-package-always-ensure t)
;; autocompile files as needed.
(use-package auto-compile
:init
;; Use uncompiled file if it is newer than the compiled one.
(setq load-prefer-newer t)
:config
(auto-compile-on-load-mode))
;; ;; Benchmark for startup-file.
;; (use-package benchmark-init
;; :config
;; ;; To disable collection of benchmark data after init is done.
;; (add-hook 'after-init-hook 'benchmark-init/deactivate))
;; Update packages if at least 7 days have passed.
(use-package auto-package-update
:custom
(auto-package-update-delete-old-versions t)
(auto-package-update-interval 7)
(auto-package-update-hide-results nil)
:config
(auto-package-update-maybe))
;;;;;;;;;;;;;;;;;;;; Global variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Determine if we run on a slow computer.
(defvar slow-computer nil)
(if (member (system-name) '("steuerbeamter" "azimuth" "localhost"))
(setq slow-computer t)) ; localhost is schnibble
;; Show manpages and error messages from compilers in English.
(setenv "LANG" "en_US.utf8")
;;;;;;;;;;;;;;;;;;;; Configure some essential things ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set garbage collection threshold to 100 MiB (or 20 MiB) to speed up init.
;; It is reset at the end of the file.
(if slow-computer
(setq gc-cons-threshold (* 20 1024 1024))
(setq gc-cons-threshold (* 100 1024 1024)))
;; Accelerate startup by not printing so much.
(setf inhibit-startup-screen t
inhibit-startup-echo-area-message t
inhibit-startup-message t)
;; Just type y/n instead of yes/no when prompted.
(defalias 'yes-or-no-p 'y-or-n-p)
;; Save cursor position.
(use-package saveplace
:config
(save-place-mode t))
;; Delete selection when you start to write.
(delete-selection-mode t)
;; Save minibuffer history.
(savehist-mode t)
;; Save backups in ~/.emacs.d/backups/ and keep more versions.
(setq backup-directory-alist
`(("." . ,(concat user-emacs-directory "backups"))))
(setq delete-old-versions t ; Delete old backups.
kept-new-versions 6 ; Keep 6 newest backups.
backup-by-copying t ; Copy to backup folder.
version-control t) ; Append version numbers to file names.
;; Save auto-saves in ~/.emacs.d/backups/.
(setq auto-save-file-name-transforms
`((".*" ,(concat user-emacs-directory "backups/") t)))
;; Set some personal information.
(setq user-full-name "tastytea"
user-mail-address "tastytea@tastytea.de")
;; kill-region (cut) and kill-ring-save (copy) act on the current line if no
;; text is visually selected.
;; https://www.emacswiki.org/emacs/WholeLineOrRegion
(put 'kill-ring-save 'interactive-form
'(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (line-beginning-position) (line-beginning-position 2)))))
(put 'kill-region 'interactive-form
'(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (line-beginning-position) (line-beginning-position 2)))))
;; Banish customizations to another file.
(setq custom-file (concat user-emacs-directory "custom.el"))
;; Scroll 1 line at a time.
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
;; ;; Never recenter cursor while scrolling.
;; (setq scroll-conservatively 101)
;; ;; Scroll before cursor has reached top/bottom.
;; ;; Way too slow with fci-mode and highlight-indent-guides activated.
;; (use-package smooth-scrolling
;; :config
;; (smooth-scrolling-mode 1))
;; Paste text where the cursor is, not where the mouse is.
(setq mouse-yank-at-point t)
;; Make scratch buffer empty and select text-mode.
(setq initial-scratch-message nil
initial-major-mode 'text-mode)
;; Always add a newline at the and of the file.
(setq require-final-newline t)
;;;;;;;;;;;;;;;;;;;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package bind-key
:config
(bind-keys
;; ;; Scroll in other window.
;; ("S-<prior>" . scroll-other-window-down)
;; ("S-<next>" . scroll-other-window)
;; Switch window
("C-<tab>" . other-window)
;; Reduce whitespace around cursor to 0 or 1, according to context.
("C-S-<delete>" . fixup-whitespace)
;; Scroll without moving the cursor.
("M-<down>" . scroll-up-line)
("M-<up>" . scroll-down-line)))
;;;;;;;;;;;;;;;;;;;; Programming / general ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Online documentation mode.
(use-package eldoc
:hook
(prog-mode . turn-on-eldoc-mode))
;; Syntax checking with many plugins.
(unless slow-computer
(use-package flycheck
:config
(global-flycheck-mode)))
;; Autocompletion mode with many plugins.
(unless slow-computer
(use-package company
:bind
(:map company-active-map
("<return>" . nil) ; Disable completion on return.
("RET" . nil) ; https://emacs.stackexchange.com/a/13290
("<tab>" . company-complete-selection) ; Make tab work in lists.
("TAB" . company-complete-selection))
:hook
(after-init . global-company-mode)))
;; Fuzzy autocompletion for company.
(use-package company-flx
:after company
:config
(company-flx-mode +1))
;; Set default indentation.
(setq-default indent-tabs-mode nil
tab-width 4)
;; Guess indentation.
(use-package dtrt-indent
:hook
(prog-mode . dtrt-indent-mode))
;; Automatic project management.
(unless slow-computer
(use-package projectile
:after neotree
:config
(projectile-mode +1)
(setq projectile-switch-project-action 'neotree-projectile-action
projectile-project-compilation-dir "build"
projectile-project-configure-cmd
"cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G 'Unix Makefiles' .."
projectile-project-compilation-cmd "cmake --build .")
(defun my/projectile-kill-buffers-and-change-tabbar-grouping ()
"Kill project buffers and change tabbar-ruler grouping to user-buffers."
(interactive)
(projectile-kill-buffers)
(tabbar-ruler-group-user-buffers))
:bind
("C-c p" . 'projectile-command-map)
(:map projectile-command-map
("k" . 'my/projectile-kill-buffers-and-change-tabbar-grouping))))
;; Highlight TODO, FIXME, NOTE and so on.
(use-package hl-todo
:bind
(:map hl-todo-mode-map
("C-c t" . hl-todo-occur))
:hook
(prog-mode . hl-todo-mode))
;; Better commenting.
(use-package smart-comment
:bind
("C-x c" . smart-comment))
;; Toggle betweeen beginning/end of line and beginning/end of code.
(use-package mwim
:bind
("<home>" . mwim-beginning-of-line-or-code)
("<end>" . mwim-end-of-line-or-code))
;; Auto-type closing brackets.
(electric-pair-mode t)
;; Fold code.
(use-package fold-dwim
:bind
("<f7>" . fold-dwim-toggle)
("C-x t" . fold-dwim-toggle)
:hook
(prog-mode . hs-minor-mode))
;; ;; Highlight indentation levels.
;; (use-package highlight-indent-guides
;; :custom
;; (highlight-indent-guides-method 'character)
;; (highlight-indent-guides-responsive 'top)
;; :hook
;; (prog-mode . highlight-indent-guides-mode))
;; Tries to find points of interest and jumps to them.
(use-package imenu-anywhere
:after ido-completing-read+
:bind
("M-i" . imenu-anywhere))
(use-package highlight-doxygen
:custom-face
(highlight-doxygen-comment ((t (:inherit font-lock-comment-face :foreground "#667788"))))
(highlight-doxygen-code-block ((t (:inherit highlight-doxygen-comment-face))))
:hook
(prog-mode . highlight-doxygen-mode))
;;;;;;;;;;;;;;;;;;;; Programming / C++ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set coding style.
(use-package cc-mode
:ensure nil ; Included in Emacs.
:config
(c-add-style "tastytea"
'("bsd"
(c-basic-offset . 4)))
:custom
(c-default-style "tastytea"))
(unless slow-computer
(use-package rtags
:pin melpa-stable
:if (executable-find "llvm-config")
:if (executable-find "clang++")
:config
(unless (and (rtags-executable-find "rc") (rtags-executable-find "rdm"))
(progn
(message "RTags is not installed!")
(rtags-install)))
(rtags-enable-standard-keybindings)
:bind
(:map c-mode-base-map
("M-." . rtags-find-symbol-at-point)
("M-," . rtags-find-references-at-point)
("M-?" . rtags-display-summary))
:hook
(c++-mode . (rtags-start-process-unless-running))
(c-mode . (rtags-start-process-unless-running))
(kill-emacs . rtags-quit-rdm)))
(use-package flycheck-rtags
:pin melpa-stable
:after (flycheck rtags)
:config
;; ensure that we use only rtags checking.
;; https://github.com/Andersbakken/rtags#optional-1
(defun my/setup-flycheck-rtags ()
(flycheck-select-checker 'rtags)
(setq-local flycheck-highlighting-mode nil)) ; Can't disable RTags overlay.
:hook
(c-mode-hook . my/setup-flycheck-rtags)
(c++-mode-hook . my/setup-flycheck-rtags))
(use-package company-rtags
:pin melpa-stable
:after (company rtags)
:custom
(rtags-completions-enabled t)
:config
;; (setq rtags-autostart-diagnostics t)
;; (rtags-diagnostics)
(push 'company-rtags company-backends))
;; cmake integration.
(unless slow-computer
(use-package cmake-ide
:after rtags
:custom
(cmake-ide-build-dir "build")
:config
(cmake-ide-setup)))
;; GUI for gdb and other debuggers.
(use-package realgud
:after cc-mode
:config
(defun my/load-realgud ()
(load-library "realgud"))
:bind
(:map c-mode-base-map
("C-c g" . my/load-realgud)))
;;;;;;;;;;;;;;;;;;;; Appearance ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Hide toolbar.
(tool-bar-mode -1)
;; Put scrollbar to the right side.
(if (display-graphic-p)
(set-scroll-bar-mode 'right))
;; Icons (required by doom).
(use-package all-the-icons
:config
(unless (file-exists-p "~/.local/share/fonts/all-the-icons.ttf")
(all-the-icons-install-fonts t)))
;; Themes for doom-modeline.
(unless slow-computer
(use-package doom-themes
:after (all-the-icons neotree)
:custom
(doom-neotree-file-icons 'icons)
:custom-face
(font-lock-comment-face ((t (:inherit font-lock-comment-face :foreground "#667755"))))
;; (font-lock-comment-face ((t (:inherit font-lock-comment-face :foreground "#555556"))))
:config
(load-theme 'doom-molokai t)
(doom-themes-neotree-config)))
;; Neat modeline.
(use-package doom-modeline
:after all-the-icons
:init
(column-number-mode t) ; Show column numbers in modeline.
:config
(setq doom-modeline-minor-modes t
;; doom-modeline-buffer-file-name-style 'relative-to-project
doom-modeline-buffer-file-name-style 'truncate-except-project
doom-modeline-minor-modes nil)
:hook
(after-init . doom-modeline-mode))
;; Miscellaneous visual improvements.
(set-face-font 'default "Source Code Pro")
(global-hl-line-mode t) ; Highlight current line.
(size-indication-mode) ; Buffer size display in the modeline.
(show-paren-mode t) ; Visualize matching parens.
;; Show line numbers on the left side of the buffer.
(use-package display-line-numbers
:if (>= emacs-major-version 26)
:config
(global-display-line-numbers-mode))
;; Colored man pages
(use-package man
:defer t
:custom-face
(Man-overstrike ((t (:inherit font-lock-type-face :bold t))))
(Man-underline ((t (:inherit font-lock-keyword-face :underline t)))))
;;;;;;;;;;;;;;;;;;;; Misc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Show directory tree in a window.
(use-package neotree
:demand t
:after all-the-icons
:custom
(neo-smart-open t)
(neo-show-updir-line t) ; Disabled by doom-themes?
(neo-window-width 30)
(neo-show-hidden-files t)
:bind
("<f8>" . neotree-toggle))
;; Git integration.
(use-package git-commit
:pin melpa-stable)
(unless slow-computer
(use-package magit
:pin melpa-stable
:config
(defun my/magit-kill-buffers (arg)
"Restore window configuration and kill all Magit buffers."
(interactive)
(let ((buffers (magit-mode-get-buffers)))
(magit-restore-window-configuration)
(mapc #'kill-buffer buffers)))
:bind
("C-x g" . magit-status)
("C-x M-g" . magit-dispatch)
:custom
(magit-bury-buffer-function 'my/magit-kill-buffers)))
;; Draw line in column 80
(use-package fill-column-indicator
:after company
:init
(defun my/set-fill-column-80 ()
"Set fill-column to 80."
(set-fill-column 80))
:config
;; Fix bug with fci + company.
(defun my/on-off-fci-before-company(command)
(when (string= "show" command)
(turn-off-fci-mode))
(when (string= "hide" command)
(turn-on-fci-mode)))
(advice-add 'company-call-frontends :before #'my/on-off-fci-before-company)
:hook
(prog-mode . my/set-fill-column-80)
(conf-mode . my/set-fill-column-80)
(markdown-mode . my/set-fill-column-80)
(prog-mode . fci-mode)
(text-mode . fci-mode))
;; Interactive substring matching.
(use-package ido
:defer 5
:config
(ido-mode t)
(ido-everywhere t))
;; Flexible matching for ido.
(use-package flx-ido
:after ido
:custom
(ido-enable-flex-matching t)
(ido-ignore-extensions t) ; Ignore extension like ~ and .o.
(ido-use-virtual-buffers t) ; Use history of recently opened buffers.
(recentf-max-saved-items 40) ; Keep this number of buffers in history.
:config
(flx-ido-mode t))
;; Replaces stock emacs completion with ido completion wherever it is possible.
(unless slow-computer
(use-package ido-completing-read+
:after ido
:config
(ido-ubiquitous-mode t)))
;; Advanced tab bar.
(unless slow-computer
(use-package tabbar-ruler
:pin melpa ; Faces are not correctly applied,
:after projectile ; version from >=2016-08-02 is needed.
:init
(setq tabbar-ruler-global-tabbar t)
:config
;; (tabbar-ruler-group-by-projectile-project) ; Group by projectile.
;; (tabbar-ruler-group-buffer-groups) ; Group by file type.
(tabbar-ruler-group-user-buffers) ; Group by frame.
;; (mode-icons-mode 0) ; Disable modeline symbols.
;; I have to define these 2 times, don't know why.
(set-face-attribute 'tabbar-selected nil
:background "gray11"
:foreground "light gray"
:family "Sans Serif"
:bold t)
(set-face-attribute 'tabbar-unselected nil
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t)
(set-face-attribute 'tabbar-modified nil
:inherit 'tabbar-modified
:foreground "brown2"
:italic t
:bold nil)
(add-hook 'projectile-after-switch-project-hook ; Does not work under :hook.
'tabbar-ruler-group-by-projectile-project)
:bind
("C-<prior>" . 'tabbar-ruler-tabbar-backward-tab)
("C-<next>" . 'tabbar-ruler-tabbar-forward-tab)
:custom-face
;; I Have to define these 2 times, don't know why.
(tabbar-selected (nil
:background "gray11"
:foreground "light gray"
:family "Sans Serif"
:bold t))
(tabbar-unselected (nil
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t))
(tabbar-modified (nil
:foreground "brown2"
:italic t
:bold nil))
))
;; Visualize whitespace.
(use-package whitespace
:config
(delete 'newline-mark whitespace-style) ; Don't paint $ at eol.
(delete 'lines whitespace-style) ; Don't paint lines red if too long.
;; Don't show dots in company menu.
(defun my/on-off-whitespace-before-company(command)
(when (string= "show" command)
(whitespace-mode -1))
(when (string= "hide" command)
(whitespace-mode t)))
(advice-add 'company-call-frontends
:before #'my/on-off-whitespace-before-company)
:bind
("C-x w" . 'whitespace-mode)
:hook
(prog-mode . whitespace-mode)
(conf-mode . whitespace-mode)
:custom-face
(whitespace-space ((nil :foreground "gray18"))))
;; Spell checking.
(if (or (executable-find "aspell")
(executable-find "hunspell")
(executable-find "ispell"))
(unless slow-computer
(use-package flyspell
:custom
(ispell-dictionary "english")
:config
(defun my/toggle-flyspell ()
"Toggle flyspell-mode and run flyspell-buffer after activating."
(interactive)
(if (bound-and-true-p flyspell-mode)
(flyspell-mode 0)
(flyspell-mode)
(flyspell-buffer)))
(defun my/flyspell-german ()
"Set dictionary to german."
(ispell-change-dictionary "german"))
:bind
("<f6>" . my/toggle-flyspell)
(:map flyspell-mode-map
("C-;" . nil)) ; iedit needs C-;.
:hook
;; Spellcheck comments.
(prog-mode . flyspell-prog-mode)
;; Spellcheck LaTeX
(LaTeX-mode . my/flyspell-german)
(LaTeX-mode . flyspell-mode))))
;; Multiple cursors.
(use-package multiple-cursors
:init
(global-unset-key (kbd "M-<down-mouse-1>"))
:bind
("C-x M-m" . mc/edit-lines)
("M-<mouse-1>" . mc/add-cursor-on-click))
;; If 2 files have the same name, append directory name after the filename.
(use-package uniquify
:ensure nil ; Included in Emacs.
:custom
(uniquify-after-kill-buffer-p t)
(uniquify-buffer-name-style 'post-forward)
(uniquify-strip-common-suffix t))
;; Delete old buffers.
;; https://www.emacswiki.org/emacs/CleanBufferList
(use-package midnight
:defer 5
:init
(setq midnight-delay 30 ; 30 seconds after "midnight"
midnight-period (* 2 60 60)) ; Clean every 2 hours.
:custom
(clean-buffer-list-delay-general 1) ; Clean normal bufs after 1d.
(clean-buffer-list-delay-special (* 30 60)) ; Clean special bufs after 30m.
:config
(setq clean-buffer-list-kill-regexps ; Add these to special buffers.
(nconc clean-buffer-list-kill-regexps
'("\\`magit-?.*:"
"\\.log\\'"
"\\`'\\*rdm\\*\\'")))
(midnight-mode t))
;; The string Time-stamp: <> in the first 8 lines of the file will be updated
;; with the current timestamp.
(use-package time-stamp
:custom
(time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %Z")
:hook
(before-save . time-stamp))
;; Edit multiple regions in the same way simultaneously.
(use-package iedit
:bind
("C-;" . iedit-mode))
;; Mode for writing blog posts with hugo.
(if (string= (system-name) "ventiloplattform")
(use-package easy-hugo
:custom
(easy-hugo-basedir "~/Projekte/www/blog.tastytea.de/")
(easy-hugo-url "https://blog.tastytea.de")
(easy-hugo-previewtime "300")
(easy-hugo-postdir "content/posts")
(easy-hugo-default-ext ".adoc")
:bind
("C-x M-h" . easy-hugo)
:mode
;; The mode is not turned on?
("\\`'\\*Easy-hugo\\*\\'" . easy-hugo-mode)))
;; Automatically insert text in new files.
(use-package autoinsert
:init
;; I only use it in here for now
(use-package yasnippet)
(defun my/autoinsert-yas-expand()
"Replace text in yasnippet template."
(yas-minor-mode t)
(yas-expand-snippet (buffer-string) (point-min) (point-max)))
:config
(add-to-list 'auto-insert-alist
'(("\\.\\(cpp\\|cc\\|cxx\\|c\\+\\+\\)\\'" . "C++ program") .
["cpp" my/autoinsert-yas-expand]))
(add-to-list 'auto-insert-alist
'(("\\.\\(hpp\\|hh\\|hxx\\|h\\+\\+\\)\\'" . "C++ header") .
["hpp" my/autoinsert-yas-expand]))
(add-to-list 'auto-insert-alist
'(("\\.[1-9]\\.adoc\\'" . "AsciiDoc manpage") .
["manpage.adoc" my/autoinsert-yas-expand]))
:custom
(auto-insert-directory (concat user-emacs-directory "auto-insert"))
(auto-insert-query nil) ; Don't ask before inserting.
:hook
(find-file . auto-insert))
;;;;;;;;;;;;;;;;;;;; LaTeX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (executable-find "xelatex")
(use-package tex-site
:ensure auctex
:custom
(TeX-parse-self t) ; Enable parse on load.
(TeX-auto-save t) ; Enable parse on save
(TeX-PDF-mode t) ; PDF mode (rather than DVI-mode)
(TeX-engine 'xelatex)
;; To use pdf-tools with auctex.
;; https://emacs.stackexchange.com/a/21764/21935
(TeX-view-program-selection '((output-pdf "PDF Tools")))
(TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)))
:mode
("\\.tex\\'" . LaTeX-mode)
:config
;; To have the buffer refresh after compilation.
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)))
;; Auto complete for LaTeX.
(use-package company-auctex
:after auctex
:hook
(LaTeX-mode . company-auctex-init))
;;;;;;;;;;;;;;;;;;;; File formats ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package adoc-mode
:mode
(("\\.adoc" . adoc-mode))
:hook
(adoc-mode . visual-line-mode))
(use-package markdown-mode
:custom
(markdown-command "cmark")
:mode
(("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:hook
(markdown-mode . visual-line-mode)
)
(use-package crontab-mode
:mode
("/cron\\.d/" . crontab-mode)
("\\`'/etc/crontab\\'" . crontab-mode))
(use-package nginx-mode
:defer t)
(use-package company-nginx
:after nginx-mode
:hook
(nginx-mode . company-nginx-keywords))
;; View PDF files.
(use-package pdf-tools
:mode
("\\.pdf\\'" . pdf-tools-install))
;;;;;;;;;;;;;;;;;;;; Server / Remote editing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Edit remote files.
(unless slow-computer
(use-package tramp
:config
;; ssh is faster than scp and supports ports.
(setq tramp-default-method "ssh")
;; Add verification code support.
(customize-set-variable
'tramp-password-prompt-regexp
(concat
"^.*"
(regexp-opt
'("passphrase" "Passphrase"
"password" "Password"
"Verification code")
t)
".*:\0? *"))
;; Respect remote PATH.
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)))
;; Run server if:
;; - Our EUID is not 0,
;; - We are not logged in via SSH,
;; - It is not already running.
(unless (equal (user-real-uid) 0)
(unless (getenv "SSH_CONNECTION")
(use-package server
:defer 5
:init
(setq server-use-tcp t
server-port 51313
server-auth-key ; 64 chars, saved in ~/.emacs.d/server/server.
"phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh")
:config
(unless (server-running-p)
(server-start))
)))
;; Set garbage collection threshold to original value.
(setq gc-cons-threshold (car (get 'gc-cons-threshold 'standard-value)))
(provide 'init)
;;; init.el ends here