update main init

This commit is contained in:
2025-08-11 20:13:14 +02:00
parent ac6eb2cb13
commit 02d21bd761
4 changed files with 364 additions and 138 deletions

View File

@@ -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<bar/mumble>
;; 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)