(push (concat user-emacs-directory "cnf/app") load-path) ;; DIRED: file browser (require 'a-dired) ;; ORD-MODE: Basically jupiter notebooks/markdown on steroids (with-eval-after-load 'org (require 'a-orgmode)) ;; MAGIT: A nice git frontend (straight-use-package 'magit) (setq magit-bury-buffer-function #'quit-window magit-display-buffer-function #'display-buffer) (with-eval-after-load 'magit (transient-append-suffix 'magit-push "-u" '(1 "=s" "Skip gitlab pipeline" "--push-option=ci.skip")) (transient-append-suffix 'magit-push "=s" '(1 "=D" "DEBUG" "--push-option=ci.variable=DEBUG=1")) ;; no special meaning for gitlab (transient-append-suffix 'magit-push "=D" '(1 "=V" "Set CI variable" "--push-option=ci.variable=")) ;; Will prompt, can only set one extra variable (transient-append-suffix 'magit-push "=V" '(1 "=O" "Set push option" "--push-option=")) ) ;; DICTCC: query dict.cc without leaving emacs (straight-use-package 'dictcc) ;; GIT-GUTTER: Indicators for git status inside the fringe (straight-use-package 'git-gutter) (straight-use-package 'git-gutter-fringe) (require 'git-gutter-fringe) ;; 0 means only update on save, otherwise set to 0.02 ;; otherwise cursor stutters (e.g. at 2 or 8) (setq git-gutter:update-interval 0 git-gutter:handled-backends '(git hg)) ;; Indicator style (It's ASCII art - yaayyy) (fringe-helper-define 'git-gutter-fr:added 'center "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX..") (fringe-helper-define 'git-gutter-fr:modified 'center "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX..") (fringe-helper-define 'git-gutter-fr:deleted 'center "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX.." "..XXX..") (add-hook 'prog-mode-hook #'git-gutter-mode) ;; More sane defaults (defvar emacs-autosave-directory (concat user-emacs-directory "autosaves/")) (unless (file-exists-p emacs-autosave-directory) (mkdir emacs-autosave-directory t)) (setq backup-directory-alist `((".*" . ,emacs-autosave-directory)) auto-save-file-name-transforms `((".*" ,emacs-autosave-directory t))) (setq make-backup-files nil create-lockfiles nil) ;; There is also require-final-newline which is a per mode setting ;; This seems to override this global value -> See mode specific configs (e.g. yaml) (setq-default require-final-newline t) (setq mode-require-final-newline t) (setq warning-minimum-level :emergency) (defalias 'yes-or-no-p 'y-or-n-p) (setq read-answer-short t) ;; Advice around the new kill-buffer--possibly-save function ;; This never calls the original function which basically replaces it ;; defalias is not possible here since this takes different arguments (defun phga/kill-buffer-y-or-n--advice (orig-fun buffer &rest args) "Replace the default behavior of the new `kill-buffer--possibly-save' function. `ORIG-FUN' is the original function that was called and `BUFFER'is the buffer that should be killed whilst beeing modified and not saved. `ARGS' is the rest of the arguments." (y-or-n-p (concat "Kill buffer " (buffer-name buffer) " without saving?"))) (advice-add 'kill-buffer--possibly-save :around #'phga/kill-buffer-y-or-n--advice) (setq auto-revert-interval 1 ; Refresh buffers fast echo-keystrokes 0.1 ; Show keystrokes asap inhibit-startup-message t ; No splash screen please initial-scratch-message nil ; Clean scratch buffer initial-major-mode 'org-mode recentf-max-saved-items 100 ; Show more recent files ring-bell-function 'ignore) ; Quiet (setq mouse-yank-at-point t) ;; Should help with reeeeally long lines e.g. json ;; there is also (setq-default bidi-display-reordering nil) ;; which is apparently not recommended by dev Eli because ;; it was never intended to be nil (could still improve things tho) (setq-default bidi-paragraph-direction 'left-to-right) ;; gnupg (require 'epa-file) (setq epg-pinentry-mode 'ask) (push '("\\.gpg\\'" . epa-file-enable) auto-mode-alist) ;; only use the encrypted version of .authinfo (setq auth-sources '("~/.authinfo.gpg")) ;; save unsaved buffers before killing frame (add-hook 'delete-frame-functions 'save-some-buffers) (add-hook 'kill-emacs-hook 'save-some-buffers) ;; Width used to draw the column indicator + used in fill-paragraph (setq-default fill-column 90) (provide 'additionals)