From: Ian Kelling Date: Thu, 28 Dec 2023 20:29:33 +0000 (-0500) Subject: general improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=311ff8bb7edde4703bbd7e045a2c5599d71a820d;p=dot-emacs general improvements --- diff --git a/init.el b/init.el index 82a989f..22068c8 100644 --- a/init.el +++ b/init.el @@ -244,13 +244,15 @@ ;; disabled while I look for another alternative ;;(icomplete-mode) +(unless (string= (daemonp) "server") + (setq ac-use-comphist nil)) (require 'auto-complete-config) (ac-config-default) ;; complete after 1 char instead of default 2 -(setq ac-auto-start 1) -(setq ac-delay 0.001) +(setq ac-auto-start 1 + ac-delay 0.001) (add-to-list 'ac-modes 'org-mode 'sql-mode) @@ -575,17 +577,36 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (defun toggle-night () (interactive) (cond ((equal (car custom-enabled-themes) 'naquadah) - (override-theme 'leuven)) + (override-theme 'ef-light)) (t (override-theme 'naquadah)))) +(setq ef-themes-mixed-fonts t + ef-themes-variable-pitch-ui t) + ;; 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")))) ;; > `(default ((,class (:foreground "#333333" :background "#F6F6F0")))) -(override-theme 'leuven) +;; +;; < `(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) +;; 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) + + +;; for learning about faces, see +;; useful snippet +;; (byte-recompile-file "/home/iank/.emacs.d/elpa/leuven-theme-20220203.947/leuven-theme.el" nil 0) ;; disable color thing with this: ;;(disable-theme (car custom-enabled-themes)) @@ -624,9 +645,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;;; cross session settings + + (use-package recentf ;; defer & commands from jwiegley :defer 10 + :if (string= (daemonp) "server") :commands (recentf-mode recentf-add-file recentf-apply-filename-handlers) @@ -635,11 +659,14 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (setq recentf-max-saved-items 400 recentf-max-menu-items 15) ) -;; save it every 5 minutes. https://www.emacswiki.org/emacs/RecentFiles -(run-at-time nil (* 5 60) 'recentf-save-list) +(when (string= (daemonp) "server") + ;; save it every 5 minutes. https://www.emacswiki.org/emacs/RecentFiles + (run-at-time nil (* 5 60) 'recentf-save-list)) + +;; less strong conditional: :unless noninteractive (use-package saveplace - :unless noninteractive + :if (string= (daemonp) "server") :config (setq save-place-version-control 'nospecial @@ -650,7 +677,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; savehist keeps track of some history search entries (use-package savehist - :unless noninteractive + :if (string= (daemonp) "server") :config (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring) ;; save every minute @@ -876,7 +903,7 @@ 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. (when (file-exists-p "/p/c/mymu4e.el") - (load "/p/c/mymu4e.el")) + (load "/p/c/mymu4e")) (when (file-exists-p "/a/h/iank-mod.el") @@ -948,7 +975,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; show the name of the current function definition in the modeline -(setq which-func-modes t) (which-function-mode 1) ;; enable winner-mode to manage window configurations @@ -1313,7 +1339,7 @@ Go to the next directory based on where the cursor is." ;;; org mode -;; todo work on org-cycle-emulate-tab + ;; todo, this doesn't work for a non-standard keybind ;;(setq org-special-ctrl-k t) @@ -1363,6 +1389,8 @@ Go to the next directory based on where the cursor is." 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) (setq @@ -1453,6 +1481,8 @@ Go to the next directory based on where the cursor is." ;; so that I can do completion before the dialog pops up ;;(local-set-key (kbd "") 'auto-complete) (local-set-key (kbd "TAB") 'auto-complete) + (define-key emacs-lisp-mode-map (kbd "M-q") nil) + ;; todo, this is causing error message on loading file, prolly not working ;;(flycheck-mode +1) (setq ac-sources (delq 'ac-source-dictionary ac-sources)) @@ -1679,14 +1709,14 @@ or else the number of characters matched by `outline-regexp'." (setq vol 80) (when (string= (system-name) "kd") (setq vol 60)) ;; 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/bird.mp3" vol))) + (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 (defun chirp-slow() (interactive) (setq vol 50) (when (string= (system-name) "tp") (setq vol 80)) ;; 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=.2 --no-terminal --vo=null --volume=%d /a/bin/data/bird.mp3" vol))) + (start-process-shell-command "ignoreme" nil (format "mpv --speed=.2 --no-terminal --vo=null --volume=%d /a/bin/data/d20.wav" vol))) (defun erc-my-privmsg-sound (proc parsed) (let* ((tgt (car (erc-response.command-args parsed))) @@ -1700,9 +1730,18 @@ or else the number of characters matched by `outline-regexp'." (unless (string-match "Server:[0-9]+" nickuserhost) (chirp))) +(defun erc-sound-if-not-server (match-type nickuserhost msg) + ;; (message "d1 %s" nickuserhost) + (unless (or (string-match-p "Server:[0-9]+" nickuserhost) (string-match-p "leah" nickuserhost)) + (chirp))) + (use-package erc :defer t + :custom-face + (erc-current-nick-face ((t :weight bold :foreground "red"))) :init + (which-function-mode 0) + ;; fuck that default turquoise (setq erc-fill-prefix "" ;; consider invisible frames to be unseen. seems like an obvious default erc-track-visibility 'visible @@ -1710,13 +1749,45 @@ or else the number of characters matched by `outline-regexp'." erc-track-switch-direction 'importance ;; defaults minus fill. todo: modify the list instead of specifying it explicitly in case the defaults change erc-modules - '(autojoin button completion irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring stamp track) + '(autojoin button completion imenu irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring stamp track) + ;; expanded from https://www.emacswiki.org/emacs/ErcChannelTracking, + ;; ignore various messages + erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" + "324" "329" "332" "333" "353") + ;; seems good, i don't care about the server buffer generally + erc-track-exclude-server-buffer t + ;; dont highlight channels just cuz of new messages + erc-track-priority-faces-only 'all + ;; so that we don't show channels where i havent been mmentioned + erc-track-faces-priority-list '(erc-current-nick-face + erc-keyword-face + erc-pal-face + erc-nick-msg-face + erc-direct-msg-face + erc-fool-face) + + ) ; end setq + :config (add-hook 'erc-server-PRIVMSG-functions 'erc-my-privmsg-sound) (add-hook 'erc-text-matched-hook 'erc-sound-if-not-server) - (erc-track-mode 1)) + (erc-track-mode 1) + (defun erc-track--switch-buffer (fun arg) + (if (not erc-track-mode) + (message (concat "Enable the ERC track module if you want to use the" + " tracking minor mode")) + (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))) + (funcall fun buf) + (erc-modified-channels-update) + (erc-track--switch-buffer fun arg))) + ;; if no active channels, switch back to what we were doing before + (t (switch-to-buffer "#fsfsys"))))) + ) ;;; named commands (defun rm-file-and-buffer () "Removes file connected to current buffer and kills buffer." @@ -1766,14 +1837,16 @@ or else the number of characters matched by `outline-regexp'." (global-unset-key (kbd "C-z"))) (use-package undo-fu-session + :if (string= (daemonp) "server") :config (setq undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))) -(unless (equal (user-uid) 0) ; don't make root owned files - (global-undo-fu-session-mode) - (when (file-exists-p "/p/c/undo-fu-session") - (setq undo-fu-session-directory "/p/c/undo-fu-session")) - ) +(when (string= (daemonp) "server") + (unless (equal (user-uid) 0) ; don't make root owned files + (global-undo-fu-session-mode) + (when (file-exists-p "/p/c/undo-fu-session") + (setq undo-fu-session-directory "/p/c/undo-fu-session")) + )) ;;; keybinds @@ -2441,6 +2514,10 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-v") 'yank-better) +(add-hook 'ivy-mode-hook + (lambda () + (define-key ivy-minibuffer-map (kbd "C-v") nil))) + (defun yank-better (arg)