]> Cypherpunks repositories - gostls13.git/commitdiff
misc/emacs: Add tab completion for godoc command, completing from known installed...
authorDominik Honnef <dominik.honnef@gmail.com>
Mon, 4 Mar 2013 20:31:57 +0000 (15:31 -0500)
committerAlan Donovan <adonovan@google.com>
Mon, 4 Mar 2013 20:31:57 +0000 (15:31 -0500)
R=golang-dev, adonovan, bradfitz, cw, patrick.allen.higgins, sameer, ugorji
CC=golang-dev
https://golang.org/cl/7373051

misc/emacs/go-mode.el

index 8a16d8a4f2e0958fbcbbd7619178472614cd5da5..0fc21b561ee2f6d8fef571f6f719409db4d1c479 100644 (file)
@@ -35,6 +35,7 @@
 (defconst go-type-name-regexp (concat "\\(?:[*(]\\)*\\(?:" go-identifier-regexp "\\.\\)?\\(" go-identifier-regexp "\\)"))
 
 (defvar go-dangling-cache)
+(defvar go-godoc-history nil)
 
 (defgroup go nil
   "Major mode for editing Go code"
@@ -476,10 +477,10 @@ you save any file, kind of defeating the point of autoloading."
          (symbol (if bounds
                      (buffer-substring-no-properties (car bounds)
                                                      (cdr bounds)))))
-    (read-string (if symbol
-                     (format "godoc (default %s): " symbol)
-                   "godoc: ")
-                 nil nil symbol)))
+    (completing-read (if symbol
+                         (format "godoc (default %s): " symbol)
+                       "godoc: ")
+                     (go-packages) nil nil nil 'go-godoc-history symbol)))
 
 (defun godoc--get-buffer (query)
   "Get an empty buffer for a godoc query."