From a969f3c247b45ab5557aff1a8777751360b9c0a4 Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Mon, 4 Mar 2013 15:31:57 -0500 Subject: [PATCH] misc/emacs: Add tab completion for godoc command, completing from known installed packages R=golang-dev, adonovan, bradfitz, cw, patrick.allen.higgins, sameer, ugorji CC=golang-dev https://golang.org/cl/7373051 --- misc/emacs/go-mode.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index 8a16d8a4f2e..0fc21b561ee 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -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."