From 31ea1a9e794788f0ab90893a7f8545bc1a059eee Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 25 Aug 2024 09:42:16 +0200 Subject: [PATCH] Put everything into init.el --- bundle/bundle--calendar.el | 50 - bundle/bundle--email.el | 123 -- bundle/bundle--general.el | 139 -- bundle/bundle--gui.el | 181 --- bundle/bundle--irc.el | 54 - bundle/bundle--linux.el | 268 ---- bundle/bundle--lisp.el | 382 ------ bundle/bundle--mk.el | 226 ---- bundle/bundle--news.el | 98 -- bundle/bundle--org.el | 560 -------- init.el | 2503 +++++++++++++++++++++++++++++++++++- 11 files changed, 2487 insertions(+), 2097 deletions(-) delete mode 100644 bundle/bundle--calendar.el delete mode 100644 bundle/bundle--email.el delete mode 100644 bundle/bundle--general.el delete mode 100644 bundle/bundle--gui.el delete mode 100644 bundle/bundle--irc.el delete mode 100644 bundle/bundle--linux.el delete mode 100644 bundle/bundle--lisp.el delete mode 100644 bundle/bundle--mk.el delete mode 100644 bundle/bundle--news.el delete mode 100644 bundle/bundle--org.el diff --git a/bundle/bundle--calendar.el b/bundle/bundle--calendar.el deleted file mode 100644 index 746d1749..00000000 --- a/bundle/bundle--calendar.el +++ /dev/null @@ -1,50 +0,0 @@ -(setq holiday-oriental-holidays nil) -(setq holiday-islamic-holidays nil) -(setq holiday-bahai-holidays nil) -(setq holiday-hebrew-holidays nil) -(setq holiday-general-holidays - '((holiday-fixed 1 1 "Neujahr") - (holiday-fixed 5 1 "1. Mai") - (holiday-fixed 10 3 "Tag der Deutschen Einheit"))) -(setq holiday-christian-holidays - '((holiday-float 12 0 -4 "1. Advent" 24) - (holiday-float 12 0 -3 "2. Advent" 24) - (holiday-float 12 0 -2 "3. Advent" 24) - (holiday-float 12 0 -1 "4. Advent" 24) - (holiday-fixed 12 25 "1. Weihnachtstag") - (holiday-fixed 12 26 "2. Weihnachtstag") - (holiday-fixed 1 6 "Heilige Drei Könige") - (holiday-easter-etc -48 "Rosenmontag") - ;; (holiday-easter-etc -3 "Gründonnerstag") - (holiday-easter-etc -2 "Karfreitag") - (holiday-easter-etc 0 "Ostersonntag") - (holiday-easter-etc +1 "Ostermontag") - (holiday-easter-etc +39 "Christi Himmelfahrt") - (holiday-easter-etc +49 "Pfingstsonntag") - (holiday-easter-etc +50 "Pfingstmontag") - (holiday-easter-etc +60 "Fronleichnam") - (holiday-fixed 8 15 "Mariae Himmelfahrt") - (holiday-fixed 11 1 "Allerheiligen") - ;; (holiday-float 11 3 1 "Buss- und Bettag" 16) - (holiday-float 11 0 1 "Totensonntag" 20))) - -(use-package calendar - :ensure nil - :config - (setq calendar-latitude 49.4) - (setq calendar-longitude 11.0) - (setq calendar-location-name "Nuremberg, DE") - :custom - (european-calendar-style t) - (calendar-christian-all-holidays-flag t) - (calendar-date-style (quote iso)) - (calendar-view-diary-initially-flag t) - (calendar-week-start-day 1) - (calendar-intermonth-text - '(propertize - (format "%2d" - (car - (calendar-iso-from-absolute - (calendar-absolute-from-gregorian - (list month day year ))))) - 'font-lock-face 'font-lock-function-name-face))) diff --git a/bundle/bundle--email.el b/bundle/bundle--email.el deleted file mode 100644 index 0d6adc7c..00000000 --- a/bundle/bundle--email.el +++ /dev/null @@ -1,123 +0,0 @@ -;;; bundle--email -(setq mml-default-sign-method "pgpmime" - mml-default-encrypt-method "pgpmime" - mml-secure-openpgp-sign-with-sender t - mail-user-agent 'message-user-agent - compose-mail-user-agent-warnings nil) - -(defun mk/sign-email () - ;; Sign an Email using the key of the sender. - (interactive) - (mml-secure-message-sign-pgpmime)) - -(defun mk/encrypt-email () - ;; Encrypt an Email using the key of the recipient. - (interactive) - (mml-secure-message-encrypt-pgpmime)) - -(defvar mk/gps-location - (eval '(let ((float-output-format "%.1f")) - (format "%s%s, %s%s" - (if (numberp calendar-latitude) - (abs calendar-latitude) - (+ (aref calendar-latitude 0) - (/ (aref calendar-latitude 1) 60.0))) - (if (numberp calendar-latitude) - (if (> calendar-latitude 0) "N" "S") - (if (eq (aref calendar-latitude 2) 'north) "N" "S")) - (if (numberp calendar-longitude) - (abs calendar-longitude) - (+ (aref calendar-longitude 0) - (/ (aref calendar-longitude 1) 60.0))) - (if (numberp calendar-longitude) - (if (> calendar-longitude 0) "E" "W") - (if (eq (aref calendar-longitude 2) 'east) "E" "W")))))) - -(defvar mk/signature-name - (concat "Cheers, " - user-full-name - " (" - calendar-location-name - ", " - mk/gps-location - ")\n")) - -(defvar mk/signature-gpg "GnuPG Key: https://meta.sr.ht/~marcuskammer.pgp\nFingerprint: 86DB 0F30 F9F1 661A 54E2 1664 C374 817B E285 268F") - -(defun mk/signature-time () - (format-time-string "Written on: %a, %d %b %Y %R %z\n")) - -(defun mk/signature () - (concat - ;mk/signature-name - ;(mk/signature-time) - mk/signature-gpg)) - -(use-package smtpmail - :custom - (smtpmail-smtp-server "smtp.mailbox.org") - (smtpmail-smtp-service 465) - (smtpmail-stream-type 'ssl) - (smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg"))) - -(add-hook 'message-signature-setup-hook (lambda () (setf message-signature (mk/signature)))) -;; (add-hook 'mail-send-hook #'ispell-message) -;; (add-hook 'message-send-hook #'ispell-message) -(add-hook 'message-mode-hook 'turn-on-auto-fill) - -(setq message-directory "~/Maildir") -(setq message-auto-save-directory "~/Maildir/Drafts") -(setq message-send-mail-function 'smtpmail-send-it) - -(use-package gnus - :custom - (gnus-use-full-window nil) - (gnus-summary-line-format "%O%U%R%z%d %B%(%[%4L: %-22,22f%]%) %s\n") - (gnus-summary-mode-line-format "Gnus: %p [%A / Sc:%4z] %Z") - (gnus-summary-same-subject "") - (gnus-summary-make-false-root 'adopt) - (gnus-summary-make-false-root-always nil) - (gnus-sum-thread-tree-indent " ") - (gnus-sum-thread-tree-root "* ") - (gnus-sum-thread-tree-false-root "") - (gnus-sum-thread-tree-single-indent "") - (gnus-sum-thread-tree-leaf-with-other "+-+> ") - (gnus-sum-thread-tree-vertical "|") - (gnus-sum-thread-tree-single-leaf "=--> ") - (gnus-thread-sort-functions '(gnus-thread-sort-by-subject gnus-thread-sort-by-most-recent-date)) - (gnus-large-newsgroup nil) - (gnus-inhibit-startup-message t) - (gnus-check-new-newsgroups nil) - (gnus-select-method '(nnnil "")) - (gnus-secondary-select-methods - '((nntp "news.eternal-september.org" - (nntp-open-connection-function nntp-open-ssl-stream) - (nntp-port-number 563) - (nntp-authinfo-file "~/.authinfo.gpg")) - (nnimap "mailbox" - (nnimap-address "imap.mailbox.org") - (nnimap-inbox "INBOX") - (nnimap-server-port 993) - (nnimap-stream ssl) - (nnimap-authinfo-file "~/.authinfo.gpg")))) - :config - (add-hook 'gnus-summary-prepare-hook 'gnus-summary-sort-by-most-recent-date)) - -(when (eq system-type 'gnu/linux) - (let ((mu4e-dir (expand-file-name "/usr/share/emacs/site-lisp/mu4e/"))) - (when (file-directory-p mu4e-dir) - (add-to-list 'load-path mu4e-dir) - (use-package mu4e - :ensure nil - :hook (mu4e-compose-pre . (lambda () (setf mu4e-compose-signature (mk/signature)))) - :custom - (mu4e-confirm-quit nil) - (mu4e-change-filenames-when-moving t) - (mu4e-drafts-folder "/Drafts") - (mu4e-get-mail-command "mbsync -a") - (mu4e-headers-date-format "%Y-%m-%d %H:%M") - (mu4e-refile-folder "/Archive") - (mu4e-sent-folder "/Sent") - (mu4e-trash-folder "/Trash") - (mu4e-split-view 'horizontal) - (mu4e-update-interval (* 10 60)))))) diff --git a/bundle/bundle--general.el b/bundle/bundle--general.el deleted file mode 100644 index d0fc5c57..00000000 --- a/bundle/bundle--general.el +++ /dev/null @@ -1,139 +0,0 @@ -(global-hl-line-mode 1) -(display-time-mode 1) -(global-prettify-symbols-mode -1) - -;;(setq display-time-format "W%V %a %d %b %Y %R %z") -(setq display-time-format "W%V %a %d %b %R") -(setq display-time-24hr-format t) - -;; Cursor and mouse -(column-number-mode 1) -(mouse-wheel-mode 1) -(blink-cursor-mode -1) - -(setq grep-command "grep -i -nH -e ") - -(when (eq system-type 'gnu/linux) - (setq shell-file-name "/bin/bash") - (setq tex-shell-file-name "/bin/bash")) - -;; Files and sessions -(setq auto-save-timeout 60) - -;; Tabs, spaces, lines and parenthesis -(show-paren-mode 1) -(setq-default tab-width 4) -(setq-default indent-tabs-mode nil) -(setq-default line-spacing nil) -(setq-default make-backup-files nil) -(setq-default next-line-add-newlines t) - -;; Miscellaneous -(require 'cl-lib) -(setq default-major-mode 'text-mode) -(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) -;;(global-set-key (kbd "M-[") 'tab-bar-history-back) -;;(global-set-key (kbd "M-]") 'tab-bar-history-forward) - -(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) -(setq compilation-ask-about-save nil) -(setq vc-handled-backends '(Git Hg)) ;; Only use Git and Hg for VC - -(setq horizontal-scroll-bar nil) -(setq vertical-scroll-bar nil) - -(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((meta)) ((control) . text-scale))) - -;;; SIMPLE -(setq completion-auto-wrap t) -(setq completion-auto-select nil) - -;;; MINIBUFFER -(setq completions-format 'one-column) -(setq completions-header-format nil) -(setq completions-max-height 20) - -;; (require 'ido) -;; (setq ido-enable-flex-matching t) -;; (setq ido-everywhere t) -;; (setq ido-create-new-buffer 'always) -;(setq ido-file-extensions-order '(".org" ".lisp" ".py" ".txt" ".el" ".epub")) -(ido-mode t) - -;(fido-mode 1) ; replace icomplete mode -;(fido-vertical-mode 1) -;;; - -;;; bundle--encoding -;; UTF-8 FTW -(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) -(setq default-buffer-file-coding-system 'utf-8-unix) -(setenv "PYTHONIOENCODING" "UTF-8") - -;;; bundle--customfile -(when (eq system-type 'gnu/linux) - (setq custom-file "~/.emacs.d/bundle/custom_gnu.el" - browse-url-secondary-browser-function 'browse-url-firefox) - (unless (file-directory-p "~/cl-sites/") - (async-shell-command "git clone git@git.sr.ht:~marcuskammer/cl-sites ~/cl-sites"))) - -(when (eq system-type 'windows-nt) - (setq explicit-shell-file-name - (seq-find 'file-executable-p - '("C:\\Program Files\\PowerShell\\7\\pwsh.exe" - "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"))) - (setq explicit-powershell.exe-args '("-NoProfile" "-InputFormat" "Text")) - (setq custom-file "~/.emacs.d/bundle/custom_win32.el") - - (when (string= system-name "XPS-8930") - (cd "~/") - (setq custom-file "~/.emacs.d/bundle/custom_win32_XPS8930.el")) - - (when (string= system-name "EVG03435NB") - (cd "~/OneDrive - Siemens AG/") - (setq custom-file "~/.emacs.d/bundle/custom_win32_EVG03435NB.el"))) - -(load custom-file :noerror) - -(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/"))) -(package-initialize) -(unless package-archive-contents - (package-refresh-contents)) -(unless (package-installed-p 'use-package) - (package-install 'use-package)) -(require 'use-package) -(setq use-package-always-ensure t) - -(use-package doom-themes - :init - (load-theme 'doom-one t) - :config - (setq doom-themes-enable-bold t - doom-themes-enable-italic t)) - -(tool-bar-mode -1) -(menu-bar-mode -1) -(scroll-bar-mode -1) -(fringe-mode 10) -(horizontal-scroll-bar-mode -1) diff --git a/bundle/bundle--gui.el b/bundle/bundle--gui.el deleted file mode 100644 index 1a34e524..00000000 --- a/bundle/bundle--gui.el +++ /dev/null @@ -1,181 +0,0 @@ -(setq-default mode-line-format - '("%e" mode-line-front-space "%b %*%n %I %l:%c %p" (vc-mode vc-mode) " " mode-line-modes mode-line-misc-info mode-line-end-spaces)) -(unless (memq 'hs-headline mode-line-format) - (setq mode-line-format - (append '(" " hs-headline) mode-line-format))) - -(set-face-attribute 'mode-line nil - :slant 'italic - :weight 'bold - :background (face-attribute 'default :background) - :foreground - (cond ((member 'doom-one custom-enabled-themes) "#5B6268") - ((member 'doom-nord custom-enabled-themes) "#9099AB") - (t (face-attribute 'mode-line-inactive :foreground))) - :box '(:line-width (1 . 8) :style flat-button)) - -(set-face-attribute 'mode-line-inactive nil - :inherit 'mode-line - :weight 'normal - :box '(:line-width (1 . 8) :style flat-button)) - -(use-package tab-bar - :custom - (tab-bar-auto-width nil) - (tab-bar-auto-width-max '(250 25)) - (tab-bar-format '(tab-bar-format-history tab-bar-format-tabs-groups)) - (tab-bar-tab-name-function 'tab-bar-tab-name-truncated) - (tab-bar-close-button-show nil) - (tab-bar-new-button-show nil) - :config - (set-face-attribute 'tab-bar nil - :inherit 'mode-line-inactive - :background (face-attribute 'mode-line-inactive :background)) - - (set-face-attribute 'tab-bar-tab nil - :inherit 'mode-line - :foreground (face-attribute 'mode-line :foreground) - :box '(:line-width 8 :style flat-button)) - - (set-face-attribute 'tab-bar-tab-inactive nil - :inherit 'mode-line-inactive - :box '(:line-width 8 :style flat-button))) - -(setq default-frame-alist - `((font . "MonoLisa-11") - (width . 85) - (height . 50) - (vertical-scroll-bars) - ,@(cond ((eq system-type 'gnu/linux) - '((fullscreen . maximized) - (undecorated . t)))))) - -(setq frame-resize-pixelwise t) - -(defun center-frame (&optional frame) - "Center FRAME on the screen." - (interactive) - (let ((frame (or frame (selected-frame)))) - (let ((frame-width (frame-pixel-width frame)) - (frame-height (frame-pixel-height frame)) - (display-width (display-pixel-width)) - (display-height (display-pixel-height))) - (set-frame-position frame - (/ (- display-width frame-width) 2) - (/ (- display-height frame-height) 2))))) - -(add-hook 'after-make-frame-functions #'center-frame) - -(use-package all-the-icons - :commands all-the-icons-install-fonts - :init - (unless (find-font (font-spec :name "all-the-icons")) - (all-the-icons-install-fonts t))) - -(use-package all-the-icons-dired - :after all-the-icons - :hook (dired-mode . all-the-icons-dired-mode)) - -(use-package emojify - :hook (erc-mode . emojify-mode) - :commands emojify-mode - :config - (when (member "Segoe UI Emoji" (font-family-list)) - ;; https://ianyepan.github.io/posts/emacs-emojis/ - (set-fontset-font t 'symbol (font-spec :family "Segoe UI Emoji") nil 'prepend) - (setq emojify-display-style 'unicode) - (setq emojify-emoji-styles '(unicode)))) - -;; (defun my-vc-info () -;; (when vc-mode -;; (concat (substring vc-mode 5) -;; " [" -;; (substring (vc-working-revision (buffer-file-name)) 0 8) -;; "] "))) - -;; (defun my-project-name () -;; (let ((proj (project-current))) -;; (if proj (file-name-base (directory-file-name (project-root proj))) -;; "NoProject"))) - -;; (setq-default header-line-format -;; (list "-%M" -;; '(:eval (my-project-name)) " " -;; system-name " " user-login-name " " -;; "-%-")) - -;; (setq-default mode-line-format -;; (list "-%b %*%n %I %l:%c %p " -;; '(:eval mode-name) " " -;; '(:eval (my-vc-info)) -;; '(:eval (if mode-line-process (concat ":" mode-line-process " ") "")) -;; 'default-directory -;; "-%-")) - -;; (set-face-attribute 'mode-line nil :weight 'bold) -;; (set-face-attribute 'header-line nil :weight 'bold) - -;; (use-package doom-modeline -;; :hook (after-init . doom-modeline-mode) -;; :custom -;; (doom-modeline-height 30) -;; (doom-modeline-bar-width 4) -;; (doom-modeline-icon nil) -;; (doom-modeline-major-mode-icon nil) -;; (doom-modeline-unicode-fallback nil) -;; (doom-modeline-minor-modes nil) -;; (doom-modeline-buffer-encoding nil) -;; (doom-modeline-battery nil)) - -(use-package helpful - :commands (helpful-callable helpful-variable helpful-command helpful-key) - :bind ([remap describe-command] . helpful-command) ([remap describe-key] . helpful-key)) - -(use-package rainbow-delimiters - :hook (prog-mode . rainbow-delimiters-mode)) - -(use-package olivetti - :custom (olivetti-body-width 83) - :bind ("" . olivetti-mode)) - -(add-hook 'Info-mode-hook - (lambda () - (make-local-variable 'olivetti-body-width) - (setq olivetti-body-width 75) - (olivetti-mode))) - -(use-package ace-window :init (global-set-key (kbd "M-o") 'ace-window)) - -;; (use-package vertico :init (vertico-mode)) - -(use-package webjump - :bind ("C-c j" . webjump) - :custom - (webjump-sites - (append '(("Wikipedia_de" . [simple-query "de.wikipedia.org" "https://de.wikipedia.org/wiki/" ""]) - ("leo.org" . [simple-query "dict.leo.org" "https://dict.leo.org/german-english/" ""])) - webjump-sample-sites))) - -(use-package doc-view - :ensure nil - :custom - (doc-view-dvipdfm-program "mutool") - (doc-view-odf->odf-converter-program "soffice") - (dov-view-odf->pdf-converter-function 'doc-view-odf->pdf-converter-soffice) - (doc-view-pdf->png-converter-function 'doc-view-pdf->png-converter-mupdf) - (doc-view-resolution 300)) - -(use-package yasnippet - :init - (yas-global-mode 1)) - -;(pixel-scroll-precision-mode +1) - -(use-package hideshow - :hook ((prog-mode . (lambda () (hs-minor-mode 1)))) - :bind (:map prog-mode-map - ("M-" . hs-toggle-hiding)) - :custom - (hs-allow-nesting t)) - -(add-hook 'prog-mode-hook (lambda () (setq line-spacing 4))) diff --git a/bundle/bundle--irc.el b/bundle/bundle--irc.el deleted file mode 100644 index d94a12a4..00000000 --- a/bundle/bundle--irc.el +++ /dev/null @@ -1,54 +0,0 @@ -(defun mk/start-irc (nick) - (interactive "sTell me your nick please: ") - (erc-tls :server "irc.libera.chat" - :port 6697 - :nick nick - :full-name "Jay Edgar Hoover")) - -(use-package erc - :defer t - :custom - (erc-track-exclude '("#emacs")) - (erc-track-exclude-types '("JOIN" "NICK" "QUIT" "MODE" "AWAY")) - (erc-hide-list '("JOIN" "NICK" "QUIT" "MODE" "AWAY")) - (erc-track-exclude-server-buffer t) - (erc-fill-column 80) - (erc-fill-function 'erc-fill-static) - (erc-fill-static-center 20) - (erc-prompt-for-nickserv-password nil) - (erc-track-shorten-start 8) - (erc-auto-query 'bury) - (erc-network-hide-list '(("libera.chat" "JOIN" "PART" "QUIT"))) - (erc-rename-buffers t) - (erc-interpret-mirc-color t) - (erc-kill-buffer-on-part t) - (erc-kill-queries-on-quit t) - (erc-kill-server-buffer-on-quit t) - (erc-modules - '(autojoin ; Set away status automatically - button ; Join channels automatically - completion ; Complete nicknames and commands (programmable) - fill ; Wrap long lines - irccontrols ; Highlight or remove IRC control characters - match ; Highlight pals, fools, and other keywords - menu ; Display a menu in ERC buffers - netsplit ; Detect netsplits - noncommands ; Don’t display non-IRC commands after evaluation - readonly ; Make displayed lines read-only - ring ; Enable an input history - services ; Identify to Nickserv (IRC Services) automatically - smiley ; Convert smileys to pretty icons - stamp ; Add timestamps to messages - truncate ; Truncate buffers to a certain size - ))) - -(use-package erc-hl-nicks - :after erc - :config - (add-to-list 'erc-modules 'hl-nicks)) - -(use-package erc-image - :after erc - :config - (setq erc-image-inline-rescale 300) - (add-to-list 'erc-modules 'image)) diff --git a/bundle/bundle--linux.el b/bundle/bundle--linux.el deleted file mode 100644 index bce4b56e..00000000 --- a/bundle/bundle--linux.el +++ /dev/null @@ -1,268 +0,0 @@ -;;; bundle--linux.el --- A bundle of useful Linux information - -;;; Commentary: -;; This file contains a variety of Emacs Lisp functions that provide -;; helpful descriptions for Linux directories, commands, and options. - -;;; Code: - -(defvar linux-filesystem-alist - '(( "/" . "Root directory, the base of the filesystem hierarchy") - ("/bin" . "Essential command binaries, needed for booting") - ("/boot" . "Bootloader files, kernel, and other files needed during booting") - ("/dev" . "Device files representing hardware components") - ("/etc" . "System-wide configuration files") - ("/home" . "User home directories") - ("/lib" . "Shared libraries and kernel modules") - ("/media" . "Mount points for removable media like CDs and USBs") - ("/mnt" . "Temporary mount points for filesystems") - ("/opt" . "Optional application software packages") - ("/proc" . "Virtual filesystem providing info about processes and system") - ("/root" . "Home directory for the root user") - ("/sbin" . "Essential system binaries, usually for the root user") - ("/srv" . "Data directories for services like HTTP, FTP, etc.") - ("/sys" . "Virtual filesystem for kernel objects") - ("/tmp" . "Temporary files, cleared on reboot") - ("/usr" . "User binaries, documentation, libraries, etc.") - ("/var" . "Variable files like logs, databases, etc.")) - "Alist mapping Linux directories to their descriptions.") - -(defun describe-linux-directory (dirname) - "Describe the purpose of a Linux directory. -Takes DIRNAME as an argument and prints its description." - (interactive "sEnter Linux directory name (e.g., /bin): ") - (let ((description (assoc-default dirname linux-filesystem-alist))) - (if description - (message "%s: %s" dirname description) - (message "Unknown directory: %s" dirname)))) - -(defvar bash-regex-alist - '(("empty line" . "^$") - ("backslash" . "\\\\") - ("line starts with a dot" . "^\\.") - ("line ends with a dot" . "\\.$") - ("line starts with a dollar sign" . "^\\$") - ("line starts with a caret" . "^\\^") - ("left square bracket" . "\\[") - ("right square bracket" . "\\]") - ("entire line" . "^.*$") - ("any alphanumeric character" . "[a-zA-Z0-9]") - ("IP Address" . "\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\b") - ("email" . "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}") - ("hex color code" . "#[a-fA-F0-9]{6}") - ("date in yyyy-mm-dd" . "\\b\\d{4}-\\d{2}-\\d{2}\\b") - ("time in hh:mm:ss" . "\\b\\d{2}:\\d{2}:\\d{2}\\b") - ("words without vowels" . "\\b[^aeiou\s]+\\b")) - "Alist mapping Bash regular expressions to their descriptions.") - -(defun describe-bash-regex (regex) - "Describe the purpose of a Bash regular expression. -Takes REGEX as an argument and prints its description." - (interactive "sEnter Bash regex (e.g., empty line): ") - (let ((description (assoc-default regex bash-regex-alist))) - (if description - (message "%s: %s" regex description) - (message "Unknown regular expression: %s" regex)))) - -(defvar linux-process-commands-alist - '(("ps" . "Shows a snapshot of the current processes") - ("top" . "Displays dynamic real-time view of system stats and processes") - ("htop" . "An interactive process viewer, similar to top but more feature-rich") - ("pgrep" . "Looks up processes based on name and other attributes") - ("pstree" . "Displays the process tree in a tree-like diagram") - ("ps -e" . "Lists all the processes running on the system") - ("ps aux" . "Displays detailed information about all processes") - ("kill" . "Terminates processes by sending signals") - ("killall" . "Kills all processes that match the given name") - ("pkill" . "Send signals to processes based on name and other attributes")) - "Alist mapping Linux process-checking commands to their descriptions.") - -(defun describe-linux-process-command (command) - "Describe the purpose of a Linux process-checking command. -Takes COMMAND as an argument and prints its description." - (interactive "sEnter Linux process command (e.g., ps): ") - (let ((description (assoc-default command linux-process-commands-alist))) - (if description - (message "%s: %s" command description) - (message "Unknown command: %s" command)))) - -(defvar linux-logfiles-alist - '(("/var/log/syslog" . "System messages, including the messages that are logged during system startup") - ("/var/log/auth.log" . "Security/authorization information, including user logins and authentication") - ("/var/log/kern.log" . "Kernel logs") - ("/var/log/cron.log" . "Logs for cron jobs") - ("/var/log/messages" . "General system activity logs") - ("/var/log/boot.log" . "System boot log") - ("/var/log/daemon.log" . "Background daemon log messages") - ("/var/log/dpkg.log" . "Logs for package installations and removals") - ("/var/log/mail.log" . "Mail server logs") - ("/var/log/user.log" . "User-level messages")) - "Alist mapping Linux log files to their descriptions.") - -(defun describe-linux-logfile (logfile) - "Describe the purpose of a Linux log file. -Takes LOGFILE as an argument and prints its description." - (interactive "sEnter Linux log file path (e.g., /var/log/syslog): ") - (let ((description (assoc-default logfile linux-logfiles-alist))) - (if description - (message "%s: %s" logfile description) - (message "Unknown log file: %s" logfile)))) - -(defvar linux-basic-commands-alist - '(("list directory contents" . "ls") - ("change directory" . "cd") - ("move or rename files" . "mv") - ("copy files" . "cp") - ("remove files or directories" . "rm") - ("print working directory" . "pwd") - ("display variable value" . "echo") - ("create an empty file" . "touch") - ("change file permissions" . "chmod") - ("change file ownership" . "chown")) - "Alist mapping basic Linux command descriptions to their commands.") - -(defun describe-basic-linux-command (command) - "Describe the purpose of a basic Linux command. -Takes COMMAND as an argument and prints its description." - (interactive "sEnter basic Linux command (e.g., ls): ") - (let ((description (assoc-default command linux-basic-commands-alist))) - (if description - (message "%s: %s" command description) - (message "Unknown command: %s" command)))) - -(defvar chown-options-alist - '(("-R" . "Operate on files and directories recursively") - ("--from" . "Change the owner and/or group of each file only if its current owner and/or group match specified values") - ("--no-dereference" . "Affect symbolic links instead of the files they point to") - ("--preserve-root" . "Fail when attempting to operate recursively on '/'") - ("--reference" . "Use owner and group of a reference file") - ("-c" . "Report when a change is made") - ("-f" . "Suppress most error messages") - ("-v" . "Output a diagnostic for every file processed")) - "Alist mapping chown command options to their descriptions.") - -(defun describe-chown-option (option) - "Describe the purpose of a chown option. -Takes OPTION as an argument and prints its description." - (interactive "sEnter chown option (e.g., -R): ") - (let ((description (assoc-default option chown-options-alist))) - (if description - (message "%s: %s" option description) - (message "Unknown chown option: %s" option)))) - -(defvar chmod-options-alist - '(("-R" . "Operate on files and directories recursively") - ("--preserve-root" . "Avoid operating recursively on '/'") - ("-c" . "Report when a change is made") - ("-f" . "Suppress most error messages") - ("-v" . "Output a diagnostic for every file processed") - ("--reference" . "Use mode of a reference file") - ("-w" . "Remove write permission") - ("-x" . "Remove execute permission") - ("-u" . "Set user ID on execution") - ("-g" . "Set group ID on execution")) - "Alist mapping chmod command options to their descriptions.") - -(defun describe-chmod-option (option) - "Describe the purpose of a chmod option. -Takes OPTION as an argument and prints its description." - (interactive "sEnter chmod option (e.g., -R): ") - (let ((description (assoc-default option chmod-options-alist))) - (if description - (message "%s: %s" option description) - (message "Unknown chmod option: %s" option)))) - -(defvar ssh-use-cases-alist - '(("remote login" . "ssh user@host") - ("run command" . "ssh user@host 'command'") - ("file transfer" . "scp file.txt user@host:/path/") - ("secure ftp" . "sftp user@host") - ("port forwarding" . "ssh -L local_port:remote_host:remote_port user@host") - ("dynamic port forwarding" . "ssh -D port user@host") - ("remote port forwarding" . "ssh -R remote_port:local_host:local_port user@host") - ("tunneling" . "ssh -L local_port:remote_host:remote_port user@host -f -N") - ("agent forwarding" . "ssh -A user@host") - ("ssh multiplexing" . "ssh -M -S /tmp/ssh_socket user@host; ssh -S /tmp/ssh_socket user@host")) - "Alist mapping SSH use cases to their corresponding commands.") - -(defun describe-ssh-use-case (use-case) - "Describe the SSH command for a given use case." - (interactive "sEnter the SSH use case: ") - (let ((command (assoc-default use-case ssh-use-cases-alist))) - (if command - (message "Command for %s: %s" use-case command) - (message "Use case not found")))) - -(defvar mk/remote-*host-aliases* - '(("website" . "marcus@www.marcuskammer.dev") - ("survey" . "cl@survey.metalisp.dev") - ("pihole" . "ubuntu@pi-hole.fritz.box")) - "Alist mapping friendly host names to actual SSH-compatible host strings.") - -(defun mk/remote--get-real-host (alias) - "Lookup the real host name based on a given ALIAS." - (or (cdr (assoc alias mk/remote-*host-aliases*)) alias)) - -(defun mk/remote--systemctl-service (alias service command) - "Execute a systemctl COMMAND on a systemd SERVICE on a remote host identified by ALIAS. - -ALIAS is a string that specifies the remote host; it can be an -alias defined in `mk/remote-*host-aliases*'. - -SERVICE is the name of the systemd service to operate on. - -COMMAND is the systemctl command to execute on the service (e.g., -'start', 'stop', 'status')." - (let* ((host (mk/remote--get-real-host alias)) - (buffer (generate-new-buffer (format "*%s-%s-%s*" alias service command))) - (process-name (format "systemctl-%s-%s" command service))) - (make-process :name process-name - :buffer buffer - :command `("ssh" ,host "sudo" "systemctl" ,command ,service) - :sentinel (lambda (process signal) - (when (memq (process-status process) '(exit signal)) - (message "Process: %s %s" process signal)))))) - -(defmacro mk/remote-define-systemctl-functions (&rest actions) - "Dynamically create functions to interact with systemd services on a remote host. - -Each function will be named `mk/remote-ACTION-service', where -ACTION is one of the symbols in ACTIONS. The functions will take -an ALIAS and SERVICE as arguments and call -`mk/remote--systemctl-service' accordingly." - `(progn - ,@(mapcar - (lambda (action) - `(defun ,(intern (format "mk/remote-%s-service" action)) (alias service) - (interactive "sEnter the host alias or name: \nsEnter the service name: ") - (mk/remote--systemctl-service alias service ,(symbol-name action)))) - actions))) - -(mk/remote-define-systemctl-functions start stop status) - -(defun mk/remote--log (alias service filename) - (let* ((filepath (concat "/var/log/" service (unless (string-empty-p filename) (concat "/" filename)))) - (host (mk/remote--get-real-host alias)) - (buffer (generate-new-buffer (format "*%s-%s-%s*" alias service filename))) - (process-name (format "log-%s-%s" service filename))) - (make-process :name process-name - :buffer buffer - :command `("ssh" ,host "sudo" "tail -f" ,filepath) - :sentinel (lambda (process signal) - (when (memq (process-status process) '(exit signal)) - (message "Process: %s %s" process signal)))))) - -(defmacro mk/define-remote-log-function (alias service &optional filename) - "Define a function to asynchronously tail a remote log file." - (let ((fname (if filename filename ""))) - `(defun ,(intern (format "mk/remote-log-%s-%s-%s" alias service filename)) () - ,(format "Tail the remote log file: %s" filename) - (interactive) - (mk/remote--log ,alias ,service ,fname)))) - -(mk/define-remote-log-function "website" "nginx" "access.csv") -(mk/define-remote-log-function "website" "nginx" "error.log") -(mk/define-remote-log-function "website" "syslog") -(mk/define-remote-log-function "survey" "nginx" "access.csv") -(mk/define-remote-log-function "survey" "syslog") -(mk/define-remote-log-function "pihole" "pihole" "pihole.log") diff --git a/bundle/bundle--lisp.el b/bundle/bundle--lisp.el deleted file mode 100644 index 48c400d9..00000000 --- a/bundle/bundle--lisp.el +++ /dev/null @@ -1,382 +0,0 @@ -(defvar mk/hyperspec-dir-locations - '("~/cl-sites/HyperSpec-7-0/HyperSpec/" - "~/HyperSpec-7-0/HyperSpec/") - "List of possible locations where the local HyperSpec could reside.") - -(defun mk/hyperspec-dir () - "Finds and returns the URI of the local HyperSpec directory. -Uses `mk/hyperspec-dir-locations' to find the directory." - (let ((dir (seq-find 'file-directory-p mk/hyperspec-dir-locations))) - (if dir - (concat "file://" (and (eq system-type 'windows-nt) "/") (expand-file-name dir)) - nil))) - -(setq common-lisp-hyperspec-root (mk/hyperspec-dir)) - -(use-package slime - :custom - (slime-autodoc-use-multiline-p 1) - :config - (define-key slime-mode-map (kbd "C-c C-q") 'slime-close-all-parens-in-sexp) - (slime-setup '(slime-autodoc - slime-tramp - slime-fancy - slime-asdf - slime-indentation - slime-editing-commands - slime-sbcl-exts)) - - ;; To create a slime specific sbcl image: - ;; shell$ sbcl - ;; * (mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf)) - ;; * (save-lisp-and-die "sbcl.core-for-slime") - - ;; Stop SLIME's REPL from grabbing DEL, - ;; which is annoying when backspacing over a '(' - - ;; (defun override-slime-repl-bindings-with-paredit () - ;; (define-key slime-repl-mode-map - ;; (read-kbd-macro paredit-backward-delete-key) nil)) - - ;; (add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit) - - (setq common-lisp-hyperspec-symbol-table - (concat common-lisp-hyperspec-root "Data/Map_Sym.txt")) - - (setq common-lisp-hyperspec-issuex-table - (concat common-lisp-hyperspec-root "Data/Map_IssX.txt")) - - (let ((image-path (expand-file-name "~/sbcl.core-for-slime"))) - (if (file-exists-p image-path) - (setq slime-lisp-implementations - `((sbcl ("sbcl" "--noinform" "--core" ,image-path) :coding-system utf-8-unix))) - (setq slime-lisp-implementations - `((sbcl ("sbcl" "--noinform") :coding-system utf-8-unix))))) - - (defvar mk/slime-remote-instances - '((:machine-instance "survey-metalisp" - :remote-host "survey.metalisp.dev" - :username "cl") - (:machine-instance "u1-marcsukammer" - :remote-host "u1.marcsukammer.dev" - :username "marcus"))) - - (mapc (lambda (instance) - (push (slime-create-filename-translator - :machine-instance (plist-get instance :machine-instance) - :remote-host (plist-get instance :remote-host) - :username (plist-get instance :username)) - slime-filename-translations)) - mk/slime-remote-instances) - - ;; syntax highlighting - (defvar slime-repl-font-lock-keywords lisp-font-lock-keywords-2) - - (defun slime-repl-font-lock-setup () - (setq font-lock-defaults - '(slime-repl-font-lock-keywords - ;; From lisp-mode.el - nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil - (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function)))) - - (add-hook 'slime-repl-mode-hook 'slime-repl-font-lock-setup) - - (defadvice slime-repl-insert-prompt (after font-lock-face activate) - (let ((inhibit-read-only t)) - (add-text-properties - slime-repl-prompt-start-mark (point) - '(font-lock-face - slime-repl-prompt-face - rear-nonsticky - (slime-repl-prompt read-only font-lock-face intangible)))))) - -(use-package elisp-mode - :ensure nil - :hook ((emacs-lisp-mode . prettify-symbols-mode) - (emacs-lisp-mode . (lambda () - (face-remap-add-relative 'font-lock-function-name-face nil :underline t) - (face-remap-add-relative 'font-lock-keyword-face nil :slant 'italic)))) - :mode (("\\.el$" . emacs-lisp-mode)) - :config - (setq-local lisp-indent-function 'lisp-indent-function) - (setq-local fill-column 84)) - -(use-package lisp-mode - :ensure nil - :hook ((lisp-mode . (lambda () - (face-remap-add-relative 'font-lock-function-name-face nil :underline t) - (face-remap-add-relative 'font-lock-keyword-face nil :slant 'italic)))) - :mode (("\\.lisp$" . lisp-mode) - ("\\.lsp$" . lisp-mode) - ("\\.cl$" . lisp-mode)) - :init - (setq inferior-lisp-program "sbcl --noinform") - - :config - (setq-local lisp-indent-function 'common-lisp-indent-function) - (setq-local fill-column 84) - (defvar g-cl-function-names - '("*" "+" "-" "/" "/=" "1+" "1-" "<" "<=" "=" ">" - ">=" "abort" "abs" "acons" "acos" "acosh" "add-method" "adjoin" - "adjust-array" "adjustable-array-p" "allocate-instance" "alpha-char-p" - "alphanumericp" "and" "append" "apply" "apropos" "apropos-list" "aref" - "arithmetic-error-operands" "arithmetic-error-operation" "array-dimension" - "array-dimensions" "array-displacement" "array-element-type" - "array-has-fill-pointer-p" "array-in-bounds-p" "array-rank" - "array-row-major-index" "array-total-size" "arrayp" "ash" "asin" "asinh" - "assert" "assoc" "assoc-if" "assoc-if-not" "atan" "atanh" "atom" "bit" - "bit-and" "bit-andc1" "bit-andc2" "bit-eqv" "bit-ior" "bit-nand" "bit-nor" - "bit-not" "bit-orc1" "bit-orc2" "bit-vector-p" "bit-xor" "block" "boole" - "both-case-p" "boundp" "break" "broadcast-stream-streams" "butlast" "byte" - "byte-position" "byte-size" "caaaar" "caaadr" "caaar" "caadar" "caaddr" - "caadr" "caar" "cadaar" "cadadr" "cadar" "caddar" "cadddr" "caddr" "cadr" - "call-method" "car" "case" "catch" "ccase" "cdaaar" "cdaadr" "cdaar" - "cdadar" "cdaddr" "cdadr" "cdar" "cddaar" "cddadr" "cddar" "cdddar" "cddddr" - "cdddr" "cddr" "cdr" "ceiling" "cell-error-name" "cerror" "change-class" - "char" "char-code" "char-downcase" "char-equal" "char-greaterp" "char-int" - "char-lessp" "char-name" "char-not-equal" "char-not-greaterp" - "char-not-lessp" "char-upcase" "char/=" "char<" "char<=" "char=" "char>" - "char>=" "character" "characterp" "check-type" "cis" "class-name" "class-of" - "clear-input" "clear-output" "close" "clrhash" "code-char" "coerce" - "compile" "compile-file" "compile-file-pathname" "compiled-function-p" - "compiler-macro-function" "complement" "complex" "complexp" - "compute-applicable-methods" "compute-restarts" "concatenate" - "concatenated-stream-streams" "cond" "conjugate" "cons" "consp" "constantly" - "constantp" "continue" "copy-alist" "copy-list" "copy-pprint-dispatch" - "copy-readtable" "copy-seq" "copy-structure" "copy-symbol" "copy-tree" "cos" - "cosh" "count" "count-if" "count-if-not" "ctypecase" "decf" "declaim" - "decode-float" "decode-universal-time" "defclass" "defconstant" "defgeneric" - "define-compiler-macro" "define-condition" "define-method-combination" - "define-modify-macro" "define-setf-expander" "define-symbol-macro" - "defmacro" "defmethod" "defpackage" "defparameter" "defsetf" "defstruct" - "deftype" "defun" "defvar" "delete" "delete-duplicates" "delete-file" - "delete-if" "delete-if-not" "delete-package" "denominator" "deposit-field" - "describe" "describe-object" "destructuring-bind" "digit-char" - "digit-char-p" "directory" "directory-namestring" "disassemble" "do" "do*" - "do-all-symbols" "do-external-symbols" "do-symbols" "documentation" "dolist" - "dotimes" "dpb" "dribble" "ecase" "echo-stream-input-stream" - "echo-stream-output-stream" "ed" "eighth" "elt" "encode-universal-time" - "endp" "enough-namestring" "ensure-directories-exist" - "ensure-generic-function" "eq" "eql" "equal" "equalp" "error" "etypecase" - "eval" "eval-when" "evenp" "every" "exp" "export" "expt" "fboundp" - "fceiling" "fdefinition" "ffloor" "fifth" "file-author" - "file-error-pathname" "file-length" "file-namestring" "file-position" - "file-string-length" "file-write-date" "fill" "fill-pointer" "find" - "find-all-symbols" "find-class" "find-if" "find-if-not" "find-method" - "find-package" "find-restart" "find-symbol" "finish-output" "first" "flet" - "float" "float-digits" "float-precision" "float-radix" "float-sign" "floatp" - "floor" "fmakunbound" "force-output" "format" "formatter" "fourth" - "fresh-line" "fround" "ftruncate" "funcall" "function" "function-keywords" - "function-lambda-expression" "functionp" "gcd" "gensym" "gentemp" "get" - "get-decoded-time" "get-dispatch-macro-character" "get-internal-real-time" - "get-internal-run-time" "get-macro-character" "get-output-stream-string" - "get-properties" "get-setf-expansion" "get-universal-time" "getf" "gethash" - "go" "graphic-char-p" "handler-bind" "handler-case" "hash-table-count" - "hash-table-p" "hash-table-rehash-size" "hash-table-rehash-threshold" - "hash-table-size" "hash-table-test" "host-namestring" "identity" "if" - "ignore-errors" "imagpart" "import" "in-package" "incf" - "initialize-instance" "input-stream-p" "inspect" "integer-decode-float" - "integer-length" "integerp" "interactive-stream-p" "intern" "intersection" - "invalid-method-error" "invoke-debugger" "invoke-restart" - "invoke-restart-interactively" "isqrt" "keywordp" "labels" "lambda" "last" - "lcm" "ldb" "ldb-test" "ldiff" "length" "let" "let*" - "lisp-implementation-type" "lisp-implementation-version" "list" "list*" - "list-all-packages" "list-length" "listen" "listp" "load" - "load-logical-pathname-translations" "load-time-value" "locally" "log" - "logand" "logandc1" "logandc2" "logbitp" "logcount" "logeqv" - "logical-pathname" "logical-pathname-translations" "logior" "lognand" - "lognor" "lognot" "logorc1" "logorc2" "logtest" "logxor" "long-site-name" - "loop" "loop-finish" "lower-case-p" "machine-instance" "machine-type" - "machine-version" "macro-function" "macroexpand" "macroexpand-1" "macrolet" - "make-array" "make-broadcast-stream" "make-concatenated-stream" - "make-condition" "make-dispatch-macro-character" "make-echo-stream" - "make-hash-table" "make-instance" "make-instances-obsolete" "make-list" - "make-load-form" "make-load-form-saving-slots" "make-package" - "make-pathname" "make-random-state" "make-sequence" "make-string" - "make-string-input-stream" "make-string-output-stream" "make-symbol" - "make-synonym-stream" "make-two-way-stream" "makunbound" "map" "map-into" - "mapc" "mapcan" "mapcar" "mapcon" "maphash" "mapl" "maplist" "mask-field" - "max" "member" "member-if" "member-if-not" "merge" "merge-pathnames" - "method-combination-error" "method-qualifiers" "min" "minusp" "mismatch" - "mod" "muffle-warning" "multiple-value-bind" "multiple-value-call" - "multiple-value-list" "multiple-value-prog1" "multiple-value-setq" - "name-char" "namestring" "nbutlast" "nconc" "nintersection" "ninth" - "no-applicable-method" "no-next-method" "not" "notany" "notevery" "nreconc" - "nreverse" "nset-difference" "nset-exclusive-or" "nstring-capitalize" - "nstring-downcase" "nstring-upcase" "nsublis" "nsubst" "nsubst-if" - "nsubst-if-not" "nsubstitute" "nsubstitute-if" "nsubstitute-if-not" "nth" - "nth-value" "nthcdr" "null" "numberp" "numerator" "nunion" "oddp" "open" - "open-stream-p" "or" "output-stream-p" "package-error-package" - "package-name" "package-nicknames" "package-shadowing-symbols" - "package-use-list" "package-used-by-list" "packagep" "pairlis" - "parse-integer" "parse-namestring" "pathname" "pathname-device" - "pathname-directory" "pathname-host" "pathname-match-p" "pathname-name" - "pathname-type" "pathname-version" "pathnamep" "peek-char" "phase" "plusp" - "pop" "position" "position-if" "position-if-not" "pprint" "pprint-dispatch" - "pprint-exit-if-list-exhausted" "pprint-fill" "pprint-indent" - "pprint-linear" "pprint-logical-block" "pprint-newline" "pprint-pop" - "pprint-tab" "pprint-tabular" "prin1" "prin1-to-string" "princ" - "princ-to-string" "print" "print-not-readable-object" "print-object" - "print-unreadable-object" "probe-file" "proclaim" "prog" "prog*" "prog1" - "prog2" "progn" "progv" "provide" "psetf" "psetq" "push" "pushnew" "quote" - "random" "random-state-p" "rassoc" "rassoc-if" "rassoc-if-not" "rational" - "rationalize" "rationalp" "read" "read-byte" "read-char" "read-char-no-hang" - "read-delimited-list" "read-from-string" "read-line" - "read-preserving-whitespace" "read-sequence" "readtable-case" "readtablep" - "realp" "realpart" "reduce" "reinitialize-instance" "rem" "remf" "remhash" - "remove" "remove-duplicates" "remove-if" "remove-if-not" "remove-method" - "remprop" "rename-file" "rename-package" "replace" "require" "rest" - "restart-bind" "restart-case" "restart-name" "return" "return-from" - "revappend" "reverse" "room" "rotatef" "round" "row-major-aref" "rplaca" - "rplacd" "sbit" "scale-float" "schar" "search" "second" "set" - "set-difference" "set-dispatch-macro-character" "set-exclusive-or" - "set-macro-character" "set-pprint-dispatch" "set-syntax-from-char" "setf" - "setq" "seventh" "shadow" "shadowing-import" "shared-initialize" "shiftf" - "short-site-name" "signal" "signum" "simple-bit-vector-p" - "simple-condition-format-arguments" "simple-condition-format-control" - "simple-string-p" "simple-vector-p" "sin" "sinh" "sixth" "sleep" - "slot-boundp" "slot-exists-p" "slot-makunbound" "slot-missing" - "slot-unbound" "slot-value" "software-type" "software-version" "some" "sort" - "special-operator-p" "sqrt" "stable-sort" "standard-char-p" "step" - "store-value" "stream-element-type" "stream-error-stream" - "stream-external-format" "streamp" "string" "string-capitalize" - "string-downcase" "string-equal" "string-greaterp" "string-left-trim" - "string-lessp" "string-not-equal" "string-not-greaterp" "string-not-lessp" - "string-right-trim" "string-trim" "string-upcase" "string/=" "string<" - "string<=" "string=" "string>" "string>=" "stringp" "sublis" "subseq" - "subsetp" "subst" "subst-if" "subst-if-not" "substitute" "substitute-if" - "substitute-if-not" "subtypep" "svref" "sxhash" "symbol-function" - "symbol-macrolet" "symbol-name" "symbol-package" "symbol-plist" - "symbol-value" "symbolp" "synonym-stream-symbol" "tagbody" "tailp" "tan" - "tanh" "tenth" "terpri" "the" "third" "throw" "time" "trace" - "translate-logical-pathname" "translate-pathname" "tree-equal" "truename" - "truncate" "two-way-stream-input-stream" "two-way-stream-output-stream" - "type-error-datum" "type-error-expected-type" "type-of" "typecase" "typep" - "unbound-slot-instance" "unexport" "unintern" "union" "unless" "unread-char" - "untrace" "unuse-package" "unwind-protect" - "update-instance-for-different-class" "update-instance-for-redefined-class" - "upgraded-array-element-type" "upgraded-complex-part-type" "upper-case-p" - "use-package" "use-value" "user-homedir-pathname" "values" "values-list" - "vector" "vector-pop" "vector-push" "vector-push-extend" "vectorp" "warn" - "when" "wild-pathname-p" "with-accessors" "with-compilation-unit" - "with-condition-restarts" "with-hash-table-iterator" - "with-input-from-string" "with-open-file" "with-open-stream" - "with-output-to-string" "with-package-iterator" "with-simple-restart" - "with-slots" "with-standard-io-syntax" "write" "write-byte" "write-char" - "write-line" "write-sequence" "write-string" "write-to-string" "y-or-n-p" - "yes-or-no-p" "zerop")) - (defvar g-cl-value-names - '("*" "**" "***" "*break-on-signals*" - "*compile-file-pathname*" "*compile-file-truename*" "*compile-print*" - "*compile-verbose*" "*debug-io*" "*debugger-hook*" - "*default-pathname-defaults*" "*error-output*" "*features*" - "*gensym-counter*" "*load-pathname*" "*load-print*" "*load-truename*" - "*load-verbose*" "*macroexpand-hook*" "*modules*" "*package*" - "*print-array*" "*print-base*" "*print-case*" "*print-circle*" - "*print-escape*" "*print-gensym*" "*print-length*" "*print-level*" - "*print-lines*" "*print-miser-width*" "*print-pprint-dispatch*" - "*print-pretty*" "*print-radix*" "*print-readably*" "*print-right-margin*" - "*query-io*" "*random-state*" "*read-base*" "*read-default-float-format*" - "*read-eval*" "*read-suppress*" "*readtable*" "*standard-input*" - "*standard-output*" "*terminal-io*" "*trace-output*" "+" "++" "+++" "-" "/" - "//" "///" "array-dimension-limit" "array-rank-limit" - "array-total-size-limit" "boole-1" "boole-2" "boole-and" "boole-andc1" - "boole-andc2" "boole-c1" "boole-c2" "boole-clr" "boole-eqv" "boole-ior" - "boole-nand" "boole-nor" "boole-orc1" "boole-orc2" "boole-set" "boole-xor" - "call-arguments-limit" "char-code-limit" "double-float-epsilon" - "double-float-negative-epsilon" "internal-time-units-per-second" - "lambda-list-keywords" "lambda-parameters-limit" - "least-negative-double-float" "least-negative-long-float" - "least-negative-normalized-double-float" - "least-negative-normalized-long-float" - "least-negative-normalized-short-float" - "least-negative-normalized-single-float" "least-negative-short-float" - "least-negative-single-float" "least-positive-double-float" - "least-positive-long-float" "least-positive-normalized-double-float" - "least-positive-normalized-long-float" - "least-positive-normalized-short-float" - "least-positive-normalized-single-float" "least-positive-short-float" - "least-positive-single-float" "long-float-epsilon" - "long-float-negative-epsilon" "most-negative-double-float" - "most-negative-fixnum" "most-negative-long-float" - "most-negative-short-float" "most-negative-single-float" - "most-positive-double-float" "most-positive-fixnum" - "most-positive-long-float" "most-positive-short-float" - "most-positive-single-float" "multiple-values-limit" "nil" "pi" - "short-float-epsilon" "short-float-negative-epsilon" "single-float-epsilon" - "single-float-negative-epsilon" "t")) - (defface g-cl-character-face - '((default :inherit font-lock-constant-face)) - "The face used to highlight Common Lisp character literals.") - (defface g-cl-standard-function-face - '((default :inherit font-lock-keyword-face)) - "The face used to highlight standard Common Lisp function symbols.") - (defface g-cl-standard-value-face - '((default :inherit font-lock-variable-name-face)) - "The face used to highlight standard Common Lisp value symbols.") - (defvar g-cl-font-lock-keywords - (let* ((character-re (concat "#\\\\" lisp-mode-symbol-regexp "\\_>")) - (function-re (concat "(" (regexp-opt g-cl-function-names t) "\\_>")) - (value-re (regexp-opt g-cl-value-names 'symbols))) - `((,character-re . 'g-cl-character-face) - (,function-re - (1 'g-cl-standard-function-face)) - (,value-re . 'g-cl-standard-value-face)))) - (defvar g-cl-font-lock-defaults - '((g-cl-font-lock-keywords) - nil ; enable syntaxic highlighting - t ; case insensitive highlighting - nil ; use the lisp-mode syntax table - (font-lock-mark-block-function . mark-defun) - (font-lock-extra-managed-props help-echo) - (font-lock-syntactic-face-function - . lisp-font-lock-syntactic-face-function))) - (defun g-init-lisp-font-lock () - (setq font-lock-defaults g-cl-font-lock-defaults)) - - (add-hook 'lisp-mode-hook 'g-init-lisp-font-lock)) - -(use-package common-lisp-snippets - :after yasnippet) - -(when (eq system-type 'gnu/linux) - (use-package geiser - :init - (setq geiser-repl-prompt-read-only t) - (setq geiser-repl-highlight-error-messages t) - (setq geiser-active-implementations '(racket guile)) - (setq geiser-default-implementation 'guile) - :hook (scheme-mode . geiser-mode))) - -;; (use-package racket-mode -;; :mode "\\.rkt\\'") - -;; (use-package geiser-racket -;; :defer t -;; :after geiser -;; :config -;; (when (eq system-type 'windows-nt) -;; (setq geiser-racket-binary "c:/Program Files/Racket/Racket.exe"))) - -(when (eq system-type 'gnu/linux) - (use-package geiser-guile - :defer t - :after geiser - :custom (geiser-guile-binary "guile"))) - -;; (use-package ac-slime -;; :after (slime auto-complete) -;; :config -;; (add-hook 'slime-mode-hook 'set-up-slime-ac) -;; (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)) - -(use-package paredit - :hook ((emacs-lisp-mode . paredit-mode) - (eval-expression-minibuffer-setup . paredit-mode) - (ielm-mode . paredit-mode) - (lisp-mode . paredit-mode) - (lisp-interaction-mode . paredit-mode) - (scheme-mode . paredit-mode)) - :bind (:map paredit-mode-map - ("M-s" . nil) - ("C-M-s" . paredit-splice-sexp))) diff --git a/bundle/bundle--mk.el b/bundle/bundle--mk.el deleted file mode 100644 index 3ccaf0bf..00000000 --- a/bundle/bundle--mk.el +++ /dev/null @@ -1,226 +0,0 @@ -(defvar mk/useful-websites - '(("https://regexr.com/" regex debug) - ("https://regex101.com/" regex debug) - ("https://www.regextester.com/" regex debug) - ("https://extendsclass.com/regex-tester.html#python" regex debug) - ("https://everything.curl.dev/" curl tool))) - -(defvar mk/mirror-website - "Locally mirror a website using `wget -mkEpnp `") - -(defvar mk/useful-regex - '(("match any word or space that precedes the :" . "[\\w\\s]+:") - ("search for anything in square brackets" . "\\[.*\\]") - ("upper and lowercase English alphabet" . "[A-Za-z]+") - ("numbers from 0 to 9" . "[0-9]") - ("upper and lowercase English alphabet, - and ." . "[A-Za-z\\-\\.]+") - ("a, - and z" . "(a-z)") - ("spaces or a comma" . "(\\s+|,)") - ("find hashtags" . "#\\w+") - ("matches both mentions (@) and hashtags" . "([@|#]\\w+)") - ("email regex" . "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$") - ("matching decimal numbers" . "-?\\d+(\\.\\d*)?") - ("matching urls" . "(?:http|https|ftp|mailto|file|data|irc):\\/\\/[A-Za-z0-9\\-]{0,63}(\\.[A-Za-z0-9\\-]{0,63})+(:\\d{1,4})?\\/*(\\/*[A-Za-z0-9\\-._]+\\/*)*(\\?.*)?(#.*)?") - ("matching dates yyyy/mm/dd" . "^\\d{4}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$") - ("matching dates mm/dd/yyyy" . "^(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/\\d{4}$") - ("matching dates dd/mm/yyyy" . "^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\\d{4}$") - ("matching HTML" . "<.+>") - ("matching specific tags" . "") - ("ISO 8601 Date Format (YYYY-MM-DD)" . "\\([0-9]{4}\\)-\\([0-1][0-9]\\)-\\([0-3][0-9]\\)"))) - -;; (defun mk-show-modeline () -;; (interactive) -;; (setq mode-line-format -;; '(("-" mode-line-mule-info -;; mode-line-modified -;; mode-line-frame-identification -;; mode-line-buffer-identification " " -;; mode-line-position -;; mode-line-modes -;; (which-func-mode -;; ("" which-func-format "--")) -;; (global-mode-string -;; ("--" global-mode-string)) "-%-"))) -;; (defvar mode-line-format-current -;; (symbol-value 'mode-line-format))) - -;; (defun mk-hide-modeline () -;; (interactive) -;; (setq mode-line-format nil)) - -;; (defun mk-write-mode-enable () -;; (setq olivetti-body-width 73) -;; (olivetti-mode) -;; (mk-hide-modeline)) - -;; (defun mk-write-mode-disable () -;; (olivetti-mode) -;; (mk-show-modeline)) - -(defun mk/split-windows-horizontal (count-windows) - "Split windows horizontal by equal width." - (interactive "nHow many splits? ") - (delete-other-windows) - (let ((width (/ (window-total-width) count-windows))) - (dotimes (i (1- count-windows)) - (split-window-right (- width))))) - -(defun mk/split-windows-vertical (count-windows) - "Split windows vertical by equal width." - (interactive "nHow many splits? ") - (delete-other-windows) - (let ((height (/ (window-total-height) count-windows))) - (dotimes (i (1- count-windows)) - (split-window-below (- height))))) - -(defun mk/split-h3 () - (interactive) - (mk/split-windows-horizontal 3)) - -(defun mk/split-v3 () - (interactive) - (mk/split-windows-vertical 3)) - -;; Set transparency of emacs -(defun transparency (value) - "Sets the transparency of the frame window. 0=transparent/100=opaque" - (interactive "nTransparency Value 0 - 100 opaque: ") - (set-frame-parameter (selected-frame) 'alpha value)) - -(defun mk/show-agenda-list () - (if (display-graphic-p) - (add-hook 'after-init-hook (lambda () (org-agenda-list) (me/split-h3))) - (org-agenda-list))) - -(defun mk/list-files (folder suffix) - (let ((regexp (concat "\\." suffix "$"))) - (directory-files folder nil regexp))) - -(defun mk/build-file-suffix ()) - -(defun mk/copy-files (src-dir dst-dir suffix) - (let ((src-files '()) - (src-dir (expand-file-name src-dir)) - (dst-dir (expand-file-name dst-dir))) - (dolist (file (mk/list-files src-dir suffix) src-files) - (let ((src-file (expand-file-name (concat src-dir "/" file))) - (dst-file (expand-file-name (concat dst-dir "/" file)))) - (add-to-list 'src-files src-file) - (copy-file src-file dst-file t))))) - -(defun mk/delete-files (lst) - (dolist (file lst) - (delete-file file t))) - - -;; (defun shr-insert (text) -;; (when (and (not (bolp)) -;; (get-text-property (1- (point)) 'image-url)) -;; (insert "\n")) -;; (cond -;; ((eq shr-folding-mode 'none) -;; (let ((start (point))) -;; (insert text) -;; (save-restriction -;; (narrow-to-region start (point)) -;; (shr--translate-insertion-chars) -;; (goto-char (point-max))))) -;; (t -;; (let ((font-start (point))) -;; (when (and (string-match "\\`[ \t\n\r]" text) -;; (not (bolp)) -;; (not (eq (char-after (1- (point))) ? ))) -;; (insert " ")) -;; (let ((start (point)) -;; (bolp (bolp))) -;; (insert text) -;; (save-restriction -;; (narrow-to-region start (point)) -;; (goto-char start) -;; (when (looking-at "[\t\n\r]+") -;; (replace-match "" t t)) -;; (while (re-search-forward "[\t\n\r]+" nil t) -;; (replace-match " " t t)) -;; (goto-char start) -;; (while (re-search-forward " +" nil t) -;; (replace-match " " t t)) -;; (shr--translate-insertion-chars) -;; (goto-char (point-max))) -;; ;; We may have removed everything we inserted if it was just -;; ;; spaces. -;; (unless (= font-start (point)) -;; ;; Mark all lines that should possibly be folded afterwards. -;; (when bolp -;; (shr-mark-fill start)) -;; (when shr-use-fonts -;; (put-text-property font-start (point) -;; 'face -;; (or shr-current-font 'variable-pitch))))))))) - -(defun mk/get-current-time-formatted () - (concat "#+DATE: " - (format "[%s]" (format-time-string "%Y-%m-%d %R" (current-time))))) - -(defun mk/generate-unique-id () - (interactive) - (let ((random-number-1 (random 9999)) - (random-number-2 (random 9999))) - (let ((unique-id (format "DE-%04d-%04d" random-number-1 random-number-2))) - (message "ID: %s" unique-id) unique-id))) - -(defmacro mk/open-html-page (name path buffer-name) - "Make interactive functions to call important docs" - `(defun ,name () - (interactive) - (eww (concat "file://" - (and (eq system-type 'windows-nt) - "/") - (expand-file-name ,path))) - (rename-buffer ,buffer-name))) - -(mk/open-html-page mk/clsite-clm - "~/cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node1.html" - "*mk/clsite-clm*") -(mk/open-html-page mk/clsite-pcl - "~/cl-sites/gigamonkeys.com/book/index.html" - "*mk/clsite-pcl*") -(mk/open-html-page mk/clsite-clcb - "~/cl-sites/lispcookbook.github.io/cl-cookbook/index.html" - "*mk/clsite-clcb*") -(mk/open-html-page mk/clsite-sqlite - "~/cl-sites/sqlite-doc-3440000/index.html" - "*mk/clsite-sqlite*") -(mk/open-html-page mk/clsite-asdf - "~/cl-sites/asdf.common-lisp.dev/index.html" - "*mk/clsite-asdf*") -(mk/open-html-page mk/clsite-lisp-docs - "~/cl-sites/lisp-docs.github.io/index.html" - "*mk/clsite-lisp-docs*") -(mk/open-html-page mk/clsite-bgnet - "~/cl-sites/bgnet/index.html" - "*mk/clsite-bgnet*") -(mk/open-html-page mk/clsite-tbnl - "~/cl-sites/edicl.github.io/hunchentoot/index.html" - "*mk/clsite-tbnl*") - -(defun mk/wget-mirror-site (url) - "Use wget to mirror a website for offline use. Takes a URL as argument." - (interactive "sEnter the URL to mirror: ") - (let ((cmd (format "wget --mirror --convert-links --adjust-extension --page-requisites --no-parent %s" url))) - (async-shell-command cmd))) - -(defun mk/get-auth-source-key (host key) - "Retrieve the API key using 'auth-source'." - (require 'auth-source) - (let* ((auth-source-creation-prompts - '((secret . (format "API key for %s@%s: " key host)))) - (found (nth 0 (auth-source-search - :max 1 - :host host - :user key - :require '(:secret) - :create t))) - (secret (plist-get found :secret))) - (if (functionp secret) - (funcall secret) - secret))) diff --git a/bundle/bundle--news.el b/bundle/bundle--news.el deleted file mode 100644 index bdd42655..00000000 --- a/bundle/bundle--news.el +++ /dev/null @@ -1,98 +0,0 @@ -(use-package elfeed - :bind ("C-x w" . elfeed) - :init - (setq elfeed-feeds - '(("https://netzpolitik.org/feed/" netz politik news) - ("https://www.marcuskammer.dev/weblog/index.xml" personal) - ("https://www.guyrutenberg.com/feed/" linux blog) - ("https://blog.mozilla.org/en/feed/" browser web) - ("https://blog.chromium.org/feeds/posts/default" browser web) - ("https://hacks.mozilla.org/feed/" browser web) - ("https://mailbox.org/share/feed-de-mailbox.xml" email mailbox web) - ("https://feeds.feedburner.com/GoogleWebFonts" fonts blog google) - ("https://twobithistory.org/feed.xml" history blog coding) - ("https://blog.getbootstrap.com/feed.xml" web bootstrap blog) - ("https://blog.mozilla.org/en/feed/" web firefox blog) - ("https://fsfe.org/news/news.de.rss" fsfe news free-software) - ("https://planet.lisp.org/rss20.xml" planet lisp) - ("https://emacsconf.org/index.atom" emacs lisp conference) - ("https://jameshunt.us/feeds/main" lisp blog) - ("https://xenodium.com/rss.xml" emacs blog) - ("https://stevelosh.com/rss.xml" lisp blog personal) - ("https://planet.lisp.org/rss20.xml" lisp blogs) - ("https://m-x-erlangen.gitlab.io/atom.xml" lisp meetup) - ("https://takeonrules.com/index.atom" lisp emacs blog) - ("https://emacsredux.com/atom.xml" emacs blog) - ("https://planet.emacslife.com/atom.xml" emacs) - ("https://yiming.dev/rss.xml" coding emacs lisp blog) - ("https://endlessparentheses.com/atom.xml" emacs elisp blog) - ("https://www.philnewton.net/blog/feed/" emacs blog) - ("https://emacsredux.com/atom.xml" emacs blog) - ("https://marcus3santos.github.io/index.xml" emacs blog) - ("https://olddeuteronomy.github.io/index.xml" emacs blog) - ("https://www.colinmclear.net/posts/index.xml" research emacs blog) - ("https://howardism.org/index.xml" emacs blog) - ("https://www.timmons.dev/rss.xml" lisp blog) - ("https://batsov.com/atom.xml" lisp emacs blog) - ("https://notes.eatonphil.com/rss.xml" lisp emacs blog) - ("https://stackoverflow.com/feeds/tag?tagnames=hunchentoot&sort=newest" lisp stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=common-lisp&sort=newest" lisp stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=elisp&sort=newest" lisp emacs stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=org-mode&sort=newest" emacs orgmode stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=xmpp&sort=newest" xmpp stackoverflow) - ;("https://stackoverflow.com/feeds/tag?tagnames=postgresql&sort=newest" sql stackoverflow) - ;("https://stackoverflow.com/feeds/tag?tagnames=mariadb&sort=newest" sql stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=guile&sort=newest" guile scheme lisp stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=sbcl&sort=newest" sbcl lisp stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=sbcl+emacs&sort=newest" sbcl emacs lisp stackoverflow) - ("https://stackoverflow.com/feeds/tag?tagnames=sbcl+common-lisp+linux&sort=newest" sbcl lisp linux stackoverflow) - ("https://sourceforge.net/p/sbcl/activity/feed" lisp sbcl) - ("https://fukamachi.hashnode.dev/rss.xml" lisp blog) - ("https://sourceforge.net/projects/sbcl/rss?path=/sbcl" lisp sbcl sourceforge) - ("https://threatpost.com/feed/" security) - ("https://krebsonsecurity.com/feed/" security blog) - ("https://www.schneier.com/feed/atom/" security blog) - ("https://userlutions.com/feed/" ux usability blog) - ("https://www.nngroup.com/feed/rss/" ux design) - ("https://feedpress.me/UXmatters" ux design) - ("https://uxmovement.com/feed" ux design) - ("https://www.uxbeginner.com/feed/" ux design) - ("https://jeffgothelf.com/feed/" lean ux design blog) - ("https://uxwritinghub.com/feed/" ux writing blog) - ("https://www.w3.org/WAI/feed.xml" ux wai aria w3c) - ("https://measuringu.com/feed/" ux blog) - ("https://ux.stackexchange.com/feeds" ux stackexchange) - ("https://emacs.stackexchange.com/feeds" emacs stackexchange) - ("https://www.mdr.de/nachrichten/podcast/general/russland-angriff-krieg-ukraine100-podcast.xml" krieg ukraine podcast) - ("https://www.deutschlandfunk.de/umwelt-und-verbraucher-100.rss" umwelt verbraucher klima podcast) - ("https://jung-naiv.podigee.io/feed/mp3" politik podcast) - ("https://www.ndr.de/nachrichten/info/podcast4696.xml" podcast umwelt klima) - ("https://ct-uplink.podigee.io/feed/mp3" podcast technik computer) - ("https://feeds.soundcloud.com/users/soundcloud:users:261098918/sounds.rss" podcast osint) - ("https://hacks.mozilla.org/feed/" blog firefox web) - ("https://karthinks.com/index.xml" blog emacs) - ("https://www.destatis.de/SiteGlobals/Functions/RSSFeed/DE/RSSNewsfeed/Aktuell.xml" destatis aktuelles presse) - ("http://www.umweltbundesamt.de/rss/presse" uba aktuelles presse) - ("https://www.test.de/rss/geldanlage-banken/" test geld finanzen) - ("https://www.test.de/rss/steuern-recht/" test steuern recht) - ("https://thefetishistas.com/feed/" latex fetish news) - ("https://tonsky.me/atom.xml" blog computer) - ("https://www.copernicus.eu/news/rss" klima) - ("https://gegenblende.dgb.de/@@rss?count=10&feed=b3b8f76e-53f1-11e6-a380-525400e5a74a" arbeit gewerkschaft news) - ("https://drewdevault.com/blog/index.xml" blog programming computer) - ("https://www.inverse.com/rss" culture magazin journalism) - ("https://inkppl.com/en/rss.xml" tattoo magazin people culture) - ("https://novaramedia.com/feed/" politics capitalism climate left media) - ("https://www.youtube.com/feeds/videos.xml?channel_id=UCN29LJGZ8FY30ysxdTnDsaw" youtube video) - ("https://www.youtube.com/feeds/videos.xml?channel_id=UC5Ghe5TBQGYIOANuiNW4hDQ" youtube video) - ("https://www.youtube.com/feeds/videos.xml?channel_id=UC0p5jTq6Xx_DosDFxVXnWaQ" youtube video) - ("https://www.youtube.com/feeds/videos.xml?channel_id=UC0p5jTq6Xx_DosDFxVXnWaQ" youtube video) - ("https://www.vag.de/rss/meldungen" ubahn opnv vag) - ("https://feeds.feedblitz.com/sethsblog" management author blog) - ("https://ourworldindata.org/atom-data-insights.xml" data world) - ("https://ourworldindata.org/atom.xml" data world) - )) - (setq elfeed-search-filter "@7-day-ago +unread") - (let ((feeds (expand-file-name "~/feeds.el"))) - (when (file-exists-p feeds) - (load-file feeds)))) diff --git a/bundle/bundle--org.el b/bundle/bundle--org.el deleted file mode 100644 index b14c8907..00000000 --- a/bundle/bundle--org.el +++ /dev/null @@ -1,560 +0,0 @@ -(use-package org - :ensure nil - :hook ((org-mode . turn-on-auto-fill)) - :init (org-clock-persistence-insinuate) - :bind - (("C-c l" . org-store-link) - ("C-c a" . org-agenda) - ("C-c c" . org-capture) - ("C-c b" . org-switchb)) - :init - (org-babel-lob-ingest "~/.emacs.d/library-of-babel.org") - (setq org-capture-templates '()) - :custom - (abbrev-suggest t) - (org-hide-block-startup t) - (org-hide-emphasis-markers nil) - (org-default-notes-file "notes.org") - (org-insert-mode-line-in-empty-file t) - (org-adapt-indentation nil) - (org-agenda-prefix-format - '((agenda . " %i %-12:c%?-12t%-6e% s") - (todo . " %i %-12:c %-6e") - (tags . " %i %-12:c") - (search . " %i %-12:c"))) - (org-agenda-dim-blocked-tasks nil) - (org-agenda-inhibit-startup nil) - (org-agenda-span 14) - (org-agenda-start-on-weekday 1) - (org-agenda-include-diary t) - (org-clock-out-remove-zero-time-clocks t) - (org-clock-persist t) - (org-clock-rounding-minutes 30) - (org-confirm-babel-evaluate nil) - (org-duration-format (quote h:mm)) - (org-export-dispatch-use-expert-ui nil) - (org-export-default-language "en") - (org-export-with-smart-quotes t) - (org-export-with-emphasize t) - (org-export-with-special-strings t) - (org-export-with-fixed-width t) - (org-export-with-timestamps nil) - (org-export-preserve-breaks nil) - (org-export-with-sub-superscripts nil) - (org-export-with-archived-trees nil) - (org-export-with-author t) - (org-export-with-broken-links t) - (org-export-with-clocks nil) - (org-export-with-creator nil) - (org-export-with-drawers nil) - (org-export-with-date t) - (org-export-with-entities t) - (org-export-with-email t) - (org-export-with-footnotes t) - (org-export-headline-levels 3) - (org-export-with-inlinetasks nil) - (org-export-with-section-numbers t) - (org-export-with-planning nil) - (org-export-with-priority nil) - (org-export-with-properties nil) - (org-export-with-statistics-cookies nil) - (org-export-with-tags nil) - (org-export-with-tasks nil) - (org-export-with-latex t) - (org-export-time-stamp-file nil) - (org-export-with-title t) - (org-export-with-toc t) - (org-export-with-todo-keywords nil) - (org-export-with-tables t) - (org-export-date-timestamp-format "%a, %d %b %Y %R %z") - (org-export-backends '(ascii html latex md odt texinfo)) - (org-global-properties '(("EFFORT_ALL" . "0:30 1:00 2:00 3:00 5:00 8:00"))) - (org-html-doctype "html5") - (org-html-html5-fancy t) - (org-log-done (quote time)) - (org-refile-targets '((nil :maxlevel . 3))) - (org-startup-folded t) - (org-startup-truncated nil) - (org-src-fontify-natively t) - (org-src-tab-acts-natively t) - (org-src-window-setup 'other-window) - (org-time-stamp-rounding-minutes '(30 30)) - (org-todo-keywords - '((sequence "TODO" "DOING(!)" "DONE(!)") - (sequence "RECRUIT" "INTERVIEW" "QDA" "DOC" "REVIEW"))) - (org-use-property-inheritance nil) - (org-attach-store-link-p 'attached) - (org-agenda-custom-commands - '(("p" "Projects" - ((tags "PROJECT"))))) - (org-latex-packages-alist - '(("" "listings") - ("" "booktabs") - ("AUTO" "polyglossia" t ("xelatex" "lualatex")) - ("" "grffile") - ("" "unicode-math") - ("" "xcolor") - ("expansion,protrusion=true" "microtype"))) - ;; Define the process to convert Org to PDF using XeLaTeX - (org-latex-pdf-process '("latexmk -lualatex -shell-escape -quiet -f %f")) - ;; Set the compiler to XeLaTeX - (org-latex-compiler "lualatex") - (org-latex-tables-booktabs t) - (org-latex-images-centered t) - ;; Enable listings and other table-related features - (org-latex-listings t) - ;; Customize the appearance of listings (source code blocks) - (org-latex-listings-options - '(("basicstyle" "\\ttfamily\\color[rgb]{0.30, 0.34, 0.42}") ; nord3 - ("showstringspaces" "false") - ("keywordstyle" "\\color[rgb]{0.23, 0.26, 0.32}\\textbf") ; nord1 - ("commentstyle" "\\color[rgb]{0.26, 0.30, 0.37}") ; nord2 - ("stringstyle" "\\color[rgb]{0.18, 0.20, 0.25}") ; nord0 - ("frame" "single") - ("numbers" "left") - ("numbersep" "5pt") - ("numberstyle" "\\ttfamily\\color[rgb]{0.30, 0.34, 0.42}") ; nord3 - ("keepspaces" "true") - ("showspaces" "false") - ("showstringspaces" "false") - ("showtabs" "false") - ("breaklines" "true") - ("breakatwhitespace" "false") - ("tabsize" "2") - ("columns" "fullflexible"))) - (org-latex-inputenc-alist '((\"utf8\" . \"utf8x\"))) - :config - (if (eq system-type 'windows-nt) - (setq org-babel-python-command "python") - (setq org-babel-python-command "python3")) - (setq time-stamp-active t - time-stamp-start "#\\+[dD][aA][tT][eE]: [\t]*" - time-stamp-end "$" - time-stamp-inserts t - time-stamp-format "[%Y-%m-%d %H:%M]") - (add-hook 'before-save-hook 'time-stamp nil) - ;; (when (eq system-type 'windows-nt) - ;; (setq org-babel-sqlite3-command "c:/msys64/ucrt64/bin/sqlite3.exe")) - (org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (lisp . t) - (gnuplot . t) - (python . t) - (sqlite . t) - (shell . t) - (plantuml . t) - (C . t) - (js . t) - (scheme . t))) - ;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks. - (defun org-agenda-log-mode-colorize-block () - "Set different line spacing based on clock time duration." - (save-excursion - (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters)) - ('light (list "#d8dee9" "#e5e9f0" "#eceff4")) - ('dark (list "#bf616a" "#d08770" "#ebcb8b" "#a3be8c" "#b48ead")))) - pos - duration) - (nconc colors colors) - (goto-char (point-min)) - (while (setq pos (next-single-property-change (point) 'duration)) - (goto-char pos) - (when (and (not (equal pos (point-at-eol))) - (setq duration (org-get-at-bol 'duration))) - ;; larger duration bar height - (let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30)))) - (ov (make-overlay (point-at-bol) (1+ (point-at-eol))))) - (overlay-put ov 'face `(:background ,(car colors) :foreground "black")) - (setq colors (cdr colors)) - (overlay-put ov 'line-height line-height) - (overlay-put ov 'line-spacing (1- line-height)))))))) - (add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block)) - -;; Define custom LaTeX class with specific formatting -(with-eval-after-load 'ox-latex - (add-to-list 'org-latex-classes - '("koma-general" - "\\documentclass[a4paper,10pt,captions=tableheading,twoside=false]{scrartcl} -\\linespread{1.25} -% ~/.emacs.d/texmf/tex/latex/mycustomstyles/ -\\usepackage{komageneral}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) - - (setq org-latex-default-class "koma-general")) - -(setq org-html-protect-char-alist - '(("&" . "&") - ("<" . "<") - (">" . ">") - (":lambda:" . "λ") - (":python:" . "🐍") - (":whale:" . "🐳") - (":turtle:" . "🐢") - (":dash:" . "💨") - (":party:" . "🥳") - (":see-no-evil:" . "🙈") - (":cloud:" . "☁️") - (":abacus:" . "🧮") - (":desktop:" . "🖥️") - (":rocket:" . "🚀") - (":unicorn:" . "🦄") - (":recycling:" . "♻") - (":crystalball:" . "🔮") - (":photography:" . "📷") - (":money:" . "💵") - (":-)" . "😊") - (":-(" . "😞"))) - -(defun mk/link-to-current-task () - "Return an Org link to the current clocked-in task, if any, or prompt for manual entry." - (if (org-clock-is-active) - (with-current-buffer (marker-buffer org-clock-marker) - (save-excursion - (goto-char org-clock-marker) - (format ":TASK_ID: [[id:%s][%s]]" (org-id-get) (org-get-heading t t)))) - (let ((manual-id (read-string "Enter Task ID (leave empty if not applicable): "))) - (unless (string-empty-p manual-id) - (format ":TASK_ID: [[id:%s][Task]]\n" manual-id))))) - -;; Note Capture Template -;; Purpose: To capture general notes. These notes can optionally be linked to a currently clocked-in task. -;; Fields: Heading, optional task link, initial content, and a timestamp. -(add-to-list 'org-capture-templates - `("n" "Note" entry (file "notes.org") - ,(concat "* %? :NOTE:\n" - ":PROPERTIES:\n" - ":ID: %(org-id-new)\n" - "%(mk/link-to-current-task)" - ":END:\n" - "Entered on: %U\n"))) - -;; Task Capture Template -;; Purpose: To capture tasks and automatically assign a unique ID to each task. -;; Fields: Heading, unique ID, timestamp, and link to where the capture was made. -(add-to-list 'org-capture-templates - `("t" "Task" entry (file "agenda/tasks.org") - ,(format "* TODO %%? :TASK:\n:PROPERTIES:\n:ID: %s\n:Project: %%^{Project}\n:END:\nEntered on %%U\n" (org-id-new)))) - -;; Journal Capture Template -;; Purpose: To capture end-of-day reflections. -;; Fields: Heading, timestamp, and prompts for what went well, what could be improved, and focus for tomorrow. -(add-to-list 'org-capture-templates - '("j" "Journal" entry (file+olp+datetree "agenda/journal.org") - "* %T - End of Day Reflection :JOURNAL:\n- Was ist heute gut gelaufen?\n %?\n- Was könnte verbessert werden?\n \n- Worauf konzentriere ich mich morgen?\n " - :empty-lines 1)) - -;; Appointment Capture Template -;; Purpose: To capture important events and appointments. -;; Fields: Heading, timestamp. -(add-to-list 'org-capture-templates - '("a" "Appointment" entry (file "agenda/appt.org") - "* %? \n%^{Date}t\n")) - -;; Meeting Capture Template -;; Purpose: To capture meeting notes and automatically start a clock for time tracking. -;; Fields: Topic, timestamp, and additional notes. -(add-to-list 'org-capture-templates - '("m" "Meeting" entry (file "agenda/meetings.org") - "* %^{Topic} \n%T\n%?" - :clock-in t - :empty-lines 1)) - -;; Log Capture Template -;; Purpose: To capture activities in a chronological order and automatically start a clock for time tracking. -;; Fields: Timestamp, activity description. -(add-to-list 'org-capture-templates - '("l" "Log" entry (file+olp+datetree "logbook.org") - "* %T - %^{Activity} :LOG:\n%?" - :clock-in t - :empty-lines 1)) - -;; UTM Parameters Capture Template -;; Purpose: To capture UTM parameters for marketing tracking. -;; Fields: Campaign name, source, medium, term, and content. -(add-to-list 'org-capture-templates - '("u" "UTM Parameters" entry (file+headline "utm.org" "UTM Parameters") - "* %^{Campaign Name}\n:PROPERTIES:\n:Source: %^{utm_source}\n:Medium: %^{utm_medium}\n:Term: %^{utm_term}\n:Content: %^{utm_content}\n:END:\n")) - -;; Bookmark Capture Template -;; Purpose: To capture bookmarks with tags and a timestamp. -;; Fields: URL, tags, timestamp. -(add-to-list 'org-capture-templates - '("b" "Bookmark" table-line (file+headline "bookmarks.org" "Bookmarks") - "| %^{URL} | %^{Tags} | %u |" :prepend t)) - -;; Code Snippet Capture Template -;; Purpose: To capture code snippets and specify the programming language. -;; Fields: Code snippet, language specification. -(add-to-list 'org-capture-templates - '("c" "Code Snippet" entry (file+headline "code.org" "Snippets") - "* %?\n#+begin_src %^{language}\n%i\n#+end_src")) - -;; Capture Templates for Interviews -;; -;; The following capture templates are designed to facilitate the collection -;; of questions and insights for user interviews. Given the importance of -;; user-centered design in experience architecture, these templates aim to -;; streamline the preparation process for interviews. - -;; Interview Sub-menu -;; -;; This entry serves as a sub-menu for all interview-related capture templates. -(add-to-list 'org-capture-templates - '("i" "Interviews")) - -;; How Might We (HMW) Template -;; -;; This template is designed to capture "How Might We" questions that are often -;; used to frame problems and opportunities in user interviews. These questions -;; can be crucial for guiding the interview in a direction that yields -;; actionable insights. -(add-to-list 'org-capture-templates - '("ih" "How Might We" entry (file+headline "interviews.org" "HMW Questions") - "* WKW/HMW %? :HMW:\n%U\n:PROPERTIES:\n:Interviewee: %^{Interviewee}\n:Context: %^{Context}\n:END:")) - -;; Interview Question Template -;; -;; Use this template to quickly capture questions that you intend to ask during -;; user interviews. The template prompts for the topic of the interview and -;; the project it is associated with, allowing for easy categorization and -;; retrieval later. -(add-to-list 'org-capture-templates - '("iq" "Interview Question" entry (file+headline "interviews.org" "Interview Questions") - "* %^{Interview Topic} :INTERVIEW:\n:PROPERTIES:\n:Project: %^{Project Name}\n:Date: %T\n:END:\n- %?\n")) - -;; User Interview Quotes Capture Template -;; Purpose: To capture important quotes from user interviews. -;; Fields: Quote, Interviewee, Timestamp in Video, Project, Context -(add-to-list 'org-capture-templates - '("io" "Quote from User Interview" entry (file+headline "interviews.org" "Quotes") - "* %^{Quote} :QUOTE:\n:PROPERTIES:\n:Interviewee: %^{Interviewee}\n:Timestamp: %^{Timestamp in Video}\n:Project: %^{Project}\n:Context: %^{Context}\n:END:\n")) - -;; Capture Templates for Project Management and Achievements -;; -;; These templates are designed to facilitate the tracking of project details -;; and individual achievements. Given the focus on agile methodologies and -;; continuous improvement, these templates aim to provide a structured way -;; to capture essential information. - -;; Project Template -;; -;; This template captures the essential details of a new project. It prompts -;; for the project name, start date, and end date, and provides sections for -;; outlining the project's objectives and challenges. Each project is assigned -;; a unique ID for easy referencing. -(add-to-list 'org-capture-templates - `("p" "Project" entry (file "agenda/projects.org") - ,(format "* %%^{Project Name} :PROJECT:\n:PROPERTIES:\n:ID: %s\n:Start Date: %%T\n:End Date: %%^{End Date}\n:END:\n** Objective\n%%?\n** Challenges\n- [ ] %%^{Challenge 1}\n- [ ] %%^{Challenge 2}\n" (org-id-new)))) - -;; Achievement Template -;; -;; This template is designed to capture individual achievements. It prompts for -;; the title of the achievement, the project it is associated with, and the date. -;; Additionally, it provides fields for describing the achievement, its impact, -;; and any associated tasks. This can be particularly useful for end-of-year -;; reviews or for maintaining a portfolio of accomplishments. -(add-to-list 'org-capture-templates - `("v" "Achievement" entry (file+olp+datetree "achievements.org") - ,(concat "* %^{Achievement Title} :ACHIEVEMENT:\n" - ":PROPERTIES:\n" - ":Project: %^{Project}\n" - ":Date: %T\n" - ":END:\n" - "- Description: %?\n" - "- Impact: %^{Impact}\n" - "- Associated Tasks: %^{Tasks}\n"))) - -(add-to-list 'org-capture-templates - '("A" "Accounting")) - -;; Expense Tracking -;; Purpose: To capture individual expenses for accounting in a table. -;; Fields: Amount, Category, Note, Date -(add-to-list 'org-capture-templates - '("Ae" "Expense" table-line (file+headline "accounting.org" "Expenses") - "| %U | %^{Amount} | %^{Category} | %? |")) - -;; Income Tracking -;; Purpose: To capture instances of income for accounting in a table. -;; Fields: Amount, Source, Date -(add-to-list 'org-capture-templates - '("Ai" "Income" table-line (file+headline "accounting.org" "Income") - "| %U | %^{Amount} | %^{Source} | %? |")) - -;; Invoice Tracking -;; Purpose: To capture invoices sent for services or products in a table. -;; Fields: Client, Amount, Due Date -(add-to-list 'org-capture-templates - '("AI" "Invoice" table-line (file+headline "accounting.org" "Invoices") - "| %T | %^{Client} | %^{Amount} | %^{Due Date} | %? |")) - -;; Budget Planning -;; Purpose: To capture budget plans for personal or business accounting in a table. -;; Fields: Estimated Income, Estimated Expenses -(add-to-list 'org-capture-templates - `("Ab" "Budget" table-line (file+headline "accounting.org" "Budget") - ,(concat "| " (format-time-string "%Y") " | " (format-time-string "%B") " | %^{Estimated Income} | %^{Estimated Expenses} | %? |"))) - -;; Investment Tracking -;; Purpose: To capture investment details for accounting in a table. -;; Fields: Type, Amount, Notes -(add-to-list 'org-capture-templates - '("Av" "Investment" table-line (file+headline "accounting.org" "Investments") - "| %U | %^{Type} | %^{Amount} | %? |")) - -;; Stock Recommendation Capture Template -;; Purpose: To capture stock recommendations for potential investment. -;; Fields: Stock Symbol, Recommender, Notes, Date -(add-to-list 'org-capture-templates - '("s" "Stock Recommendation" entry (file+headline "stocks.org" "Stock Recommendations") - "* %^{Stock Name} :STOCK:\n:PROPERTIES:\n:Date: %T\n:WKN: %^{WKN}\n:ISIN: %^{ISIN}\n:END:\n%?")) - -(add-to-list 'org-capture-templates - '("B" "Bücherliste" table-line - (file+headline "books.org" "Meine Bücherliste") - "| %^{Buchtitel} | %^{Autor} | %^{Status||Geplant|In Bearbeitung|Fertig} | %U |" :kill-buffer t)) - -(require 'request) - -(defun fetch-gitlab-issue-and-capture () - (interactive) - (let ((project-id (read-string "Enter GitLab Project ID: ")) - (issue-id (read-string "Enter GitLab Issue ID: ")) - (gitlab-token (getenv "GITLAB_TOKEN"))) - (unless gitlab-token - (error "GITLAB_TOKEN environment variable not set")) - (request - (format "https://code.siemens.com/api/v4/projects/%s/issues/%s" project-id issue-id) - :headers `(("Private-Token" . ,gitlab-token)) - :parser 'json-read - :success (cl-function - (lambda (&key data &allow-other-keys) - (org-capture nil "g") - (let ((title (assoc-default 'title data)) - (description (assoc-default 'description data))) - (insert (format "%s\n%s" title description)))))))) - -(add-to-list 'org-capture-templates - '("g" "GitLab Issue" entry (file "gitlab_issues.org") - "* %?")) - -;; (global-set-key (kbd "C-c g") 'fetch-gitlab-issue-and-capture) - -(use-package org-roam - :after org - :init - (setq org-roam-db-autosync-mode t) - (setq org-roam-v2-ack t) - (setq org-roam-db-location "~/org-roam.db") - (require 'org-roam-dailies) - :bind (("C-c r l" . org-roam-buffer-toggle) - ("C-c r f" . org-roam-node-find) - ("C-c r g" . org-roam-graph) - ("C-c r i" . org-roam-node-insert) - ("C-c r c" . org-roam-capture) - ("C-c r j" . org-roam-dailies-map) - :map org-roam-dailies-map - ("t" . org-roam-dailies-capture-today) - ("y" . org-roam-dailies-capture-yesterday) - ("T" . org-roam-dailies-capture-tomorrow) - :map org-mode-map - ("C-M-i" . completion-at-point)) - :custom - (org-roam-completion-everywhere nil) - (org-roam-dailies-capture-templates - '(("d" "default" entry "* %<%R> %?" - :if-new (file+head "%<%F>.org" "#+title: %<%F>\n")))) - (org-roam-capture-templates - '(("d" "default" plain - "%?" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") - :unnarrowed t) - ("r" "Research" plain - "* Hypothesis:\n%?\n* Methodology:\n* Results:\n* Conclusions:\n" - :if-new (file+head "research/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") - :unnarrowed t) - ("m" "Meeting" plain - "* Participants:\n%?\n* Discussion topics:\n* Action points:\n" - :if-new (file+head "meetings/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") - :unnarrowed t) - ("p" "Project" plain - "* Goals:\n%?\n* Milestones:\n* Resources:\n" - :if-new (file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") - :unnarrowed t) - ("l" "Literature" plain - "* Authors:\n%?\n* Main theses:\n* Own thoughts:\n" - :if-new (file+head "literature/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") - :unnarrowed t)))) - -(use-package org-tree-slide - :bind ("" . org-tree-slide-mode) - :custom - (org-image-actual-width nil)) - -(use-package org-web-tools - :defer t - :custom (org-web-tools-pandoc-sleep-time 0.4)) - -;; (use-package ob-go -;; :after org) - -(use-package ox-reveal - :after org) - -;; (use-package ox-pandoc -;; :after org -;; :custom -;; (org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))) - -;; (defun me/write-readme-md-on-save () -;; ;; when README.org, also write README.md on save -;; (when (string-match "README" (buffer-file-name)) -;; (make-local-variable 'after-save-hook) -;; (add-hook 'after-save-hook -;; (lambda () (let ((outfile (org-export-output-file-name ".md"))) -;; (org-export-to-file 'md outfile)))))) -;; (add-hook 'org-mode-hook 'me/write-readme-md-on-save) - -;; (use-package ob-go -;; :after org -;; :config -;; (append '((go . t)) org-babel-load-languages)) - -(use-package ob-http - :after org - :config - (append '((http . t)) org-babel-load-languages)) - -;; (use-package ob-racket -;; :after org -;; :pin manual -;; :config -;; (append '((racket . t) (scribble . t)) org-babel-load-languages)) - -;; (use-package ox-rss -;; :after org) - -;; (use-package ob-restclient -;; :after org -;; :config -;; (append '((restclient . t)) org-babel-load-languages)) - -(defun mk/extract-headlines-by-tag (tag) - "Extract headlines and their content from current buffer by TAG." - (interactive "sEnter tag: ") - (save-excursion - (let ((result-buffer (generate-new-buffer (concat "*Extracted Headlines " tag "*")))) - (with-current-buffer result-buffer - (org-mode) - (insert "* Extracted Headlines by Tag: " tag " *\n\n")) - (org-element-map (org-element-parse-buffer) 'headline - (lambda (headline) - (when (member tag (org-element-property :tags headline)) - (with-current-buffer result-buffer - (insert (org-element-interpret-data headline) "\n"))))) - (pop-to-buffer result-buffer)))) diff --git a/init.el b/init.el index 86d4b4ef..2334a971 100755 --- a/init.el +++ b/init.el @@ -2,19 +2,2490 @@ ;; (or (eq (server-running-p) t) ;; (server-start)) -(let ((bundle-dir (expand-file-name "~/.emacs.d/bundle/"))) - (when (file-directory-p bundle-dir) - (add-to-list 'load-path bundle-dir) - (load "bundle--general") - (load "bundle--gui") - (load "bundle--package") - (load "bundle--lisp") - (load "bundle--irc") - (load "bundle--news") - (load "bundle--calendar") - (load "bundle--email") - (load "bundle--org") - (load "bundle--stats") - (load "bundle--ux") - (load "bundle--mk") - (load "bundle--linux"))) +;; (load "bundle--general") + +(global-hl-line-mode 1) +(display-time-mode 1) +(global-prettify-symbols-mode -1) + +;; (setq display-time-format "W%V %a %d %b %Y %R %z") +(setq display-time-format "W%V %a %d %b %R") +(setq display-time-24hr-format t) + +;; Cursor and mouse +(column-number-mode 1) +(mouse-wheel-mode 1) +(blink-cursor-mode -1) + +(setq grep-command "grep -i -nH -e ") + +(when (eq system-type 'gnu/linux) + (setq shell-file-name "/bin/bash") + (setq tex-shell-file-name "/bin/bash")) + +;; Files and sessions +(setq auto-save-timeout 60) + +;; Tabs, spaces, lines and parenthesis +(show-paren-mode 1) +(setq-default tab-width 4) +(setq-default indent-tabs-mode nil) +(setq-default line-spacing nil) +(setq-default make-backup-files nil) +(setq-default next-line-add-newlines t) + +;; Miscellaneous +(require 'cl-lib) +(setq default-major-mode 'text-mode) +(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) +;;(global-set-key (kbd "M-[") 'tab-bar-history-back) +;;(global-set-key (kbd "M-]") 'tab-bar-history-forward) + +(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) +(setq compilation-ask-about-save nil) +(setq vc-handled-backends '(Git Hg)) ;; Only use Git and Hg for VC + +(setq horizontal-scroll-bar nil) +(setq vertical-scroll-bar nil) + +(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((meta)) ((control) . text-scale))) + +;; SIMPLE +(setq completion-auto-wrap t) +(setq completion-auto-select nil) + +;; MINIBUFFER +(setq completions-format 'one-column) +(setq completions-header-format nil) +(setq completions-max-height 20) + +;; (require 'ido) +;; (setq ido-enable-flex-matching t) +;; (setq ido-everywhere t) +;; (setq ido-create-new-buffer 'always) +;;(setq ido-file-extensions-order '(".org" ".lisp" ".py" ".txt" ".el" ".epub")) +(ido-mode t) +;; (fido-mode 1) ; replace icomplete mode +;; (fido-vertical-mode 1) +;; UTF-8 FTW +(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) +(setq default-buffer-file-coding-system 'utf-8-unix) +(setenv "PYTHONIOENCODING" "UTF-8") + +(when (eq system-type 'gnu/linux) + (setq custom-file "~/.emacs.d/bundle/custom_gnu.el" + browse-url-secondary-browser-function 'browse-url-firefox) + (unless (file-directory-p "~/cl-sites/") + (async-shell-command "git clone git@git.sr.ht:~marcuskammer/cl-sites ~/cl-sites"))) + +(when (eq system-type 'windows-nt) + (setq explicit-shell-file-name + (seq-find 'file-executable-p + '("C:\\Program Files\\PowerShell\\7\\pwsh.exe" + "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"))) + (setq explicit-powershell.exe-args '("-NoProfile" "-InputFormat" "Text")) + (setq custom-file "~/.emacs.d/bundle/custom_win32.el") + + (when (string= system-name "XPS-8930") + (cd "~/") + (setq custom-file "~/.emacs.d/bundle/custom_win32_XPS8930.el")) + + (when (string= system-name "EVG03435NB") + (cd "~/OneDrive - Siemens AG/") + (setq custom-file "~/.emacs.d/bundle/custom_win32_EVG03435NB.el"))) + +(load custom-file :noerror) + +(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/"))) +(package-initialize) +(unless package-archive-contents + (package-refresh-contents)) +(unless (package-installed-p 'use-package) + (package-install 'use-package)) +(require 'use-package) +(setq use-package-always-ensure t) + +(use-package doom-themes + :init + (load-theme 'doom-one t) + :config + (setq doom-themes-enable-bold t + doom-themes-enable-italic t)) + +(tool-bar-mode -1) +(menu-bar-mode -1) +(scroll-bar-mode -1) +(fringe-mode 10) +(horizontal-scroll-bar-mode -1) + +;; (load "bundle--gui") + +(setq-default mode-line-format + '("%e" mode-line-front-space "%b %*%n %I %l:%c %p" (vc-mode vc-mode) " " mode-line-modes mode-line-misc-info mode-line-end-spaces)) + +(unless (memq 'hs-headline mode-line-format) + (setq mode-line-format + (append '(" " hs-headline) mode-line-format))) + +(set-face-attribute 'mode-line nil + :slant 'italic + :weight 'bold + :background (face-attribute 'default :background) + :foreground + (cond ((member 'doom-one custom-enabled-themes) "#5B6268") + ((member 'doom-nord custom-enabled-themes) "#9099AB") + (t (face-attribute 'mode-line-inactive :foreground))) + :box '(:line-width (1 . 8) :style flat-button)) + +(set-face-attribute 'mode-line-inactive nil + :inherit 'mode-line + :weight 'normal + :box '(:line-width (1 . 8) :style flat-button)) + +(use-package tab-bar + :custom + (tab-bar-auto-width nil) + (tab-bar-auto-width-max '(250 25)) + (tab-bar-format '(tab-bar-format-history tab-bar-format-tabs-groups)) + (tab-bar-tab-name-function 'tab-bar-tab-name-truncated) + (tab-bar-close-button-show nil) + (tab-bar-new-button-show nil) + :config + (set-face-attribute 'tab-bar nil + :inherit 'mode-line-inactive + :background (face-attribute 'mode-line-inactive :background)) + + (set-face-attribute 'tab-bar-tab nil + :inherit 'mode-line + :foreground (face-attribute 'mode-line :foreground) + :box '(:line-width 8 :style flat-button)) + + (set-face-attribute 'tab-bar-tab-inactive nil + :inherit 'mode-line-inactive + :box '(:line-width 8 :style flat-button))) + +(setq default-frame-alist + `((font . "MonoLisa-11") + (width . 85) + (height . 50) + (vertical-scroll-bars) + ,@(cond ((eq system-type 'gnu/linux) + '((fullscreen . maximized) + (undecorated . t)))))) + +(setq frame-resize-pixelwise t) + +(defun center-frame (&optional frame) + "Center FRAME on the screen." + (interactive) + (let ((frame (or frame (selected-frame)))) + (let ((frame-width (frame-pixel-width frame)) + (frame-height (frame-pixel-height frame)) + (display-width (display-pixel-width)) + (display-height (display-pixel-height))) + (set-frame-position frame + (/ (- display-width frame-width) 2) + (/ (- display-height frame-height) 2))))) + +(add-hook 'after-make-frame-functions #'center-frame) + +(use-package all-the-icons + :commands all-the-icons-install-fonts + :init + (unless (find-font (font-spec :name "all-the-icons")) + (all-the-icons-install-fonts t))) + +(use-package all-the-icons-dired + :after all-the-icons + :hook (dired-mode . all-the-icons-dired-mode)) + +(use-package emojify + :hook (erc-mode . emojify-mode) + :commands emojify-mode + :config + (when (member "Segoe UI Emoji" (font-family-list)) + ;; https://ianyepan.github.io/posts/emacs-emojis/ + (set-fontset-font t 'symbol (font-spec :family "Segoe UI Emoji") nil 'prepend) + (setq emojify-display-style 'unicode) + (setq emojify-emoji-styles '(unicode)))) + +;; (defun my-vc-info () +;; (when vc-mode +;; (concat (substring vc-mode 5) +;; " [" +;; (substring (vc-working-revision (buffer-file-name)) 0 8) +;; "] "))) + +;; (defun my-project-name () +;; (let ((proj (project-current))) +;; (if proj (file-name-base (directory-file-name (project-root proj))) +;; "NoProject"))) + +;; (setq-default header-line-format +;; (list "-%M" +;; '(:eval (my-project-name)) " " +;; system-name " " user-login-name " " +;; "-%-")) + +;; (setq-default mode-line-format +;; (list "-%b %*%n %I %l:%c %p " +;; '(:eval mode-name) " " +;; '(:eval (my-vc-info)) +;; '(:eval (if mode-line-process (concat ":" mode-line-process " ") "")) +;; 'default-directory +;; "-%-")) + +;; (set-face-attribute 'mode-line nil :weight 'bold) +;; (set-face-attribute 'header-line nil :weight 'bold) + +;; (use-package doom-modeline +;; :hook (after-init . doom-modeline-mode) +;; :custom +;; (doom-modeline-height 30) +;; (doom-modeline-bar-width 4) +;; (doom-modeline-icon nil) +;; (doom-modeline-major-mode-icon nil) +;; (doom-modeline-unicode-fallback nil) +;; (doom-modeline-minor-modes nil) +;; (doom-modeline-buffer-encoding nil) +;; (doom-modeline-battery nil)) + +(use-package helpful + :commands (helpful-callable helpful-variable helpful-command helpful-key) + :bind ([remap describe-command] . helpful-command) ([remap describe-key] . helpful-key)) + +(use-package rainbow-delimiters + :hook (prog-mode . rainbow-delimiters-mode)) + +(use-package olivetti + :custom (olivetti-body-width 83) + :bind ("" . olivetti-mode)) + +(add-hook 'Info-mode-hook + (lambda () + (make-local-variable 'olivetti-body-width) + (setq olivetti-body-width 75) + (olivetti-mode))) + +(use-package ace-window :init (global-set-key (kbd "M-o") 'ace-window)) + +;; (use-package vertico :init (vertico-mode)) + +(use-package webjump + :bind ("C-c j" . webjump) + :custom + (webjump-sites + (append '(("Wikipedia_de" . [simple-query "de.wikipedia.org" "https://de.wikipedia.org/wiki/" ""]) + ("leo.org" . [simple-query "dict.leo.org" "https://dict.leo.org/german-english/" ""])) + webjump-sample-sites))) + +(use-package doc-view + :ensure nil + :custom + (doc-view-dvipdfm-program "mutool") + (doc-view-odf->odf-converter-program "soffice") + (dov-view-odf->pdf-converter-function 'doc-view-odf->pdf-converter-soffice) + (doc-view-pdf->png-converter-function 'doc-view-pdf->png-converter-mupdf) + (doc-view-resolution 300)) + +(use-package yasnippet + :init + (yas-global-mode 1)) + +(use-package hideshow + :hook ((prog-mode . (lambda () (hs-minor-mode 1)))) + :bind (:map prog-mode-map + ("M-" . hs-toggle-hiding)) + :custom + (hs-allow-nesting t)) + +(add-hook 'prog-mode-hook (lambda () (setq line-spacing 4))) + +;; (load "bundle--package") + +(require 'package) + +(defun get-auth-key (host) + "Retrieve the Anthropics API key using 'auth-source'." + (require 'auth-source) + (let* ((auth-source-creation-prompts + '((secret . "API key for %u@%h: "))) + (found (nth 0 (auth-source-search + :max 1 + :host host + :user "apikey" + :require '(:secret) + :create t))) + (secret (plist-get found :secret))) + (if (functionp secret) + (funcall secret) + secret))) + +(use-package htmlize) + +(use-package time + :ensure nil + :config + (setq world-clock-time-format "%a %d %b %R %Z") + (setq world-clock-list + '(("America/Los_Angeles" "Seattle") + ("America/New_York" "New York") + ("Europe/London" "London") + ("Europe/Paris" "Paris") + ("Europe/Sofia" "Sofia") + ("Asia/Calcutta" "Bangalore") + ("Asia/Tokyo" "Tokyo")))) + +(use-package autoinsert + :ensure nil + :init (auto-insert-mode 1) + :config + (setq auto-insert-query nil) + (let ((new-templates + '((("\\.sh\\'" . "Shell script header") nil "#!/bin/bash\n# -*- mode: shell-script; coding: utf-8; -*-\n") + (("\\.js\\'" . "JavaScript header") nil "#!/usr/bin/env node\n// -*- mode: js; coding: utf-8; -*-\n") + (("\\.css\\'" . "CSS header") nil "/* -*- mode: css; coding: utf-8; -*-\n * Dependencies: none\n */\n") + (("\\.html\\'" . "HTML header") nil "\n") + (("\\.lisp\\'" . "Lisp header") nil ";;;; -*- mode: common-lisp; coding: utf-8; -*-\n")))) + (setq auto-insert-alist (nconc new-templates auto-insert-alist)))) + +(use-package tramp + :ensure nil + :config + (when (eq system-type 'windows-nt) + (setq tramp-default-method "sshx"))) + +(use-package shr + :custom + (shr-use-colors nil) + (shr-use-fonts nil) + (shr-inhibit-images t) + (shr-cookie-policy nil) + (shr-width nil)) + +(use-package shrface + :hook ((eww-after-render . shrface-mode) + (nov-mode . shrface-mode)) + :custom + (shrface-href-versatile t) + (shrface-toggle-bullets t) + :config + (shrface-basic) + (shrface-trial) + (shrface-default-keybindings)) + +(defun hunspell-available-p () + "Check if Hunspell is available on the system." + (cond + ;; Check for Windows + ((eq system-type 'windows-nt) + (or (executable-find "hunspell.exe") + (executable-find "hunspell"))) + ;; Check for Linux and other Unix-like systems + ((or (eq system-type 'gnu/linux) + (eq system-type 'darwin) + (eq system-type 'berkeley-unix)) + (executable-find "hunspell")) + ;; Return nil for unsupported systems + (t nil))) + +(when (hunspell-available-p) + (progn + (use-package flyspell + :hook ((LaTeX-mode . flyspell-mode) + (org-mode . flyspell-mode) + (text-mode . flyspell-mode) + (prog-mode . flyspell-prog-mode))) + + (use-package ispell + :ensure nil + :config + ;; On windows: Copy *.aff and *.dic files to C:\msys64\ucrt64\share\hunspell + ;; `hunspell -D`, the program will display the dictionaries and affix files it + ;; finds and loads. + ;; (when (eq system-type 'windows-nt) + ;; (setq ispell-program-name "c:/msys64/ucrt64/bin/hunspell.exe")) + (setq ispell-program-name "hunspell") + (setq ispell-dictionary "german,english") + (setq ispell-local-dictionary-alist + '(("german" "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-d" "de_DE_frami,de_AT_frami,de_CH_frami") nil utf-8) + ("english" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US,en_GB") nil utf-8) + ("german,english" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "de_DE_frami,en_US") nil utf-8))) + (setq ispell-hunspell-dictionary-alist ispell-local-dictionary-alist)))) + +(defun mk/nov-font-settings () + (setq-local line-spacing 2)) + +(use-package browse-url + :custom + (browse-url-browser-function 'eww-browse-url)) + +(use-package eww + :config + (require 'shrface)) + +(use-package nov + :hook ((nov-mode . visual-line-mode) + (nov-mode . mk/nov-font-settings)) + :mode ("\\.epub\\'" . nov-mode) + :custom + (nov-header-line-format nil) + (nov-text-width 82) + (nov-variable-pitch nil) + :config + (require 'shrface) + (setq nov-shr-rendering-functions '((img . nov-render-img) (title . nov-render-title))) + (setq nov-shr-rendering-functions (append nov-shr-rendering-functions shr-external-rendering-functions))) +;; (when (eq system-type 'windows-nt) +;; (setq nov-unzip-program "c:/msys64/usr/bin/unzip.exe"))) + +(use-package eglot + :hook ((typescript-mode . eglot-ensure) + (js2-mode . eglot-ensure)) + :config + (if (eq system-name 'windows-nt) + ;; %USERPROFILE%\AppData\Local\Programs\clangd-windows-17.0.3\clangd_17.0.3\bin + (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")) + (add-to-list 'eglot-server-programs '((c++-mode c-mode) "ccls")))) + + +(use-package sql + :config + (setq sql-connection-alist + '((finance-db + (sql-product 'sqlite) + (sql-database "~/Documents/org/data/FINANCE.db")))) + (when (eq system-type 'windows-nt) + (setq sql-postgres-program "C:/Program Files/PostgreSQL/16/bin/psql.exe") + (setq sql-sqlite-options '("-interactive")) + (setq sql-mariadb-options '("-C" "-t" "-f" "-n")) + (setq sql-mysql-options '("-C" "-t" "-f" "-n")))) + +;; (defun me/c-mode-style-hook () +;; ;; https://www.gnu.org/prep/standards/html_node/Writing-C.html +;; ;; if linux kernel source use linux style, else use gnu style +;; (c-set-style +;; (if (and (buffer-file-name) +;; (string-match "/usr/src/linux" (buffer-file-name))) +;; "linux" +;; "gnu"))) + +;; (use-package cc-mode +;; :defer t +;; :ensure nil +;; :hook ((c-mode-common . c-toggle-auto-newline) +;; (c-mode-common . me/c-mode-style-hook)) +;; :custom +;; (fill-column 79) +;; (c-basic-offset 2) +;; (indent-tabs-mode nil) +;; :config +;; (define-key c-mode-base-map (kbd "RET") 'newline-and-indent)) + +;; (defun me/c-mode-compile-command-hook () +;; ;; if no makefile use gcc for compile command +;; (unless (or (file-exists-p "makefile") +;; (file-exists-p "Makefile")) +;; (set (make-local-variable 'compile-command) +;; (concat "gcc " "-Wall " "-g " buffer-file-name " -o " +;; (file-name-sans-extension buffer-file-name))))) + +;; (add-hook 'c-mode-common-hook 'me/c-mode-compile-command-hook) + +;; (defun me/c-mode-compile-on-save () +;; ;; compile on save hook +;; (make-local-variable 'after-save-hook) +;; (add-hook 'after-save-hook (lambda () (compile compile-command)))) + +;; (add-hook 'c-mode-common-hook 'me/c-mode-compile-on-save) + +;; (use-package js-mode +;; :ensure nil +;; :hook (js-mode . eglot-ensure) +;; :mode (("\\.webmanifest\\'" . js-mode) +;; ("\\.js\\'" . js-mode) +;; ("\\.mjs\\'" . js-mode) +;; ("\\.cjs\\'" . js-mode))) + +(use-package js2-mode + :mode + (("\\.webmanifest\\'" . js2-mode) + ("\\.js\\'" . js2-mode) + ("\\.mjs\\'" . js2-mode) + ("\\.cjs\\'" . js2-mode)) + :config + (add-to-list 'interpreter-mode-alist '("node" . js2-mode))) + +;; (use-package go-mode +;; :defer t +;; :mode ("\\.go\\'" . go-mode) +;; :hook ((before-save . gofmt-before-save) +;; (go-mode . eglot-ensure)) +;; :config +;; (defun me/go-mode-compile-command-hook () +;; ;; if no makefile use go vet for compile command +;; (unless (or (file-exists-p "makefile") +;; (file-exists-p "Makefile")) +;; (set (make-local-variable 'compile-command) +;; (concat "go " "vet " buffer-file-name)))) +;; (add-hook 'go-mode-hook 'me/go-mode-compile-command-hook) +;; (defun me/go-mode-compile-on-save () +;; ;; compile on save hook +;; (make-local-variable 'after-save-hook) +;; (add-hook 'after-save-hook (lambda () (compile compile-command))))) +;; ;; (add-hook 'go-mode-hook 'me/go-mode-compile-on-save))) + +(use-package web-mode + ;; :hook html-mode + :mode (("\\.html?\\'" . web-mode) + ("\\.xhtml?\\'" . web-mode) + ("\\.tmpl\\'" . web-mode) + ("\\.hbs\\'" . web-mode) + ("\\.handlebars\\'" . web-mode)) + :custom + (web-mode-markup-indent-offset 2) + (web-mode-css-indent-offset 2) + (web-mode-code-indent-offset 2) + (web-mode-enable-auto-pairing nil) + (web-mode-enable-auto-closing t) + (web-mode-enable-current-element-highlight t) + (web-mode-enable-current-column-highlight t)) + +(use-package python + :mode (("\\.py\\'" . python-mode) + ("\\.wsgi$" . python-mode) + ("\\.j2" . python-mode)) + :hook (python-mode . abbrev-mode) + :init + (setq python-indent-guess-indent-offset nil) + (setq python-indent-offset 4) + (setq python-shell-interpreter "ipython") + (setq python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True") + :custom + (fill-column 79)) + +;; (use-package simple-httpd +;; :defer t) + +(use-package go-translate + :bind (("C-c t" . gt-do-translate)) + :config + (setq gt-langs '(en de)) + (setq gt-default-translator + (gt-translator + :taker (gt-taker :text 'word) + :engines (gt-google-engine) + :render (gt-buffer-render)))) + +(use-package magit + :bind ("C-x g" . magit-status) + :init + (when (eq system-type 'windows-nt) + (setq magit-git-executable "C:/Program Files/Git/mingw64/libexec/git-core/git.exe")) + :custom + (magit-diff-refine-hunk 'all) + (magit-display-buffer-function 'magit-display-buffer-fullcolumn-most-v1) + (magit-ediff-dwim-show-on-hunks t) + (magit-log-arguments '("--graph" "--color" "--decorate" "--show-signature" "--follow" "-n256")) + (magit-log-margin-show-committer-date t) + (magit-log-remove-graph-args '("--follow" "--grep" "-G" "-S" "-L")) + (magit-todos-insert-after '(bottom)) + :config + (global-set-key (kbd "C-x M-g") 'magit-dispatch)) + +(use-package yaml-mode + :mode "\\.yml\\'" + :hook + (yaml-mode . (lambda () (auto-fill-mode -1)))) + +(use-package csv-mode + :mode "\\.csv\\'") + +(use-package markdown-mode + :mode "\\.md\\'") + +;; (use-package typescript-mode +;; :defer t +;; :mode "\\.ts\\'" +;; :hook (typescript-mode . eglot-ensure) +;; :config (setq typescript-indent-level 2)) + +(when (eq system-type 'gnu/linux) + (use-package spotify + :bind ("S-" . spotify-playpause))) + +(use-package mastodon + :defer t + :custom + (mastodon-instance-url "https://emacs.ch") + (mastodon-active-user "qhBidG3d")) + +(use-package jabber + :defer t + :custom + (jabber-muc-decorate-presence-patterns + '(("enters the room" . nil) + ("has entered the room" . nil) + ("joined the room" . nil) + ("has left the chatroom" . nil))) + (jabber-activity-mode nil) + (jabber-account-list + '(("marcus.kammer@mailbox.org"))) + (jabber-muc-autojoin + '("lisp@conference.a3.pm" + "emacs@conference.conversations.im" + "community@conference.jabber.fsfe.org" + "ml-survey@conference.mailbox.org" + "userexperience@conference.mailbox.org")) + (jabber-muc-default-nicknames + '(("lisp@conference.a3.pm" . "marcus") + ("emacs@conference.conversations.im" . "marcus") + ("ml-survey@conference.mailbox.org" . "marcus") + ("userexperience@conference.mailbox.org" . "marcus")))) + +;; (use-package hyperbole +;; :config +;; (setq hyrolo-date-format "%Y-%m-%d %H:%M:%S") +;; (add-hook 'hyperbole-init-hook +;; (lambda () +;; (setq hyrolo-file-list +;; (append (hyrolo-initialize-file-list) +;; (cons "~/.rolo.otl" +;; (directory-files-recursively org-directory (rx "." (or "org" "otl") eos)))))))) + +(use-package plantuml-mode + :mode ("\\.puml\\'" "\\.plantuml\\'") + :custom + (plantuml-default-exec-mode 'jar) + (plantuml-jar-path "~/plantuml.jar") + (org-plantuml-jar-path "~/plantuml.jar") + (plantuml-java-args '("-DPLANTUML_DPI=300" "-Djava.awt.headless=true" "-jar" "--illegal-access=deny"))) + +(use-package tex-mode + :defer t + :ensure auctex + :config + ;; TeX mode settings for editing .tex files + (setq TeX-auto-save t) ; Enable auto-save + (setq TeX-electric-math (cons "$" "$")) ; Shortcut for math mode + (if (eq system-type 'windows-nt) + (progn + (setq TeX-view-program-list '(("SumatraPDF" "~/AppData/Local/SumatraPDF/SumatraPDF.exe %o"))) + (setq TeX-view-program-selection '((output-pdf "SumatraPDF")))) + (setq TeX-view-program-selection '((output-pdf "Evince")))) + (setq TeX-source-correlate-start-server t) ; Enable source-correlate + (setq TeX-master nil) ; Default master file + (setq TeX-engine 'luatex) ; Set engine to XeTeX + (setq TeX-command-extra-options "-shell-escape")) ; Allow shell escape + +(use-package auctex + :hook ((LaTeX-mode . turn-on-reftex) + (LaTeX-mode . LaTeX-math-mode)) + :custom + (LaTeX-indent-level 4) + (LaTeX-item-indent 0)) + +(use-package epg + :ensure nil + :config + (when (eq system-type 'windows-nt) + (setq epg-gpg-home-directory "~/AppData/Roaming/gnupg" + epg-gpg-program "c:/Program Files (x86)/GnuPG/bin/gpg.exe" + epg-gpgconf-program "c:/Program Files (x86)/GnuPG/bin/gpgconf.exe"))) + +(use-package which-key + :init (which-key-mode)) + +(use-package ssh-config-mode + :mode ("/sshd_config\\'" . ssh-config-mode) + :config + (add-hook 'ssh-config-mode-hook 'turn-on-font-lock)) + +(use-package nginx-mode + :mode ("/nginx/.*\\'" . nginx-mode)) + +(use-package dashboard + :config + (dashboard-setup-startup-hook)) + +;; (use-package flymake-json) + +;; (use-package json-mode +;; :ensure nil +;; :mode "\\.json\\'" +;; :hook (json-mode . flymake-json-load)) + +;; (use-package json-navigator +;; :defer t +;; :after json-mode) + +;; (use-package jq-format +;; :defer t +;; :after json-mode) + +(use-package gptel + :bind (("C-c g" . gptel-menu) + ("C-c G" . gptel) + ("C-c M-g" . gptel-send) + :map gptel-mode-map + ("C-c C-c" . gptel-send) + ("C-c C-k" . gptel-abort)) + :config + (when (eq system-type 'windows-nt) + (setq gptel-use-curl t)) + (setq gptel-prompt-prefix-alist + '((markdown-mode . "# ") + (org-mode . "* ") + (text-mode . "# "))) + (setq gptel-default-mode 'org-mode) + (setq gptel-model "claude-3-5-sonnet-20240620") + (setq gptel-backend (gptel-make-anthropic "Claude" :stream t :key gptel-api-key)) + (setq gptel-directives + '((default . "You are an expert Common Lisp developer specializing in web development with Hunchentoot and functional programming. Emphasize functional programming principles throughout, including pure functions, immutability, and higher-order functions. Provide concise code examples and best practices for each topic. You are using the following common lisp libraries: spinneret for html generation, hunchentoot as web server, and mito as ORM. If needed choose more libraries for different cases.") + (bash . "You are an experienced Bash scripting teacher. I want to learn how to write Bash scripts. Please explain concepts clearly, provide examples, and guide me through writing scripts step-by-step. Let's start with the basics and gradually move to more advanced topics. If I have questions or need further clarification, help me understand the material thoroughly.") + (cs-teacher . "You are a virtual teaching assistant for a high school computer science course. The course focuses on functional programming, data structures, and algorithms using Common Lisp. Your goal is to provide clear, engaging, and educational explanations, examples, and exercises to help students grasp complex concepts. Your responses should be appropriate for high school students, keeping explanations simple yet thorough.") + (statistic-teacher . "You are a virtual teaching assistant for a high school statistic and math course. The course focuses on statistics. Your goal is to provide clear, engaging, and educational explanations, examples, and exercises to help students grasp complex concepts. Your responses should be appropriate for high school students, keeping explanations simple yet thorough.")))) + +(use-package gnuplot + :defer t) + +(use-package docker) + +(use-package dockerfile-mode + :mode ("\\.dockerfile\\'" . dockerfile-mode)) + +(use-package terraform-mode + :defer t + :custom + (terraform-format-on-save t)) + +(use-package auto-complete + :init + (ac-config-default) + :config + (setq ac-use-menu-map t) + (setq ac-ignore-case nil) + (add-hook 'prog-mode-hook 'auto-complete-mode)) + +;; (load "bundle--lisp") + +(defvar mk/hyperspec-dir-locations + '("~/cl-sites/HyperSpec-7-0/HyperSpec/" + "~/HyperSpec-7-0/HyperSpec/") + "List of possible locations where the local HyperSpec could reside.") + +(defun mk/hyperspec-dir () + "Finds and returns the URI of the local HyperSpec directory. +Uses `mk/hyperspec-dir-locations' to find the directory." + (let ((dir (seq-find 'file-directory-p mk/hyperspec-dir-locations))) + (if dir + (concat "file://" (and (eq system-type 'windows-nt) "/") (expand-file-name dir)) + nil))) + +(setq common-lisp-hyperspec-root (mk/hyperspec-dir)) + +(use-package slime + :custom + (slime-autodoc-use-multiline-p 1) + :config + (define-key slime-mode-map (kbd "C-c C-q") 'slime-close-all-parens-in-sexp) + (slime-setup '(slime-autodoc + slime-tramp + slime-fancy + slime-asdf + slime-indentation + slime-editing-commands + slime-sbcl-exts)) + + ;; To create a slime specific sbcl image: + ;; shell$ sbcl + ;; * (mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf)) + ;; * (save-lisp-and-die "sbcl.core-for-slime") + + ;; Stop SLIME's REPL from grabbing DEL, + ;; which is annoying when backspacing over a '(' + + ;; (defun override-slime-repl-bindings-with-paredit () + ;; (define-key slime-repl-mode-map + ;; (read-kbd-macro paredit-backward-delete-key) nil)) + + ;; (add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit) + + (setq common-lisp-hyperspec-symbol-table + (concat common-lisp-hyperspec-root "Data/Map_Sym.txt")) + + (setq common-lisp-hyperspec-issuex-table + (concat common-lisp-hyperspec-root "Data/Map_IssX.txt")) + + (let ((image-path (expand-file-name "~/sbcl.core-for-slime"))) + (if (file-exists-p image-path) + (setq slime-lisp-implementations + `((sbcl ("sbcl" "--noinform" "--core" ,image-path) :coding-system utf-8-unix))) + (setq slime-lisp-implementations + `((sbcl ("sbcl" "--noinform") :coding-system utf-8-unix))))) + + (defvar mk/slime-remote-instances + '((:machine-instance "survey-metalisp" + :remote-host "survey.metalisp.dev" + :username "cl") + (:machine-instance "u1-marcsukammer" + :remote-host "u1.marcsukammer.dev" + :username "marcus"))) + + (mapc (lambda (instance) + (push (slime-create-filename-translator + :machine-instance (plist-get instance :machine-instance) + :remote-host (plist-get instance :remote-host) + :username (plist-get instance :username)) + slime-filename-translations)) + mk/slime-remote-instances) + + ;; syntax highlighting + (defvar slime-repl-font-lock-keywords lisp-font-lock-keywords-2) + + (defun slime-repl-font-lock-setup () + (setq font-lock-defaults + '(slime-repl-font-lock-keywords + ;; From lisp-mode.el + nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil + (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function)))) + + (add-hook 'slime-repl-mode-hook 'slime-repl-font-lock-setup) + + (defadvice slime-repl-insert-prompt (after font-lock-face activate) + (let ((inhibit-read-only t)) + (add-text-properties + slime-repl-prompt-start-mark (point) + '(font-lock-face + slime-repl-prompt-face + rear-nonsticky + (slime-repl-prompt read-only font-lock-face intangible)))))) + +(use-package elisp-mode + :ensure nil + :hook ((emacs-lisp-mode . prettify-symbols-mode) + (emacs-lisp-mode . (lambda () + (face-remap-add-relative 'font-lock-function-name-face nil :underline t) + (face-remap-add-relative 'font-lock-keyword-face nil :slant 'italic)))) + :mode (("\\.el$" . emacs-lisp-mode)) + :config + (setq-local lisp-indent-function 'lisp-indent-function) + (setq-local fill-column 84)) + +(use-package lisp-mode + :ensure nil + :hook ((lisp-mode . (lambda () + (face-remap-add-relative 'font-lock-function-name-face nil :underline t) + (face-remap-add-relative 'font-lock-keyword-face nil :slant 'italic)))) + :mode (("\\.lisp$" . lisp-mode) + ("\\.lsp$" . lisp-mode) + ("\\.cl$" . lisp-mode)) + :init + (setq inferior-lisp-program "sbcl --noinform") + + :config + (setq-local lisp-indent-function 'common-lisp-indent-function) + (setq-local fill-column 84) + (defvar g-cl-function-names + '("*" "+" "-" "/" "/=" "1+" "1-" "<" "<=" "=" ">" + ">=" "abort" "abs" "acons" "acos" "acosh" "add-method" "adjoin" + "adjust-array" "adjustable-array-p" "allocate-instance" "alpha-char-p" + "alphanumericp" "and" "append" "apply" "apropos" "apropos-list" "aref" + "arithmetic-error-operands" "arithmetic-error-operation" "array-dimension" + "array-dimensions" "array-displacement" "array-element-type" + "array-has-fill-pointer-p" "array-in-bounds-p" "array-rank" + "array-row-major-index" "array-total-size" "arrayp" "ash" "asin" "asinh" + "assert" "assoc" "assoc-if" "assoc-if-not" "atan" "atanh" "atom" "bit" + "bit-and" "bit-andc1" "bit-andc2" "bit-eqv" "bit-ior" "bit-nand" "bit-nor" + "bit-not" "bit-orc1" "bit-orc2" "bit-vector-p" "bit-xor" "block" "boole" + "both-case-p" "boundp" "break" "broadcast-stream-streams" "butlast" "byte" + "byte-position" "byte-size" "caaaar" "caaadr" "caaar" "caadar" "caaddr" + "caadr" "caar" "cadaar" "cadadr" "cadar" "caddar" "cadddr" "caddr" "cadr" + "call-method" "car" "case" "catch" "ccase" "cdaaar" "cdaadr" "cdaar" + "cdadar" "cdaddr" "cdadr" "cdar" "cddaar" "cddadr" "cddar" "cdddar" "cddddr" + "cdddr" "cddr" "cdr" "ceiling" "cell-error-name" "cerror" "change-class" + "char" "char-code" "char-downcase" "char-equal" "char-greaterp" "char-int" + "char-lessp" "char-name" "char-not-equal" "char-not-greaterp" + "char-not-lessp" "char-upcase" "char/=" "char<" "char<=" "char=" "char>" + "char>=" "character" "characterp" "check-type" "cis" "class-name" "class-of" + "clear-input" "clear-output" "close" "clrhash" "code-char" "coerce" + "compile" "compile-file" "compile-file-pathname" "compiled-function-p" + "compiler-macro-function" "complement" "complex" "complexp" + "compute-applicable-methods" "compute-restarts" "concatenate" + "concatenated-stream-streams" "cond" "conjugate" "cons" "consp" "constantly" + "constantp" "continue" "copy-alist" "copy-list" "copy-pprint-dispatch" + "copy-readtable" "copy-seq" "copy-structure" "copy-symbol" "copy-tree" "cos" + "cosh" "count" "count-if" "count-if-not" "ctypecase" "decf" "declaim" + "decode-float" "decode-universal-time" "defclass" "defconstant" "defgeneric" + "define-compiler-macro" "define-condition" "define-method-combination" + "define-modify-macro" "define-setf-expander" "define-symbol-macro" + "defmacro" "defmethod" "defpackage" "defparameter" "defsetf" "defstruct" + "deftype" "defun" "defvar" "delete" "delete-duplicates" "delete-file" + "delete-if" "delete-if-not" "delete-package" "denominator" "deposit-field" + "describe" "describe-object" "destructuring-bind" "digit-char" + "digit-char-p" "directory" "directory-namestring" "disassemble" "do" "do*" + "do-all-symbols" "do-external-symbols" "do-symbols" "documentation" "dolist" + "dotimes" "dpb" "dribble" "ecase" "echo-stream-input-stream" + "echo-stream-output-stream" "ed" "eighth" "elt" "encode-universal-time" + "endp" "enough-namestring" "ensure-directories-exist" + "ensure-generic-function" "eq" "eql" "equal" "equalp" "error" "etypecase" + "eval" "eval-when" "evenp" "every" "exp" "export" "expt" "fboundp" + "fceiling" "fdefinition" "ffloor" "fifth" "file-author" + "file-error-pathname" "file-length" "file-namestring" "file-position" + "file-string-length" "file-write-date" "fill" "fill-pointer" "find" + "find-all-symbols" "find-class" "find-if" "find-if-not" "find-method" + "find-package" "find-restart" "find-symbol" "finish-output" "first" "flet" + "float" "float-digits" "float-precision" "float-radix" "float-sign" "floatp" + "floor" "fmakunbound" "force-output" "format" "formatter" "fourth" + "fresh-line" "fround" "ftruncate" "funcall" "function" "function-keywords" + "function-lambda-expression" "functionp" "gcd" "gensym" "gentemp" "get" + "get-decoded-time" "get-dispatch-macro-character" "get-internal-real-time" + "get-internal-run-time" "get-macro-character" "get-output-stream-string" + "get-properties" "get-setf-expansion" "get-universal-time" "getf" "gethash" + "go" "graphic-char-p" "handler-bind" "handler-case" "hash-table-count" + "hash-table-p" "hash-table-rehash-size" "hash-table-rehash-threshold" + "hash-table-size" "hash-table-test" "host-namestring" "identity" "if" + "ignore-errors" "imagpart" "import" "in-package" "incf" + "initialize-instance" "input-stream-p" "inspect" "integer-decode-float" + "integer-length" "integerp" "interactive-stream-p" "intern" "intersection" + "invalid-method-error" "invoke-debugger" "invoke-restart" + "invoke-restart-interactively" "isqrt" "keywordp" "labels" "lambda" "last" + "lcm" "ldb" "ldb-test" "ldiff" "length" "let" "let*" + "lisp-implementation-type" "lisp-implementation-version" "list" "list*" + "list-all-packages" "list-length" "listen" "listp" "load" + "load-logical-pathname-translations" "load-time-value" "locally" "log" + "logand" "logandc1" "logandc2" "logbitp" "logcount" "logeqv" + "logical-pathname" "logical-pathname-translations" "logior" "lognand" + "lognor" "lognot" "logorc1" "logorc2" "logtest" "logxor" "long-site-name" + "loop" "loop-finish" "lower-case-p" "machine-instance" "machine-type" + "machine-version" "macro-function" "macroexpand" "macroexpand-1" "macrolet" + "make-array" "make-broadcast-stream" "make-concatenated-stream" + "make-condition" "make-dispatch-macro-character" "make-echo-stream" + "make-hash-table" "make-instance" "make-instances-obsolete" "make-list" + "make-load-form" "make-load-form-saving-slots" "make-package" + "make-pathname" "make-random-state" "make-sequence" "make-string" + "make-string-input-stream" "make-string-output-stream" "make-symbol" + "make-synonym-stream" "make-two-way-stream" "makunbound" "map" "map-into" + "mapc" "mapcan" "mapcar" "mapcon" "maphash" "mapl" "maplist" "mask-field" + "max" "member" "member-if" "member-if-not" "merge" "merge-pathnames" + "method-combination-error" "method-qualifiers" "min" "minusp" "mismatch" + "mod" "muffle-warning" "multiple-value-bind" "multiple-value-call" + "multiple-value-list" "multiple-value-prog1" "multiple-value-setq" + "name-char" "namestring" "nbutlast" "nconc" "nintersection" "ninth" + "no-applicable-method" "no-next-method" "not" "notany" "notevery" "nreconc" + "nreverse" "nset-difference" "nset-exclusive-or" "nstring-capitalize" + "nstring-downcase" "nstring-upcase" "nsublis" "nsubst" "nsubst-if" + "nsubst-if-not" "nsubstitute" "nsubstitute-if" "nsubstitute-if-not" "nth" + "nth-value" "nthcdr" "null" "numberp" "numerator" "nunion" "oddp" "open" + "open-stream-p" "or" "output-stream-p" "package-error-package" + "package-name" "package-nicknames" "package-shadowing-symbols" + "package-use-list" "package-used-by-list" "packagep" "pairlis" + "parse-integer" "parse-namestring" "pathname" "pathname-device" + "pathname-directory" "pathname-host" "pathname-match-p" "pathname-name" + "pathname-type" "pathname-version" "pathnamep" "peek-char" "phase" "plusp" + "pop" "position" "position-if" "position-if-not" "pprint" "pprint-dispatch" + "pprint-exit-if-list-exhausted" "pprint-fill" "pprint-indent" + "pprint-linear" "pprint-logical-block" "pprint-newline" "pprint-pop" + "pprint-tab" "pprint-tabular" "prin1" "prin1-to-string" "princ" + "princ-to-string" "print" "print-not-readable-object" "print-object" + "print-unreadable-object" "probe-file" "proclaim" "prog" "prog*" "prog1" + "prog2" "progn" "progv" "provide" "psetf" "psetq" "push" "pushnew" "quote" + "random" "random-state-p" "rassoc" "rassoc-if" "rassoc-if-not" "rational" + "rationalize" "rationalp" "read" "read-byte" "read-char" "read-char-no-hang" + "read-delimited-list" "read-from-string" "read-line" + "read-preserving-whitespace" "read-sequence" "readtable-case" "readtablep" + "realp" "realpart" "reduce" "reinitialize-instance" "rem" "remf" "remhash" + "remove" "remove-duplicates" "remove-if" "remove-if-not" "remove-method" + "remprop" "rename-file" "rename-package" "replace" "require" "rest" + "restart-bind" "restart-case" "restart-name" "return" "return-from" + "revappend" "reverse" "room" "rotatef" "round" "row-major-aref" "rplaca" + "rplacd" "sbit" "scale-float" "schar" "search" "second" "set" + "set-difference" "set-dispatch-macro-character" "set-exclusive-or" + "set-macro-character" "set-pprint-dispatch" "set-syntax-from-char" "setf" + "setq" "seventh" "shadow" "shadowing-import" "shared-initialize" "shiftf" + "short-site-name" "signal" "signum" "simple-bit-vector-p" + "simple-condition-format-arguments" "simple-condition-format-control" + "simple-string-p" "simple-vector-p" "sin" "sinh" "sixth" "sleep" + "slot-boundp" "slot-exists-p" "slot-makunbound" "slot-missing" + "slot-unbound" "slot-value" "software-type" "software-version" "some" "sort" + "special-operator-p" "sqrt" "stable-sort" "standard-char-p" "step" + "store-value" "stream-element-type" "stream-error-stream" + "stream-external-format" "streamp" "string" "string-capitalize" + "string-downcase" "string-equal" "string-greaterp" "string-left-trim" + "string-lessp" "string-not-equal" "string-not-greaterp" "string-not-lessp" + "string-right-trim" "string-trim" "string-upcase" "string/=" "string<" + "string<=" "string=" "string>" "string>=" "stringp" "sublis" "subseq" + "subsetp" "subst" "subst-if" "subst-if-not" "substitute" "substitute-if" + "substitute-if-not" "subtypep" "svref" "sxhash" "symbol-function" + "symbol-macrolet" "symbol-name" "symbol-package" "symbol-plist" + "symbol-value" "symbolp" "synonym-stream-symbol" "tagbody" "tailp" "tan" + "tanh" "tenth" "terpri" "the" "third" "throw" "time" "trace" + "translate-logical-pathname" "translate-pathname" "tree-equal" "truename" + "truncate" "two-way-stream-input-stream" "two-way-stream-output-stream" + "type-error-datum" "type-error-expected-type" "type-of" "typecase" "typep" + "unbound-slot-instance" "unexport" "unintern" "union" "unless" "unread-char" + "untrace" "unuse-package" "unwind-protect" + "update-instance-for-different-class" "update-instance-for-redefined-class" + "upgraded-array-element-type" "upgraded-complex-part-type" "upper-case-p" + "use-package" "use-value" "user-homedir-pathname" "values" "values-list" + "vector" "vector-pop" "vector-push" "vector-push-extend" "vectorp" "warn" + "when" "wild-pathname-p" "with-accessors" "with-compilation-unit" + "with-condition-restarts" "with-hash-table-iterator" + "with-input-from-string" "with-open-file" "with-open-stream" + "with-output-to-string" "with-package-iterator" "with-simple-restart" + "with-slots" "with-standard-io-syntax" "write" "write-byte" "write-char" + "write-line" "write-sequence" "write-string" "write-to-string" "y-or-n-p" + "yes-or-no-p" "zerop")) + (defvar g-cl-value-names + '("*" "**" "***" "*break-on-signals*" + "*compile-file-pathname*" "*compile-file-truename*" "*compile-print*" + "*compile-verbose*" "*debug-io*" "*debugger-hook*" + "*default-pathname-defaults*" "*error-output*" "*features*" + "*gensym-counter*" "*load-pathname*" "*load-print*" "*load-truename*" + "*load-verbose*" "*macroexpand-hook*" "*modules*" "*package*" + "*print-array*" "*print-base*" "*print-case*" "*print-circle*" + "*print-escape*" "*print-gensym*" "*print-length*" "*print-level*" + "*print-lines*" "*print-miser-width*" "*print-pprint-dispatch*" + "*print-pretty*" "*print-radix*" "*print-readably*" "*print-right-margin*" + "*query-io*" "*random-state*" "*read-base*" "*read-default-float-format*" + "*read-eval*" "*read-suppress*" "*readtable*" "*standard-input*" + "*standard-output*" "*terminal-io*" "*trace-output*" "+" "++" "+++" "-" "/" + "//" "///" "array-dimension-limit" "array-rank-limit" + "array-total-size-limit" "boole-1" "boole-2" "boole-and" "boole-andc1" + "boole-andc2" "boole-c1" "boole-c2" "boole-clr" "boole-eqv" "boole-ior" + "boole-nand" "boole-nor" "boole-orc1" "boole-orc2" "boole-set" "boole-xor" + "call-arguments-limit" "char-code-limit" "double-float-epsilon" + "double-float-negative-epsilon" "internal-time-units-per-second" + "lambda-list-keywords" "lambda-parameters-limit" + "least-negative-double-float" "least-negative-long-float" + "least-negative-normalized-double-float" + "least-negative-normalized-long-float" + "least-negative-normalized-short-float" + "least-negative-normalized-single-float" "least-negative-short-float" + "least-negative-single-float" "least-positive-double-float" + "least-positive-long-float" "least-positive-normalized-double-float" + "least-positive-normalized-long-float" + "least-positive-normalized-short-float" + "least-positive-normalized-single-float" "least-positive-short-float" + "least-positive-single-float" "long-float-epsilon" + "long-float-negative-epsilon" "most-negative-double-float" + "most-negative-fixnum" "most-negative-long-float" + "most-negative-short-float" "most-negative-single-float" + "most-positive-double-float" "most-positive-fixnum" + "most-positive-long-float" "most-positive-short-float" + "most-positive-single-float" "multiple-values-limit" "nil" "pi" + "short-float-epsilon" "short-float-negative-epsilon" "single-float-epsilon" + "single-float-negative-epsilon" "t")) + (defface g-cl-character-face + '((default :inherit font-lock-constant-face)) + "The face used to highlight Common Lisp character literals.") + (defface g-cl-standard-function-face + '((default :inherit font-lock-keyword-face)) + "The face used to highlight standard Common Lisp function symbols.") + (defface g-cl-standard-value-face + '((default :inherit font-lock-variable-name-face)) + "The face used to highlight standard Common Lisp value symbols.") + (defvar g-cl-font-lock-keywords + (let* ((character-re (concat "#\\\\" lisp-mode-symbol-regexp "\\_>")) + (function-re (concat "(" (regexp-opt g-cl-function-names t) "\\_>")) + (value-re (regexp-opt g-cl-value-names 'symbols))) + `((,character-re . 'g-cl-character-face) + (,function-re + (1 'g-cl-standard-function-face)) + (,value-re . 'g-cl-standard-value-face)))) + (defvar g-cl-font-lock-defaults + '((g-cl-font-lock-keywords) + nil ; enable syntaxic highlighting + t ; case insensitive highlighting + nil ; use the lisp-mode syntax table + (font-lock-mark-block-function . mark-defun) + (font-lock-extra-managed-props help-echo) + (font-lock-syntactic-face-function + . lisp-font-lock-syntactic-face-function))) + (defun g-init-lisp-font-lock () + (setq font-lock-defaults g-cl-font-lock-defaults)) + + (add-hook 'lisp-mode-hook 'g-init-lisp-font-lock)) + +(use-package common-lisp-snippets + :after yasnippet) + +(when (eq system-type 'gnu/linux) + (use-package geiser + :init + (setq geiser-repl-prompt-read-only t) + (setq geiser-repl-highlight-error-messages t) + (setq geiser-active-implementations '(racket guile)) + (setq geiser-default-implementation 'guile) + :hook (scheme-mode . geiser-mode))) + +;; (use-package racket-mode +;; :mode "\\.rkt\\'") + +;; (use-package geiser-racket +;; :defer t +;; :after geiser +;; :config +;; (when (eq system-type 'windows-nt) +;; (setq geiser-racket-binary "c:/Program Files/Racket/Racket.exe"))) + +(when (eq system-type 'gnu/linux) + (use-package geiser-guile + :defer t + :after geiser + :custom (geiser-guile-binary "guile"))) + +;; (use-package ac-slime +;; :after (slime auto-complete) +;; :config +;; (add-hook 'slime-mode-hook 'set-up-slime-ac) +;; (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)) + +(use-package paredit + :hook ((emacs-lisp-mode . paredit-mode) + (eval-expression-minibuffer-setup . paredit-mode) + (ielm-mode . paredit-mode) + (lisp-mode . paredit-mode) + (lisp-interaction-mode . paredit-mode) + (scheme-mode . paredit-mode)) + :bind (:map paredit-mode-map + ("M-s" . nil) + ("C-M-s" . paredit-splice-sexp))) + +;; (load "bundle--irc") + +(defun mk/start-irc (nick) + (interactive "sTell me your nick please: ") + (erc-tls :server "irc.libera.chat" + :port 6697 + :nick nick + :full-name "Jay Edgar Hoover")) + +(use-package erc + :defer t + :custom + (erc-track-exclude '("#emacs")) + (erc-track-exclude-types '("JOIN" "NICK" "QUIT" "MODE" "AWAY")) + (erc-hide-list '("JOIN" "NICK" "QUIT" "MODE" "AWAY")) + (erc-track-exclude-server-buffer t) + (erc-fill-column 80) + (erc-fill-function 'erc-fill-static) + (erc-fill-static-center 20) + (erc-prompt-for-nickserv-password nil) + (erc-track-shorten-start 8) + (erc-auto-query 'bury) + (erc-network-hide-list '(("libera.chat" "JOIN" "PART" "QUIT"))) + (erc-rename-buffers t) + (erc-interpret-mirc-color t) + (erc-kill-buffer-on-part t) + (erc-kill-queries-on-quit t) + (erc-kill-server-buffer-on-quit t) + (erc-modules + '(autojoin ; Set away status automatically + button ; Join channels automatically + completion ; Complete nicknames and commands (programmable) + fill ; Wrap long lines + irccontrols ; Highlight or remove IRC control characters + match ; Highlight pals, fools, and other keywords + menu ; Display a menu in ERC buffers + netsplit ; Detect netsplits + noncommands ; Don’t display non-IRC commands after evaluation + readonly ; Make displayed lines read-only + ring ; Enable an input history + services ; Identify to Nickserv (IRC Services) automatically + smiley ; Convert smileys to pretty icons + stamp ; Add timestamps to messages + truncate ; Truncate buffers to a certain size + ))) + +(use-package erc-hl-nicks + :after erc + :config + (add-to-list 'erc-modules 'hl-nicks)) + +(use-package erc-image + :after erc + :config + (setq erc-image-inline-rescale 300) + (add-to-list 'erc-modules 'image)) + +;; (load "bundle--news") + +(use-package elfeed + :bind ("C-x w" . elfeed) + :init + (setq elfeed-feeds + '(("https://netzpolitik.org/feed/" netz politik news) + ("https://www.marcuskammer.dev/weblog/index.xml" personal) + ("https://www.guyrutenberg.com/feed/" linux blog) + ("https://blog.mozilla.org/en/feed/" browser web) + ("https://blog.chromium.org/feeds/posts/default" browser web) + ("https://hacks.mozilla.org/feed/" browser web) + ("https://mailbox.org/share/feed-de-mailbox.xml" email mailbox web) + ("https://feeds.feedburner.com/GoogleWebFonts" fonts blog google) + ("https://twobithistory.org/feed.xml" history blog coding) + ("https://blog.getbootstrap.com/feed.xml" web bootstrap blog) + ("https://blog.mozilla.org/en/feed/" web firefox blog) + ("https://fsfe.org/news/news.de.rss" fsfe news free-software) + ("https://planet.lisp.org/rss20.xml" planet lisp) + ("https://emacsconf.org/index.atom" emacs lisp conference) + ("https://jameshunt.us/feeds/main" lisp blog) + ("https://xenodium.com/rss.xml" emacs blog) + ("https://stevelosh.com/rss.xml" lisp blog personal) + ("https://planet.lisp.org/rss20.xml" lisp blogs) + ("https://m-x-erlangen.gitlab.io/atom.xml" lisp meetup) + ("https://takeonrules.com/index.atom" lisp emacs blog) + ("https://emacsredux.com/atom.xml" emacs blog) + ("https://planet.emacslife.com/atom.xml" emacs) + ("https://yiming.dev/rss.xml" coding emacs lisp blog) + ("https://endlessparentheses.com/atom.xml" emacs elisp blog) + ("https://www.philnewton.net/blog/feed/" emacs blog) + ("https://emacsredux.com/atom.xml" emacs blog) + ("https://marcus3santos.github.io/index.xml" emacs blog) + ("https://olddeuteronomy.github.io/index.xml" emacs blog) + ("https://www.colinmclear.net/posts/index.xml" research emacs blog) + ("https://howardism.org/index.xml" emacs blog) + ("https://www.timmons.dev/rss.xml" lisp blog) + ("https://batsov.com/atom.xml" lisp emacs blog) + ("https://notes.eatonphil.com/rss.xml" lisp emacs blog) + ("https://stackoverflow.com/feeds/tag?tagnames=hunchentoot&sort=newest" lisp stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=common-lisp&sort=newest" lisp stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=elisp&sort=newest" lisp emacs stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=org-mode&sort=newest" emacs orgmode stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=xmpp&sort=newest" xmpp stackoverflow) + ;;("https://stackoverflow.com/feeds/tag?tagnames=postgresql&sort=newest" sql stackoverflow) + ;;("https://stackoverflow.com/feeds/tag?tagnames=mariadb&sort=newest" sql stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=guile&sort=newest" guile scheme lisp stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=sbcl&sort=newest" sbcl lisp stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=sbcl+emacs&sort=newest" sbcl emacs lisp stackoverflow) + ("https://stackoverflow.com/feeds/tag?tagnames=sbcl+common-lisp+linux&sort=newest" sbcl lisp linux stackoverflow) + ("https://sourceforge.net/p/sbcl/activity/feed" lisp sbcl) + ("https://fukamachi.hashnode.dev/rss.xml" lisp blog) + ("https://sourceforge.net/projects/sbcl/rss?path=/sbcl" lisp sbcl sourceforge) + ("https://threatpost.com/feed/" security) + ("https://krebsonsecurity.com/feed/" security blog) + ("https://www.schneier.com/feed/atom/" security blog) + ("https://userlutions.com/feed/" ux usability blog) + ("https://www.nngroup.com/feed/rss/" ux design) + ("https://feedpress.me/UXmatters" ux design) + ("https://uxmovement.com/feed" ux design) + ("https://www.uxbeginner.com/feed/" ux design) + ("https://jeffgothelf.com/feed/" lean ux design blog) + ("https://uxwritinghub.com/feed/" ux writing blog) + ("https://www.w3.org/WAI/feed.xml" ux wai aria w3c) + ("https://measuringu.com/feed/" ux blog) + ("https://ux.stackexchange.com/feeds" ux stackexchange) + ("https://emacs.stackexchange.com/feeds" emacs stackexchange) + ("https://www.mdr.de/nachrichten/podcast/general/russland-angriff-krieg-ukraine100-podcast.xml" krieg ukraine podcast) + ("https://www.deutschlandfunk.de/umwelt-und-verbraucher-100.rss" umwelt verbraucher klima podcast) + ("https://jung-naiv.podigee.io/feed/mp3" politik podcast) + ("https://www.ndr.de/nachrichten/info/podcast4696.xml" podcast umwelt klima) + ("https://ct-uplink.podigee.io/feed/mp3" podcast technik computer) + ("https://feeds.soundcloud.com/users/soundcloud:users:261098918/sounds.rss" podcast osint) + ("https://hacks.mozilla.org/feed/" blog firefox web) + ("https://karthinks.com/index.xml" blog emacs) + ("https://www.destatis.de/SiteGlobals/Functions/RSSFeed/DE/RSSNewsfeed/Aktuell.xml" destatis aktuelles presse) + ("http://www.umweltbundesamt.de/rss/presse" uba aktuelles presse) + ("https://www.test.de/rss/geldanlage-banken/" test geld finanzen) + ("https://www.test.de/rss/steuern-recht/" test steuern recht) + ("https://thefetishistas.com/feed/" latex fetish news) + ("https://tonsky.me/atom.xml" blog computer) + ("https://www.copernicus.eu/news/rss" klima) + ("https://gegenblende.dgb.de/@@rss?count=10&feed=b3b8f76e-53f1-11e6-a380-525400e5a74a" arbeit gewerkschaft news) + ("https://drewdevault.com/blog/index.xml" blog programming computer) + ("https://www.inverse.com/rss" culture magazin journalism) + ("https://inkppl.com/en/rss.xml" tattoo magazin people culture) + ("https://novaramedia.com/feed/" politics capitalism climate left media) + ("https://www.youtube.com/feeds/videos.xml?channel_id=UCN29LJGZ8FY30ysxdTnDsaw" youtube video) + ("https://www.youtube.com/feeds/videos.xml?channel_id=UC5Ghe5TBQGYIOANuiNW4hDQ" youtube video) + ("https://www.youtube.com/feeds/videos.xml?channel_id=UC0p5jTq6Xx_DosDFxVXnWaQ" youtube video) + ("https://www.youtube.com/feeds/videos.xml?channel_id=UC0p5jTq6Xx_DosDFxVXnWaQ" youtube video) + ("https://www.vag.de/rss/meldungen" ubahn opnv vag) + ("https://feeds.feedblitz.com/sethsblog" management author blog) + ("https://ourworldindata.org/atom-data-insights.xml" data world) + ("https://ourworldindata.org/atom.xml" data world) + )) + (setq elfeed-search-filter "@7-day-ago +unread") + (let ((feeds (expand-file-name "~/feeds.el"))) + (when (file-exists-p feeds) + (load-file feeds)))) + +;; (load "bundle--calendar") + +(setq holiday-oriental-holidays nil) +(setq holiday-islamic-holidays nil) +(setq holiday-bahai-holidays nil) +(setq holiday-hebrew-holidays nil) +(setq holiday-general-holidays + '((holiday-fixed 1 1 "Neujahr") + (holiday-fixed 5 1 "1. Mai") + (holiday-fixed 10 3 "Tag der Deutschen Einheit"))) +(setq holiday-christian-holidays + '((holiday-float 12 0 -4 "1. Advent" 24) + (holiday-float 12 0 -3 "2. Advent" 24) + (holiday-float 12 0 -2 "3. Advent" 24) + (holiday-float 12 0 -1 "4. Advent" 24) + (holiday-fixed 12 25 "1. Weihnachtstag") + (holiday-fixed 12 26 "2. Weihnachtstag") + (holiday-fixed 1 6 "Heilige Drei Könige") + (holiday-easter-etc -48 "Rosenmontag") + ;; (holiday-easter-etc -3 "Gründonnerstag") + (holiday-easter-etc -2 "Karfreitag") + (holiday-easter-etc 0 "Ostersonntag") + (holiday-easter-etc +1 "Ostermontag") + (holiday-easter-etc +39 "Christi Himmelfahrt") + (holiday-easter-etc +49 "Pfingstsonntag") + (holiday-easter-etc +50 "Pfingstmontag") + (holiday-easter-etc +60 "Fronleichnam") + (holiday-fixed 8 15 "Mariae Himmelfahrt") + (holiday-fixed 11 1 "Allerheiligen") + ;; (holiday-float 11 3 1 "Buss- und Bettag" 16) + (holiday-float 11 0 1 "Totensonntag" 20))) + +(use-package calendar + :ensure nil + :config + (setq calendar-latitude 49.4) + (setq calendar-longitude 11.0) + (setq calendar-location-name "Nuremberg, DE") + :custom + (european-calendar-style t) + (calendar-christian-all-holidays-flag t) + (calendar-date-style (quote iso)) + (calendar-view-diary-initially-flag t) + (calendar-week-start-day 1) + (calendar-intermonth-text + '(propertize + (format "%2d" + (car + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian + (list month day year ))))) + 'font-lock-face 'font-lock-function-name-face))) + +;; (load "bundle--email") + +(setq mml-default-sign-method "pgpmime" + mml-default-encrypt-method "pgpmime" + mml-secure-openpgp-sign-with-sender t + mail-user-agent 'message-user-agent + compose-mail-user-agent-warnings nil) + +(defun mk/sign-email () + ;; Sign an Email using the key of the sender. + (interactive) + (mml-secure-message-sign-pgpmime)) + +(defun mk/encrypt-email () + ;; Encrypt an Email using the key of the recipient. + (interactive) + (mml-secure-message-encrypt-pgpmime)) + +(defvar mk/gps-location + (eval '(let ((float-output-format "%.1f")) + (format "%s%s, %s%s" + (if (numberp calendar-latitude) + (abs calendar-latitude) + (+ (aref calendar-latitude 0) + (/ (aref calendar-latitude 1) 60.0))) + (if (numberp calendar-latitude) + (if (> calendar-latitude 0) "N" "S") + (if (eq (aref calendar-latitude 2) 'north) "N" "S")) + (if (numberp calendar-longitude) + (abs calendar-longitude) + (+ (aref calendar-longitude 0) + (/ (aref calendar-longitude 1) 60.0))) + (if (numberp calendar-longitude) + (if (> calendar-longitude 0) "E" "W") + (if (eq (aref calendar-longitude 2) 'east) "E" "W")))))) + +(defvar mk/signature-name + (concat "Cheers, " + user-full-name + " (" + calendar-location-name + ", " + mk/gps-location + ")\n")) + +(defvar mk/signature-gpg "GnuPG Key: https://meta.sr.ht/~marcuskammer.pgp\nFingerprint: 86DB 0F30 F9F1 661A 54E2 1664 C374 817B E285 268F") + +(defun mk/signature-time () + (format-time-string "Written on: %a, %d %b %Y %R %z\n")) + +(defun mk/signature () + (concat + ;;mk/signature-name + ;;(mk/signature-time) + mk/signature-gpg)) + +(use-package smtpmail + :custom + (smtpmail-smtp-server "smtp.mailbox.org") + (smtpmail-smtp-service 465) + (smtpmail-stream-type 'ssl) + (smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg"))) + +(add-hook 'message-signature-setup-hook (lambda () (setf message-signature (mk/signature)))) +;; (add-hook 'mail-send-hook #'ispell-message) +;; (add-hook 'message-send-hook #'ispell-message) +(add-hook 'message-mode-hook 'turn-on-auto-fill) + +(setq message-directory "~/Maildir") +(setq message-auto-save-directory "~/Maildir/Drafts") +(setq message-send-mail-function 'smtpmail-send-it) + +(use-package gnus + :custom + (gnus-use-full-window nil) + (gnus-summary-line-format "%O%U%R%z%d %B%(%[%4L: %-22,22f%]%) %s\n") + (gnus-summary-mode-line-format "Gnus: %p [%A / Sc:%4z] %Z") + (gnus-summary-same-subject "") + (gnus-summary-make-false-root 'adopt) + (gnus-summary-make-false-root-always nil) + (gnus-sum-thread-tree-indent " ") + (gnus-sum-thread-tree-root "* ") + (gnus-sum-thread-tree-false-root "") + (gnus-sum-thread-tree-single-indent "") + (gnus-sum-thread-tree-leaf-with-other "+-+> ") + (gnus-sum-thread-tree-vertical "|") + (gnus-sum-thread-tree-single-leaf "=--> ") + (gnus-thread-sort-functions '(gnus-thread-sort-by-subject gnus-thread-sort-by-most-recent-date)) + (gnus-large-newsgroup nil) + (gnus-inhibit-startup-message t) + (gnus-check-new-newsgroups nil) + (gnus-select-method '(nnnil "")) + (gnus-secondary-select-methods + '((nntp "news.eternal-september.org" + (nntp-open-connection-function nntp-open-ssl-stream) + (nntp-port-number 563) + (nntp-authinfo-file "~/.authinfo.gpg")) + (nnimap "mailbox" + (nnimap-address "imap.mailbox.org") + (nnimap-inbox "INBOX") + (nnimap-server-port 993) + (nnimap-stream ssl) + (nnimap-authinfo-file "~/.authinfo.gpg")))) + :config + (add-hook 'gnus-summary-prepare-hook 'gnus-summary-sort-by-most-recent-date)) + +(when (eq system-type 'gnu/linux) + (let ((mu4e-dir (expand-file-name "/usr/share/emacs/site-lisp/mu4e/"))) + (when (file-directory-p mu4e-dir) + (add-to-list 'load-path mu4e-dir) + (use-package mu4e + :ensure nil + :hook (mu4e-compose-pre . (lambda () (setf mu4e-compose-signature (mk/signature)))) + :custom + (mu4e-confirm-quit nil) + (mu4e-change-filenames-when-moving t) + (mu4e-drafts-folder "/Drafts") + (mu4e-get-mail-command "mbsync -a") + (mu4e-headers-date-format "%Y-%m-%d %H:%M") + (mu4e-refile-folder "/Archive") + (mu4e-sent-folder "/Sent") + (mu4e-trash-folder "/Trash") + (mu4e-split-view 'horizontal) + (mu4e-update-interval (* 10 60)))))) + +;; (load "bundle--org") + +(use-package org + :ensure nil + :hook ((org-mode . turn-on-auto-fill)) + :init (org-clock-persistence-insinuate) + :bind + (("C-c l" . org-store-link) + ("C-c a" . org-agenda) + ("C-c c" . org-capture) + ("C-c b" . org-switchb)) + :init + (org-babel-lob-ingest "~/.emacs.d/library-of-babel.org") + (setq org-capture-templates '()) + :custom + (abbrev-suggest t) + (org-hide-block-startup t) + (org-hide-emphasis-markers nil) + (org-default-notes-file "notes.org") + (org-insert-mode-line-in-empty-file t) + (org-adapt-indentation nil) + (org-agenda-prefix-format + '((agenda . " %i %-12:c%?-12t%-6e% s") + (todo . " %i %-12:c %-6e") + (tags . " %i %-12:c") + (search . " %i %-12:c"))) + (org-agenda-dim-blocked-tasks nil) + (org-agenda-inhibit-startup nil) + (org-agenda-span 14) + (org-agenda-start-on-weekday 1) + (org-agenda-include-diary t) + (org-clock-out-remove-zero-time-clocks t) + (org-clock-persist t) + (org-clock-rounding-minutes 30) + (org-confirm-babel-evaluate nil) + (org-duration-format (quote h:mm)) + (org-export-dispatch-use-expert-ui nil) + (org-export-default-language "en") + (org-export-with-smart-quotes t) + (org-export-with-emphasize t) + (org-export-with-special-strings t) + (org-export-with-fixed-width t) + (org-export-with-timestamps nil) + (org-export-preserve-breaks nil) + (org-export-with-sub-superscripts nil) + (org-export-with-archived-trees nil) + (org-export-with-author t) + (org-export-with-broken-links t) + (org-export-with-clocks nil) + (org-export-with-creator nil) + (org-export-with-drawers nil) + (org-export-with-date t) + (org-export-with-entities t) + (org-export-with-email t) + (org-export-with-footnotes t) + (org-export-headline-levels 3) + (org-export-with-inlinetasks nil) + (org-export-with-section-numbers t) + (org-export-with-planning nil) + (org-export-with-priority nil) + (org-export-with-properties nil) + (org-export-with-statistics-cookies nil) + (org-export-with-tags nil) + (org-export-with-tasks nil) + (org-export-with-latex t) + (org-export-time-stamp-file nil) + (org-export-with-title t) + (org-export-with-toc t) + (org-export-with-todo-keywords nil) + (org-export-with-tables t) + (org-export-date-timestamp-format "%a, %d %b %Y %R %z") + (org-export-backends '(ascii html latex md odt texinfo)) + (org-global-properties '(("EFFORT_ALL" . "0:30 1:00 2:00 3:00 5:00 8:00"))) + (org-html-doctype "html5") + (org-html-html5-fancy t) + (org-log-done (quote time)) + (org-refile-targets '((nil :maxlevel . 3))) + (org-startup-folded t) + (org-startup-truncated nil) + (org-src-fontify-natively t) + (org-src-tab-acts-natively t) + (org-src-window-setup 'other-window) + (org-time-stamp-rounding-minutes '(30 30)) + (org-todo-keywords + '((sequence "TODO" "DOING(!)" "DONE(!)") + (sequence "RECRUIT" "INTERVIEW" "QDA" "DOC" "REVIEW"))) + (org-use-property-inheritance nil) + (org-attach-store-link-p 'attached) + (org-agenda-custom-commands + '(("p" "Projects" + ((tags "PROJECT"))))) + (org-latex-packages-alist + '(("" "listings") + ("" "booktabs") + ("AUTO" "polyglossia" t ("xelatex" "lualatex")) + ("" "grffile") + ("" "unicode-math") + ("" "xcolor") + ("expansion,protrusion=true" "microtype"))) + ;; Define the process to convert Org to PDF using XeLaTeX + (org-latex-pdf-process '("latexmk -lualatex -shell-escape -quiet -f %f")) + ;; Set the compiler to XeLaTeX + (org-latex-compiler "lualatex") + (org-latex-tables-booktabs t) + (org-latex-images-centered t) + ;; Enable listings and other table-related features + (org-latex-listings t) + ;; Customize the appearance of listings (source code blocks) + (org-latex-listings-options + '(("basicstyle" "\\ttfamily\\color[rgb]{0.30, 0.34, 0.42}") ; nord3 + ("showstringspaces" "false") + ("keywordstyle" "\\color[rgb]{0.23, 0.26, 0.32}\\textbf") ; nord1 + ("commentstyle" "\\color[rgb]{0.26, 0.30, 0.37}") ; nord2 + ("stringstyle" "\\color[rgb]{0.18, 0.20, 0.25}") ; nord0 + ("frame" "single") + ("numbers" "left") + ("numbersep" "5pt") + ("numberstyle" "\\ttfamily\\color[rgb]{0.30, 0.34, 0.42}") ; nord3 + ("keepspaces" "true") + ("showspaces" "false") + ("showstringspaces" "false") + ("showtabs" "false") + ("breaklines" "true") + ("breakatwhitespace" "false") + ("tabsize" "2") + ("columns" "fullflexible"))) + (org-latex-inputenc-alist '((\"utf8\" . \"utf8x\"))) + :config + (if (eq system-type 'windows-nt) + (setq org-babel-python-command "python") + (setq org-babel-python-command "python3")) + (setq time-stamp-active t + time-stamp-start "#\\+[dD][aA][tT][eE]: [\t]*" + time-stamp-end "$" + time-stamp-inserts t + time-stamp-format "[%Y-%m-%d %H:%M]") + (add-hook 'before-save-hook 'time-stamp nil) + ;; (when (eq system-type 'windows-nt) + ;; (setq org-babel-sqlite3-command "c:/msys64/ucrt64/bin/sqlite3.exe")) + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (lisp . t) + (gnuplot . t) + (python . t) + (sqlite . t) + (shell . t) + (plantuml . t) + (C . t) + (js . t) + (scheme . t))) + ;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks. + (defun org-agenda-log-mode-colorize-block () + "Set different line spacing based on clock time duration." + (save-excursion + (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters)) + ('light (list "#d8dee9" "#e5e9f0" "#eceff4")) + ('dark (list "#bf616a" "#d08770" "#ebcb8b" "#a3be8c" "#b48ead")))) + pos + duration) + (nconc colors colors) + (goto-char (point-min)) + (while (setq pos (next-single-property-change (point) 'duration)) + (goto-char pos) + (when (and (not (equal pos (point-at-eol))) + (setq duration (org-get-at-bol 'duration))) + ;; larger duration bar height + (let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30)))) + (ov (make-overlay (point-at-bol) (1+ (point-at-eol))))) + (overlay-put ov 'face `(:background ,(car colors) :foreground "black")) + (setq colors (cdr colors)) + (overlay-put ov 'line-height line-height) + (overlay-put ov 'line-spacing (1- line-height)))))))) + (add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block)) + +;; Define custom LaTeX class with specific formatting +(with-eval-after-load 'ox-latex + (add-to-list 'org-latex-classes + '("koma-general" + "\\documentclass[a4paper,10pt,captions=tableheading,twoside=false]{scrartcl} +\\linespread{1.25} +% ~/.emacs.d/texmf/tex/latex/mycustomstyles/ +\\usepackage{komageneral}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) + + (setq org-latex-default-class "koma-general")) + +(setq org-html-protect-char-alist + '(("&" . "&") + ("<" . "<") + (">" . ">") + (":lambda:" . "λ") + (":python:" . "🐍") + (":whale:" . "🐳") + (":turtle:" . "🐢") + (":dash:" . "💨") + (":party:" . "🥳") + (":see-no-evil:" . "🙈") + (":cloud:" . "☁️") + (":abacus:" . "🧮") + (":desktop:" . "🖥️") + (":rocket:" . "🚀") + (":unicorn:" . "🦄") + (":recycling:" . "♻") + (":crystalball:" . "🔮") + (":photography:" . "📷") + (":money:" . "💵") + (":-)" . "😊") + (":-(" . "😞"))) + +(defun mk/link-to-current-task () + "Return an Org link to the current clocked-in task, if any, or prompt for manual entry." + (if (org-clock-is-active) + (with-current-buffer (marker-buffer org-clock-marker) + (save-excursion + (goto-char org-clock-marker) + (format ":TASK_ID: [[id:%s][%s]]" (org-id-get) (org-get-heading t t)))) + (let ((manual-id (read-string "Enter Task ID (leave empty if not applicable): "))) + (unless (string-empty-p manual-id) + (format ":TASK_ID: [[id:%s][Task]]\n" manual-id))))) + +;; Note Capture Template +;; Purpose: To capture general notes. These notes can optionally be linked to a currently clocked-in task. +;; Fields: Heading, optional task link, initial content, and a timestamp. +(add-to-list 'org-capture-templates + `("n" "Note" entry (file "notes.org") + ,(concat "* %? :NOTE:\n" + ":PROPERTIES:\n" + ":ID: %(org-id-new)\n" + "%(mk/link-to-current-task)" + ":END:\n" + "Entered on: %U\n"))) + +;; Task Capture Template +;; Purpose: To capture tasks and automatically assign a unique ID to each task. +;; Fields: Heading, unique ID, timestamp, and link to where the capture was made. +(add-to-list 'org-capture-templates + `("t" "Task" entry (file "agenda/tasks.org") + ,(format "* TODO %%? :TASK:\n:PROPERTIES:\n:ID: %s\n:Project: %%^{Project}\n:END:\nEntered on %%U\n" (org-id-new)))) + +;; Journal Capture Template +;; Purpose: To capture end-of-day reflections. +;; Fields: Heading, timestamp, and prompts for what went well, what could be improved, and focus for tomorrow. +(add-to-list 'org-capture-templates + '("j" "Journal" entry (file+olp+datetree "agenda/journal.org") + "* %T - End of Day Reflection :JOURNAL:\n- Was ist heute gut gelaufen?\n %?\n- Was könnte verbessert werden?\n \n- Worauf konzentriere ich mich morgen?\n " + :empty-lines 1)) + +;; Appointment Capture Template +;; Purpose: To capture important events and appointments. +;; Fields: Heading, timestamp. +(add-to-list 'org-capture-templates + '("a" "Appointment" entry (file "agenda/appt.org") + "* %? \n%^{Date}t\n")) + +;; Meeting Capture Template +;; Purpose: To capture meeting notes and automatically start a clock for time tracking. +;; Fields: Topic, timestamp, and additional notes. +(add-to-list 'org-capture-templates + '("m" "Meeting" entry (file "agenda/meetings.org") + "* %^{Topic} \n%T\n%?" + :clock-in t + :empty-lines 1)) + +;; Log Capture Template +;; Purpose: To capture activities in a chronological order and automatically start a clock for time tracking. +;; Fields: Timestamp, activity description. +(add-to-list 'org-capture-templates + '("l" "Log" entry (file+olp+datetree "logbook.org") + "* %T - %^{Activity} :LOG:\n%?" + :clock-in t + :empty-lines 1)) + +;; UTM Parameters Capture Template +;; Purpose: To capture UTM parameters for marketing tracking. +;; Fields: Campaign name, source, medium, term, and content. +(add-to-list 'org-capture-templates + '("u" "UTM Parameters" entry (file+headline "utm.org" "UTM Parameters") + "* %^{Campaign Name}\n:PROPERTIES:\n:Source: %^{utm_source}\n:Medium: %^{utm_medium}\n:Term: %^{utm_term}\n:Content: %^{utm_content}\n:END:\n")) + +;; Bookmark Capture Template +;; Purpose: To capture bookmarks with tags and a timestamp. +;; Fields: URL, tags, timestamp. +(add-to-list 'org-capture-templates + '("b" "Bookmark" table-line (file+headline "bookmarks.org" "Bookmarks") + "| %^{URL} | %^{Tags} | %u |" :prepend t)) + +;; Code Snippet Capture Template +;; Purpose: To capture code snippets and specify the programming language. +;; Fields: Code snippet, language specification. +(add-to-list 'org-capture-templates + '("c" "Code Snippet" entry (file+headline "code.org" "Snippets") + "* %?\n#+begin_src %^{language}\n%i\n#+end_src")) + +;; Capture Templates for Interviews +;; +;; The following capture templates are designed to facilitate the collection +;; of questions and insights for user interviews. Given the importance of +;; user-centered design in experience architecture, these templates aim to +;; streamline the preparation process for interviews. + +;; Interview Sub-menu +;; +;; This entry serves as a sub-menu for all interview-related capture templates. +(add-to-list 'org-capture-templates + '("i" "Interviews")) + +;; How Might We (HMW) Template +;; +;; This template is designed to capture "How Might We" questions that are often +;; used to frame problems and opportunities in user interviews. These questions +;; can be crucial for guiding the interview in a direction that yields +;; actionable insights. +(add-to-list 'org-capture-templates + '("ih" "How Might We" entry (file+headline "interviews.org" "HMW Questions") + "* WKW/HMW %? :HMW:\n%U\n:PROPERTIES:\n:Interviewee: %^{Interviewee}\n:Context: %^{Context}\n:END:")) + +;; Interview Question Template +;; +;; Use this template to quickly capture questions that you intend to ask during +;; user interviews. The template prompts for the topic of the interview and +;; the project it is associated with, allowing for easy categorization and +;; retrieval later. +(add-to-list 'org-capture-templates + '("iq" "Interview Question" entry (file+headline "interviews.org" "Interview Questions") + "* %^{Interview Topic} :INTERVIEW:\n:PROPERTIES:\n:Project: %^{Project Name}\n:Date: %T\n:END:\n- %?\n")) + +;; User Interview Quotes Capture Template +;; Purpose: To capture important quotes from user interviews. +;; Fields: Quote, Interviewee, Timestamp in Video, Project, Context +(add-to-list 'org-capture-templates + '("io" "Quote from User Interview" entry (file+headline "interviews.org" "Quotes") + "* %^{Quote} :QUOTE:\n:PROPERTIES:\n:Interviewee: %^{Interviewee}\n:Timestamp: %^{Timestamp in Video}\n:Project: %^{Project}\n:Context: %^{Context}\n:END:\n")) + +;; Capture Templates for Project Management and Achievements +;; +;; These templates are designed to facilitate the tracking of project details +;; and individual achievements. Given the focus on agile methodologies and +;; continuous improvement, these templates aim to provide a structured way +;; to capture essential information. + +;; Project Template +;; +;; This template captures the essential details of a new project. It prompts +;; for the project name, start date, and end date, and provides sections for +;; outlining the project's objectives and challenges. Each project is assigned +;; a unique ID for easy referencing. +(add-to-list 'org-capture-templates + `("p" "Project" entry (file "agenda/projects.org") + ,(format "* %%^{Project Name} :PROJECT:\n:PROPERTIES:\n:ID: %s\n:Start Date: %%T\n:End Date: %%^{End Date}\n:END:\n** Objective\n%%?\n** Challenges\n- [ ] %%^{Challenge 1}\n- [ ] %%^{Challenge 2}\n" (org-id-new)))) + +;; Achievement Template +;; +;; This template is designed to capture individual achievements. It prompts for +;; the title of the achievement, the project it is associated with, and the date. +;; Additionally, it provides fields for describing the achievement, its impact, +;; and any associated tasks. This can be particularly useful for end-of-year +;; reviews or for maintaining a portfolio of accomplishments. +(add-to-list 'org-capture-templates + `("v" "Achievement" entry (file+olp+datetree "achievements.org") + ,(concat "* %^{Achievement Title} :ACHIEVEMENT:\n" + ":PROPERTIES:\n" + ":Project: %^{Project}\n" + ":Date: %T\n" + ":END:\n" + "- Description: %?\n" + "- Impact: %^{Impact}\n" + "- Associated Tasks: %^{Tasks}\n"))) + +(add-to-list 'org-capture-templates + '("A" "Accounting")) + +;; Expense Tracking +;; Purpose: To capture individual expenses for accounting in a table. +;; Fields: Amount, Category, Note, Date +(add-to-list 'org-capture-templates + '("Ae" "Expense" table-line (file+headline "accounting.org" "Expenses") + "| %U | %^{Amount} | %^{Category} | %? |")) + +;; Income Tracking +;; Purpose: To capture instances of income for accounting in a table. +;; Fields: Amount, Source, Date +(add-to-list 'org-capture-templates + '("Ai" "Income" table-line (file+headline "accounting.org" "Income") + "| %U | %^{Amount} | %^{Source} | %? |")) + +;; Invoice Tracking +;; Purpose: To capture invoices sent for services or products in a table. +;; Fields: Client, Amount, Due Date +(add-to-list 'org-capture-templates + '("AI" "Invoice" table-line (file+headline "accounting.org" "Invoices") + "| %T | %^{Client} | %^{Amount} | %^{Due Date} | %? |")) + +;; Budget Planning +;; Purpose: To capture budget plans for personal or business accounting in a table. +;; Fields: Estimated Income, Estimated Expenses +(add-to-list 'org-capture-templates + `("Ab" "Budget" table-line (file+headline "accounting.org" "Budget") + ,(concat "| " (format-time-string "%Y") " | " (format-time-string "%B") " | %^{Estimated Income} | %^{Estimated Expenses} | %? |"))) + +;; Investment Tracking +;; Purpose: To capture investment details for accounting in a table. +;; Fields: Type, Amount, Notes +(add-to-list 'org-capture-templates + '("Av" "Investment" table-line (file+headline "accounting.org" "Investments") + "| %U | %^{Type} | %^{Amount} | %? |")) + +;; Stock Recommendation Capture Template +;; Purpose: To capture stock recommendations for potential investment. +;; Fields: Stock Symbol, Recommender, Notes, Date +(add-to-list 'org-capture-templates + '("s" "Stock Recommendation" entry (file+headline "stocks.org" "Stock Recommendations") + "* %^{Stock Name} :STOCK:\n:PROPERTIES:\n:Date: %T\n:WKN: %^{WKN}\n:ISIN: %^{ISIN}\n:END:\n%?")) + +(add-to-list 'org-capture-templates + '("B" "Bücherliste" table-line + (file+headline "books.org" "Meine Bücherliste") + "| %^{Buchtitel} | %^{Autor} | %^{Status||Geplant|In Bearbeitung|Fertig} | %U |" :kill-buffer t)) + +(require 'request) + +(defun fetch-gitlab-issue-and-capture () + (interactive) + (let ((project-id (read-string "Enter GitLab Project ID: ")) + (issue-id (read-string "Enter GitLab Issue ID: ")) + (gitlab-token (getenv "GITLAB_TOKEN"))) + (unless gitlab-token + (error "GITLAB_TOKEN environment variable not set")) + (request + (format "https://code.siemens.com/api/v4/projects/%s/issues/%s" project-id issue-id) + :headers `(("Private-Token" . ,gitlab-token)) + :parser 'json-read + :success (cl-function + (lambda (&key data &allow-other-keys) + (org-capture nil "g") + (let ((title (assoc-default 'title data)) + (description (assoc-default 'description data))) + (insert (format "%s\n%s" title description)))))))) + +(add-to-list 'org-capture-templates + '("g" "GitLab Issue" entry (file "gitlab_issues.org") + "* %?")) + +;; (global-set-key (kbd "C-c g") 'fetch-gitlab-issue-and-capture) + +(use-package org-roam + :after org + :init + (setq org-roam-db-autosync-mode t) + (setq org-roam-v2-ack t) + (setq org-roam-db-location "~/org-roam.db") + (require 'org-roam-dailies) + :bind (("C-c r l" . org-roam-buffer-toggle) + ("C-c r f" . org-roam-node-find) + ("C-c r g" . org-roam-graph) + ("C-c r i" . org-roam-node-insert) + ("C-c r c" . org-roam-capture) + ("C-c r j" . org-roam-dailies-map) + :map org-roam-dailies-map + ("t" . org-roam-dailies-capture-today) + ("y" . org-roam-dailies-capture-yesterday) + ("T" . org-roam-dailies-capture-tomorrow) + :map org-mode-map + ("C-M-i" . completion-at-point)) + :custom + (org-roam-completion-everywhere nil) + (org-roam-dailies-capture-templates + '(("d" "default" entry "* %<%R> %?" + :if-new (file+head "%<%F>.org" "#+title: %<%F>\n")))) + (org-roam-capture-templates + '(("d" "default" plain + "%?" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("r" "Research" plain + "* Hypothesis:\n%?\n* Methodology:\n* Results:\n* Conclusions:\n" + :if-new (file+head "research/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("m" "Meeting" plain + "* Participants:\n%?\n* Discussion topics:\n* Action points:\n" + :if-new (file+head "meetings/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("p" "Project" plain + "* Goals:\n%?\n* Milestones:\n* Resources:\n" + :if-new (file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("l" "Literature" plain + "* Authors:\n%?\n* Main theses:\n* Own thoughts:\n" + :if-new (file+head "literature/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t)))) + +(use-package org-tree-slide + :bind ("" . org-tree-slide-mode) + :custom + (org-image-actual-width nil)) + +(use-package org-web-tools + :defer t + :custom (org-web-tools-pandoc-sleep-time 0.4)) + +;; (use-package ob-go +;; :after org) + +(use-package ox-reveal + :after org) + +;; (use-package ox-pandoc +;; :after org +;; :custom +;; (org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))) + +;; (defun me/write-readme-md-on-save () +;; ;; when README.org, also write README.md on save +;; (when (string-match "README" (buffer-file-name)) +;; (make-local-variable 'after-save-hook) +;; (add-hook 'after-save-hook +;; (lambda () (let ((outfile (org-export-output-file-name ".md"))) +;; (org-export-to-file 'md outfile)))))) +;; (add-hook 'org-mode-hook 'me/write-readme-md-on-save) + +;; (use-package ob-go +;; :after org +;; :config +;; (append '((go . t)) org-babel-load-languages)) + +(use-package ob-http + :after org + :config + (append '((http . t)) org-babel-load-languages)) + +;; (use-package ob-racket +;; :after org +;; :pin manual +;; :config +;; (append '((racket . t) (scribble . t)) org-babel-load-languages)) + +;; (use-package ox-rss +;; :after org) + +;; (use-package ob-restclient +;; :after org +;; :config +;; (append '((restclient . t)) org-babel-load-languages)) + +(defun mk/extract-headlines-by-tag (tag) + "Extract headlines and their content from current buffer by TAG." + (interactive "sEnter tag: ") + (save-excursion + (let ((result-buffer (generate-new-buffer (concat "*Extracted Headlines " tag "*")))) + (with-current-buffer result-buffer + (org-mode) + (insert "* Extracted Headlines by Tag: " tag " *\n\n")) + (org-element-map (org-element-parse-buffer) 'headline + (lambda (headline) + (when (member tag (org-element-property :tags headline)) + (with-current-buffer result-buffer + (insert (org-element-interpret-data headline) "\n"))))) + (pop-to-buffer result-buffer)))) + +;; (load "bundle--mk") + +(defvar mk/useful-websites + '(("https://regexr.com/" regex debug) + ("https://regex101.com/" regex debug) + ("https://www.regextester.com/" regex debug) + ("https://extendsclass.com/regex-tester.html#python" regex debug) + ("https://everything.curl.dev/" curl tool))) + +(defvar mk/mirror-website + "Locally mirror a website using `wget -mkEpnp `") + +(defvar mk/useful-regex + '(("match any word or space that precedes the :" . "[\\w\\s]+:") + ("search for anything in square brackets" . "\\[.*\\]") + ("upper and lowercase English alphabet" . "[A-Za-z]+") + ("numbers from 0 to 9" . "[0-9]") + ("upper and lowercase English alphabet, - and ." . "[A-Za-z\\-\\.]+") + ("a, - and z" . "(a-z)") + ("spaces or a comma" . "(\\s+|,)") + ("find hashtags" . "#\\w+") + ("matches both mentions (@) and hashtags" . "([@|#]\\w+)") + ("email regex" . "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$") + ("matching decimal numbers" . "-?\\d+(\\.\\d*)?") + ("matching urls" . "(?:http|https|ftp|mailto|file|data|irc):\\/\\/[A-Za-z0-9\\-]{0,63}(\\.[A-Za-z0-9\\-]{0,63})+(:\\d{1,4})?\\/*(\\/*[A-Za-z0-9\\-._]+\\/*)*(\\?.*)?(#.*)?") + ("matching dates yyyy/mm/dd" . "^\\d{4}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$") + ("matching dates mm/dd/yyyy" . "^(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/\\d{4}$") + ("matching dates dd/mm/yyyy" . "^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\\d{4}$") + ("matching HTML" . "<.+>") + ("matching specific tags" . "") + ("ISO 8601 Date Format (YYYY-MM-DD)" . "\\([0-9]{4}\\)-\\([0-1][0-9]\\)-\\([0-3][0-9]\\)"))) + +(defun mk/split-windows-horizontal (count-windows) + "Split windows horizontal by equal width." + (interactive "nHow many splits? ") + (delete-other-windows) + (let ((width (/ (window-total-width) count-windows))) + (dotimes (i (1- count-windows)) + (split-window-right (- width))))) + +(defun mk/split-windows-vertical (count-windows) + "Split windows vertical by equal width." + (interactive "nHow many splits? ") + (delete-other-windows) + (let ((height (/ (window-total-height) count-windows))) + (dotimes (i (1- count-windows)) + (split-window-below (- height))))) + +(defun mk/split-h3 () + (interactive) + (mk/split-windows-horizontal 3)) + +(defun mk/split-v3 () + (interactive) + (mk/split-windows-vertical 3)) + +;; Set transparency of emacs +(defun transparency (value) + "Sets the transparency of the frame window. 0=transparent/100=opaque" + (interactive "nTransparency Value 0 - 100 opaque: ") + (set-frame-parameter (selected-frame) 'alpha value)) + +(defun mk/show-agenda-list () + (if (display-graphic-p) + (add-hook 'after-init-hook (lambda () (org-agenda-list) (me/split-h3))) + (org-agenda-list))) + +(defun mk/list-files (folder suffix) + (let ((regexp (concat "\\." suffix "$"))) + (directory-files folder nil regexp))) + +(defun mk/build-file-suffix ()) + +(defun mk/copy-files (src-dir dst-dir suffix) + (let ((src-files '()) + (src-dir (expand-file-name src-dir)) + (dst-dir (expand-file-name dst-dir))) + (dolist (file (mk/list-files src-dir suffix) src-files) + (let ((src-file (expand-file-name (concat src-dir "/" file))) + (dst-file (expand-file-name (concat dst-dir "/" file)))) + (add-to-list 'src-files src-file) + (copy-file src-file dst-file t))))) + +(defun mk/delete-files (lst) + (dolist (file lst) + (delete-file file t))) + +(defun mk/get-current-time-formatted () + (concat "#+DATE: " + (format "[%s]" (format-time-string "%Y-%m-%d %R" (current-time))))) + +(defun mk/generate-unique-id () + (interactive) + (let ((random-number-1 (random 9999)) + (random-number-2 (random 9999))) + (let ((unique-id (format "DE-%04d-%04d" random-number-1 random-number-2))) + (message "ID: %s" unique-id) unique-id))) + +(defmacro mk/open-html-page (name path buffer-name) + "Make interactive functions to call important docs" + `(defun ,name () + (interactive) + (eww (concat "file://" + (and (eq system-type 'windows-nt) + "/") + (expand-file-name ,path))) + (rename-buffer ,buffer-name))) + +(mk/open-html-page mk/clsite-clm + "~/cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node1.html" + "*mk/clsite-clm*") +(mk/open-html-page mk/clsite-pcl + "~/cl-sites/gigamonkeys.com/book/index.html" + "*mk/clsite-pcl*") +(mk/open-html-page mk/clsite-clcb + "~/cl-sites/lispcookbook.github.io/cl-cookbook/index.html" + "*mk/clsite-clcb*") +(mk/open-html-page mk/clsite-sqlite + "~/cl-sites/sqlite-doc-3440000/index.html" + "*mk/clsite-sqlite*") +(mk/open-html-page mk/clsite-asdf + "~/cl-sites/asdf.common-lisp.dev/index.html" + "*mk/clsite-asdf*") +(mk/open-html-page mk/clsite-lisp-docs + "~/cl-sites/lisp-docs.github.io/index.html" + "*mk/clsite-lisp-docs*") +(mk/open-html-page mk/clsite-bgnet + "~/cl-sites/bgnet/index.html" + "*mk/clsite-bgnet*") +(mk/open-html-page mk/clsite-tbnl + "~/cl-sites/edicl.github.io/hunchentoot/index.html" + "*mk/clsite-tbnl*") + +(defun mk/wget-mirror-site (url) + "Use wget to mirror a website for offline use. Takes a URL as argument." + (interactive "sEnter the URL to mirror: ") + (let ((cmd (format "wget --mirror --convert-links --adjust-extension --page-requisites --no-parent %s" url))) + (async-shell-command cmd))) + +(defun mk/get-auth-source-key (host key) + "Retrieve the API key using 'auth-source'." + (require 'auth-source) + (let* ((auth-source-creation-prompts + '((secret . (format "API key for %s@%s: " key host)))) + (found (nth 0 (auth-source-search + :max 1 + :host host + :user key + :require '(:secret) + :create t))) + (secret (plist-get found :secret))) + (if (functionp secret) + (funcall secret) + secret))) + +;; (load "bundle--linux") + +(defvar linux-filesystem-alist + '(( "/" . "Root directory, the base of the filesystem hierarchy") + ("/bin" . "Essential command binaries, needed for booting") + ("/boot" . "Bootloader files, kernel, and other files needed during booting") + ("/dev" . "Device files representing hardware components") + ("/etc" . "System-wide configuration files") + ("/home" . "User home directories") + ("/lib" . "Shared libraries and kernel modules") + ("/media" . "Mount points for removable media like CDs and USBs") + ("/mnt" . "Temporary mount points for filesystems") + ("/opt" . "Optional application software packages") + ("/proc" . "Virtual filesystem providing info about processes and system") + ("/root" . "Home directory for the root user") + ("/sbin" . "Essential system binaries, usually for the root user") + ("/srv" . "Data directories for services like HTTP, FTP, etc.") + ("/sys" . "Virtual filesystem for kernel objects") + ("/tmp" . "Temporary files, cleared on reboot") + ("/usr" . "User binaries, documentation, libraries, etc.") + ("/var" . "Variable files like logs, databases, etc.")) + "Alist mapping Linux directories to their descriptions.") + +(defun describe-linux-directory (dirname) + "Describe the purpose of a Linux directory. +Takes DIRNAME as an argument and prints its description." + (interactive "sEnter Linux directory name (e.g., /bin): ") + (let ((description (assoc-default dirname linux-filesystem-alist))) + (if description + (message "%s: %s" dirname description) + (message "Unknown directory: %s" dirname)))) + +(defvar bash-regex-alist + '(("empty line" . "^$") + ("backslash" . "\\\\") + ("line starts with a dot" . "^\\.") + ("line ends with a dot" . "\\.$") + ("line starts with a dollar sign" . "^\\$") + ("line starts with a caret" . "^\\^") + ("left square bracket" . "\\[") + ("right square bracket" . "\\]") + ("entire line" . "^.*$") + ("any alphanumeric character" . "[a-zA-Z0-9]") + ("IP Address" . "\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\b") + ("email" . "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}") + ("hex color code" . "#[a-fA-F0-9]{6}") + ("date in yyyy-mm-dd" . "\\b\\d{4}-\\d{2}-\\d{2}\\b") + ("time in hh:mm:ss" . "\\b\\d{2}:\\d{2}:\\d{2}\\b") + ("words without vowels" . "\\b[^aeiou\s]+\\b")) + "Alist mapping Bash regular expressions to their descriptions.") + +(defun describe-bash-regex (regex) + "Describe the purpose of a Bash regular expression. +Takes REGEX as an argument and prints its description." + (interactive "sEnter Bash regex (e.g., empty line): ") + (let ((description (assoc-default regex bash-regex-alist))) + (if description + (message "%s: %s" regex description) + (message "Unknown regular expression: %s" regex)))) + +(defvar linux-process-commands-alist + '(("ps" . "Shows a snapshot of the current processes") + ("top" . "Displays dynamic real-time view of system stats and processes") + ("htop" . "An interactive process viewer, similar to top but more feature-rich") + ("pgrep" . "Looks up processes based on name and other attributes") + ("pstree" . "Displays the process tree in a tree-like diagram") + ("ps -e" . "Lists all the processes running on the system") + ("ps aux" . "Displays detailed information about all processes") + ("kill" . "Terminates processes by sending signals") + ("killall" . "Kills all processes that match the given name") + ("pkill" . "Send signals to processes based on name and other attributes")) + "Alist mapping Linux process-checking commands to their descriptions.") + +(defun describe-linux-process-command (command) + "Describe the purpose of a Linux process-checking command. +Takes COMMAND as an argument and prints its description." + (interactive "sEnter Linux process command (e.g., ps): ") + (let ((description (assoc-default command linux-process-commands-alist))) + (if description + (message "%s: %s" command description) + (message "Unknown command: %s" command)))) + +(defvar linux-logfiles-alist + '(("/var/log/syslog" . "System messages, including the messages that are logged during system startup") + ("/var/log/auth.log" . "Security/authorization information, including user logins and authentication") + ("/var/log/kern.log" . "Kernel logs") + ("/var/log/cron.log" . "Logs for cron jobs") + ("/var/log/messages" . "General system activity logs") + ("/var/log/boot.log" . "System boot log") + ("/var/log/daemon.log" . "Background daemon log messages") + ("/var/log/dpkg.log" . "Logs for package installations and removals") + ("/var/log/mail.log" . "Mail server logs") + ("/var/log/user.log" . "User-level messages")) + "Alist mapping Linux log files to their descriptions.") + +(defun describe-linux-logfile (logfile) + "Describe the purpose of a Linux log file. +Takes LOGFILE as an argument and prints its description." + (interactive "sEnter Linux log file path (e.g., /var/log/syslog): ") + (let ((description (assoc-default logfile linux-logfiles-alist))) + (if description + (message "%s: %s" logfile description) + (message "Unknown log file: %s" logfile)))) + +(defvar linux-basic-commands-alist + '(("list directory contents" . "ls") + ("change directory" . "cd") + ("move or rename files" . "mv") + ("copy files" . "cp") + ("remove files or directories" . "rm") + ("print working directory" . "pwd") + ("display variable value" . "echo") + ("create an empty file" . "touch") + ("change file permissions" . "chmod") + ("change file ownership" . "chown")) + "Alist mapping basic Linux command descriptions to their commands.") + +(defun describe-basic-linux-command (command) + "Describe the purpose of a basic Linux command. +Takes COMMAND as an argument and prints its description." + (interactive "sEnter basic Linux command (e.g., ls): ") + (let ((description (assoc-default command linux-basic-commands-alist))) + (if description + (message "%s: %s" command description) + (message "Unknown command: %s" command)))) + +(defvar chown-options-alist + '(("-R" . "Operate on files and directories recursively") + ("--from" . "Change the owner and/or group of each file only if its current owner and/or group match specified values") + ("--no-dereference" . "Affect symbolic links instead of the files they point to") + ("--preserve-root" . "Fail when attempting to operate recursively on '/'") + ("--reference" . "Use owner and group of a reference file") + ("-c" . "Report when a change is made") + ("-f" . "Suppress most error messages") + ("-v" . "Output a diagnostic for every file processed")) + "Alist mapping chown command options to their descriptions.") + +(defun describe-chown-option (option) + "Describe the purpose of a chown option. +Takes OPTION as an argument and prints its description." + (interactive "sEnter chown option (e.g., -R): ") + (let ((description (assoc-default option chown-options-alist))) + (if description + (message "%s: %s" option description) + (message "Unknown chown option: %s" option)))) + +(defvar chmod-options-alist + '(("-R" . "Operate on files and directories recursively") + ("--preserve-root" . "Avoid operating recursively on '/'") + ("-c" . "Report when a change is made") + ("-f" . "Suppress most error messages") + ("-v" . "Output a diagnostic for every file processed") + ("--reference" . "Use mode of a reference file") + ("-w" . "Remove write permission") + ("-x" . "Remove execute permission") + ("-u" . "Set user ID on execution") + ("-g" . "Set group ID on execution")) + "Alist mapping chmod command options to their descriptions.") + +(defun describe-chmod-option (option) + "Describe the purpose of a chmod option. +Takes OPTION as an argument and prints its description." + (interactive "sEnter chmod option (e.g., -R): ") + (let ((description (assoc-default option chmod-options-alist))) + (if description + (message "%s: %s" option description) + (message "Unknown chmod option: %s" option)))) + +(defvar ssh-use-cases-alist + '(("remote login" . "ssh user@host") + ("run command" . "ssh user@host 'command'") + ("file transfer" . "scp file.txt user@host:/path/") + ("secure ftp" . "sftp user@host") + ("port forwarding" . "ssh -L local_port:remote_host:remote_port user@host") + ("dynamic port forwarding" . "ssh -D port user@host") + ("remote port forwarding" . "ssh -R remote_port:local_host:local_port user@host") + ("tunneling" . "ssh -L local_port:remote_host:remote_port user@host -f -N") + ("agent forwarding" . "ssh -A user@host") + ("ssh multiplexing" . "ssh -M -S /tmp/ssh_socket user@host; ssh -S /tmp/ssh_socket user@host")) + "Alist mapping SSH use cases to their corresponding commands.") + +(defun describe-ssh-use-case (use-case) + "Describe the SSH command for a given use case." + (interactive "sEnter the SSH use case: ") + (let ((command (assoc-default use-case ssh-use-cases-alist))) + (if command + (message "Command for %s: %s" use-case command) + (message "Use case not found")))) + +(defvar mk/remote-*host-aliases* + '(("website" . "marcus@www.marcuskammer.dev") + ("survey" . "cl@survey.metalisp.dev") + ("pihole" . "ubuntu@pi-hole.fritz.box")) + "Alist mapping friendly host names to actual SSH-compatible host strings.") + +(defun mk/remote--get-real-host (alias) + "Lookup the real host name based on a given ALIAS." + (or (cdr (assoc alias mk/remote-*host-aliases*)) alias)) + +(defun mk/remote--systemctl-service (alias service command) + "Execute a systemctl COMMAND on a systemd SERVICE on a remote host identified by ALIAS. + +ALIAS is a string that specifies the remote host; it can be an +alias defined in `mk/remote-*host-aliases*'. + +SERVICE is the name of the systemd service to operate on. + +COMMAND is the systemctl command to execute on the service (e.g., +'start', 'stop', 'status')." + (let* ((host (mk/remote--get-real-host alias)) + (buffer (generate-new-buffer (format "*%s-%s-%s*" alias service command))) + (process-name (format "systemctl-%s-%s" command service))) + (make-process :name process-name + :buffer buffer + :command `("ssh" ,host "sudo" "systemctl" ,command ,service) + :sentinel (lambda (process signal) + (when (memq (process-status process) '(exit signal)) + (message "Process: %s %s" process signal)))))) + +(defmacro mk/remote-define-systemctl-functions (&rest actions) + "Dynamically create functions to interact with systemd services on a remote host. + +Each function will be named `mk/remote-ACTION-service', where +ACTION is one of the symbols in ACTIONS. The functions will take +an ALIAS and SERVICE as arguments and call +`mk/remote--systemctl-service' accordingly." + `(progn + ,@(mapcar + (lambda (action) + `(defun ,(intern (format "mk/remote-%s-service" action)) (alias service) + (interactive "sEnter the host alias or name: \nsEnter the service name: ") + (mk/remote--systemctl-service alias service ,(symbol-name action)))) + actions))) + +(mk/remote-define-systemctl-functions start stop status) + +(defun mk/remote--log (alias service filename) + (let* ((filepath (concat "/var/log/" service (unless (string-empty-p filename) (concat "/" filename)))) + (host (mk/remote--get-real-host alias)) + (buffer (generate-new-buffer (format "*%s-%s-%s*" alias service filename))) + (process-name (format "log-%s-%s" service filename))) + (make-process :name process-name + :buffer buffer + :command `("ssh" ,host "sudo" "tail -f" ,filepath) + :sentinel (lambda (process signal) + (when (memq (process-status process) '(exit signal)) + (message "Process: %s %s" process signal)))))) + +(defmacro mk/define-remote-log-function (alias service &optional filename) + "Define a function to asynchronously tail a remote log file." + (let ((fname (if filename filename ""))) + `(defun ,(intern (format "mk/remote-log-%s-%s-%s" alias service filename)) () + ,(format "Tail the remote log file: %s" filename) + (interactive) + (mk/remote--log ,alias ,service ,fname)))) + +(mk/define-remote-log-function "website" "nginx" "access.csv") +(mk/define-remote-log-function "website" "nginx" "error.log") +(mk/define-remote-log-function "website" "syslog") +(mk/define-remote-log-function "survey" "nginx" "access.csv") +(mk/define-remote-log-function "survey" "syslog") +(mk/define-remote-log-function "pihole" "pihole" "pihole.log")