branch: elpa/go-mode commit 32cbd78c0af29837ace3db04a224d6d01ec6851e Author: Dominik Honnef <domi...@honnef.co> Commit: Dominik Honnef <domi...@honnef.co>
Remove polyfills for functions from Emacs 26 Updates gh-394 --- go-mode.el | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/go-mode.el b/go-mode.el index 349c6bc..1a85492 100644 --- a/go-mode.el +++ b/go-mode.el @@ -1926,7 +1926,7 @@ with goflymake (see URL `https://github.com/dougm/goflymake'), gocode The tool used can be set via ‘gofmt-command’ (default: gofmt) and additional arguments can be set as a list via ‘gofmt-args’." (interactive) - (let ((tmpfile (go--make-nearby-temp-file "gofmt" nil ".go")) + (let ((tmpfile (make-nearby-temp-file "gofmt" nil ".go")) (patchbuf (get-buffer-create "*Gofmt patch*")) (errbuf (if gofmt-show-errors (get-buffer-create "*Gofmt Errors*"))) (coding-system-for-read 'utf-8) @@ -1952,11 +1952,11 @@ arguments can be set as a list via ‘gofmt-args’." ;; accepting a full path, and some features ;; of goimports rely on knowing the full ;; name. - (list "-srcdir" (go--file-local-name + (list "-srcdir" (file-local-name (file-truename buffer-file-name)))))) (setq our-gofmt-args (append our-gofmt-args gofmt-args - (list "-w" (go--file-local-name tmpfile)))) + (list "-w" (file-local-name tmpfile)))) (message "Calling gofmt: %s %s" gofmt-command our-gofmt-args) ;; We're using errbuf for the mixed stdout and stderr output. This ;; is not an issue because gofmt -w does not produce any stdout @@ -2000,7 +2000,7 @@ arguments can be set as a list via ‘gofmt-args’." (concat (file-name-directory filename) (file-name-nondirectory tmpfile)) tmpfile))) (while (search-forward-regexp - (concat "^\\(" (regexp-quote (go--file-local-name truefile)) + (concat "^\\(" (regexp-quote (file-local-name truefile)) "\\):") nil t) (replace-match (file-name-nondirectory filename) t t nil 1))) @@ -2906,29 +2906,6 @@ If BUFFER, return the number of characters in that buffer instead." ;;;###autoload (add-to-list 'auto-mode-alist '("go\\.mod\\'" . go-dot-mod-mode)) -;; Polyfills for functions added in Emacs 26. Remove these once we don’t -;; support Emacs 25 any more. -(defalias 'go--file-local-name - (if (fboundp 'file-local-name) #'file-local-name - (lambda (file) (or (file-remote-p file 'localname) file)))) - -(defalias 'go--make-nearby-temp-file - (if (fboundp 'make-nearby-temp-file) #'make-nearby-temp-file - (lambda (prefix &optional dir-flag suffix) - (let ((temporary-file-directory (go--temporary-file-directory))) - (make-temp-file prefix dir-flag suffix))))) - -(defalias 'go--temporary-file-directory - (if (fboundp 'temporary-file-directory) #'temporary-file-directory - (lambda () - (let ((remote (file-remote-p default-directory))) - (if remote - ;; Assume that /tmp is a temporary directory on the remote host. - ;; This won’t work on Windows. - (concat remote "/tmp") - temporary-file-directory))))) - - ;; The following functions were copied (and modified) from rust-mode.el. ;; ;; Copyright (c) 2015 The Rust Project Developers