From b787ad524d3f1004cd076ca3e96c73728f91dd2c Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 27 May 2025 23:58:58 -0400 Subject: [PATCH] cleanup --- init.el | 140 +++++++---------------------------------------- misc-disabled.el | 38 ++++++++----- 2 files changed, 42 insertions(+), 136 deletions(-) diff --git a/init.el b/init.el index 2e0e564..7df7f8b 100644 --- a/init.el +++ b/init.el @@ -718,79 +718,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (completion-category-defaults nil) (completion-category-overrides '((file (styles partial-completion))))) -;;; image dired - - -(setq image-dired-debug t - image-dired-marking-shows-next nil - ;; just testing it out in case - image-dired-track-movement nil - image-dired-thumb-margin 1 - ;; odd useless borders - image-dired-thumb-relief 0 - image-auto-resize 'fit-window - image-dired-thumb-size 400 - ;; image-dired-cmd-create-temp-image-options ("convert" "-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t" "-filter" "Lanczos" "-colorspace" "RGB" "-define" "jpeg:dct-method=float" "-quality" "95") - ;;image-dired-cmd-create-thumbnail-options ("convert" "-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t" "-filter" "Lanczos" "-colorspace" "RGB" "-define" "jpeg:dct-method=float" "-quality" "95") - image-dired-cmd-create-thumbnail-options '("convert" "%f" "-strip" "-resize" "%wx%h" "-filter" "Lanczos" "-define" "jpeg:dct-method=float" "-quality" "95" "%t") - image-dired-cmd-create-thumbnail-options '("true") - ) - - -(defun imgdired-rating () - "highlight" - (interactive) - (with-current-buffer image-dired-thumbnail-buffer - (save-mark-and-excursion - (goto-char (point-min)) - (let ((inhibit-read-only t)) - (while (not (eobp)) - (when-let* ((file-path (image-dired-original-file-name)) - (file (file-name-nondirectory file-path))) - (image-dired-rating-highlight-at-point file)) - (forward-char 2)))))) - -;; find new faces with (list-faces-display) -(defun image-dired-rating-highlight-at-point (file) - (with-silent-modifications - (let* ((rating (gethash file khash))) - (cond ((and rating (>= rating 4)) - (add-face-text-property (point) (1+ (point)) - 'shr-mark)) - ((and rating (= rating 3)) - (add-face-text-property (point) (1+ (point)) - 'reb-match-1)) - ((and rating (= rating 1)) - ;; brown - (add-face-text-property (point) (1+ (point)) - 'reb-match-3)) - (t (remove-text-properties (point) (1+ (point)) - '(face reb-match-1))))))) - -;; successfull font markup test: -;; (with-silent-modifications (add-face-text-property (point) (+ 10 (point)) 'image-dired-thumb-mark)) -;; ;; [45] bright yellow: shr-mark -;; ;; [3] medium blue: reb-match-1 -;; ;; [12] light brown -;; - -;; scratch pad for looking over the thumb width calculations: -;; char-width: (frame-char-width) = 9 -;; width: (window-body-width (image-dired-thumbnail-window) t) = 2777 - - -;; The same-window helps prevent image-dired window from jumping all around, but it doesn't completely stop it. - -;; (setq display-buffer-alist '((".*" display-buffer-reuse-window))) -;; (setq display-buffer-alist '((".*" display-buffer-in-previous-window))) -;; (setq display-buffer-alist '((".*" display-buffer-same-window))) -;; (setq display-buffer-alist nil) -;; (setq image-dired-track-movement nil) -;; (setq image-dired-track-movement t) -;; -;; I eventually solved it based on a patch in debbugs waiting for review. - - ;;; dired @@ -1121,26 +1048,14 @@ A non-nil CURRENT-ONLY argument means save only current buffer." - ;;; misc general settings -;; I tried to look for a function that would set this that is -;; not part of the emacs interactive customize stuff, but didn't see one -;; in the faces documentation. - - ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. -;; iank: commented for now as this breaks artist mode -;;(custom-set-faces - -;;'(header-line ((t (:background "default" :foreground "default" :overline nil :underline nil)))) -;; '(region ((t nil)))) - ;; notes on tramp debugging: ;; emacs -Q ;; (setq tramp-verbose 10) @@ -1163,6 +1078,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (setq + initial-scratch-message nil + ;; avoid this stupid prompt when doing sudo-edit ;; Save auth info to file ~/.authinfo? [y/n/N/e/?] ;; which doesn't actually use the default N by pressing enter, @@ -1311,16 +1228,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." -;; (custom-set-faces -;; ;; setting header-line-format to " " as a hack for a top margin the oly thning I could find to do a top margin -;; '(header-line ((t (:background "default" :foreground "default" :overline nil :underline nil)))) -;; ;; don't highlight the region -;; '(region ((t nil)))) -(setq-default header-line-format " ") - - -(setq initial-scratch-message nil) - ;; vertical margin background. ;; google turned up: http://lists.gnu.org/archive/html/help-gnu-emacs/2014-03/msg00544.html @@ -1334,6 +1241,17 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;;; misc function definitions +(defun iank-top-margin () + (interactive) + "for usability, sometimes I wanted a blank top margin. Note the custom-set-faces breaks artist mode." + (custom-set-faces + ;; setting header-line-format to " " as a hack for a top margin the oly thning I could find to do a top margin + '(header-line ((t (:background "default" :foreground "default" :overline nil :underline nil)))) + ;; don't highlight the region + '(region ((t nil)))) + (setq-default header-line-format " ")) + + (defun fill-buffer () (interactive) @@ -1593,14 +1511,6 @@ Go to the next directory based on where the cursor is." ;;; prog-mode-defaults -(defface highlight-symbol-face - '((((class color) (background dark)) - (:background "gray30")) - (((class color) (background light)) - (:background "gray90"))) - "highlight-symbol-face copied from `highlight-symbol-mode' for use in maintained replacement mode: highlight-thing-mode.") - - (defun prog-mode-defaults () "Default coding hook, useful with any programming language." ;; so that I can do completion before the dialog pops up @@ -1671,8 +1581,7 @@ indent yanked text (with prefix arg don't indent)." (let ((transient-mark-mode nil)) (yank-advised-indent-function (region-beginning) (region-end))))) - -;;; shell mode +;;; outline ;; # eval: (outline-minor-mode) @@ -1696,6 +1605,10 @@ or else the number of characters matched by `outline-regexp'." +;;; shell mode + + + ;; avoid stupid git crap like "warning, terminal not fully functional" (setenv "PAGER" "cat") ;; don't store successive duplicates in comint command history @@ -1942,7 +1855,7 @@ or else the number of characters matched by `outline-regexp'." " 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)) + (if-let* ((buf (erc-track-get-active-buffer arg)) ((buffer-live-p buf))) (funcall fun buf) (erc-modified-channels-update) @@ -2658,21 +2571,6 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-d") 'kill-ring-save) -;; by default is does image-dired-delete-character (stops displaying its thumbnail), pretty useless. -(add-hook 'image-dired-thumbnail-mode-hook - (lambda () - (define-key image-dired-thumbnail-mode-map (kbd ",") 'image-dired-copy-filename-r1) - (define-key image-dired-thumbnail-mode-map (kbd ".") 'image-dired-copy-filename-r2) - (define-key image-dired-thumbnail-mode-map (kbd "/") 'image-dired-copy-filename-r3) - (define-key image-dired-thumbnail-mode-map (kbd "k") 'image-dired-copy-filename-r4) - (define-key image-dired-thumbnail-mode-map (kbd "l") 'image-dired-copy-filename-r5) - (define-key image-dired-thumbnail-mode-map (kbd "u") 'image-dired-copy-filename-ban) - (define-key image-dired-thumbnail-mode-map (kbd "y") 'image-dired-copy-filename-draw) - (define-key image-dired-thumbnail-mode-map (kbd "h") 'image-dired-copy-filename-tame) - (define-key image-dired-thumbnail-mode-map (kbd "o") 'image-dired-copy-filename-tbdremix) - (define-key image-dired-thumbnail-mode-map (kbd "n") 'image-dired-copy-filename-remix) - (define-key image-dired-thumbnail-mode-map (kbd "C-d") nil))) - (add-hook 'c-mode-common-hook (lambda () diff --git a/misc-disabled.el b/misc-disabled.el index 55cfff6..a362bf4 100644 --- a/misc-disabled.el +++ b/misc-disabled.el @@ -26,28 +26,36 @@ (add-hook 'info-mode-hook 'my-info-init) +;;;;; highlight-thing-mode -;;;; I briefly put this in prog-mode-defaults when looking for a maintained replacement of highlight-symbol, -;;;; but I found a different package that was more maintained. -;; (highlight-thing-mode) -;; (setq highlight-thing-limit-to-region-in-large-buffers-p t -;; highlight-thing-narrow-region-lines 40 -;; highlight-thing-large-buffer-limit 5000) -;; ;; highlight-symbol-face copied from `highlight-symbol-mode' for use -;; ;; in maintained replacement mode: highlight-thing-mode. -;; (face-spec-set 'highlight-thing -;; '((((class color) (background dark)) -;; (:background "gray30")) -;; (((class color) (background light)) -;; (:background "gray90"))) -;; 'face-defface-spec) +;;I briefly put this in prog-mode-defaults when looking for a maintained replacement of highlight-symbol, +;;but I found a different package that was more maintained. +(highlight-thing-mode) +(setq highlight-thing-limit-to-region-in-large-buffers-p t + highlight-thing-narrow-region-lines 40 + highlight-thing-large-buffer-limit 5000) +;; highlight-symbol-face copied from `highlight-symbol-mode' for use +;; in maintained replacement mode: highlight-thing-mode. +(face-spec-set 'highlight-thing + '((((class color) (background dark)) + (:background "gray30")) + (((class color) (background light)) + (:background "gray90"))) + 'face-defface-spec) +(defface highlight-symbol-face + '((((class color) (background dark)) + (:background "gray30")) + (((class color) (background light)) + (:background "gray90"))) + "highlight-symbol-face copied from `highlight-symbol-mode' for use in maintained replacement mode: highlight-thing-mode.") -;; mastodon + +;;;;; mastodon (setq mastodon-instance-url "https://hostux.social" mastodon-active-user "iank") -- 2.30.2