Commit 81cab4c3 authored by Dominik Honnef's avatar Dominik Honnef Committed by Alan Donovan

misc/emacs: minor cleanups

R=adonovan
CC=golang-codereviews
https://golang.org/cl/23290044
parent 29fe067b
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
;; macro. ;; macro.
(if nil (if nil
(declare-function go--position-bytes "go-mode" (point))) (declare-function go--position-bytes "go-mode" (point)))
;; XEmacs unfortunately does not offer position-bytes. We can fall ;; XEmacs unfortunately does not offer position-bytes. We can fall
;; back to just using (point), but it will be incorrect as soon as ;; back to just using (point), but it will be incorrect as soon as
;; multibyte characters are being used. ;; multibyte characters are being used.
...@@ -249,8 +250,8 @@ For mode=set, all covered lines will have this weight." ...@@ -249,8 +250,8 @@ For mode=set, all covered lines will have this weight."
"Syntax table for Go mode.") "Syntax table for Go mode.")
(defun go--build-font-lock-keywords () (defun go--build-font-lock-keywords ()
;; we cannot use 'symbols in regexp-opt because emacs <24 doesn't ;; we cannot use 'symbols in regexp-opt because GNU Emacs <24
;; understand that ;; doesn't understand that
(append (append
`((,(go--regexp-enclose-in-symbol (regexp-opt go-mode-keywords t)) . font-lock-keyword-face) `((,(go--regexp-enclose-in-symbol (regexp-opt go-mode-keywords t)) . font-lock-keyword-face)
(,(go--regexp-enclose-in-symbol (regexp-opt go-builtins t)) . font-lock-builtin-face) (,(go--regexp-enclose-in-symbol (regexp-opt go-builtins t)) . font-lock-builtin-face)
...@@ -450,8 +451,9 @@ current line will be returned." ...@@ -450,8 +451,9 @@ current line will be returned."
(goto-char (- (point-max) pos)))))) (goto-char (- (point-max) pos))))))
(defun go-beginning-of-defun (&optional count) (defun go-beginning-of-defun (&optional count)
(unless count (setq count 1)) (setq count (or count 1))
(let ((first t) failure) (let ((first t)
failure)
(dotimes (i (abs count)) (dotimes (i (abs count))
(while (and (not failure) (while (and (not failure)
(or first (go-in-string-or-comment-p))) (or first (go-in-string-or-comment-p)))
...@@ -513,7 +515,7 @@ The following extra functions are defined: ...@@ -513,7 +515,7 @@ The following extra functions are defined:
If you want to automatically run `gofmt' before saving a file, If you want to automatically run `gofmt' before saving a file,
add the following hook to your emacs configuration: add the following hook to your emacs configuration:
\(add-hook 'before-save-hook 'gofmt-before-save) \(add-hook 'before-save-hook #'gofmt-before-save)
If you want to use `godef-jump' instead of etags (or similar), If you want to use `godef-jump' instead of etags (or similar),
consider binding godef-jump to `M-.', which is the default key consider binding godef-jump to `M-.', which is the default key
...@@ -532,7 +534,8 @@ If you're looking for even more integration with Go, namely ...@@ -532,7 +534,8 @@ If you're looking for even more integration with Go, namely
on-the-fly syntax checking, auto-completion and snippets, it is on-the-fly syntax checking, auto-completion and snippets, it is
recommended that you look at goflymake recommended that you look at goflymake
\(https://github.com/dougm/goflymake), gocode \(https://github.com/dougm/goflymake), gocode
\(https://github.com/nsf/gocode) and yasnippet-go \(https://github.com/nsf/gocode), go-eldoc
\(github.com/syohex/emacs-go-eldoc) and yasnippet-go
\(https://github.com/dominikh/yasnippet-go)" \(https://github.com/dominikh/yasnippet-go)"
;; Font lock ;; Font lock
...@@ -1108,7 +1111,7 @@ divisor for FILE-NAME." ...@@ -1108,7 +1111,7 @@ divisor for FILE-NAME."
(start-line start-column end-line end-column num count) (start-line start-column end-line end-column num count)
(mapcar #'string-to-number rest) (mapcar #'string-to-number rest)
(when (and (string= (file-name-nondirectory file) file-name)) (when (string= (file-name-nondirectory file) file-name)
(if (> count max-count) (if (> count max-count)
(setq max-count count)) (setq max-count count))
(push (make-go--covered :start-line start-line (push (make-go--covered :start-line start-line
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment