.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 (2997B)


      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 (cond
     23  (*is-mac*
     24   (set-frame-parameter nil 'fullscreen 'fullscreen)
     25   (global-unset-key (kbd "<f12>"))
     26   (global-set-key (kbd "<f12>") #'toggle-frame-fullscreen))
     27  (*is-windows*
     28   (toggle-frame-maximized))
     29  (t nil))
     30 
     31 ;; backup and autosave
     32 (setq backup-directory-alist
     33       `((".*" . ,(expand-file-name "backup/" user-emacs-directory)))
     34       backup-by-copying t
     35       delete-old-versions t
     36       kept-new-versions 6
     37       kept-old-versions 2
     38       version-control t)
     39 (setq auto-save-file-name-transforms
     40       `((".*" ,(expand-file-name "auto-save-list/" user-emacs-directory) t)))
     41 
     42 ;; disable lockfiles
     43 (setq create-lockfiles nil)
     44 
     45 ;; disable ring bell
     46 (setq ring-bell-function 'ignore)
     47 
     48 ;; package manager load path
     49 (cond
     50  (*is-windows*
     51   (add-to-list 'exec-path (expand-file-name "H/appppppppppp/scoop/apps/"))
     52   (setenv "PATH" (concat (expand-file-name "H/appppppppppp/scoop/apps/") ";" (getenv "PATH"))))
     53  (*is-mac*
     54   (add-to-list 'exec-path (expand-file-name "/opt/homebrew/bin/"))
     55   (setenv "PATH" (concat (expand-file-name "/opt/homebrew/bin/") ":" (getenv "PATH"))))
     56  (*is-linux*
     57   (add-to-list 'exec-path (expand-file-name "~/.guix-home/profile/bin/"))
     58   (setenv "PATH" (concat (expand-file-name "~/.guix-home/profile/bin/") ":" (getenv "PATH")))))
     59 
     60 ;; scratch buffer
     61 (setq initial-scratch-message
     62       "")
     63 
     64 ;; frame title
     65 (setq-default frame-title-format '("%b - Emacs"))
     66 
     67 ;; native compile warning
     68 (setq native-comp-async-warnings-errors-kind 'silent)
     69 
     70 ;; short answer
     71 (if (boundp 'use-short-answers)
     72     (setq use-short-answers t)
     73   (fset 'yes-or-no-p 'y-or-n-p))
     74 
     75 ;; ask for confirmation when killing emacs
     76 (setq confirm-kill-emacs #'y-or-n-p)
     77 
     78 ;; trash
     79 (setq delete-by-moving-to-trash t)
     80 
     81 ;; optimize word wrapping
     82 (setq word-wrap-by-category t)
     83 
     84 ;; don't insert tabs
     85 (setq-default indent-tabs-mode nil)
     86 
     87 ;; query gpg passphrase in minibuffer, needs to add
     88 ;; 'allow-loopback-pinentry' to gpg-agent config, comment it if you
     89 ;; are using other pinentry programs
     90 ;; (setq epg-pinentry-mode 'loopback)
     91 
     92 ;; secondary browser
     93 (setq browse-url-secondary-browser-function 'eww)
     94 
     95 ;; disabled commands
     96 (put 'narrow-to-region 'disabled nil)
     97 (put 'scroll-left 'disabled nil)
     98 
     99 ;; modifier keys on mac
    100 (when *is-mac*
    101   (setq mac-command-modifier 'meta)
    102   (setq mac-option-modifier 'super)
    103   (setq mac-pass-control-to-system t)
    104   (setq mac-pass-command-to-system nil))
    105 
    106 (provide 'init-startup)
    107 ;;; init-startup.el ends here