minor improvements master
authorIan Kelling <iank@fsf.org>
Wed, 15 Apr 2026 19:46:46 +0000 (15:46 -0400)
committerIan Kelling <iank@fsf.org>
Wed, 15 Apr 2026 19:46:46 +0000 (15:46 -0400)
init.el

diff --git a/init.el b/init.el
index 3f65b8a7298f79680e4dd1f9f38198662ddeb65d..4b4ba3a845166a833e9fbf11d7789844d5dc82b2 100644 (file)
--- a/init.el
+++ b/init.el
 ;; https://emacs.stackexchange.com/a/70478
 (when (boundp 'native-comp-eln-load-path)
   (startup-redirect-eln-cache "../.emacs-eln-cache"))
 ;; https://emacs.stackexchange.com/a/70478
 (when (boundp 'native-comp-eln-load-path)
   (startup-redirect-eln-cache "../.emacs-eln-cache"))
-
+;; something is broken, it keeps compiling like 30 packages every time emacs starts. Here are the first few:
+;; Compiling /usr/local/share/emacs/31.0.50/lisp/emacs-lisp/pcase.el.gz...
+;; uncompressing pcase.el.gz...
+;; uncompressing pcase.el.gz...done
+;; Compiling /usr/local/share/emacs/31.0.50/lisp/emacs-lisp/rx.el.gz...
+;; uncompressing rx.el.gz...
+;; uncompressing rx.el.gz...done
+;; Compiling /usr/local/share/emacs/31.0.50/lisp/info.el.gz...
+;; uncompressing info.el.gz...
+;; uncompressing info.el.gz...done
+;;
+;; troubleshooting. this is nil, but dies in init.el due to the function not being loaded yet it seems.
+;;(message "compile pcase: %s" (native--compile-async-skip-p "/usr/local/share/emacs/31.0.50/lisp/emacs-lisp/pcase.el.gz" nil nil))
+;; comp-native-version-dir: value is "31.0.50-f9033924"
+;;
+;; a file near the end of the list we can test on sometime:
+;;/usr/local/share/emacs/31.0.50/lisp/emacs-lisp/cl-lib.el.gz
+;;
+;; It did not help if I started with emacs -Q: then it just compiled
+;; into ~/.emacs.d/eln-cache. To keep that directory empty, I just
+;; removed it , touched it, then chmod 400 on it.
+;;
+;; i tested the 2 solutions here: https://emacs.stackexchange.com/questions/82010/why-is-emacs-recompiling-some-packages-on-every-startup, neither one worked.
+;;
+;;For now, its like 30 seconds of compilation that i'm going to ignore.
 
 ;; speed up init https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little_known_steps_to_speed_up_emacs_start/
 ;;
 ;; Todo: look over this for good ideas:
 ;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
 
 
 ;; speed up init https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little_known_steps_to_speed_up_emacs_start/
 ;;
 ;; Todo: look over this for good ideas:
 ;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
 
+
+;;;; note: this optimization broke auto-compression-mode:
+;; (setq file-name-handler-alist nil)
+;; (add-hook 'after-init-hook
+;;           #'(lambda ()
+;;               (setq file-name-handler-alist file-name-handler-alist-old)))
+;; (defvar file-name-handler-alist-old file-name-handler-alist)
+
+
 (setq
 (setq
- file-name-handler-alist nil
  message-log-max 16384
  gc-cons-threshold 100000000 ;; 100 mb
  ;; package-enable-at-startup nil
  gc-cons-percentage 0.6
  auto-window-vscroll nil)
 
  message-log-max 16384
  gc-cons-threshold 100000000 ;; 100 mb
  ;; package-enable-at-startup nil
  gc-cons-percentage 0.6
  auto-window-vscroll nil)
 
-(add-hook 'after-init-hook
-          #'(lambda ()
-              (setq file-name-handler-alist file-name-handler-alist-old)))
-(defvar file-name-handler-alist-old file-name-handler-alist)
-
 ;; 2019-6-26, 1.26s
 ;; ; to profile init:
 ;; ; uncomment the following block
 ;; 2019-6-26, 1.26s
 ;; ; to profile init:
 ;; ; uncomment the following block
