From a78394293b412b6afc0222895da2d132c34098ea Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 21 May 2025 14:42:20 +0200 Subject: [PATCH] update go-mode --- .../go-mode-autoloads.el | 7 +++++ .../go-mode-pkg.el | 6 ++-- .../go-mode.el | 31 +++++++++++++++++-- 3 files changed, 39 insertions(+), 5 deletions(-) rename elpa/{go-mode-20240620.1948 => go-mode-20250311.156}/go-mode-autoloads.el (93%) rename elpa/{go-mode-20240620.1948 => go-mode-20250311.156}/go-mode-pkg.el (62%) rename elpa/{go-mode-20240620.1948 => go-mode-20250311.156}/go-mode.el (98%) diff --git a/elpa/go-mode-20240620.1948/go-mode-autoloads.el b/elpa/go-mode-20250311.156/go-mode-autoloads.el similarity index 93% rename from elpa/go-mode-20240620.1948/go-mode-autoloads.el rename to elpa/go-mode-20250311.156/go-mode-autoloads.el index d54b631a..da8149e2 100644 --- a/elpa/go-mode-20240620.1948/go-mode-autoloads.el +++ b/elpa/go-mode-20250311.156/go-mode-autoloads.el @@ -98,6 +98,13 @@ A major mode for editor go.work files. (fn)" t) (add-to-list 'auto-mode-alist '("go\\.work\\'" . go-dot-work-mode)) +(autoload 'go-asm-mode "go-mode" "\ +Major mode for Go assembly (.s) files. + +(fn)" t) +(add-to-list 'magic-mode-alist (cons #'go--is-go-asm #'go-asm-mode)) +(autoload 'go--is-go-asm "go-mode" "\ +Determine whether a file is (probably) a Go assembly file.") (register-definition-prefixes "go-mode" '("go-" "god" "gofmt")) ;;; End of scraped data diff --git a/elpa/go-mode-20240620.1948/go-mode-pkg.el b/elpa/go-mode-20250311.156/go-mode-pkg.el similarity index 62% rename from elpa/go-mode-20240620.1948/go-mode-pkg.el rename to elpa/go-mode-20250311.156/go-mode-pkg.el index 29c8528a..7f2e52bf 100644 --- a/elpa/go-mode-20240620.1948/go-mode-pkg.el +++ b/elpa/go-mode-20250311.156/go-mode-pkg.el @@ -1,8 +1,8 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "go-mode" "20240620.1948" +(define-package "go-mode" "20250311.156" "Major mode for the Go programming language." '((emacs "26.1")) :url "https://github.com/dominikh/go-mode.el" - :commit "636d36e37a0d2b6adb2e12d802ff4794ccbba336" - :revdesc "636d36e37a0d" + :commit "58b0c3dfc87f5ae4137ea498dc0e03adc9eeb751" + :revdesc "58b0c3dfc87f" :keywords '("languages" "go")) diff --git a/elpa/go-mode-20240620.1948/go-mode.el b/elpa/go-mode-20250311.156/go-mode.el similarity index 98% rename from elpa/go-mode-20240620.1948/go-mode.el rename to elpa/go-mode-20250311.156/go-mode.el index 3dd801b8..884868ca 100644 --- a/elpa/go-mode-20240620.1948/go-mode.el +++ b/elpa/go-mode-20250311.156/go-mode.el @@ -7,8 +7,8 @@ ;; license that can be found in the LICENSE file. ;; Author: The go-mode Authors -;; Package-Version: 20240620.1948 -;; Package-Revision: 636d36e37a0d +;; Package-Version: 20250311.156 +;; Package-Revision: 58b0c3dfc87f ;; Keywords: languages go ;; Package-Requires: ((emacs "26.1")) ;; URL: https://github.com/dominikh/go-mode.el @@ -3090,6 +3090,33 @@ This handles multi-line comments with a * prefix on each line." (call-interactively #'lsp-rename)) (error "buffer is not managed by a known LSP client"))) +;;;###autoload +(define-derived-mode go-asm-mode asm-mode "Go assembly" + "Major mode for Go assembly (.s) files." + (set (make-local-variable 'comment-start) "// ") + (set (make-local-variable 'comment-end) "") + (set (make-local-variable 'comment-use-syntax) t) + (set (make-local-variable 'comment-start-skip) "\\(//+\\)\\s *") + (setq indent-tabs-mode t)) + +;;;###autoload +(add-to-list 'magic-mode-alist (cons #'go--is-go-asm #'go-asm-mode)) + +;;;###autoload +(defun go--is-go-asm () + "Determine whether a file is (probably) a Go assembly file." + (when (string-suffix-p ".s" (buffer-file-name)) + (let ((directory (file-name-directory (buffer-file-name)))) + (when directory + (cl-some (lambda (s) (or (string-suffix-p ".go" s) (string-suffix-p ".mod" s))) + (condition-case nil + ;; We only look at 8192 files, to avoid heavy I/O in + ;; case the user opens a .s file in a giant directory. + ;; If it weren't for that, we could set the count to 1 + ;; and use the 'match' argument of directory-files to + ;; look for the first '.go' file. + (directory-files directory nil nil t 8192) + (error nil))))))) (provide 'go-mode) -- 2.47.3