[emacs] Tweaks

This commit is contained in:
John Doty 2025-05-16 19:30:34 +00:00
parent e4b05aeac8
commit 40a87f666b
2 changed files with 13 additions and 9 deletions

View file

@ -78,10 +78,11 @@
mocha modus-themes monky monokai-theme multi-term mocha modus-themes monky monokai-theme multi-term
mustache-mode nyan-mode paredit popup prettier-js mustache-mode nyan-mode paredit popup prettier-js
projectile protobuf-mode python-mode request rjsx-mode projectile protobuf-mode python-mode request rjsx-mode
ruby-mode rust-mode scala-ts-mode sql-indent swift-mode ruby-mode rust-mode scala-ts-mode simple-httpd sql-indent
switch-window terraform-mode thrift tide tree-sitter tss swift-mode switch-window terraform-mode thrift tide
tuareg typescript-mode use-package vterm web-mode wgrep tree-sitter tss tuareg typescript-mode use-package uuidgen
wgsl-mode xref-js2 xterm-color yaml-mode zig-mode)) vterm web-mode wgrep wgsl-mode xref-js2 xterm-color
yaml-mode zig-mode))
'(reb-re-syntax 'string) '(reb-re-syntax 'string)
'(rmail-mail-new-frame t) '(rmail-mail-new-frame t)
'(safe-local-variable-values '(safe-local-variable-values

View file

@ -100,9 +100,12 @@ If it is a buffer object, just return it. If it names a file, visit the
that buffer. Otherwise return nil." that buffer. Otherwise return nil."
(cond (cond
((bufferp buffer-or-file) buffer-or-file) ((bufferp buffer-or-file) buffer-or-file)
((file-exists-p buffer-or-file) (find-file-noselect buffer-or-file)) ((file-exists-p (expand-file-name buffer-or-file))
(find-file-noselect (expand-file-name buffer-or-file)))
((length= (match-buffers buffer-or-file) 1) ((length= (match-buffers buffer-or-file) 1)
(car (match-buffers buffer-or-file))))) (car (match-buffers buffer-or-file)))
(t (error "file %s doesn't exist and does not name an open buffer"
buffer-or-file))))
(defun doty-tools--open-file (filename &optional max-chars) (defun doty-tools--open-file (filename &optional max-chars)
"Visit FILENAME and return up to MAX-CHARS of its contents as a string. "Visit FILENAME and return up to MAX-CHARS of its contents as a string.
@ -404,9 +407,9 @@ Returns file path, modified status, major mode, size, line count, and more."
(treesit-node-check node 'missing))) (treesit-node-check node 'missing)))
(defun doty-tools--map-buffer (buffer) (defun doty-tools--map-buffer (file-or-buffer)
"Generate a map for BUFFER." "Generate a map for FILE-OR-BUFFER."
(with-current-buffer buffer (with-current-buffer (doty-tools--buffer-or-file file-or-buffer)
(let* ((registration (or (assoc (treesit-language-at (point-min)) (let* ((registration (or (assoc (treesit-language-at (point-min))
doty-tools--treesit-queries) doty-tools--treesit-queries)
(error "Language '%s' not registered as a tree-sitter mapper" (error "Language '%s' not registered as a tree-sitter mapper"