Get rid of display-buffer-alist for gotsfmt.
This commit is contained in:
parent
b306e75fde
commit
e069307e29
15
README.org
15
README.org
@ -4536,14 +4536,14 @@ Listing [[lst:setup-go]] defines:
|
|||||||
(interactive)
|
(interactive)
|
||||||
(when (eq major-mode 'go-ts-mode)
|
(when (eq major-mode 'go-ts-mode)
|
||||||
(let ((source (current-buffer))
|
(let ((source (current-buffer))
|
||||||
(goal (get-buffer-create "*Gofmt Output*"))
|
(output (get-buffer-create "*Gofmt Output*"))
|
||||||
(filename (buffer-file-name)))
|
(filename (buffer-file-name)))
|
||||||
(when (eq t (buffer-modified-p source)) ; autosaved is not OK.
|
(when (eq t (buffer-modified-p source)) ; autosaved is not OK.
|
||||||
(save-buffer))
|
(save-buffer))
|
||||||
(set-buffer goal)
|
(set-buffer output)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
;; Direct stdin and stderr to goal.
|
;; Direct stdin and stderr to output.
|
||||||
;; Get goal with filename in patch by calling "gofmt -d filename".
|
;; Get output with filename in patch by calling "gofmt -d filename".
|
||||||
;; Provoke a gofmt error (delete package statement) to debug this.
|
;; Provoke a gofmt error (delete package statement) to debug this.
|
||||||
(if (zerop (call-process "gofmt" nil t nil "-d" filename))
|
(if (zerop (call-process "gofmt" nil t nil "-d" filename))
|
||||||
(if (> (point) (point-min))
|
(if (> (point) (point-min))
|
||||||
@ -4553,13 +4553,10 @@ Listing [[lst:setup-go]] defines:
|
|||||||
(save-buffer)
|
(save-buffer)
|
||||||
(message "Gofmt tabbed your code!"))
|
(message "Gofmt tabbed your code!"))
|
||||||
(message "Gofmt adores 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!")))))
|
(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)))
|
(add-to-list 'auto-mode-alist `(,(rx ".go" eos) . go-ts-mode)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user