From 3c5abef2a6f46fb8d64a161829eb86ffe2bf5e08 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Tue, 12 Aug 2025 17:19:27 +0200 Subject: [PATCH] update main init --- settings/completion-settings.el | 6 +- settings/general-settings.el | 14 -- settings/gui-settings.el | 24 +++- settings/pre-settings.el | 219 ++++++++++++++++++++++++++++++++ snippets/org-mode/letter | 2 +- 5 files changed, 245 insertions(+), 20 deletions(-) diff --git a/settings/completion-settings.el b/settings/completion-settings.el index 70eed354..5ae24588 100644 --- a/settings/completion-settings.el +++ b/settings/completion-settings.el @@ -132,8 +132,6 @@ of `menu-bar-final-items'." (lookup-key (cons 'keymap (nreverse (current-active-maps))) keyseq)) ) -;;(setq tab-always-indent 'complete) ;; use 'complete when auto-complete is disabled - (use-package company :delight (company-mode "Co") ;; \u24B8 c ;;:bind (("C-M-i" . company-complete)) @@ -172,9 +170,9 @@ Possible PACKAGE values are `company'." (define-key map (kbd "TAB") 'company-complete-common-or-cycle) (define-key map (kbd "") 'company-complete-common-or-cycle) (define-key map (kbd "") - (lambda () (company-complete-common-or-cycle -1))) + (lambda () (interactive) (company-complete-common-or-cycle -1))) (define-key map (kbd "") - (lambda () (company-complete-common-or-cycle -1))) + (lambda () (interactive) (company-complete-common-or-cycle -1))) ) (t (define-key map (kbd "TAB") nil) diff --git a/settings/general-settings.el b/settings/general-settings.el index 6995b529..b31215dd 100644 --- a/settings/general-settings.el +++ b/settings/general-settings.el @@ -136,23 +136,9 @@ already exists in the home directory." ;; overwrite selected text (delete-selection-mode t) -;; always use spaces, not tabs, when indenting -(setq-default indent-tabs-mode nil) -;; width for tabs -(setq-default tab-width 2) - ;; ignore case when searching (setq case-fold-search t) -;; require final newlines in files when they are saved -(setq require-final-newline t) - -;; each line of text gets one line on the screen (i.e., text will run -;; off the right instead of wrapping around onto a new line) -(setq-default truncate-lines t) -;; truncate lines even in partial-width windows -;;(setq truncate-partial-width-windows t) - (defun my-unfill-paragraph () "Replace newline chars in current paragraph by single spaces. This command does the inverse of `fill-paragraph'. diff --git a/settings/gui-settings.el b/settings/gui-settings.el index 6f59cf55..fffddd52 100644 --- a/settings/gui-settings.el +++ b/settings/gui-settings.el @@ -319,12 +319,34 @@ see `awesome-tray-mode-hook'" (use-package dired :defer t :config + (setq dired-free-space nil + dired-dwim-target t ; Propose a target for intelligent moving/copying + dired-deletion-confirmer 'y-or-n-p + dired-filter-verbose nil + dired-recursive-deletes 'top + dired-recursive-copies 'always + dired-vc-rename-file t + dired-create-destination-dirs 'ask + dired-mouse-drag-files t + ;; Suppress Dired buffer kill prompt for deleted dirs + dired-clean-confirm-killing-deleted-buffers nil) + + ;; This is a higher-level predicate that wraps `dired-directory-changed-p' + ;; with additional logic. This `dired-buffer-stale-p' predicate handles remote + ;; files, wdired, unreadable dirs, and delegates to dired-directory-changed-p + ;; for modification checks. + (setq auto-revert-remote-files nil) + (setq dired-auto-revert-buffer 'dired-buffer-stale-p) + + ;; dired-omit-mode + (setq dired-omit-verbose nil + dired-omit-files (concat "\\`[.]\\'")) + (setq dired-listing-switches "-l --almost-all --human-readable --group-directories-first --no-group") ;; this command is useful when you want to close the window of `dirvish-side' ;; automatically when opening a file ;; (put 'dired-find-alternate-file 'disabled nil) - (setq dired-mouse-drag-files t) (setq mouse-drag-and-drop-region-cross-program t) ) (use-package dirvish diff --git a/settings/pre-settings.el b/settings/pre-settings.el index 7a6fc288..c4009493 100644 --- a/settings/pre-settings.el +++ b/settings/pre-settings.el @@ -388,10 +388,229 @@ with a drive letter and a colon.")) (when (and (display-graphic-p) (fboundp 'context-menu-mode)) (add-hook 'after-init-hook #'context-menu-mode))) +;;; Cursor + +;; The blinking cursor is distracting and interferes with cursor settings in +;; some minor modes that try to change it buffer-locally (e.g., Treemacs). +(when (bound-and-true-p blink-cursor-mode) + (blink-cursor-mode -1)) + +;; Don't blink the paren matching the one at point, it's too distracting. +(setq blink-matching-paren nil) + +;; Do not extend the cursor to fit wide characters +(setq x-stretch-cursor nil) + +;; Reduce rendering/line scan work by not rendering cursors or regions in +;; non-focused windows. +(setq-default cursor-in-non-selected-windows nil) +(setq highlight-nonselected-windows nil) + +;;; Text editing, indent, font, and formatting + +;; Avoid automatic frame resizing when adjusting settings. +(setq global-text-scale-adjust-resizes-frames nil) + +;; A longer delay can be annoying as it causes a noticeable pause after each +;; deletion, disrupting the flow of editing. +(setq delete-pair-blink-delay 0.03) + +(setq-default left-fringe-width 8) +(setq-default right-fringe-width 8) + +;; Disable visual indicators in the fringe for buffer boundaries and empty lines +(setq-default indicate-buffer-boundaries nil) +(setq-default indicate-empty-lines nil) + +;; Continue wrapped lines at whitespace rather than breaking in the +;; middle of a word. +(setq-default word-wrap t) + +;; Disable wrapping by default due to its performance cost. +(setq-default truncate-lines t) + +;; If enabled and `truncate-lines' is disabled, soft wrapping will not occur +;; when the window is narrower than `truncate-partial-width-windows' characters. +(setq truncate-partial-width-windows nil) + +;; Configure automatic indentation to be triggered exclusively by newline and +;; DEL (backspace) characters. +(setq-default electric-indent-chars '(?\n ?\^?)) + +;; Prefer spaces over tabs. Spaces offer a more consistent default compared to +;; 8-space tabs. This setting can be adjusted on a per-mode basis as needed. +(setq-default indent-tabs-mode nil + tab-width 2) + +;; Enable indentation and completion using the TAB key +(setq tab-always-indent 'complete) +(setq tab-first-completion 'word-or-paren-or-punct) + +;; Perf: Reduce command completion overhead. +(setq read-extended-command-predicate #'command-completion-default-include-p) + +;; Enable multi-line commenting which ensures that `comment-indent-new-line' +;; properly continues comments onto new lines. +(setq comment-multi-line t) + +;; Ensures that empty lines within the commented region are also commented out. +;; This prevents unintended visual gaps and maintains a consistent appearance. +(setq comment-empty-lines t) + +;; We often split terminals and editor windows or place them side-by-side, +;; making use of the additional horizontal space. +(setq-default fill-column 80) + +;; Disable the obsolete practice of end-of-line spacing from the typewriter era. +(setq sentence-end-double-space nil) + +;; According to the POSIX, a line is defined as "a sequence of zero or more +;; non-newline characters followed by a terminating newline". +(setq require-final-newline t) + +;; Eliminate delay before highlighting search matches +(setq lazy-highlight-initial-delay 0) + +;;; Modeline + +;; Makes Emacs omit the load average information from the mode line. +(setq display-time-default-load-average nil) + +;;; Filetype (python sh ...) + +(setq sh-indent-after-continuation 'always) +;;; ls-lisp +(use-package ls-lisp + :defer t + :config + (setq ls-lisp-verbosity nil) + (setq ls-lisp-dirs-first t) ) +;;; Ediff + +;; Configure Ediff to use a single frame and split windows horizontally +(setq ediff-window-setup-function 'ediff-setup-windows-plain + ediff-split-window-function 'split-window-horizontally) + +;;; Help + +;; Enhance `apropos' and related functions to perform more extensive searches +(setq apropos-do-all t) + +;; Fixes #11: Prevents help command completion from triggering autoload. +;; Loading additional files for completion can slow down help commands and may +;; unintentionally execute initialization code from some libraries. +(setq help-enable-completion-autoload nil) +(setq help-enable-autoload nil) +(setq help-enable-symbol-autoload nil) +(setq help-window-select t) ;; Focus new help windows when opened + +;;; Eglot + +;; A setting of nil or 0 means Eglot will not block the UI at all, allowing +;; Emacs to remain fully responsive, although LSP features will only become +;; available once the connection is established in the background. +(setq eglot-sync-connect 0) + +(setq eglot-autoshutdown t) ; Shut down server after killing last managed buffer + +;; Activate Eglot in cross-referenced non-project files +(setq eglot-extend-to-xref t) + +;; Eglot optimization +(if my-debug + (setq eglot-events-buffer-config '(:size 2000000 :format full)) + ;; This reduces log clutter to improves performance. + (setq jsonrpc-event-hook nil) + ;; Reduce memory usage and avoid cluttering *EGLOT events* buffer + (setq eglot-events-buffer-size 0) ; Deprecated + (setq eglot-events-buffer-config '(:size 0 :format short))) + +(setq eglot-report-progress my-debug) ; Prevent minibuffer spam + +;;; Flymake + +(setq flymake-show-diagnostics-at-end-of-line nil) + +;; Disable wrapping around when navigating Flymake errors. +(setq flymake-wrap-around nil) + +;;; hl-line-mode + +;; Restrict `hl-line-mode' highlighting to the current window, reducing visual +;; clutter and slightly improving `hl-line-mode' performance. +(setq hl-line-sticky-flag nil) +(setq global-hl-line-sticky-flag nil) + +;;; icomplete + +;; Do not delay displaying completion candidates in `fido-mode' or +;; `fido-vertical-mode' +(setq icomplete-compute-delay 0.01) + +;;; flyspell + +(setq flyspell-issue-welcome-flag nil) + +;; Improves flyspell performance by preventing messages from being displayed for +;; each word when checking the entire buffer. +(setq flyspell-issue-message-flag nil) + +;;; ispell + +;; In Emacs 30 and newer, disable Ispell completion to avoid annotation errors +;; when no `ispell' dictionary is set. +(setq text-mode-ispell-word-completion nil) + +(setq ispell-silently-savep t) + +;;; ibuffer + +(setq ibuffer-formats + '((mark modified read-only locked + " " (name 55 55 :left :elide) + " " (size 8 -1 :right) + " " (mode 18 18 :left :elide) " " filename-and-process) + (mark " " (name 16 -1) " " filename))) + +;;; xref + +;; Enable completion in the minibuffer instead of the definitions buffer +(setq xref-show-definitions-function 'xref-show-definitions-completing-read + xref-show-xrefs-function 'xref-show-definitions-completing-read) + +;;; abbrev + +;; Ensure `abbrev_defs` is stored in the correct location when +;; `user-emacs-directory` is modified, as it defaults to ~/.emacs.d/abbrev_defs +;; regardless of the change. +(setq abbrev-file-name (concat user-cache-directory "abbrev_defs")) + +(setq save-abbrevs 'silently) + +;;; dabbrev + +(setq dabbrev-upcase-means-case-search t) + +(setq dabbrev-ignored-buffer-modes + '(archive-mode image-mode docview-mode tags-table-mode pdf-view-mode)) + +(setq dabbrev-ignored-buffer-regexps + '(;; - Buffers starting with a space (internal or temporary buffers) + "\\` " + ;; Tags files such as ETAGS, GTAGS, RTAGS, TAGS, e?tags, and GPATH, + ;; including versions with numeric extensions like <123> + "\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?")) + +;;; Remove warnings from narrow-to-region, upcase-region... + +(dolist (cmd '(list-timers narrow-to-region upcase-region downcase-region + list-threads erase-buffer scroll-left + dired-find-alternate-file set-goal-column)) + (put cmd 'disabled nil)) ;;; diff --git a/snippets/org-mode/letter b/snippets/org-mode/letter index 2e0477f9..4dd232e4 100644 --- a/snippets/org-mode/letter +++ b/snippets/org-mode/letter @@ -3,7 +3,7 @@ # group: Letter Templates # key: ?letter # -- -# -*- ispell-local-dictionary: "greman" -*- +# -*- ispell-local-dictionary: "german" -*- :FORM: #+LANGUAGE: de #+FROM_ASSOCIATION: XYZ AG