Update emacs ini.el

This commit is contained in:
Marcus Kammer 2023-11-08 19:02:06 +01:00
parent d7e27945f5
commit a94a90b2da
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -501,60 +501,148 @@ write_files:
owner: cl:cl
defer: True
content: |
;; Set up package archives from which to fetch Emacs packages
(setq package-archives
'(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
'(("melpa" . "https://melpa.org/packages/") ;; MELPA: Community-maintained repo of Emacs packages
("org" . "https://orgmode.org/elpa/") ;; Org ELPA: Official repo for Org mode packages
("elpa" . "https://elpa.gnu.org/packages/") ;; GNU ELPA: Official GNU repo for Emacs packages
("nongnu" . "https://elpa.nongnu.org/nongnu/"))) ;; NonGNU ELPA: Repo for non-GNU Emacs packages
;; Initialize the package management system
(package-initialize)
;; Refresh package contents if they're not already present
(unless package-archive-contents
(package-refresh-contents))
;; Install use-package if not already installed
(unless (package-installed-p 'use-package)
(package-install 'use-package))
;; Load use-package which simplifies package management
(require 'use-package)
;; Load ido for interactive buffer and file navigation
(require 'ido)
;; Ensure packages are installed by default
(setq use-package-always-ensure t)
;; Disable the tool bar
(tool-bar-mode -1)
;; Disable the menu bar
(menu-bar-mode -1)
;; Enable showing matching parentheses
(show-paren-mode 1)
;; Highlight the current line
(global-hl-line-mode 1)
;; Display the time in the mode line
(display-time-mode 1)
;; Disable symbol prettification
(global-prettify-symbols-mode -1)
;; Prefer UTF-8 Unix coding system
(prefer-coding-system 'utf-8-unix)
(set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; Customize time display format
(setq display-time-format "W%V %a %d %b %R")
;; Use 24-hour time format
(setq display-time-24hr-format t)
;; Use UTF-8 Unix for buffer file coding
(setq default-buffer-file-coding-system 'utf-8-unix)
;; Disable tab indentation
(setq indent-tabs-mode nil)
;; Set line spacing to default
(setq line-spacing nil)
;; Disable creation of backup files
(setq make-backup-files nil)
;; Set width of a tab to 4 spaces
(setq tab-width 4)
;; Single space ends a sentence
(setq sentence-end-double-space nil)
;; Add newlines when navigating to the next line
(setq next-line-add-newlines t)
;; Ensure files end with a newline
(setq require-final-newline t)
(require 'ido)
;; Enable flexible string matching for ido
(setq ido-enable-flex-matching t)
;; Enable ido in all contexts where it can be used
(setq ido-everywhere t)
;; Always create a new buffer with ido if needed
(setq ido-create-new-buffer 'always)
;; Set the default major mode to text mode
(setq default-major-mode 'text-mode)
;; Disable the startup screen and buffer menu
(setq inhibit-startup-buffer-menu t inhibit-startup-screen t)
(put 'narrow-to-region 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(defalias 'yes-or-no-p 'y-or-n-p)
(add-hook 'after-save-hook
'executable-make-buffer-file-executable-if-script-p)
(global-set-key (kbd "M-i") 'imenu)
(global-set-key (kbd "C-x C-b") 'ibuffer-list-buffers)
(add-hook 'diary-display-hook 'fancy-diary-display)
(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
(add-hook 'write-file-hooks 'delete-trailing-whitespace)
(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
(add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
;; Do not ask about saving files before compilation
(setq compilation-ask-about-save nil)
(setq vc-handled-backends '(Git Hg)) ;; Only use Git and Hg for VC
;; Set version control systems to be used
(setq vc-handled-backends '(Git Hg))
;; Enable narrowing to region
(put 'narrow-to-region 'disabled nil)
;; Enable narrowing to page
(put 'narrow-to-page 'disabled nil)
;; Use y/n instead of full yes/no for confirmations
(defalias 'yes-or-no-p 'y-or-n-p)
;; Bind M-i to imenu for easy navigation
(global-set-key (kbd "M-i") 'imenu)
;; Bind C-x C-b to ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer-list-buffers)
;; Automatically wrap lines in text mode
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; Use fancy diary display
(add-hook 'diary-display-hook 'fancy-diary-display)
;; Highlight today in calendar
(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
;; Delete trailing whitespace on save
(add-hook 'write-file-hooks 'delete-trailing-whitespace)
;; Include other diary files
(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
;; Mark included diary files
(add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
;; Make script files executable upon save
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
;; Enable ido mode
(ido-mode t)
;; Enable fido mode for a more modern ido experience
(fido-mode 1)
runcmd: