.emacs.d

the most bloated Emacs config on this planet
git clone https://git.trogloxene.org/.emacs.d.git
Log | Files | Refs

init-startup.el (2949B)


      1 ;;; init-startup.el --- startup settings -*- lexical-binding: t -*-
      2 
      3 ;;; Commentary:
      4 
      5 ;;; Code:
      6 
      7 ;; coding system
      8 (set-selection-coding-system 'utf-8)
      9 (when (fboundp 'set-charset-priority)
     10   (set-charset-priority 'unicode))
     11 (set-default-coding-systems 'utf-8)
     12 (set-buffer-file-coding-system 'utf-8)
     13 (set-clipboard-coding-system 'utf-8)
     14 (set-file-name-coding-system 'utf-8)
     15 (set-keyboard-coding-system 'utf-8)
     16 (set-next-selection-coding-system 'utf-8)
     17 (set-terminal-coding-system 'utf-8)
     18 (setq locale-coding-system 'utf-8)
     19 (setq system-time-locale "C")
     20 
     21 ;; fullscreen
     22 (add-hook 'emacs-startup-hook
     23           (lambda () (set-frame-parameter nil 'fullscreen my-frame-parameter)))
     24 
     25 ;; set lisp files directory
     26 (setq user-lisp-directory (concat user-emacs-directory "lisp/"))
     27 
     28 ;; backup and autosave
     29 (setq backup-directory-alist
     30       `((".*" . ,(expand-file-name "backup/" user-emacs-directory)))
     31       backup-by-copying t
     32       delete-old-versions t
     33       kept-new-versions 6
     34       kept-old-versions 2
     35       version-control t)
     36 (setq auto-save-file-name-transforms
     37       `((".*" ,(expand-file-name "auto-save-list/" user-emacs-directory) t)))
     38 
     39 ;; disable lockfiles
     40 (setq create-lockfiles nil)
     41 
     42 ;; disable ring bell
     43 (setq ring-bell-function 'ignore)
     44 
     45 ;; scratch buffer
     46 (setq initial-scratch-message
     47       "")
     48 
     49 ;; frame title
     50 (setq-default frame-title-format '("%b - Emacs"))
     51 
     52 ;; native compile warning
     53 (setq native-comp-async-report-warnings-errors 'silent)
     54 
     55 ;; short answer
     56 (if (boundp 'use-short-answers)
     57     (setq use-short-answers t)
     58   (fset 'yes-or-no-p 'y-or-n-p))
     59 
     60 ;; ask for confirmation when killing emacs
     61 (setq confirm-kill-emacs #'y-or-n-p)
     62 
     63 ;; trash
     64 (setq delete-by-moving-to-trash t)
     65 
     66 ;; optimize word wrapping
     67 (setq word-wrap-by-category t)
     68 
     69 ;; don't insert tabs
     70 (setq-default indent-tabs-mode nil)
     71 
     72 ;; query gpg passphrase in minibuffer, needs to add
     73 ;; 'allow-loopback-pinentry' to gpg-agent config, comment it if you
     74 ;; are using other pinentry programs
     75 ;; (setq epg-pinentry-mode 'loopback)
     76 
     77 ;; secondary browser
     78 (setq browse-url-secondary-browser-function 'eww)
     79 
     80 ;; disabled commands
     81 (put 'narrow-to-region 'disabled nil)
     82 (put 'scroll-left 'disabled nil)
     83 (setq enable-recursive-minibuffers t)
     84 
     85 ;; modifier keys on mac
     86 (when *is-emacs-mac-port*
     87   (setq mac-command-modifier 'meta)
     88   (setq mac-option-modifier 'super)
     89   (setq mac-pass-control-to-system t)
     90   (setq mac-pass-command-to-system nil))
     91 
     92 ;; proxy
     93 (defun load-proxy ()
     94   "Load proxy."
     95   (interactive)
     96   (setq url-proxy-services
     97         `(("http" . ,my-proxy)
     98           ("https" . ,my-proxy)
     99           ("no_proxy" . "\\(localhost\\|127\\.0\\.0\\.1\\|192\\.168\\.*\\)"))))
    100 (when my-load-proxy
    101   (load-proxy))
    102 
    103 (defun clear-proxy ()
    104   "Clear proxy."
    105   (interactive)
    106   (setq url-proxy-services nil))
    107 
    108 ;; something else
    109 (setq inhibit-compacting-font-caches t
    110       frame-inhibit-implied-resize t
    111       frame-resize-pixelwise t)
    112 
    113 (provide 'init-startup)
    114 ;;; init-startup.el ends here