[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
mustache-mode nyan-mode paredit popup prettier-js
projectile protobuf-mode python-mode request rjsx-mode
ruby-mode rust-mode scala-ts-mode sql-indent swift-mode
switch-window terraform-mode thrift tide tree-sitter tss
tuareg typescript-mode use-package vterm web-mode wgrep
wgsl-mode xref-js2 xterm-color yaml-mode zig-mode))
ruby-mode rust-mode scala-ts-mode simple-httpd sql-indent
swift-mode switch-window terraform-mode thrift tide
tree-sitter tss tuareg typescript-mode use-package uuidgen
vterm web-mode wgrep wgsl-mode xref-js2 xterm-color
yaml-mode zig-mode))
'(reb-re-syntax 'string)
'(rmail-mail-new-frame t)
'(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."
(cond
((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)
(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)
"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)))
(defun doty-tools--map-buffer (buffer)
"Generate a map for BUFFER."
(with-current-buffer buffer
(defun doty-tools--map-buffer (file-or-buffer)
"Generate a map for FILE-OR-BUFFER."
(with-current-buffer (doty-tools--buffer-or-file file-or-buffer)
(let* ((registration (or (assoc (treesit-language-at (point-min))
doty-tools--treesit-queries)
(error "Language '%s' not registered as a tree-sitter mapper"