@@ -573,9 +600,10 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 (defun toggle-night ()
   (interactive)
   (cond  ((equal (car custom-enabled-themes) 'naquadah)
 (defun toggle-night ()
   (interactive)
   (cond  ((equal (car custom-enabled-themes) 'naquadah)
+          ;; (when (and (boundp 'global-hide-mode-line-mode) global-hide-mode-line-mode)
+          ;;   (global-hide-mode-line-mode -1))
           (override-theme 'ef-light))
          (t
           (override-theme 'ef-light))
          (t
-          (global-hide-mode-line-mode -1)
           (override-theme 'naquadah))))
 
 
           (override-theme 'naquadah))))
 
 
@@ -746,6 +774,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 
 ;; copied from dired-x info manual
 (with-eval-after-load 'dired
 
 ;; copied from dired-x info manual
 (with-eval-after-load 'dired
+  (setq dired-x-hands-off-my-keys nil)
   (require 'dired-x)
   ;; use e instead for find file. i would like
   ;; dired-do-async-shell-command, except it pops open some async
   (require 'dired-x)
   ;; use e instead for find file. i would like
   ;; dired-do-async-shell-command, except it pops open some async
@@ -900,6 +929,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 
 ;;; modes with little configuration needed
 
 
 ;;; modes with little configuration needed
 
+(add-to-list 'auto-mode-alist '("\\.curlrc\\'" . conf-mode))
+
+
 (setq sqlformat-command 'sqlfluff)
 
 (custom-set-variables
 (setq sqlformat-command 'sqlfluff)
 
 (custom-set-variables
@@ -954,10 +986,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 ;; and a function
 ;; inspired by mu4e info manual, search for mu4e-compose-pre-hook.
 (load-file "/p/c/plisp/mymu4e.el")
 ;; and a function
 ;; inspired by mu4e info manual, search for mu4e-compose-pre-hook.
 (load-file "/p/c/plisp/mymu4e.el")
+(load-file "/p/c/plisp/help-fns+.el")
 
 (add-to-list 'load-path "/p/c/plisp")
 (use-package myidir
 
 (add-to-list 'load-path "/p/c/plisp")
 (use-package myidir
-  :commands (myidir rthumb-new myidir-use-batch-input))
+  :commands (myidir rthumb-new myidir-use-batch-input pg-idir))
 
 
 (when (file-exists-p "/a/h/iank-mod.el")
 
 
 (when (file-exists-p "/a/h/iank-mod.el")
@@ -1014,7 +1047,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 (delete-selection-mode t)
 
 ;; Transparently open compressed files
 (delete-selection-mode t)
 
 ;; Transparently open compressed files
-(auto-compression-mode t)
+(auto-compression-mode 1)
 
 ;; dot mode, repeats last action
 (require 'dot-mode)
 
 ;; dot mode, repeats last action
 (require 'dot-mode)
@@ -1077,10 +1110,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
         perl-brace-imaginary-offset         0
         perl-label-offset                  -2
         )
         perl-brace-imaginary-offset         0
         perl-label-offset                  -2
         )
-  (define-key perl-mode-map (kbd "C-\\") 'perl-iank-regex)
-
-  )
+  (define-key perl-mode-map (kbd "C-\\") 'perl-iank-regex))
 (add-hook 'perl-mode-hook 'perl-mode-defaults)
 (add-hook 'perl-mode-hook 'perl-mode-defaults)
+;; cperl-mode has more features, replace perl-mode with it.
+;;(fset 'perl-mode 'cperl-mode)
+
 
 
 ;; in perl, sometimes a missing semicolon will cause the
 
 
 ;; in perl, sometimes a missing semicolon will cause the
@@ -1366,7 +1400,13 @@ Go to the next directory based on where the cursor is."
 ;; I have 2 sql formatters. I prefer the format of sqlfluff, but it is
 ;; very picky and will refuse to work sometimes. So, here is a function
 ;; to more easily use the other one.
 ;; I have 2 sql formatters. I prefer the format of sqlfluff, but it is
 ;; very picky and will refuse to work sometimes. So, here is a function
 ;; to more easily use the other one.
-;;(defun sqlformat-iank-alt ())
+(defun sqlformat-iank-alt ()
+  (interactive)
+  (setq sqlformat-command 'sqlformat
+        sqlformat-args (list "-k" "lower" "-r" "--wrap_after=80"))
+  (sqlformat-buffer)
+  (setq sqlformat-command 'sqlfluff
+        sqlformat-args nil))
 
 (defun indent-buffer ()
   "Indents the entire buffer."
 
 (defun indent-buffer ()
   "Indents the entire buffer."
@@ -1374,26 +1414,11 @@ Go to the next directory based on where the cursor is."
   (cond ((derived-mode-p 'org-mode)
          (org-indent-region (point-min) (point-max)))
         ((derived-mode-p 'sql-mode)
   (cond ((derived-mode-p 'org-mode)
          (org-indent-region (point-min) (point-max)))
         ((derived-mode-p 'sql-mode)
-         ;;;; i dun think this is needed, but leaving it here just in case.
-         ;; (let ((err-buf (get-buffer "*sqlformat errors*")))
-         ;;   (when err-buf (kill-buffer err-buf)))
-
+         (message "iank body")
          ;; fixes parsing errors for the perl i've been writing.
          (replace-regexp-in-buffer "?" "'?'")
          (sqlformat-buffer)
          ;; fixes parsing errors for the perl i've been writing.
          (replace-regexp-in-buffer "?" "'?'")
          (sqlformat-buffer)
-         (replace-regexp-in-buffer "'\\?'" "?")
-         (let ((err-buf (get-buffer "*sqlformat errors*"))
-               err-str)
-           (when err-buf
-             (with-current-buffer err-buf
-               (setq err-str (buffer-substring-no-properties (point-min) (point-max))))
-             (when (not (string-empty-p err-str))
-               (message "using alt formatter due to error: %s" err-str)
-                 (setq sqlformat-command 'sqlformat
-                       sqlformat-args (list "-k" "lower" "-r" "--wrap_after=80"))
-                 (sqlformat-buffer)
-                 (setq sqlformat-command 'sqlfluff
-                       sqlformat-args nil)))))
+         (replace-regexp-in-buffer "'\\?'" "?"))
         ((derived-mode-p 'python-mode)
          (py-autopep8))
         (t
         ((derived-mode-p 'python-mode)
          (py-autopep8))
         (t
@@ -1432,12 +1457,6 @@ Go to the next directory based on where the cursor is."
   (forward-symbol (- arg)))
 
 ;;; mode line
   (forward-symbol (- arg)))
 
 ;;; mode line
-;; make window title be the buffer name
-(setq
- frame-title-format "e-iak %b"
- icon-title-format "e-iak %b"
- )
-
 (defun my-after-change-major-mode-hook ()
   (setq mode-line-mule-info nil
         minor-mode-alist nil
 (defun my-after-change-major-mode-hook ()
   (setq mode-line-mule-info nil
         minor-mode-alist nil
@@ -1847,7 +1866,7 @@ or else the number of characters matched by `outline-regexp'."
 (defun chirp()
   (interactive)
   (setq vol 80)
 (defun chirp()
   (interactive)
   (setq vol 80)
-  (when (string= (system-name) "kd") (setq vol 60))
+  (when (string= (system-name) "frodo") (setq vol 50))
   ;; speed is there so i can adjust and make it go slow so it plays long enough to adjust in pavucontrol
   (start-process-shell-command "ignoreme" nil (format "mpv --speed=1 --no-terminal --vo=null --volume=%d /a/bin/data/d20.wav" vol)))
 ;; from https://www.emacswiki.org/emacs/ErcSound
   ;; speed is there so i can adjust and make it go slow so it plays long enough to adjust in pavucontrol
   (start-process-shell-command "ignoreme" nil (format "mpv --speed=1 --no-terminal --vo=null --volume=%d /a/bin/data/d20.wav" vol)))
 ;; from https://www.emacswiki.org/emacs/ErcSound
@@ -1879,6 +1898,7 @@ or else the number of characters matched by `outline-regexp'."
   :defer t
   :custom-face
   (erc-current-nick-face ((t :weight bold :foreground "red")))
   :defer t
   :custom-face
   (erc-current-nick-face ((t :weight bold :foreground "red")))
+
   :init
   (which-function-mode 0)
   ;; fuck that default turquoise
   :init
   (which-function-mode 0)
   ;; fuck that default turquoise
@@ -1892,10 +1912,7 @@ or else the number of characters matched by `outline-regexp'."
         ;; when starting erc, open #fsfsys. otherwise it is super
         ;; annoying to always have to manually switch buffers.
         erc-join-hook (lambda () (when (string= (buffer-name(current-buffer)) "#fsfsys") (switch-to-buffer (current-buffer))))
         ;; when starting erc, open #fsfsys. otherwise it is super
         ;; annoying to always have to manually switch buffers.
         erc-join-hook (lambda () (when (string= (buffer-name(current-buffer)) "#fsfsys") (switch-to-buffer (current-buffer))))
-        ;; defaults minus fill. you can find defaults by searching for
-        ;; defcustom erc-modules in erc.el, or customize group erc.
-        erc-modules '(autojoin button completion imenu irccontrols list match menu
-                               move-to-prompt netsplit networks readonly ring stamp track)
+
         ;; expanded from https://www.emacswiki.org/emacs/ErcChannelTracking,
         ;; ignore various messages
         erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
         ;; expanded from https://www.emacswiki.org/emacs/ErcChannelTracking,
         ;; ignore various messages
         erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
@@ -1949,6 +1966,12 @@ or else the number of characters matched by `outline-regexp'."
         ) ; end setq
 
   :config
         ) ; end setq
 
   :config
+  ;; This method based on erc info manual instructions.
+  ;; defaults minus fill. you can find defaults by searching for
+  ;; defcustom erc-modules in erc.el, or customize group erc.
+  ;; up to date as of 2025-12
+  (setopt erc-modules '(autojoin button completion imenu irccontrols list match menu
+                                 move-to-prompt netsplit networks readonly ring stamp track))
   (add-hook 'erc-server-PRIVMSG-functions
             'erc-my-privmsg-sound)
   (add-hook 'erc-text-matched-hook 'erc-sound-if-not-server)
   (add-hook 'erc-server-PRIVMSG-functions
             'erc-my-privmsg-sound)
   (add-hook 'erc-text-matched-hook 'erc-sound-if-not-server)
@@ -1995,8 +2018,10 @@ or else the number of characters matched by `outline-regexp'."
          (?s (file . ,"/usr/share/doc/exim4-base/spec.txt.gz"))
          (?w (file . ,"/p/w.org"))
          (?k (file . ,"/a/bin/ds/Arduino/Model01-Firmware/Model01-Firmware.ino"))
          (?s (file . ,"/usr/share/doc/exim4-base/spec.txt.gz"))
          (?w (file . ,"/p/w.org"))
          (?k (file . ,"/a/bin/ds/Arduino/Model01-Firmware/Model01-Firmware.ino"))
+         (?v (file . ,"/a/f/gluestick/hosts/virtual.mdwn"))
          (?x (file . ,"/a/x.txt"))
          (?q (file . ,"/a/x.sql"))
          (?x (file . ,"/a/x.txt"))
          (?q (file . ,"/a/x.sql"))
+         ;; if I could put commands, I'd add: mu-query, message-id=i
          ))
   (set-register (car r) (cadr r)))
 
          ))
   (set-register (car r) (cadr r)))
 
@@ -2033,6 +2058,9 @@ or else the number of characters matched by `outline-regexp'."
 
 ;;;; misc
 
 
 ;;;; misc
 
+;; org-roam install message said this should be in my config. but if fails. meh.
+;; (org-roam-db-autosync-mode)
+
 (define-prefix-command 'terminal-key-map)
 (global-set-key (kbd "\e[") 'terminal-key-map)
 
 (define-prefix-command 'terminal-key-map)
 (global-set-key (kbd "\e[") 'terminal-key-map)
 
@@ -2184,7 +2212,8 @@ run.
 example of setting it in a file:
 ;; Local Variables:
 ;; run-fun: merge-test
 example of setting it in a file:
 ;; Local Variables:
 ;; run-fun: merge-test
-;; End: "
+;; End:
+"
   (basic-save-buffer)
   (if (and (boundp 'run-fun) run-fun)
       (funcall run-fun)
   (basic-save-buffer)
   (if (and (boundp 'run-fun) run-fun)
       (funcall run-fun)
@@ -2428,7 +2457,8 @@ modes like org-mode which have their own yank function."
 
 ;;;;; M-2 shell-cd-to-file
 
 
 ;;;;; M-2 shell-cd-to-file
 
-
+;; open *shell* and cd to the dir of the current file.
+;; Or if the buffer has no file, just run (shell).
 (defun shell-cd-to-file ()
   (interactive)
   (let ((file (buffer-file-name)))
 (defun shell-cd-to-file ()
   (interactive)
   (let ((file (buffer-file-name)))
@@ -2436,7 +2466,7 @@ modes like org-mode which have their own yank function."
         (send-comint-string "*shell*"
                             (concat "c " (file-name-directory file))
                             'shell)
         (send-comint-string "*shell*"
                             (concat "c " (file-name-directory file))
                             'shell)
-      (message "%s" "shell-cd-to-file: buffer has no file name"))))
+      (shell))))
 (global-set-key (kbd "M-2") 'shell-cd-to-file)
 
 ;;;;; C-M-2 copy-symbol
 (global-set-key (kbd "M-2") 'shell-cd-to-file)
 
 ;;;;; C-M-2 copy-symbol
@@ -2881,6 +2911,8 @@ modes like org-mode which have their own yank function."
 
 ;;;;; C-M-i - query-replace-regexp
 
 
 ;;;;; C-M-i - query-replace-regexp
 
+;; Note: to enter a newline in the replacement, press C-M-m
+
 (global-set-key (kbd "C-M-i") 'query-replace-regexp)
 (add-hook 'flyspell-mode-hook
           (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))
 (global-set-key (kbd "C-M-i") 'query-replace-regexp)
 (add-hook 'flyspell-mode-hook
           (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))