Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;; init-defaults.el --- Some default things -*- lexical-binding: t; -*-
- ;;; Commentary:
- ;;; Code:
- ;; Some variables
- (defvar minotaur-emacs-dir
- (eval-when-compile (file-truename user-emacs-directory))
- "Our Emacs directory, where everything is loaded. Must end with a slash.")
- (defvar minotaur-local-dir
- (concat minotaur-emacs-dir ".local/")
- "For local storage of many things.
- Purely for the sake of sanity; i.e. we don't want random files that are used
- for saving places or any other data just lying in the `user-emacs-directory'.")
- (defvar minotaur-etc-dir
- (concat minotaur-local-dir "etc/")
- "For non-volatile local storage.
- Stuff that doesn't change.")
- (defvar minotaur-cache-dir
- (concat minotaur-local-dir "cache/")
- "For volatile local storage.
- For stuff that *does* change.")
- (defvar minotaur-package-dir
- (concat minotaur-local-dir "packages/")
- "A clean place to store packages.")
- (defvar minotaur-debug-mode (or (getenv "DEBUG") init-file-debug)
- "If non-nil, Minotaur will log more.
- Use `minotaur-toggle-debug-mode' to toggle it. The --debug-init flag and setting the
- DEBUG envvar will enable this at startup.")
- (defun minotaur-toggle-debug-mode (&optional arg)
- "Toggle `debug-on-error' and `minotaur-debug-mode' for verbose logging."
- (interactive (list (or current-prefix-arg 'toggle)))
- (let ((value
- (cond ((eq arg 'toggle) (not minotaur-debug-mode))
- ((> (prefix-numeric-value arg) 0)))))
- (setq minotaur-debug-mode value
- debug-on-error value)
- (message "Debug mode %s" (if value "on" "off"))))
- (defconst EMACS26+ (> emacs-major-version 25))
- (defconst EMACS27+ (> emacs-major-version 26))
- (defconst IS-MAC (eq system-type 'darwin))
- (defconst IS-LINUX (eq system-type 'gnu/linux))
- (defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
- (defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix)))
- ;;; Editing basics from Doom Emacs
- (setq-default
- large-file-warning-threshold 15000000
- vc-follow-symlinks t
- ;; Save clipboard contents into kill-ring before replacing them
- save-interprogram-paste-before-kill t
- ;; Bookmarks
- bookmark-default-file (concat minotaur-etc-dir "bookmarks")
- bookmark-save-flag t
- ;; Formatting
- delete-trailing-lines nil
- fill-column 80
- sentence-end-double-space nil
- word-wrap t
- ;; Scrolling
- hscroll-margin 2
- hscroll-step 1
- scroll-conservatively 1001
- scroll-margin 1
- scroll-preserve-screen-position t
- mouse-wheel-scroll-amount '(5 ((shift) . 2))
- mouse-wheel-progressive-speed nil ; don't accelerate scrolling
- ;; Whitespace (see `editorconfig')
- indent-tabs-mode nil
- require-final-newline t
- tab-always-indent t
- tab-width 4
- tabify-regexp "^\t* [ \t]+" ; for :retab
- ;; Wrapping
- truncate-lines t
- truncate-partial-width-windows 50)
- ;; Remove hscroll-margin in shells, otherwise it causes jumpiness
- (with-eval-after-load 'eshell
- (setq hscroll-margin 0))
- (with-eval-after-load 'term
- (setq hscroll-margin 0))
- ;; More editing defaults
- (setq uniquify-buffer-name-style 'post-forward-angle-brackets) ; Show path if names are same
- (setq adaptive-fill-regexp "[ t]+|[ t]*([0-9]+.|*+)[ t]*")
- (setq adaptive-fill-first-line-regexp "^* *$")
- (setq delete-by-moving-to-trash t) ; Deleting files go to OS's trash folder
- (setq make-backup-files nil) ; Forbide to make backup files
- (setq auto-save-default nil) ; Disable auto save
- (setq set-mark-command-repeat-pop t) ; Repeating C-SPC after popping mark pops it again
- (setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
- (setq sentence-end-double-space nil)
- ;; Permanently indent with spaces, never with TABs
- (setq-default c-basic-offset 4
- tab-width 4
- indent-tabs-mode nil)
- ;; UI defaults
- (setq ansi-color-for-comint-mode t
- bidi-display-reordering nil ; disable bidirectional text for tiny performance boost
- blink-matching-paren nil ; don't blink--too distracting
- compilation-always-kill t ; kill compilation process before starting another
- compilation-ask-about-save nil ; save all buffers on `compile'
- compilation-scroll-output 'first-error
- confirm-nonexistent-file-or-buffer t
- cursor-in-non-selected-windows nil ; hide cursors in other windows
- display-line-numbers-width 3
- track-eol t
- enable-recursive-minibuffers nil
- frame-inhibit-implied-resize t
- ;; remove continuation arrow on right fringe
- fringe-indicator-alist
- (delq (assq 'continuation fringe-indicator-alist)
- fringe-indicator-alist)
- highlight-nonselected-windows nil
- image-animate-loop t
- sentence-end-double-space nil
- indicate-buffer-boundaries nil
- indicate-empty-lines nil
- max-mini-window-height 0.3
- use-file-dialog nil
- use-dialog-box nil
- inhibit-startup-screen t
- inhibit-startup-echo-area-message t
- echo-keystrokes 0.1
- mode-line-default-help-echo nil ; disable mode-line mouseovers
- mouse-yank-at-point t ; middle-click paste at point, not at click
- resize-mini-windows 'grow-only ; Minibuffer resizing
- show-help-function nil ; hide :help-echo text
- split-width-threshold 160 ; favor horizontal splits
- uniquify-buffer-name-style nil ; custom modeline will show file paths anyway
- use-dialog-box nil ; always avoid GUI
- show-trailing-whitespace t
- visible-cursor nil
- x-stretch-cursor nil
- ;; `pos-tip' defaults
- pos-tip-internal-border-width 6
- pos-tip-border-width 1
- ;; no beeping or blinking please
- ring-bell-function #'ignore
- visible-bell nil
- ;; don't (region-end)size emacs in steps, it looks weird
- window-resize-pixelwise t
- frame-resize-pixelwise t)
- ;; UTF-8 as the default coding system
- (when (fboundp 'set-charset-priority)
- (set-charset-priority 'unicode)) ; pretty
- (prefer-coding-system 'utf-8) ; pretty
- (setq locale-coding-system 'utf-8) ; please
- (unless IS-WINDOWS
- (setq selection-coding-system 'utf-8)) ; with sugar on top
- (fset #'yes-or-no-p #'y-or-n-p)
- (fset #'display-startup-echo-area-message #'ignore)
- (if (bound-and-true-p tooltip-mode) (tooltip-mode -1))
- (blink-cursor-mode -1)
- (add-to-list 'default-frame-alist '(tool-bar-lines . 0))
- (add-to-list 'default-frame-alist '(menu-bar-lines . 0))
- (add-to-list 'default-frame-alist '(vertical-scroll-bars))
- (setq-default show-trailing-whitespace nil)
- (with-eval-after-load 'prog-mode
- (setq show-trailing-white-space t))
- (with-eval-after-load 'text-mode
- (setq show-trailing-white-space t))
- (with-eval-after-load 'conf-mode
- (setq show-trailing-white-space t))
- (put 'whitespace-toggle-options 'disabled t)
- (put 'global-whitespace-toggle-options 'disabled t)
- ;; Leave me alone, *Warnings* and *Flycheck errors*
- (add-to-list 'display-buffer-alist '("^\\*Warnings\\*$" (display-buffer-no-window)
- (allow-no-window . t)))
- (add-to-list 'display-buffer-alist '("^\\*Flycheck errors\\*$" (display-buffer-no-window)
- (allow-no-window . t)))
- ;; More defaults from Doom Emacs.
- (setq-default
- ad-redefinition-action 'accept ; silence redefined function warnings
- apropos-do-all t ; make `apropos' more useful
- auto-mode-case-fold nil
- autoload-compute-prefixes nil
- load-prefer-newer t
- ediff-window-setup-function 'ediff-setup-windows-plain
- debug-on-error minotaur-debug-mode
- jka-compr-verbose minotaur-debug-mode ; silence compression messages
- ffap-machine-p-known 'reject ; don't ping things that look like domain names
- find-file-visit-truename t ; resolve symlinks when opening files
- idle-update-delay 1 ; update ui slightly less often
- ;; be quiet at startup; don't load or display anything unnecessary
- inhibit-startup-message t
- inhibit-startup-echo-area-message user-login-name
- inhibit-default-init t
- initial-major-mode 'fundamental-mode
- initial-scratch-message nil
- ;; History & backup settings (save nothing, that's what git is for)
- auto-save-default nil
- create-lockfiles nil
- history-length 500
- make-backup-files nil ; don't create backup~ files
- ;; byte compilation
- byte-compile-verbose minotaur-debug-mode
- byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local)
- ;; security
- gnutls-verify-error (not (getenv "INSECURE")) ; you shouldn't use this
- tls-checktrust gnutls-verify-error
- tls-program (list "gnutls-cli --x509cafile %t -p %p %h"
- ;; compatibility fallbacks
- "gnutls-cli -p %p %h"
- "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof")
- ;; Don't store authinfo in plain text!
- auth-sources (list (expand-file-name "authinfo.gpg" minotaur-etc-dir)
- "~/.authinfo.gpg")
- ;; Don't litter `minotaur-emacs-dir'
- abbrev-file-name (concat minotaur-local-dir "abbrev.el")
- async-byte-compile-log-file (concat minotaur-etc-dir "async-bytecomp.log")
- auto-save-file-name-transformers (concat minotaur-cache-dir "auto-save-list/")
- auto-save-list-file-name (concat minotaur-cache-dir "autosave")
- backup-directory-alist (list (cons "." (concat minotaur-cache-dir "backup/")))
- desktop-dirname (concat minotaur-etc-dir "desktop")
- desktop-base-file-name "autosave"
- desktop-base-lock-name "autosave-lock"
- pcache-directory (concat minotaur-cache-dir "pcache/")
- request-storage-directory (concat minotaur-cache-dir "request")
- server-auth-dir (concat minotaur-cache-dir "server/")
- shared-game-score-directory (concat minotaur-etc-dir "shared-game-score/")
- tramp-auto-save-directory (concat minotaur-cache-dir "tramp-auto-save/")
- tramp-backup-directory-alist backup-directory-alist
- tramp-persistency-file-name (concat minotaur-cache-dir "tramp-persistency.el")
- url-cache-directory (concat minotaur-cache-dir "url/")
- url-configuration-directory (concat minotaur-etc-dir "url/")
- gamegrid-user-score-file-directory (concat minotaur-etc-dir "games/"))
- (autoload 'zap-up-to-char "misc"
- "Kill up to, but not including ARGth occurrence of CHAR." t)
- (provide 'init-defaults)
- ;;; init-defaults.el ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement