LEFT | RIGHT |
(no file at all) | |
1 ;;; go-mode.el --- Major mode for the Go programming language | 1 ;;; go-mode.el --- Major mode for the Go programming language |
2 | 2 |
3 ;;; Commentary: | 3 ;;; Commentary: |
4 | 4 |
5 ;; For installation instructions, see go-mode-load.el | 5 ;; For installation instructions, see go-mode-load.el |
6 | 6 |
7 ;;; To do: | 7 ;;; To do: |
8 | 8 |
9 ;; * Indentation is *almost* identical to gofmt | 9 ;; * Indentation is *almost* identical to gofmt |
10 ;; ** We think struct literal keys are labels and outdent them | 10 ;; ** We think struct literal keys are labels and outdent them |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 (defvar go-mode-keywords | 62 (defvar go-mode-keywords |
63 '("break" "default" "func" "interface" "select" | 63 '("break" "default" "func" "interface" "select" |
64 "case" "defer" "go" "map" "struct" | 64 "case" "defer" "go" "map" "struct" |
65 "chan" "else" "goto" "package" "switch" | 65 "chan" "else" "goto" "package" "switch" |
66 "const" "fallthrough" "if" "range" "type" | 66 "const" "fallthrough" "if" "range" "type" |
67 "continue" "for" "import" "return" "var") | 67 "continue" "for" "import" "return" "var") |
68 "All keywords in the Go language. Used for font locking and | 68 "All keywords in the Go language. Used for font locking and |
69 some syntax analysis.") | 69 some syntax analysis.") |
70 | 70 |
71 (defvar go-mode-font-lock-keywords | 71 (defvar go-mode-font-lock-keywords |
72 (let ((builtins '("append" "cap" "close" "complex" "copy" "imag" "len" | 72 (let ((builtins '("append" "cap" "close" "complex" "copy" "delete" "imag" "len
" |
73 "make" "new" "panic" "print" "println" "real" "recover")) | 73 "make" "new" "panic" "print" "println" "real" "recover")) |
74 (constants '("nil" "true" "false" "iota")) | 74 (constants '("nil" "true" "false" "iota")) |
75 (type-name "\\s *\\(?:[*(]\\s *\\)*\\(?:\\w+\\s *\\.\\s *\\)?\\(\\w+\\)"
) | 75 (type-name "\\s *\\(?:[*(]\\s *\\)*\\(?:\\w+\\s *\\.\\s *\\)?\\(\\w+\\)"
) |
76 ) | 76 ) |
77 `((,(regexp-opt go-mode-keywords 'words) . font-lock-keyword-face) | 77 `((,(regexp-opt go-mode-keywords 'words) . font-lock-keyword-face) |
78 (,(regexp-opt builtins 'words) . font-lock-builtin-face) | 78 (,(regexp-opt builtins 'words) . font-lock-builtin-face) |
79 (,(regexp-opt constants 'words) . font-lock-constant-face) | 79 (,(regexp-opt constants 'words) . font-lock-constant-face) |
80 ;; Function names in declarations | 80 ;; Function names in declarations |
81 ("\\<func\\>\\s *\\(\\w+\\)" 1 font-lock-function-name-face) | 81 ("\\<func\\>\\s *\\(\\w+\\)" 1 font-lock-function-name-face) |
82 ;; Function names in methods are handled by function call pattern | 82 ;; Function names in methods are handled by function call pattern |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 "Show go documentation for a query, much like M-x man." | 582 "Show go documentation for a query, much like M-x man." |
583 (interactive (list (godoc-read-query))) | 583 (interactive (list (godoc-read-query))) |
584 (unless (string= query "") | 584 (unless (string= query "") |
585 (set-process-sentinel | 585 (set-process-sentinel |
586 (start-process-shell-command "godoc" (godoc-get-buffer query) | 586 (start-process-shell-command "godoc" (godoc-get-buffer query) |
587 (concat "godoc " query)) | 587 (concat "godoc " query)) |
588 'godoc-buffer-sentinel) | 588 'godoc-buffer-sentinel) |
589 nil)) | 589 nil)) |
590 | 590 |
591 (provide 'go-mode) | 591 (provide 'go-mode) |
LEFT | RIGHT |