From: Ian Kelling Date: Wed, 1 Jul 2026 11:49:23 +0000 (-0400) Subject: misc updates, including stop using ctrl one shot key to avoid mistakes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=HEAD;p=dot-emacs misc updates, including stop using ctrl one shot key to avoid mistakes --- diff --git a/init.el b/init.el index 4b4ba3a..c4e7596 100644 --- a/init.el +++ b/init.el @@ -282,7 +282,9 @@ ;;(require 'src-loaddefs) -(setenv "EMACS" "") + +(setenv "EMACS" "") ;; I should have wrote why i did this :( + ;; generally unnecessary, but why not (setq explicit-shell-file-name "bash" explicit-bash-args nil @@ -592,25 +594,33 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (disable-theme (car custom-enabled-themes))) (load-theme arg t)) -;; not a real var? remove when I see this again -;;(setq color-theme-is-global t) - -;; temporary, make night be default +;; toggle night theme. (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)) + (override-theme 'modus-operandi)) (t (override-theme 'naquadah)))) +;; per https://protesilaos.com/emacs/modus-themes. +(require-theme 'modus-themes) +(setq modus-themes-disable-other-themes t) +(modus-themes-load-theme 'modus-operandi) -(setq ef-themes-mixed-fonts t - ef-themes-variable-pitch-ui t) + +;;; Notes on past color themes and theme investigations ;;; +;; used this for a long time +;; (override-theme 'ef-light) +;; +;; This looks like it could be a nice change of pace +;; (override-theme 'modus-operandi-tinted) +;; I used this for a long time. +;;(override-theme 'leuven) ;; in the leuven theme file, i made this change. will need to remake it ;; on package updates. I could fork, but its a pretty simple change ;; < `(default ((,class (:foreground "#333333" :background "#FFFFFF")))) @@ -619,15 +629,16 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; < `(font-lock-comment-face ((,class (:slant italic :foreground "#8D8D84")))) ; #696969 ;; > `(font-lock-comment-face ((,class (:slant italic :foreground "#484848")))) ; #696969 -;;(override-theme 'leuven) -;; based on ef-themes README.org -(mapc #'disable-theme custom-enabled-themes) +;; I used ef-light for a long time. +;; based on ef-themes README.org: +;;(mapc #'disable-theme custom-enabled-themes) +;; (setq ef-themes-mixed-fonts t +;; ef-themes-variable-pitch-ui t) ;; the default blue is too dark and messes with erc colors -(setq ef-light-palette-overrides - '((bg-mode-line "#efefef"))) -(ef-themes-select 'ef-light) -;;(load-theme 'ef-light) +;;(setq ef-light-palette-overrides +;; '((bg-mo]de-line "#efefef"))) +;;(ef-themes-select 'ef-light) ;; note override-theme also works fine ;; for learning about faces, see @@ -671,7 +682,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;;; cross session settings - +;; note: manual save/restore of open files: +;; M-x desktop-save +;; M-x desktop-read (use-package recentf ;; defer & commands from jwiegley @@ -690,6 +703,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; save it every 2 minutes. https://www.emacswiki.org/emacs/RecentFiles (run-at-time nil (* 2 60) 'recentf-save-list)) + ;; less strong conditional: :unless noninteractive (use-package saveplace :if (string= (daemonp) "server") @@ -931,7 +945,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (add-to-list 'auto-mode-alist '("\\.curlrc\\'" . conf-mode)) - +;; Note this is one of the hard-coded options. Note: +;; sqlfluff will exit with failure due to linting violations, +;; but it will still do the formatting. The best way +;; I've found to deal with this so far is to just run +;; the command on the file from the terminal. There are +;; also some ideas in /a/c/subdir_files/.config/sqlfluff/.sqlfluff (setq sqlformat-command 'sqlfluff) (custom-set-variables @@ -988,10 +1007,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (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 pg-idir)) +(when (file-exists-p "/r/b/myidir.el") + (load-file "/r/b/myidir.el")) (when (file-exists-p "/a/h/iank-mod.el") (load-file "/a/h/iank-mod.el")) @@ -1161,6 +1179,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; "remote-shell" "/bin/bash")) ;;(customize-set-variable 'tramp-encoding-shell "/bin/bash") +;; normally, TERM is set to dumb, but this causes emacsclient launched +;; from within emacs to fail with: "*ERROR*: Unknown terminal type" +;; todo: something after this point is setting it back to DUMNB +(setenv "TERM") + (setq copy-region-blink-delay 0.3 ;; be more consistent @@ -1237,9 +1260,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; remove ugly 3d box feature (set-face-attribute 'mode-line nil :box nil) -(add-to-list 'default-frame-alist - '(font . "DejaVu Sans Mono-11")) - ; the default will jump 2 sizes. +;; This seems to fix my problem of the font being too small by default. +;; I've read that height is 1/10 pt. +(set-face-attribute 'default nil + :height 120) +;; (setq text-scale-mode-step 1.1) (setq font-lock-maximum-decoration t inhibit-startup-message t @@ -1271,7 +1296,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." imenu-auto-rescan t indicate-empty-lines t) ; mark end of buffer - (blink-cursor-mode 0) (menu-bar-mode -1) (tool-bar-mode -1) @@ -1414,7 +1438,7 @@ 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) - (message "iank body") + ;;(message "iank sql format debug") ;; fixes parsing errors for the perl i've been writing. (replace-regexp-in-buffer "?" "'?'") (sqlformat-buffer) @@ -2061,6 +2085,9 @@ or else the number of characters matched by `outline-regexp'." ;; org-roam install message said this should be in my config. but if fails. meh. ;; (org-roam-db-autosync-mode) +;; prevent accidental horizontal scroll left, which I never want. +(global-unset-key (kbd "C-x <")) + (define-prefix-command 'terminal-key-map) (global-set-key (kbd "\e[") 'terminal-key-map) @@ -2084,11 +2111,12 @@ or else the number of characters matched by `outline-regexp'." (isearch-toggle-regexp) (cond (isearch-regexp (global-set-key (kbd "C-r") 'isearch-backward-regexp) - (define-key global-map (kbd "") 'isearch-forward-regexp)) + (define-key global-map (kbd "C-f") 'isearch-forward-regexp)) (t (global-set-key (kbd "C-r") 'isearch-backward) - (define-key global-map (kbd "") 'isearch-forward)))) + (define-key global-map (kbd "C-f") 'isearch-forward)))) (define-key isearch-mode-map (kbd "M-r") 'my-isearch-toggle-regexp) +(define-key isearch-mode-map (kbd "C-e") 'my-isearch-toggle-regexp) (define-key Info-mode-map "x" 'Info-follow-nearest-node) @@ -2099,55 +2127,51 @@ or else the number of characters matched by `outline-regexp'." ;; todo: this doesnt work. needs , which doesnt work in terminal. fix that. (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace) -;;;;; f12 - isearch-forward -;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs -(global-set-key (kbd "") 'isearch-forward) -(global-set-key (kbd "") 'isearch-forward) -(define-key isearch-mode-map (kbd "") 'isearch-repeat-forward) -(define-key isearch-mode-map (kbd "") 'isearch-repeat-forward) -;; get rid of the standard completion binding, always use auto-complete -;; this didn't work very well -;;(global-set-key (kbd "TAB") 'auto-complete) -(define-key global-map [remap completion-at-point] 'auto-complete) +;;;;; f12 - tbd ;;;;; end - move-end-of-line ;; taken from emacs wiki, along with home function ;; http://www.emacswiki.org/emacs/BackToIndentationOrBeginning -(defun point-in-comment () - "Determine if the point is inside a comment" - (interactive) - (let ((syn (syntax-ppss))) - (and (nth 8 syn) - (not (nth 3 syn))))) -(defun end-of-code-or-line (arg) - "Move to end of line, or before start of comments depending on situation. - Toggle back and forth positions if we are already at one. - Comments are recognized in any mode that sets syntax-ppss - properly." - (interactive "P") - (when (catch 'bol - (let ((start (point)) - (bol (save-excursion - (beginning-of-line) - (point))) - (eol (progn (move-end-of-line arg) (point)))) - (while (point-in-comment) - (backward-char) - (when (= (point) bol) - (throw 'bol t))) - (throw 'bol (and (not (= eol start)) (>= start (point)))))) - (move-end-of-line arg))) - -(global-set-key (kbd "") 'end-of-code-or-line)(add-hook 'org-mode-hook (lambda () (define-key org-mode-map (kbd "") 'org-end-of-line))) +;;; doing a test without this set: june 2026 + +;; (defun point-in-comment () +;; "Determine if the point is inside a comment" +;; (interactive) +;; (let ((syn (syntax-ppss))) +;; (and (nth 8 syn) +;; (not (nth 3 syn))))) +;; (defun end-of-code-or-line (arg) +;; "Move to end of line, or before start of comments depending on situation. +;; Toggle back and forth positions if we are already at one. +;; Comments are recognized in any mode that sets syntax-ppss +;; properly." +;; (interactive "P") +;; (when (catch 'bol +;; (let ((start (point)) +;; (bol (save-excursion +;; (beginning-of-line) +;; (point))) +;; (eol (progn (move-end-of-line arg) (point)))) +;; (while (point-in-comment) +;; (backward-char) +;; (when (= (point) bol) +;; (throw 'bol t))) +;; (throw 'bol (and (not (= eol start)) (>= start (point)))))) +;; (move-end-of-line arg))) +;;(global-set-key (kbd "") 'end-of-code-or-line) +;;; orig key for testing +;;(global-set-key (kbd "") 'move-end-of-line) +(add-hook 'org-mode-hook (lambda () (define-key org-mode-map (kbd "") 'org-end-of-line))) ;;;;; home - back-to-indentation -(defun back-to-indentation-or-beginning () - (interactive) - (if (= (point) (progn (back-to-indentation) (point))) - (if (derived-mode-p 'org-mode) - (org-beginning-of-line) - (beginning-of-line)))) + +(defun back-to-indentation-or-beginning (&optional arg) + (interactive "^p") + (when (= (point) (progn (back-to-indentation) (point))) + (move-beginning-of-line arg))) (global-set-key (kbd "") 'back-to-indentation-or-beginning) +;;; test stardard keybind: +;; (global-set-key (kbd "") 'move-beginning-of-line) ;;;;; s-tab - indent-buffer ;; This is translated from S- in graphicsal mode. previously, I had @@ -2500,6 +2524,10 @@ modes like org-mode which have their own yank function." (add-hook 'org-mode-hook (lambda () (define-key org-mode-map (kbd "M-q") 'org-shifttab))) +;; default is prog-fill-reindent-defun +(add-hook 'prog-mode-hook + (lambda () (define-key prog-mode-map (kbd "M-q") nil))) + (global-set-key (kbd "M-q") 'bicycle-cycle-global) ;;;;; C-M-q quoted-insert @@ -2556,13 +2584,17 @@ modes like org-mode which have their own yank function." ;;;;; M-r sql-up (global-set-key (kbd "M-r") 'sqlformat-region) -;;;;; C-a copy buffer +;;;;; C-a kill-whole-line + +(global-set-key (kbd "C-a") 'kill-whole-line) +(defun kill-whole-line-wrapper (&optional arg) + "If we are at the end of the file, kill backwards instead of doing nothing." + (interactive "P") + (if (= (point) (point-max)) + (kill-whole-line -1) + (kill-whole-line arg))) + -(defun copy-all () - "Copy entire buffer to clipboard" - (interactive) - (clipboard-kill-ring-save (point-min) (point-max))) -(global-set-key (kbd "C-a") 'copy-all) ;;;;; C-s - c-x prefix ;; prefix key binds. @@ -2624,26 +2656,17 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-d") 'split-window-horizontally) -;;;;; C-f - kill-whole-line +;;;;; C-f - isearch-forward +;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs + +;; not my normal keyboard. +(global-set-key (kbd "C-f") 'isearch-forward) +(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward) +;; get rid of the standard completion binding, always use auto-complete +;; this didn't work very well +;;(global-set-key (kbd "TAB") 'auto-complete) +(define-key global-map [remap completion-at-point] 'auto-complete) -(global-set-key (kbd "C-f") 'kill-whole-line-wrapper) -(setq-default - kill-whole-line-accumulate nil - kill-whole-line-accumulate-engage nil - ) -(defun kill-whole-line-wrapper (&optional arg) - "If we are at the end of the file, kill backwards instead of doing nothing." - (interactive "P") - (when kill-whole-line-accumulate - ;; set last-command the 2nd time we run this function with - ;; accumulate on. - (if kill-whole-line-accumulate-engage - (setq last-command 'kill-region) - (setq kill-whole-line-accumulate-engage t)) - ) - (if (= (point) (point-max)) - (kill-whole-line -1) - (kill-whole-line arg))) ;;;;; M-f - print-var-at-point @@ -2707,6 +2730,9 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-d") 'kill-ring-save) +(add-hook 'php-mode-hook + (lambda () + (define-key php-mode-map (kbd "C-d") nil))) (add-hook 'c-mode-common-hook (lambda () @@ -2735,8 +2761,6 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-v") 'yank-better) - - (defun yank-better (arg) "Paste, linewise if our kill ends with a newline. I change the behavior of plain prefix. It makes it not do linewise paste, @@ -2747,10 +2771,11 @@ modes like org-mode which have their own yank function." (interactive "*P") (if (and (not (equal arg '(4))) (string-suffix-p "\n" (current-kill 0 t))) (beginning-of-line)) - (if (and (stringp mode-name) (string= mode-name "Org")) - (call-interactively 'org-yank) - (setq this-command 'yank) - (call-interactively 'yank (and (not (equal arg '(4))))))) + (cond ((and (stringp mode-name) (string= mode-name "Org")) + (call-interactively 'org-yank)) + (t + (setq this-command 'yank) + (call-interactively 'yank (and (not (equal arg '(4)))))))) (put 'yank-better 'delete-selection 'yank) @@ -2933,6 +2958,13 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-p") 'move-mouse-to-point) +;;;;; M-p copy-all +(defun copy-all () + "Copy entire buffer to clipboard" + (interactive) + (clipboard-kill-ring-save (point-min) (point-max))) +(global-set-key (kbd "M-p") 'copy-all) + ;;;;; C-M-p - delete-horizontal-space (global-set-key (kbd "C-M-p") 'delete-horizontal-space) @@ -3195,6 +3227,7 @@ modes like org-mode which have their own yank function." ;;;;; C-t - org cycle todo / toggle comint motion + (add-hook 'org-mode-hook (lambda () (define-key org-mode-map (kbd "C-t") 'org-todo))) @@ -3239,14 +3272,6 @@ modes like org-mode which have their own yank function." (eval-after-load "message" '(define-key message-mode-map (kbd "C-t") 'mail-signature)) -(defun kill-whole-line-toggle-accumulate () - (interactive) - (setq kill-whole-line-accumulate-engage nil) - (message "c-t %s" (setq kill-whole-line-accumulate (not kill-whole-line-accumulate))) - ) - -(global-set-key (kbd "C-t") 'kill-whole-line-toggle-accumulate) - (defun my-ansi-color-file () (interactive) (when (string= (buffer-file-name) "/home/iank/tmp-fs.log")