;; 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
+
+;;;; 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
- 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)
-(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
(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
- (global-hide-mode-line-mode -1)
(override-theme 'naquadah))))
;; 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
;;; modes with little configuration needed
+(add-to-list 'auto-mode-alist '("\\.curlrc\\'" . conf-mode))
+
+
(setq sqlformat-command 'sqlfluff)
(custom-set-variables
;; 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
- :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")
(delete-selection-mode t)
;; Transparently open compressed files
-(auto-compression-mode t)
+(auto-compression-mode 1)
;; dot mode, repeats last action
(require 'dot-mode)
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)
+;; cperl-mode has more features, replace perl-mode with it.
+;;(fset 'perl-mode 'cperl-mode)
+
;; in perl, sometimes a missing semicolon will cause the
;; 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."
(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)
- (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
(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 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
:defer t
:custom-face
(erc-current-nick-face ((t :weight bold :foreground "red")))
+
:init
(which-function-mode 0)
;; fuck that default turquoise
;; 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"
) ; 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)
(?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"))
+ ;; if I could put commands, I'd add: mu-query, message-id=i
))
(set-register (car r) (cadr r)))
;;;; 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)
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)
;;;;; 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)))
(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
;;;;; 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)))