diff --git a/settings/completion-settings.el b/settings/completion-settings.el index 23d3bd49..70eed354 100644 --- a/settings/completion-settings.el +++ b/settings/completion-settings.el @@ -46,7 +46,6 @@ (ivy-mode 1) ;; also with `ivy-rich-mode' (see below). `ivy-mode' still active for views not defined by `ivy-rich-mode'. (setq ivy-use-virtual-buffers t) ;; Add recent files and bookmarks to the ivy-switch-buffer (setq ivy-count-format "%d/%d ") ;; Displays the current and total number in the collection in the prompt - (setq enable-recursive-minibuffers t) (setq ivy-extra-directories '("../" "./")) ;; keep "./" and "../" in the list to be able to use also mouse click and if asked for directory to have the current one as a candidate "./" (setq ivy-use-selectable-prompt t) ;; make the prompt line selectable. Example: create a file bar when a file barricade exists in the current directory. Also C-M-j usable ;; enable this if you want `swiper' to use it diff --git a/settings/general-settings.el b/settings/general-settings.el index 157d339b..6995b529 100644 --- a/settings/general-settings.el +++ b/settings/general-settings.el @@ -6,9 +6,6 @@ ;;; Code: -;; Change "yes or no" to "y or n" -(fset 'yes-or-no-p 'y-or-n-p) - ;; transparency (defun transparency-p () "Toggle transparency of the frame." @@ -71,68 +68,6 @@ (with-current-buffer buf (and buffer-file-name (buffer-modified-p))))) -;; recentf stuff -(use-package recentf - :config - (setq - recentf-save-file (locate-user-emacs-file ".cache/recentf" "recentf") - recentf-max-saved-items 1000 - recentf-max-menu-items 30 - recentf-auto-cleanup 'never ;; disable before we start recentf! Set to never bc otherwise it tries to read also tramp (remote) files - ) - (add-to-list 'recentf-exclude - (recentf-expand-file-name user-cache-directory)) - ;;(global-set-key "\C-x\ \C-r" 'recentf-open-files) ;; see completion-settings ivy counsel - ;;(run-at-time nil (* 10 60) 'recentf-save-list) - (run-with-idle-timer (* 10 60) t 'recentf-save-list) - (recentf-mode) - ) - -;; by default backup files are saved in the current directory, ending with ~ -;; instead stashes them all in -(let ((backup-dir (concat user-cache-directory "backups")) - (auto-saves-dir (concat user-cache-directory "auto-saves/"))) - (dolist (dir (list backup-dir auto-saves-dir)) - (when (not (file-directory-p dir)) - (make-directory dir t))) - (setq backup-directory-alist `(("." . ,backup-dir))) - (setq backup-by-copying t) - (setq auto-save-file-name-transforms `((".*" ,auto-saves-dir t))) - (setq auto-save-list-file-prefix (concat auto-saves-dir ".saves-")) - (setq tramp-backup-directory-alist `((".*" . ,backup-dir))) - (setq tramp-auto-save-directory auto-saves-dir)) -(setq-default delete-by-moving-to-trash t) ;; Delete files to trash - -(use-package tramp - :defer t - :config - ;; tramp-cache.el - (setq tramp-persistency-file-name (concat user-cache-directory "tramp")) - - ;; Enable full-featured Dirvish over TRAMP on ssh connections - ;; https://www.gnu.org/software/tramp/#Improving-performance-of-asynchronous-remote-processes - (connection-local-set-profile-variables - 'remote-direct-async-process - '((tramp-direct-async-process . t))) - (connection-local-set-profiles - '(:application tramp :protocol "ssh") - 'remote-direct-async-process) - ;; Tips to speed up connections - (setq tramp-verbose 0) - (setq tramp-chunksize 2000) - (setq tramp-ssh-controlmaster-options nil) ) - -(if (fboundp 'save-place-mode) - (save-place-mode) - (setq save-place t) - ) -;; Save point position between sessions -(setq save-place-file (concat user-cache-directory "places")) - -;; minibuffer history, e.g. M-x with amex -(setq savehist-file (concat user-cache-directory "history")) -(savehist-mode) - (use-package x-win :defer t :config @@ -149,7 +84,6 @@ already exists in the home directory." ;; save session ;;(desktop-save-mode 1) (setq desktop-dirname user-cache-directory) -(setq history-length 500) ;; Since all lists will be truncated when saved, it is important to have a high default history length (add-to-list 'desktop-path user-cache-directory) (defun desktop-settings-setup () "Some settings setup for 'desktop-save-mode'." @@ -199,30 +133,6 @@ already exists in the home directory." ) -;; auto revert buffer -(when (fboundp 'global-auto-revert-mode) - ;; All the "reverting buffer foo" messages are _really_ distracting. - (setq auto-revert-verbose nil) - (global-auto-revert-mode 1) - ;; just as the docs warn, this can really make Emacs sluggish. - (if running-on-windows - (if (fboundp 'lwarn) - (lwarn - 'global-auto-revert-mode - :warning - "`global-auto-revert-mode' is turned on. It's nifty, -but it's REALLY SLOW when you have buffers that are visiting -remote files. And despite its documentation, it does NOT ignore -those files, if you're using windows, and the file name begins -with a drive letter and a colon.")) - (setq global-auto-revert-non-file-buffers t))) -(setq revert-without-query '(".*")) - -(use-package uniquify - :defer t - :config - (setq uniquify-buffer-name-style 'forward)) ;; forward: bar/mumble/name insead of post-forward-angle-brackets: name - ;; overwrite selected text (delete-selection-mode t) @@ -278,11 +188,6 @@ Version 2016-07-13" (line-number-mode t) (column-number-mode t) -;; highlight parentheses when the cursor is next to them -(use-package paren - :config - (show-paren-mode t)) - ;; emacs warning: ;; ad-handle-definition: `text-scale-increase' got redefined ;; these warnings are generated when functions are redefined with defadvice. @@ -564,7 +469,6 @@ Version 2016-07-13" (setq mouse-wheel-progressive-speed nil) ; Progressive speed is too fast for me. (setq mouse-wheel-tilt-scroll t) ; Turn on horizontal scrolling with mouse wheel (setq mouse-wheel-flip-direction t) ; Swap direction of `wheel-right' and `wheel-left' -(setq scroll-conservatively 101) ; 101 minimizes screen movement and maintains point visibility with minimal adjustment ;; for scroll-all-mode add mouse wheel support ;; https://www.emacswiki.org/emacs/ScrollAllMode (defun my-mwheel-scroll-all-function (func &optional arg) diff --git a/settings/gui-settings.el b/settings/gui-settings.el index f395a6f8..6f59cf55 100644 --- a/settings/gui-settings.el +++ b/settings/gui-settings.el @@ -53,41 +53,6 @@ (set-face-attribute 'fill-column-indicator nil :foreground "DarkSlateGray")) -;; ┌────────────── Frame width ───────────────┐ -;; ┌────── Window width ──────┐ -;; ┌ ┌──────────────────────────────────────────┐ -;; │ │ ┌──────────────────────────────────────┐ │ -;; │ │ │ Header line │ │ -;; │ ┌ │ ├───┬─┬────────────────────────┬─┬─┬───┤ │ -;; F │ W │ │ │ │●┼─ Left fringe ┊ │ │ │●┼── Frame border -;; r │ i │ │ │ ●─┼─┼─ Left margin ┊ │ │ ●─┼─┼── Right margin -;; a │ n │ │ │ │ │ ┊ │●┼───┼─┼── Right fringe -;; m │ d │ │ │ │ │ ┊●┼─┼───┼─┼── Display column -;; e │ o │ │ │ │ │ ┊ │ │ │ │ -;; │ w │ │ │ │ │ ┊ │ │ │ │ -;; h │ │ │ │ │ │ Text area ┊ │ │ │ │ -;; e │ h │ │ │ │ │ ┊ │ │ │ │ -;; i │ e │ │ │ │ │ ┊ │ │ │ │ -;; g │ i │ │ │ │ │ ┊ │ │ │ │ -;; h │ g │ │ │ │ │ ┊ │ │ │ │ -;; t │ h │ │ │ │ │ ┊ │ │ │ │ -;; │ t │ │ │ │ │ ┊ │ │ │ │ -;; │ └ │ ├───┴─┴────────────────────────┴─┴─┴───┤ │ -;; │ │ │ Mode line │ │ -;; │ │ ├───┬─┬──────────────────────────┬─┬───┤ │ -;; │ │ │ │ │ Minibuffer / Echo area │ │ │ │ -;; │ │ └───┴─┴──────────────────────────┴─┴───┘ │ -;; └ └──────────────────────────────────────────┘ -;; └─┬─┘ └┬┘ └┬┘ -;; Margin width Fringe width (pixels) ┘ │ -;; (chars) Border width (pixels) ┘ -(use-package frame - :config - (setq window-divider-default-right-width 2) - ;; (setq window-divider-default-bottom-width 1) ;; -2 from awesome-tray - (setq window-divider-default-places 'right-only) - (window-divider-mode 1)) - (use-package scroll-bar ;; built-in :defer t diff --git a/settings/pre-settings.el b/settings/pre-settings.el index 1dc502ff..7a6fc288 100644 --- a/settings/pre-settings.el +++ b/settings/pre-settings.el @@ -1,6 +1,7 @@ ;;; pre-settings.el --- Summary -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: + ;; count startup time (defun display-startup-time () "Display the startup time and number of garbage collections." @@ -10,12 +11,6 @@ gcs-done)) (add-hook 'emacs-startup-hook #'display-startup-time 100) -;; omit warnings like: /opt/emacs-conf/lisp/org/oc-basic.el: Warning: ‘buffer-substring’ is an obsolete generalized variable. -(setq byte-compile-warnings nil) - -(use-package delight - :defer t) ;; used for use-package :delight, see delight-delighted-modes, defer b/c of awesome-tray - ;; ;; functions ;; @@ -43,6 +38,369 @@ Both Win32 and Cygwin count.") (if (require 'dbus) (dbus-ping :session "org.freedesktop.Notifications"))) ;; is not enough "Check if DBus is available.") +;;; Before package + +;; Ask the user whether to terminate asynchronous compilations on exit. +;; This prevents native compilation from leaving temporary files in /tmp. +(setq native-comp-async-query-on-exit t) + +;; Allow for shorter responses: "y" for yes and "n" for no. +(setq read-answer-short t) +(if (boundp 'use-short-answers) + (setq use-short-answers t) + (advice-add 'yes-or-no-p :override #'y-or-n-p)) + +;;; Undo/redo + +(setq undo-limit (* 13 160000) + undo-strong-limit (* 13 240000) + undo-outer-limit (* 13 24000000)) + +;;; Minibuffer + +;; Allow nested minibuffers +(setq enable-recursive-minibuffers t) + +;; Keep the cursor out of the read-only portions of the minibuffer +(setq minibuffer-prompt-properties + '(read-only t intangible t cursor-intangible t face minibuffer-prompt)) +(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + +;;; User interface + +;; By default, Emacs "updates" its ui more often than it needs to +(setq which-func-update-delay 1.0) +(setq idle-update-delay which-func-update-delay) ;; Obsolete in >= 30.1 + +(defalias #'view-hello-file #'ignore) ; Never show the hello file + +;; No beeping or blinking +(setq visible-bell nil) +(setq ring-bell-function #'ignore) + +;;; Show-paren + +(use-package paren + ;; highlight parentheses when the cursor is next to them + :config + (setq show-paren-delay 0.1 + show-paren-highlight-openparen t + show-paren-when-point-inside-paren t + show-paren-when-point-in-periphery t) + (show-paren-mode 1)) + +;;; Misc + +(setq custom-buffer-done-kill t) + +(setq whitespace-line-column nil) ; Use the value of `fill-column'. + +;; Can be activated with `display-line-numbers-mode' +(setq-default display-line-numbers-width 3) +(setq-default display-line-numbers-widen t) + +(setq truncate-string-ellipsis "…") + +;; Disable truncation of printed s-expressions in the message buffer +(setq eval-expression-print-length nil + eval-expression-print-level nil) + +;; Position underlines at the descent line instead of the baseline. +(setq x-underline-at-descent-line t) + +(use-package tramp + :defer t + :config + ;; tramp-cache.el + (setq tramp-persistency-file-name (concat user-cache-directory "tramp")) + + ;; Enable full-featured Dirvish over TRAMP on ssh connections + ;; https://www.gnu.org/software/tramp/#Improving-performance-of-asynchronous-remote-processes + (connection-local-set-profile-variables + 'remote-direct-async-process + '((tramp-direct-async-process . t))) + (connection-local-set-profiles + '(:application tramp :protocol "ssh") + 'remote-direct-async-process) + ;; Tips to speed up connections + (setq tramp-verbose 1) + (setq tramp-chunksize 2000) + (setq tramp-ssh-controlmaster-options nil) + ;; + (setq tramp-completion-reread-directory-timeout 50) + (setq remote-file-name-inhibit-cache 50) ) + +;; Automatically rescan the buffer for Imenu entries when `imenu' is invoked +;; This ensures the index reflects recent edits. +(setq imenu-auto-rescan t) + +;; Prevent truncation of long function names in `imenu' listings +(setq imenu-max-item-length 160) + +;; Disable auto-adding a new line at the bottom when scrolling. +(setq next-line-add-newlines nil) + +;;; Files + +;; Delete by moving to trash in interactive mode +(setq delete-by-moving-to-trash (not noninteractive)) +(setq remote-file-name-inhibit-delete-by-moving-to-trash t) + +;; Ignoring this is acceptable since it will redirect to the buffer regardless. +(setq find-file-suppress-same-file-warnings t) + +;; Resolve symlinks so that operations are conducted from the file's directory +(setq find-file-visit-truename t + vc-follow-symlinks t) + +;; Prefer vertical splits over horizontal ones +(setq split-width-threshold 170 + split-height-threshold nil) + +;;; Buffers + +(setq uniquify-buffer-name-style 'forward) + +(use-package uniquify + :defer t + :config + (setq uniquify-buffer-name-style 'forward)) ;; forward: bar/mumble/name insead of post-forward-angle-brackets: name + +;;; comint (general command interpreter in a window) + +(setq ansi-color-for-comint-mode t + comint-prompt-read-only t + comint-buffer-maximum-size 4096) + +;;; Compilation + +(setq compilation-ask-about-save nil + compilation-always-kill t + compilation-scroll-output 'first-error) + +;; Skip confirmation prompts when creating a new file or buffer +(setq confirm-nonexistent-file-or-buffer nil) + +;;; Backup files +;;; Auto save + +;; Avoid backups or lockfiles to prevent creating world-readable copies of files +(setq create-lockfiles nil) +(setq make-backup-files nil) + +;; by default backup files are saved in the current directory, ending with ~ +;; instead stashes them all in +(let ((backup-dir (concat user-cache-directory "backups")) + (auto-saves-dir (concat user-cache-directory "auto-saves/"))) + (dolist (dir (list backup-dir auto-saves-dir)) + (when (not (file-directory-p dir)) + (make-directory dir t))) + (setq backup-directory-alist `(("." . ,backup-dir))) + (setq auto-save-file-name-transforms `((".*" ,auto-saves-dir t))) + (setq auto-save-list-file-prefix (concat auto-saves-dir ".saves-")) + (setq tramp-backup-directory-alist `((".*" . ,backup-dir))) + (setq tramp-auto-save-directory auto-saves-dir) ) + +;; backup + +(setq backup-by-copying-when-linked t) +(setq backup-by-copying t) ; Backup by copying rather renaming +(setq delete-old-versions t) ; Delete excess backup versions silently +(setq version-control t) ; Use version numbers for backup files +(setq kept-new-versions 5) +(setq kept-old-versions 5) + +;; auto save + +;; Enable auto-save to safeguard against crashes or data loss. The +;; `recover-file' or `recover-session' functions can be used to restore +;; auto-saved data. +(setq auto-save-default nil) +(setq auto-save-no-message t) + +;; Do not auto-disable auto-save after deleting large chunks of +;; text. +(setq auto-save-include-big-deletions t) + +;; Auto save options +(setq kill-buffer-delete-auto-save-files t) + +;; Remove duplicates from the kill ring to reduce clutter +(setq kill-do-not-save-duplicates t) + +;;; VC + +(setq vc-git-print-log-follow t) +(setq vc-make-backup-files nil) ; Do not backup version controlled files +(setq vc-git-diff-switches '("--histogram")) ; Faster algorithm for diffing. + +;;; Auto revert +;; Auto-revert in Emacs is a feature that automatically updates the contents of +;; a buffer to reflect changes made to the underlying file. +(setq revert-without-query (list ".") ; Do not prompt + auto-revert-stop-on-user-input nil + auto-revert-verbose nil) ; All the "reverting buffer foo" messages are _really_ distracting. + +;; Revert other buffers (e.g, Dired) +(setq global-auto-revert-non-file-buffers t) +(setq global-auto-revert-ignore-modes '(Buffer-menu-mode)) ; Resolve issue #29 + +;; just as the docs warn, this can really make Emacs sluggish. +(if running-on-windows + (if (fboundp 'lwarn) + (lwarn + 'global-auto-revert-mode + :warning + "`global-auto-revert-mode' is turned on. It's nifty, +but it's REALLY SLOW when you have buffers that are visiting +remote files. And despite its documentation, it does NOT ignore +those files, if you're using windows, and the file name begins +with a drive letter and a colon.")) + (setq global-auto-revert-non-file-buffers t)) + +(global-auto-revert-mode 1) + +;;; recentf + +;; `recentf' is an that maintains a list of recently accessed files. +(use-package recentf + :config + ;;(global-set-key "\C-x\ \C-r" 'recentf-open-files) ;; see completion-settings ivy counsel + (setq recentf-save-file (locate-user-emacs-file ".cache/recentf" "recentf")) + (setq recentf-max-saved-items 1000) ; default is 20 + (setq recentf-max-menu-items 30) ; default is 10 + (setq recentf-auto-cleanup 'never) ; disable before we start recentf! Set to never bc otherwise it tries to read also tramp (remote) files + (setq recentf-exclude + (list "^/\\(?:ssh\\|su\\|sudo\\)?:" + (recentf-expand-file-name user-cache-directory))) + (run-with-idle-timer (* 10 60) t 'recentf-save-list) + (recentf-mode 1) ) + +;;; saveplace + +;; Enables Emacs to remember the last location within a file upon reopening. +(setq save-place-file (concat user-cache-directory "places")) +(setq save-place-limit 600) +(save-place-mode 1) + +;;; savehist + +;; `savehist-mode' is an Emacs feature that preserves the minibuffer history +;; between sessions. +(setq history-length 500) ;; Since all lists will be truncated when saved, it is important to have a high default history length +(setq savehist-save-minibuffer-history t) ;; Default +(setq savehist-additional-variables + '(kill-ring ; clipboard + register-alist ; macros + mark-ring global-mark-ring ; marks + search-ring regexp-search-ring)) ; searches +;; minibuffer history, e.g. M-x with amex +(setq savehist-file (concat user-cache-directory "history")) +(savehist-mode) + +;;; Frames and windows +;; ┌────────────── Frame width ───────────────┐ +;; ┌────── Window width ──────┐ +;; ┌ ┌──────────────────────────────────────────┐ +;; │ │ ┌──────────────────────────────────────┐ │ +;; │ │ │ Header line │ │ +;; │ ┌ │ ├───┬─┬────────────────────────┬─┬─┬───┤ │ +;; F │ W │ │ │ │●┼─ Left fringe ┊ │ │ │●┼── Frame border +;; r │ i │ │ │ ●─┼─┼─ Left margin ┊ │ │ ●─┼─┼── Right margin +;; a │ n │ │ │ │ │ ┊ │●┼───┼─┼── Right fringe +;; m │ d │ │ │ │ │ ┊●┼─┼───┼─┼── Display column +;; e │ o │ │ │ │ │ ┊ │ │ │ │ +;; │ w │ │ │ │ │ ┊ │ │ │ │ +;; h │ │ │ │ │ │ Text area ┊ │ │ │ │ +;; e │ h │ │ │ │ │ ┊ │ │ │ │ +;; i │ e │ │ │ │ │ ┊ │ │ │ │ +;; g │ i │ │ │ │ │ ┊ │ │ │ │ +;; h │ g │ │ │ │ │ ┊ │ │ │ │ +;; t │ h │ │ │ │ │ ┊ │ │ │ │ +;; │ t │ │ │ │ │ ┊ │ │ │ │ +;; │ └ │ ├───┴─┴────────────────────────┴─┴─┴───┤ │ +;; │ │ │ Mode line │ │ +;; │ │ ├───┬─┬──────────────────────────┬─┬───┤ │ +;; │ │ │ │ │ Minibuffer / Echo area │ │ │ │ +;; │ │ └───┴─┴──────────────────────────┴─┴───┘ │ +;; └ └──────────────────────────────────────────┘ +;; └─┬─┘ └┬┘ └┬┘ +;; Margin width Fringe width (pixels) ┘ │ +;; (chars) Border width (pixels) ┘ + +;; However, do not resize windows pixelwise, as this can cause crashes in some +;; cases when resizing too many windows at once or rapidly. +(setq window-resize-pixelwise nil) + +(setq resize-mini-windows 'grow-only) + +(use-package frame + :config + ;; The native border "uses" a pixel of the fringe on the rightmost + ;; splits, whereas `window-divider-mode' does not. + (setq window-divider-default-right-width 2) + (setq window-divider-default-bottom-width 6) + (setq window-divider-default-places 'right-only) + (window-divider-mode 1)) + +;;; Fontification + +;; Disable fontification during user input to reduce lag in large buffers. +;; Also helps marginally with scrolling performance. +(setq redisplay-skip-fontification-on-input t) + +;;; Scrolling + +;; Enables faster scrolling. This may result in brief periods of inaccurate +;; syntax highlighting, which should quickly self-correct. +(setq fast-but-imprecise-scrolling t) + +;; Move point to top/bottom of buffer before signaling a scrolling error. +(setq scroll-error-top-bottom t) + +;; Keep screen position if scroll command moved it vertically out of the window. +(setq scroll-preserve-screen-position t) + +;; If `scroll-conservatively' is set above 100, the window is never +;; automatically recentered, which decreases the time spend recentering. +(setq scroll-conservatively 101) + +;; 1. Preventing automatic adjustments to `window-vscroll' for long lines. +;; 2. Resolving the issue of random half-screen jumps during scrolling. +(setq auto-window-vscroll nil) + +;; Number of lines of margin at the top and bottom of a window. +(setq scroll-margin 0) + +;; Number of lines of continuity when scrolling by screenfuls. +(setq next-screen-context-lines 0) + +;; Horizontal scrolling +(setq hscroll-margin 2 + hscroll-step 1) + +;;; Mouse + +(setq mouse-yank-at-point nil) + +;; Emacs 29 +(when (memq 'context-menu my-ui-features) + (when (and (display-graphic-p) (fboundp 'context-menu-mode)) + (add-hook 'after-init-hook #'context-menu-mode))) + + + + + + +;;; + +;; omit warnings like: /opt/emacs-conf/lisp/org/oc-basic.el: Warning: ‘buffer-substring’ is an obsolete generalized variable. +(setq byte-compile-warnings nil) + +(use-package delight + :defer t) ;; used for use-package :delight, see delight-delighted-modes, defer b/c of awesome-tray + ;; add local icon folder to the image-load-path (when (featurep 'image) (add-to-list 'image-load-path (concat config-dir "icon/")))