From 9031aeab6968343a61ba7d393fd8c567c27a1360 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 25 Jun 2025 00:30:10 -0400 Subject: [PATCH] minor improvements --- init.el | 101 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/init.el b/init.el index e6be9cb..40ad4ad 100644 --- a/init.el +++ b/init.el @@ -40,22 +40,22 @@ ;; 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 -(defvar file-name-handler-alist-old file-name-handler-alist) -(setq package-enable-at-startup nil - file-name-handler-alist nil + +(setq + file-name-handler-alist nil message-log-max 16384 - gc-cons-threshold 402653184 + 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 - ;; 100 mb - gc-cons-threshold 100000000)) - ;; taken from wiegley, dunno why the t is there. - t) + #'(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: @@ -246,6 +246,9 @@ ;;; shell mode stuff +(require 'mmm-mode) +(setq mmm-global-mode 'maybe) + (require 'readline-complete) ;; not sure how I made these, but I deleted, and ;; it would be nice to make them again sometime @@ -934,10 +937,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; mu4e-user-mail-address-list ;; and a function ;; inspired by mu4e info manual, search for mu4e-compose-pre-hook. -(when (file-exists-p "/p/c/mymu4e.el") - (load-file "/p/c/mymu4e.el")) -(when (file-exists-p "/p/c/myidir.el") - (load-file "/p/c/myidir.el")) +(load-file "/p/c/plisp/mymu4e.el") + +(add-to-list 'load-path "/p/c/plisp") +(use-package myidir + :commands (myidir rthumb-new myidir-use-batch-input)) (when (file-exists-p "/a/h/iank-mod.el") @@ -1048,6 +1052,36 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (temp-buffer-resize-mode 1) +(defun perl-mode-defaults () + ;; per perl-mode help, gnu style: + (setq perl-indent-level 2 + perl-continued-statement-offset 2 + perl-continued-brace-offset 0 + perl-brace-offset 0 + perl-brace-imaginary-offset 0 + perl-label-offset -2 + ) + (define-key perl-mode-map (kbd "C-\\") 'perl-iank-regex) + + ) +(add-hook 'perl-mode-hook 'perl-mode-defaults) + + +;; in perl, sometimes a missing semicolon will cause the +;; program to work partly and for an error that is not near the missing semicolon. +;; This works super well to find missing semicolons. +(defun perl-iank-regex () + "Start regexp isearch forward with pre-populated search string." + (interactive) + (let ((search-string "^[^#]*[^ +{};,]$")) + (isearch-mode t t nil nil) + (setq isearch-string search-string + isearch-message search-string) + (isearch-push-state) + (isearch-search-and-update))) + +;; regex for perl files to find missing semicolons: ;;; misc general settings @@ -1420,29 +1454,36 @@ Go to the next directory based on where the cursor is." org-log-into-drawer t org-extend-today-until 0 org-startup-truncated nil - org-clock-persist t org-use-sub-superscripts "{}" org-export-with-sub-superscripts nil - org-clock-mode-line-total 'today ;; global STYLE property values for completion org-global-properties (quote (("STYLE_ALL" . "habit"))) org-special-ctrl-a/e t ;; home and end work special in headlines org-completion-use-ido t ;; i had some problem with this in the past, but don't know what, so whatever. org-cycle-emulate-tab nil - org-catch-invisible-edits 'smart) + org-catch-invisible-edits 'smart -(setq - org-default-notes-file "/a/t.org" - org-directory "/p") + + ;; 2025: I don't use it and its giving me lexical scope bindings all the time + ;;org-clock-persist t + ;;org-clock-mode-line-total 'today + + ) ;; modeilne populated from (org-clock-get-clocked-time) ;; which is populated from the var org-clock-total-time ;; which is populated by a function which starts from (org-clock-get-sum-start) -;; +;; 2025: I don't use it and its giving me lexical scope bindings all the time +;; (eval-after-load "org" +;; '(org-clock-persistence-insinuate)) + + + +(setq + org-default-notes-file "/a/t.org" + org-directory "/p") -(eval-after-load "org" - '(org-clock-persistence-insinuate)) (defun time-to-org-day (time) (round (time-to-number-of-days @@ -1528,6 +1569,12 @@ Go to the next directory based on where the cursor is." ;; (idle-highlight-mode) ;; (setq idle-highlight-idle-time 0.1) + ;; note: I used to set c-default-style other to "stroustrup" to avoid brace indent after if, but don't care enough anymore, just go with gnu. + ;; + ;; (setq-default c-basic-offset 2) + '(c-default-style '((java-mode . "java") + (awk-mode . "awk") + (other . "stroustrup"))) (make-local-variable 'column-number-mode) @@ -1704,7 +1751,7 @@ or else the number of characters matched by `outline-regexp'." (setq ;; example. decided i actually wanted it there. -;; global-visible-mark-mode-exclude-list (list "\\*image-dired\\*") + ;; global-visible-mark-mode-exclude-list (list "\\*image-dired\\*") visible-mark-faces '(visible-mark-face1 visible-mark-face2) visible-mark-forward-faces '(visible-mark-forward-face1) ;; highlight the last 2 marks @@ -1864,7 +1911,7 @@ or else the number of characters matched by `outline-regexp'." (cond (erc-modified-channels-alist ;; if we're not in erc-mode, set this buffer to return to (if-let* ((buf (erc-track-get-active-buffer arg)) - ((buffer-live-p buf))) + ((buffer-live-p buf))) (funcall fun buf) (erc-modified-channels-update) (erc-track--switch-buffer fun arg))) @@ -2417,6 +2464,7 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-e") 'copy-line) ;;;;; M-e ?? unused +(global-set-key (kbd "M-e") 'goto-line) ;;;;; C-r isearch-backward @@ -3051,6 +3099,9 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-SPC") 'ispell-word) ;;;; left secondary +;;;;; M-1 toggle-night +(global-set-key (kbd "M-1") 'toggle-night) + ;;;;; C-M-4 - widen (global-set-key (kbd "C-M-4") 'widen) -- 2.30.2