From 65104acdfc58dccd32037d69fb07d6683a685e70 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 13 Nov 2018 12:41:47 +0100 Subject: [PATCH] update go-mode. Signed-off-by: Andreas Gerler --- elpa/go-mode-20170726.555/go-mode-pkg.el | 2 - .../go-mode-autoloads.el | 11 +++- elpa/go-mode-20181012.329/go-mode-pkg.el | 2 + .../go-mode.el | 57 +++++++++++++++---- 4 files changed, 56 insertions(+), 16 deletions(-) delete mode 100644 elpa/go-mode-20170726.555/go-mode-pkg.el rename elpa/{go-mode-20170726.555 => go-mode-20181012.329}/go-mode-autoloads.el (91%) create mode 100644 elpa/go-mode-20181012.329/go-mode-pkg.el rename elpa/{go-mode-20170726.555 => go-mode-20181012.329}/go-mode.el (97%) diff --git a/elpa/go-mode-20170726.555/go-mode-pkg.el b/elpa/go-mode-20170726.555/go-mode-pkg.el deleted file mode 100644 index e2170124..00000000 --- a/elpa/go-mode-20170726.555/go-mode-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "go-mode" "20170726.555" "Major mode for the Go programming language" 'nil :commit "7eb5b3dd0ac31d176e9d56da4172f66aef8fae47" :url "https://github.com/dominikh/go-mode.el" :keywords '("languages" "go")) diff --git a/elpa/go-mode-20170726.555/go-mode-autoloads.el b/elpa/go-mode-20181012.329/go-mode-autoloads.el similarity index 91% rename from elpa/go-mode-20170726.555/go-mode-autoloads.el rename to elpa/go-mode-20181012.329/go-mode-autoloads.el index ea233f92..93aa93e2 100644 --- a/elpa/go-mode-20170726.555/go-mode-autoloads.el +++ b/elpa/go-mode-20181012.329/go-mode-autoloads.el @@ -1,10 +1,12 @@ ;;; go-mode-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "go-mode" "go-mode.el" (23119 40983 105815 -;;;;;; 401000)) +;;;### (autoloads nil "go-mode" "go-mode.el" (0 0 0 0)) ;;; Generated autoloads from go-mode.el (autoload 'go-mode "go-mode" "\ @@ -94,11 +96,14 @@ Tries to look for a URL at point. \(fn URL)" t nil) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "go-mode" '("gofmt" "god" "go-"))) + ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; go-mode-autoloads.el ends here diff --git a/elpa/go-mode-20181012.329/go-mode-pkg.el b/elpa/go-mode-20181012.329/go-mode-pkg.el new file mode 100644 index 00000000..b7607483 --- /dev/null +++ b/elpa/go-mode-20181012.329/go-mode-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "go-mode" "20181012.329" "Major mode for the Go programming language" 'nil :commit "120fb911f1d8038f828da85eed8aaad977dabd8c" :keywords '("languages" "go") :authors '(("The go-mode Authors")) :maintainer '("The go-mode Authors") :url "https://github.com/dominikh/go-mode.el") diff --git a/elpa/go-mode-20170726.555/go-mode.el b/elpa/go-mode-20181012.329/go-mode.el similarity index 97% rename from elpa/go-mode-20170726.555/go-mode.el rename to elpa/go-mode-20181012.329/go-mode.el index a33fa6f4..c3976a97 100644 --- a/elpa/go-mode-20170726.555/go-mode.el +++ b/elpa/go-mode-20181012.329/go-mode.el @@ -8,7 +8,7 @@ ;; Author: The go-mode Authors ;; Version: 1.5.0 -;; Package-Version: 20170726.555 +;; Package-Version: 20181012.329 ;; Keywords: languages go ;; URL: https://github.com/dominikh/go-mode.el ;; @@ -1030,7 +1030,8 @@ with goflymake \(see URL `https://github.com/dougm/goflymake'), gocode ;; Appending lines decrements the offset (possibly making it ;; negative), deleting lines increments it. This order ;; simplifies the forward-line invocations. - (line-offset 0)) + (line-offset 0) + (column (current-column))) (save-excursion (with-current-buffer patch-buffer (goto-char (point-min)) @@ -1057,7 +1058,8 @@ with goflymake \(see URL `https://github.com/dougm/goflymake'), gocode (cl-incf line-offset len) (go--delete-whole-line len))) (t - (error "Invalid rcs patch or internal error in go--apply-rcs-patch"))))))))) + (error "Invalid rcs patch or internal error in go--apply-rcs-patch"))))))) + (move-to-column column))) (defun gofmt--is-goimports-p () (string-equal (file-name-base gofmt-command) "goimports")) @@ -1068,7 +1070,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 (make-temp-file "gofmt" nil ".go")) + (let ((tmpfile (go--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) @@ -1094,17 +1096,25 @@ 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" (file-truename buffer-file-name))))) - (setq our-gofmt-args (append our-gofmt-args - gofmt-args - (list "-w" tmpfile))) + (list "-srcdir" (go--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)))) (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 ;; output in case of success. - (if (zerop (apply #'call-process gofmt-command nil errbuf nil our-gofmt-args)) + (if (zerop (apply #'process-file gofmt-command nil errbuf nil our-gofmt-args)) (progn - (if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile)) + ;; There is no remote variant of ‘call-process-region’, but we + ;; can invoke diff locally, and the results should be the same. + (if (zerop (let ((local-copy (file-local-copy tmpfile))) + (unwind-protect + (call-process-region + (point-min) (point-max) "diff" nil patchbuf + nil "-n" "-" (or local-copy tmpfile)) + (when local-copy (delete-file local-copy))))) (message "Buffer is already gofmted") (go--apply-rcs-patch patchbuf) (message "Applied gofmt")) @@ -1133,7 +1143,10 @@ arguments can be set as a list via ‘gofmt-args`." (if (gofmt--is-goimports-p) (concat (file-name-directory filename) (file-name-nondirectory tmpfile)) tmpfile))) - (while (search-forward-regexp (concat "^\\(" (regexp-quote truefile) "\\):") nil t) + (while (search-forward-regexp + (concat "^\\(" (regexp-quote (go--file-local-name truefile)) + "\\):") + nil t) (replace-match (file-name-nondirectory filename) t t nil 1))) (compilation-mode) (display-buffer errbuf)))) @@ -2009,6 +2022,28 @@ If BUFFER, return the number of characters in that buffer instead." (1- (position-bytes (point-max))))) +;; 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))))) + (provide 'go-mode) ;;; go-mode.el ends here -- 2.47.3