Get rid of display-buffer-alist for gotsfmt.

This commit is contained in:
Gerard Vermeulen 2025-01-25 20:33:08 +01:00
parent b306e75fde
commit e069307e29

View File

@ -4536,14 +4536,14 @@ Listing [[lst:setup-go]] defines:
(interactive)
(when (eq major-mode 'go-ts-mode)
(let ((source (current-buffer))
(goal (get-buffer-create "*Gofmt Output*"))
(output (get-buffer-create "*Gofmt Output*"))
(filename (buffer-file-name)))
(when (eq t (buffer-modified-p source)) ; autosaved is not OK.
(save-buffer))
(set-buffer goal)
(set-buffer output)
(erase-buffer)
;; Direct stdin and stderr to goal.
;; Get goal with filename in patch by calling "gofmt -d filename".
;; Direct stdin and stderr to output.
;; Get output with filename in patch by calling "gofmt -d filename".
;; Provoke a gofmt error (delete package statement) to debug this.
(if (zerop (call-process "gofmt" nil t nil "-d" filename))
(if (> (point) (point-min))
@ -4553,13 +4553,10 @@ Listing [[lst:setup-go]] defines:
(save-buffer)
(message "Gofmt tabbed your code!"))
(message "Gofmt adores your code!"))
(display-buffer goal)
(display-buffer output '(display-buffer-below-selected
(inhibit-same-window . t)))
(message "Your code chokes Gofmt!")))))
(add-to-list 'display-buffer-alist `("*Gofmt Output*"
display-buffer-reuse-window
(inhibit-same-window . nil)))
(add-to-list 'auto-mode-alist `(,(rx ".go" eos) . go-ts-mode)))
#+end_src