Move builtin package initialisation from configuration.org to init.el

This commit is contained in:
2025-05-30 11:29:23 +02:00
parent 9e5528e519
commit a5d503f1a6
2 changed files with 254 additions and 397 deletions

254
init.el
View File

@@ -276,6 +276,260 @@ order."
(put 'Info-edit 'disabled nil)
(put 'list-timers 'disabled nil)
;; simple to always show the current column, and using visual lines in text
;; modes
(use-package simple
:ensure nil
:custom
(column-number-mode t)
:hook
(text-mode . (lambda () (visual-line-mode t))))
(use-package prog-mode
:ensure nil
:init
(setq prettify-symbols-alist
'(("lambda" . )
("function" . )
("map" . ?↦)
("not" . )
("and" . ?∧)
("or" . ?)))
:config
(global-prettify-symbols-mode t))
(use-package thingatpt
:ensure nil)
(use-package nxml-mode
:ensure nil
:custom
(nxml-attribute-indent 4)
(nxml-child-indent 4)
(nxml-outline-child-indent 4))
(use-package recentf
:ensure nil
:config
(run-at-time nil (* 5 60) 'recentf-save-list)
(add-to-list 'recentf-exclude (expand-file-name "elpa" user-emacs-directory)))
(use-package files
:ensure nil
:custom
(make-backup-file-name-function 'xah/backup-file-name))
(defun prevent-whitespace-mode-for-some ()
"Prevent `whitespace-mode' from running in some modes."
(and
(not (derived-mode-p 'magit-mode))
(not (derived-mode-p 'org-mode))))
(use-package whitespace
:demand
:config
(add-function :before-while whitespace-enable-predicate 'prevent-whitespace-mode-for-some)
(global-whitespace-mode 1)
:custom
(whitespace-line-column 120)
:bind
(([f10] . whitespace-mode)
([(shift f10)] . global-whitespace-mode)
:map gpolonkai/pers-map
("w" . whitespace-cleanup))
:custom-face
(whitespace-line ((t (:inherit nil :background "orange4")))))
;; Taken from https://ryuslash.org/posts/C-d-to-close-eshell.html
(defun eshell-C-d ()
"Either call `delete-char' interactively or quit."
(interactive)
(condition-case err
(call-interactively #'delete-char)
(error (if (and (eq (car err) 'end-of-buffer)
(looking-back eshell-prompt-regexp nil))
(kill-buffer)
(signal (car err) (cdr err))))))
(defun gpolonkai/eshell-set-c-d-locally ()
"Bind my `eshell-C-d' function locally."
(local-set-key (kbd "C-d") #'eshell-C-d))
;; Taken from https://blog.hoetzel.info/post/eshell-notifications/
(defun eshell-command-alert (process status)
"Send `alert' with severity based on STATUS when PROCESS finished."
(let* ((cmd (process-command process))
(buffer (process-buffer process))
(msg (format "%s: %s" (mapconcat 'identity cmd " ") status)))
(if (string-prefix-p "finished" status)
(alert msg :buffer buffer :severity 'normal)
(alert msg :buffer buffer :severity 'urgent))))
(use-package eshell
:bind
(:map gpolonkai/pers-map
("e" . eshell))
:hook
(eshell-mode . gpolonkai/eshell-set-c-d-locally)
(eshell-kill . eshell-command-alert))
(use-package calendar
:ensure nil
:custom
(calendar-week-start-day 1))
(use-package cal-dst
:ensure nil
:custom
(calendar-time-zone 60)
(calendar-standard-time-zone-name "CET")
(calendar-daylight-time-zone-name "CEST"))
(use-package solar
:ensure nil
:custom
(calendar-latitude 47.4)
(calendar-longitude 19.0)
(calendar-location-name "Budapest, Hungary"))
;; TODO: This :config call can be omitted if i add it to the calendar-load-hook
(use-package hungarian-holidays
:config
(hungarian-holidays-add))
(add-to-list 'holiday-other-holidays '(holiday-float 7 5 -1 "SysAdmin Day") t)
(add-to-list 'holiday-other-holidays '(holiday-fixed 10 21 "Reptile Awareness Day") t)
(use-package saveplace
:ensure nil
:config
(save-place-mode 1)
:custom
(save-place-file (expand-file-name ".places" user-emacs-directory)))
(use-package ediff
:ensure nil
:custom
(ediff-merge-split-window-function 'split-window-horizontally)
(ediff-split-window-function 'split-window-vertically)
(ediff-window-setup-function 'ediff-setup-windows-plain))
(use-package autorevert
:ensure nil
:config
(global-auto-revert-mode 1))
(use-package eww
:custom
(eww-search-prefix "https://duckduckgo.com/html/?q="))
;; TODO: This :config call can be omitted if i add it to prog-mode-hook
(use-package electric
:config
;; This seems to be the default, but lets make sure…
(electric-indent-mode 1))
(use-package savehist
:config
(savehist-mode 1))
(use-package webjump
:bind
(:map gpolonkai/pers-map
("j" . webjump)))
(defun gpolonkai/activate-which-func-mode ()
"Activate `which-func-mode' if it exists."
(if (fboundp 'which-function-mode)
(which-function-mode)
(which-func-mode)))
;; This :config call can be omitted if i add it to which-function-mode-hook
(use-package which-func
:config
(setq which-func-unknown "")
:hook
(prog-mode . gpolonkai/activate-which-func-mode))
;; “Fortunes” are from the Hungarian version an ancient MS-DOS based program called TAGLINE
(use-package cookie1
:demand t
:custom
(cookie-file (expand-file-name "fortune-cookies.txt" user-emacs-directory))
:bind
(:map gpolonkai/pers-map
("k" . cookie)))
(use-package dired
:ensure nil
:custom
(dired-dwim-target t)
(wdired-create-parent-directories t)
(wdired-allow-to-change-permissions t)
:bind
(:map dired-mode-map
("RET" . dired-find-alternate-file)
("^" . (lambda () (interactive) (find-alternate-file "..")))
("W" . wdired-change-to-wdired-mode)))
(use-package goto-addr
:hook ((compilation-mode . goto-address-mode)
(prog-mode . goto-address-prog-mode)
(eshell-mode . goto-address-mode)
(shell-mode . goto-address-mode))
:bind
(:map goto-address-highlight-keymap
("<RET>" . goto-address-at-point)
("M-<RET>" . newline))
:commands (goto-address-prog-mode goto-address-mode))
;; Close unused buffers at midnight.
(use-package midnight
:ensure nil
:custom
(clean-buffer-list-kill-never-buffer-names '("*scratch*"
"*Messages*"
"*dashboard*"))
:config
(midnight-mode t))
(use-package display-line-numbers
:bind
(:map gpolonkai/pers-map
("C-n" . display-line-numbers-mode)))
(use-package ispell
:custom
(ispell-dictionary "en_GB")
(ispell-program-name "/usr/bin/hunspell")
:hook
(mail-send . ispell-message)
(message-send . ispell-message))
(use-package speedbar)
;; A Termux-specific override for `browse-url'
(when (gpolonkai/termux-p)
(use-package browse-url
:ensure nil
:config
(advice-add 'browse-url-default-browser :override
(lambda (url &rest args)
(start-process-shell-command
"open-url"
nil
(concat "am start -a android.intent.action.VIEW --user 0 -d "
url))))))
(use-package dabbrev
:bind (("M-/" . dabbrev-completion)
("C-M-/" . dabbrev-expand)))
;; I started moving my configuration to this Org file. Its easier to document this way.
(org-babel-load-file (expand-file-name "configuration.org" user-emacs-directory))