More emacs 31.1 stuff

This commit is contained in:
2026-08-25 01:47:15 -07:00
parent 2dcbc82889
commit 858ba5e0fc
+36 -56
View File
@@ -45,6 +45,26 @@
;; if this is not here, init.el fails to load from a freshly-initialized repo ;; if this is not here, init.el fails to load from a freshly-initialized repo
(use-package llama) (use-package llama)
;; posframe
(use-package posframe
:init
(defun my/posframe-tip (name msg)
"Like `popup-tip', but with a posframe.
NAME should be the buffer name to pass to `posframe-show'. MSG is the message to
display."
(unwind-protect
(progn
(posframe-show name
:string msg
:position (point)
:max-width 80
:border-width 2
:border-color "white")
(clear-this-command-keys)
(push (read-event) unread-command-events)
(posframe-hide name))
(posframe-hide name))))
;; no-littering ;; no-littering
(use-package no-littering (use-package no-littering
:defer nil :defer nil
@@ -214,19 +234,6 @@ Apply OLDFUN with to ARGS."
show-paren-not-in-comments-or-strings 'on-mismatch) show-paren-not-in-comments-or-strings 'on-mismatch)
(show-paren-mode 1) (show-paren-mode 1)
;; Form feed characters
(face-spec-set 'whitespace-page-delimiter
'((((supports :strike-through t))
:strike-through t :extend t :inherit shadow)
(t :extend t :inherit shadow :inverse-video t)))
(define-globalized-minor-mode my/global-whitespace-page-delimiters-mode
whitespace-page-delimiters-mode
whitespace-page-delimiters-mode
:group 'whitespace)
(my/global-whitespace-page-delimiters-mode 1)
;; Display line numbers ;; Display line numbers
(global-display-line-numbers-mode 1) (global-display-line-numbers-mode 1)
@@ -516,10 +523,10 @@ PRED is nil, the value of `my/kill-some-buffers-default-pred' is used."
:ensure nil :ensure nil
:bind (("C-x t s" . split-tab) :bind (("C-x t s" . split-tab)
("C-x t e" . merge-tabs)) ("C-x t e" . merge-tabs))
:custom :config
(setq tab-bar-show 1 (setopt tab-bar-show 1
tab-bar-tab-hints t tab-bar-tab-hints t
icon-preference '(symbol text image emoji)) icon-preference '(symbol text image emoji))
(tab-bar-mode 1) (tab-bar-mode 1)
(tab-bar-history-mode 1)) (tab-bar-history-mode 1))
@@ -1296,29 +1303,6 @@ environment variable accordingly."
(setq xref-show-xrefs-function #'consult-xref (setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)) xref-show-definitions-function #'consult-xref))
;; popup.el
(use-package popup)
;; posframe
(use-package posframe
:init
(defun my/posframe-tip (name msg)
"Like `popup-tip', but with a posframe.
NAME should be the buffer name to pass to `posframe-show'. MSG is the message to
display."
(unwind-protect
(progn
(posframe-show name
:string msg
:position (point)
:max-width 80
:border-width 2
:border-color "white")
(clear-this-command-keys)
(push (read-event) unread-command-events)
(posframe-hide name))
(posframe-hide name))))
(defun my/-floating-tooltip-fill-string (msg &optional width prefix) (defun my/-floating-tooltip-fill-string (msg &optional width prefix)
"Fill MSG to WIDTH, defaulting to 80 characters. "Fill MSG to WIDTH, defaulting to 80 characters.
If PREFIX is a number, add that many spaces before each continuation line. If If PREFIX is a number, add that many spaces before each continuation line. If
@@ -1337,10 +1321,7 @@ it is a string, add that string. If it is nil, add 5 spaces."
MSG is the message to show in the popup. NAME is the name of the buffer to pass MSG is the message to show in the popup. NAME is the name of the buffer to pass
to `posframe-show' if the display is graphical. to `posframe-show' if the display is graphical.
WIDTH and PREFIX are as for `my/-floating-tooltip-fill-string'." WIDTH and PREFIX are as for `my/-floating-tooltip-fill-string'."
(let ((msg (my/-floating-tooltip-fill-string msg width prefix))) (my/posframe-tip name (my/-floating-tooltip-fill-string msg width prefix)))
(if (display-graphic-p)
(my/posframe-tip name msg)
(popup-tip msg))))
;; flymake ;; flymake
(use-package flymake (use-package flymake
@@ -4131,7 +4112,7 @@ vising, and their major mode"
;; dashboard.el ;; dashboard.el
(use-package dashboard (use-package dashboard
:custom :custom
(initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) (initial-buffer-choice #'dashboard-open)
(dashboard-force-refresh t) (dashboard-force-refresh t)
(dashboard-display-icons-p t) (dashboard-display-icons-p t)
(dashboard-icon-type 'nerd-icons) (dashboard-icon-type 'nerd-icons)
@@ -4141,19 +4122,18 @@ vising, and their major mode"
(projects . 5) (projects . 5)
(bookmarks . 5))) (bookmarks . 5)))
:config :config
(defvar-local my/-dashboard-did-fix-image nil (add-hook 'server-after-make-frame-hook #'dashboard-open)
"Weather or not the dashboard image has been fixed in this buffer.")
(defun my/-dashboard-fix-image ()
(unless my/-dashboard-did-fix-image
(dashboard-refresh-buffer)
(setq my/-dashboard-did-fix-image t)))
(defun my/-dashboard-setup-function ()
(add-hook 'window-configuration-change-hook 'my/-dashboard-fix-image nil t)
(setq-local display-line-numbers nil))
(add-hook 'dashboard-mode-hook 'my/-dashboard-setup-function)
(set-face-background 'dashboard-banner-logo-title nil)
(dashboard-setup-startup-hook)) (dashboard-setup-startup-hook))
;; prettify ^L characters (emacs 31.1 mode breaks stuff)
(use-package form-feed
:custom-face
(form-feed-line ((((type graphic)) :strike-through "#555556")
(((type tty)) :inherit font-lock-comment-face :underline t)))
:config
(global-form-feed-mode 1))
;; world clocks ;; world clocks
(setopt zoneinfo-style-world-list (setopt zoneinfo-style-world-list
'(("America/Los_Angeles" "California") '(("America/Los_Angeles" "California")