[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 35f4178 043/173: Allow including window-start in the doc-b
From: |
Dmitry Gutov |
Subject: |
[elpa] master 35f4178 043/173: Allow including window-start in the doc-buffer return value |
Date: |
Thu, 23 Jun 2016 00:28:36 +0000 (UTC) |
branch: master
commit 35f4178f43317ae6e94525656a7382f066171872
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Allow including window-start in the doc-buffer return value
Closes #357
---
NEWS.md | 2 ++
company.el | 17 +++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 012d0bc..319e959 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## Next
+* Backend command `doc-buffer` now can also return a cons of buffer and window
+ start position.
* Backend command `ignore-case` has been documented.
* `company-template-c-like-templatify` does not replace the default argument
values with `argN` anymore
diff --git a/company.el b/company.el
index af5c040..1481914 100644
--- a/company.el
+++ b/company.el
@@ -375,9 +375,11 @@ them from cache.
documentation string for it.
`doc-buffer': The second argument is a completion candidate. Return a
-buffer with documentation for it. Preferably use `company-doc-buffer',
+buffer with documentation for it. Preferably use `company-doc-buffer'. If
+not all buffer contents pertain to this candidate, return a cons of buffer
+and window start position.
-`location': The second argument is a completion candidate. Return the cons
+`location': The second argument is a completion candidate. Return a cons
of buffer and buffer location, or of file and line number where the
completion candidate was defined.
@@ -2066,11 +2068,14 @@ character, stripping the modifiers. That character
must be a digit."
(company--electric-do
(let* ((selected (nth company-selection company-candidates))
(doc-buffer (or (company-call-backend 'doc-buffer selected)
- (error "No documentation available"))))
+ (error "No documentation available")))
+ start)
+ (when (consp doc-buffer)
+ (setq start (cdr doc-buffer)
+ doc-buffer (car doc-buffer)))
(setq other-window-scroll-buffer (get-buffer doc-buffer))
- (with-current-buffer doc-buffer
- (goto-char (point-min)))
- (display-buffer doc-buffer t)))))
+ (let ((win (display-buffer doc-buffer t)))
+ (set-window-start win (if start start (point-min))))))))
(put 'company-show-doc-buffer 'company-keep t)
(defun company-show-location ()
- [elpa] master ed3e711 084/173: company-yasnippet: Disable cache (#422), (continued)
- [elpa] master ed3e711 084/173: company-yasnippet: Disable cache (#422), Dmitry Gutov, 2016/06/22
- [elpa] master 7d14350 051/173: company-eclim-executable: Pick up the value of eclim-executable, if present, Dmitry Gutov, 2016/06/22
- [elpa] master 9e66366 067/173: Fix #404 by blanking out line-prefix again, Dmitry Gutov, 2016/06/22
- [elpa] master 433ae92 072/173: Retouch the docstring further, Dmitry Gutov, 2016/06/22
- [elpa] master 02d0e74 074/173: Modernize the Commentary a bit, Dmitry Gutov, 2016/06/22
- [elpa] master 7d005c4 080/173: Document some company-grab- functions, Dmitry Gutov, 2016/06/22
- [elpa] master 07a4e9e 094/173: Travis: Try to fix the "held broken packages", Dmitry Gutov, 2016/06/22
- [elpa] master 7779820 092/173: Remove completions without annotations when considering duplicates, Dmitry Gutov, 2016/06/22
- [elpa] master f1ca92f 042/173: Update NEWS [ci skip], Dmitry Gutov, 2016/06/22
- [elpa] master f45b11e 033/173: Don't replace the default argument values with `argN` anymore, Dmitry Gutov, 2016/06/22
- [elpa] master 35f4178 043/173: Allow including window-start in the doc-buffer return value,
Dmitry Gutov <=
- [elpa] master b0a946d 052/173: company-clang--start-process: Only erase buffer when there's no existing process, Dmitry Gutov, 2016/06/22
- [elpa] master 5e29e41 003/173: company-files--grab-existing-name: Check if the file is remote, Dmitry Gutov, 2016/06/22
- [elpa] master 7579ced 055/173: Fix a bug reference, Dmitry Gutov, 2016/06/22
- [elpa] master 05987e6 056/173: Fix #362 (arbitrary jumping of point), Dmitry Gutov, 2016/06/22
- [elpa] master 679846a 065/173: Makefile: allow package and elpa targets to run without git, Dmitry Gutov, 2016/06/22
- [elpa] master 33f7bbc 077/173: Fix some compilation warnings, Dmitry Gutov, 2016/06/22
- [elpa] master d39b956 059/173: Introduce company-indent-or-complete-common, Dmitry Gutov, 2016/06/22
- [elpa] master 478f124 087/173: company-dabbrev-code-modes: Improve Customize labels, Dmitry Gutov, 2016/06/22
- [elpa] master 4a6eea9 089/173: Use company-dabbrev-char-regexp more consistently (#433), Dmitry Gutov, 2016/06/22
- [elpa] master a3858be 086/173: Ignore trigger key prefixes that are shorter than symbol-at-point, Dmitry Gutov, 2016/06/22