]> code.delx.au - gnu-emacs-elpa/commitdiff
company-show-doc-buffer: Still call doc-buffer inside the electric block
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 25 Feb 2015 13:35:56 +0000 (15:35 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 25 Feb 2015 13:35:56 +0000 (15:35 +0200)
#309

company.el

index eb322677d955447e0bbe3276609c90473eca8700..3ef045d6fbed0dc7e276f0747ca8100f96b7098a 100644 (file)
@@ -2045,14 +2045,15 @@ character, stripping the modifiers.  That character must be a digit."
 (defun company-show-doc-buffer ()
   "Temporarily show the documentation buffer for the selection."
   (interactive)
-  (let* ((selected (nth company-selection company-candidates))
-         (doc-buffer (or (company-call-backend 'doc-buffer selected)
-                         (error "No documentation available")))
-         (other-window-scroll-buffer (get-buffer doc-buffer)))
+  (let (other-window-scroll-buffer)
     (company--electric-do
-      (with-current-buffer doc-buffer
-        (goto-char (point-min)))
-      (display-buffer doc-buffer t))))
+      (let* ((selected (nth company-selection company-candidates))
+             (doc-buffer (or (company-call-backend 'doc-buffer selected)
+                             (error "No documentation available"))))
+        (setq other-window-scroll-buffer (get-buffer doc-buffer))
+        (with-current-buffer doc-buffer
+          (goto-char (point-min)))
+        (display-buffer doc-buffer t)))))
 (put 'company-show-doc-buffer 'company-keep t)
 
 (defun company-show-location ()