[elpa] 23/28: Fix WRT `keep-prefix'
dgutov pushed a commit to branch master in repository elpa. commit 82b53c5fc5226f6a415d97eb48666a9278903191 Author: Dmitry Gutov Date: Wed Aug 27 05:02:39 2014 +0400 Fix WRT `keep-prefix' --- company.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/company.el b/company.el index b93..c1671aa 100644 --- a/company.el +++ b/company.el @@ -2552,7 +2552,8 @@ Returns a negative number if the tooltip should be displayed above point." (defun company--show-inline-p () (and (not (cdr company-candidates)) company-common - (string-prefix-p company-prefix company-common))) + (or (eq (company-call-backend 'ignore-case) 'keep-prefix) + (string-prefix-p company-prefix company-common ;;; echo ;;;
[elpa] 02/28: company-dabbrev--search-buffer: Use `syntax-ppss' to get to the beg of str-or-cmt
dgutov pushed a commit to branch master in repository elpa. commit a5a6eeecf0ac9bda696091ab2a88a573f2fe3fd4 Author: Dmitry Gutov Date: Thu Jul 31 17:15:00 2014 +0300 company-dabbrev--search-buffer: Use `syntax-ppss' to get to the beg of str-or-cmt Fixes #158 --- company-dabbrev.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/company-dabbrev.el b/company-dabbrev.el index ef63d90..3d57bb5 100644 --- a/company-dabbrev.el +++ b/company-dabbrev.el @@ -95,7 +95,7 @@ If you set this value to nil, you may also want to set start limit (setq match (match-string-no-properties 0)) (if (and ignore-comments (company-in-string-or-comment)) -(re-search-backward "\\s<\\|\\s!\\|\\s\"\\|\\s|" nil t) +(goto-char (nth 8 (syntax-ppss))) (when (>= (length match) company-dabbrev-minimum-length) (push match symbols (goto-char (or pos (point-min)))
[elpa] 17/28: company-input-noop still seems to be needed in the terminal
dgutov pushed a commit to branch master in repository elpa. commit 7e1ca8e6ee18a2afb16843fdf4e0bde1128d5f4d Author: Dmitry Gutov Date: Mon Aug 18 06:17:02 2014 +0400 company-input-noop still seems to be needed in the terminal --- company.el |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/company.el b/company.el index bbaea00..d5e500d 100644 --- a/company.el +++ b/company.el @@ -768,7 +768,7 @@ means that `company-mode' is always turned on except in `message-mode' buffers." ;; Hack: ;; Emacs calculates the active keymaps before reading the event. That means we ;; cannot change the keymap from a timer. So we send a bogus command. -;; XXX: Seems not to be needed anymore in Emacs 24.4 +;; XXX: Even in Emacs 24.4, seems to be needed in the terminal. (defun company-ignore () (interactive) (setq this-command last-command)) @@ -1284,8 +1284,7 @@ from the rest of the back-ends in the group, if any, will be left at the end." (eq tick (buffer-chars-modified-tick)) (eq pos (point)) (when (company-auto-begin) - (when (version< emacs-version "24.3.50") - (company-input-noop)) + (company-input-noop) (company-post-command (defun company-auto-begin ()
[elpa] 12/28: Tweak wording
dgutov pushed a commit to branch master in repository elpa. commit c2d4a0f945afbfd929a024980a51549a4688c678 Author: Dmitry Gutov Date: Mon Aug 11 21:56:34 2014 +0400 Tweak wording --- NEWS.md |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/NEWS.md b/NEWS.md index e2a5c48..c966ce5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,7 +5,7 @@ * On Emacs 24.4 or newer, tooltip positioning takes line-spacing into account. * New face `company-tooltip-search`, used for the search string in the tooltip. * The default value of `company-dabbrev-minimum-length` is set to 4, independent - of what `company-minimum-prefix-length` is set to. + of the `company-minimum-prefix-length` value. ## 2014-07-26 (0.8.2)
[elpa] 03/28: company-dabbrev-minimum-length: change the initvalue and document better
dgutov pushed a commit to branch master in repository elpa. commit 8a7002515f04ae07a120c299a52af2f95e94b73b Author: Dmitry Gutov Date: Thu Jul 31 19:44:04 2014 +0300 company-dabbrev-minimum-length: change the initvalue and document better #158 --- NEWS.md|5 + company-dabbrev.el |8 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index fe1313c..04788ab 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # History of user-visible changes +# Next + +* The default value of `company-dabbrev-minimum-length` is set to 4, independent + of what `company-minimum-prefix-length` is set to. + ## 2014-07-26 (0.8.2) * New user option `company-occurrence-weight-function`, allowing to tweak the diff --git a/company-dabbrev.el b/company-dabbrev.el index 3d57bb5..3ca8e33 100644 --- a/company-dabbrev.el +++ b/company-dabbrev.el @@ -63,9 +63,11 @@ Any other value means downcase. If you set this value to nil, you may also want to set `company-dabbrev-ignore-case' to any value other than `keep-prefix'.") -(defcustom company-dabbrev-minimum-length (1+ company-minimum-prefix-length) - "The minimum length for the string to be included." - :type 'integer) +(defcustom company-dabbrev-minimum-length 4 + "The minimum length for the completion candidate to be included. +This variable affects both `company-dabbrev' and `company-dabbrev-code'." + :type 'integer + :package-version '(company . "0.8.3")) (defmacro company-dabrev--time-limit-while (test start limit &rest body) (declare (indent 3) (debug t))
[elpa] 07/28: company--window-inner-height: remove, use `window-body-height'
dgutov pushed a commit to branch master in repository elpa. commit e7f432480b9aaac4ceb8fc27189c430770cb136e Author: Dmitry Gutov Date: Mon Aug 4 02:38:37 2014 +0400 company--window-inner-height: remove, use `window-body-height' Available since Emacs 24.1. Fixes #160 --- company.el |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/company.el b/company.el index 3f90a48..276e0b4 100644 --- a/company.el +++ b/company.el @@ -2359,10 +2359,6 @@ If SHOW-VERSION is non-nil, show the version in the echo area." ;; show -(defsubst company--window-inner-height () - (let ((edges (window-inside-edges))) -(- (nth 3 edges) (nth 1 edges - (defsubst company--window-width () (let ((ww (window-body-width))) ;; Account for the line continuation column. @@ -2382,7 +2378,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area." "Calculate the appropriate tooltip height. Returns a negative number if the tooltip should be displayed above point." (let* ((lines (company--row)) - (below (- (company--window-inner-height) 1 lines))) + (below (- (window-body-height) 1 lines))) (if (and (< below (min company-tooltip-minimum company-candidates-length)) (> lines below)) (- (max 3 (min company-tooltip-limit lines)))
[elpa] 10/28: Mention company-tooltip-search in NEWS
dgutov pushed a commit to branch master in repository elpa. commit c757a2be4f07f5f2bb9ae6bc93c603a922adc78c Author: Dmitry Gutov Date: Tue Aug 5 04:13:14 2014 +0400 Mention company-tooltip-search in NEWS --- NEWS.md |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/NEWS.md b/NEWS.md index 04788ab..33e1e68 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ # Next +* New face `company-tooltip-search`, used for the search string in the tooltip. * The default value of `company-dabbrev-minimum-length` is set to 4, independent of what `company-minimum-prefix-length` is set to.
[elpa] 24/28: Use `company-dabbrev-ignore-case' when searching for candidates
dgutov pushed a commit to branch master in repository elpa. commit 11241a341708cbd645a2f67f0eb09c279b6ebe07 Author: Dmitry Gutov Date: Wed Aug 27 05:04:24 2014 +0400 Use `company-dabbrev-ignore-case' when searching for candidates --- company-dabbrev.el | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/company-dabbrev.el b/company-dabbrev.el index 3ca8e33..08a13f6 100644 --- a/company-dabbrev.el +++ b/company-dabbrev.el @@ -137,14 +137,15 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'." (interactive (company-begin-backend 'company-dabbrev)) (prefix (company-grab-word)) (candidates - (let ((words (company-dabbrev--search (company-dabbrev--make-regexp arg) - company-dabbrev-time-limit - (pcase company-dabbrev-other-buffers - (`t (list major-mode)) - (`all `all - (downcase-p (if (eq company-dabbrev-downcase 'case-replace) - case-replace - company-dabbrev-downcase))) + (let* ((case-fold-search company-dabbrev-ignore-case) +(words (company-dabbrev--search (company-dabbrev--make-regexp arg) +company-dabbrev-time-limit +(pcase company-dabbrev-other-buffers + (`t (list major-mode)) + (`all `all +(downcase-p (if (eq company-dabbrev-downcase 'case-replace) +case-replace + company-dabbrev-downcase))) (if downcase-p (mapcar 'downcase words) words)))
[elpa] 21/28: Add a comment
dgutov pushed a commit to branch master in repository elpa. commit 3427e265fe793fac5924bf3c35a0acd444711824 Author: Dmitry Gutov Date: Sun Aug 24 03:05:37 2014 +0400 Add a comment --- company.el |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/company.el b/company.el index 9a0c72a..b93 100644 --- a/company.el +++ b/company.el @@ -2456,6 +2456,8 @@ Returns a negative number if the tooltip should be displayed above point." (overlay-put ov 'line-prefix "") (if (/= (overlay-start ov) (overlay-end ov)) (overlay-put ov 'display disp) +;; `display' is usually better (http://debbugs.gnu.org/18285), +;; but it doesn't work when the overlay is empty. (overlay-put ov 'after-string disp)) (overlay-put ov 'window (selected-window)
[elpa] 13/28: Use `posn-actual-col-row' to determine the current col and row
dgutov pushed a commit to branch master in repository elpa. commit 6468e89e00758abebc42477cc0df30a960546d78 Author: Dmitry Gutov Date: Mon Aug 18 04:49:19 2014 +0400 Use `posn-actual-col-row' to determine the current col and row Issue #136 WIP. Reverting d21bb454dcfacda8808b596e4bca85a53a99eabf, for the most part, http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00361.html. --- company.el | 40 +++- 1 files changed, 15 insertions(+), 25 deletions(-) diff --git a/company.el b/company.el index 4b59655..f5598cc 100644 --- a/company.el +++ b/company.el @@ -778,22 +778,19 @@ means that `company-mode' is always turned on except in `message-mode' buffers." (defun company-input-noop () (push 31415926 unread-command-events)) -(defun company--column (&optional pos) - (save-excursion -(when pos (goto-char pos)) -(save-restriction - (+ (save-excursion - (vertical-motion 0) - (narrow-to-region (point) (point-max)) - (let ((prefix (get-text-property (point) 'line-prefix))) - (if prefix (length prefix) 0))) - (current-column) +(defun company--posn-col-row (pos) + (let* ((col-row (posn-actual-col-row pos)) + (col (car col-row)) + (row (cdr col-row))) +(when header-line-format + (cl-decf row)) +(cons (+ col (window-hscroll)) row))) + +(defun company--col-row (&optional pos) + (company--posn-col-row (posn-at-point pos))) (defun company--row (&optional pos) - (save-excursion -(when pos (goto-char pos)) -(count-screen-lines (window-start) -(progn (vertical-motion 0) (point) + (cdr (company--col-row pos))) ;;; backends ;;; @@ -1813,14 +1810,7 @@ and invoke the normal binding." (>= evt-row (+ row height))) (defun company--event-col-row (event) - (let* ((col-row (posn-actual-col-row (event-start event))) - (col (car col-row)) - (row (cdr col-row))) -(cl-incf col (window-hscroll)) -(and header-line-format - (version< "24" emacs-version) - (cl-decf row)) -(cons col row))) + (company--posn-col-row (event-start event))) (defun company-select-mouse (event) "Select the candidate picked by the mouse." @@ -2426,10 +2416,10 @@ Returns a negative number if the tooltip should be displayed above point." (overlay-put ov 'company-height height) (defun company-pseudo-tooltip-show-at-point (pos column-offset) - (let ((row (company--row pos)) -(col (- (company--column pos) column-offset))) + (let* ((col-row (company--col-row pos)) + (col (- (car col-row) column-offset))) (when (< col 0) (setq col 0)) -(company-pseudo-tooltip-show (1+ row) col company-selection))) +(company-pseudo-tooltip-show (1+ (cdr col-row)) col company-selection))) (defun company-pseudo-tooltip-edit (selection) (let* ((height (overlay-get company-pseudo-tooltip-overlay 'company-height))
[elpa] 26/28: company-dabbrev-code-ignore-case: rephrase a bit
dgutov pushed a commit to branch master in repository elpa. commit b5ee68f132dee438d23636de09631ddec3a732e2 Author: Dmitry Gutov Date: Wed Aug 27 05:10:51 2014 +0400 company-dabbrev-code-ignore-case: rephrase a bit --- company-dabbrev-code.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el index 371d908..0566c50 100644 --- a/company-dabbrev-code.el +++ b/company-dabbrev-code.el @@ -66,7 +66,7 @@ See also `company-dabbrev-code-time-limit'." :type 'boolean) (defcustom company-dabbrev-code-ignore-case nil - "Non-nil to ignore case in completion candidates." + "Non-nil to ignore case when collecting completion candidates." :type 'boolean) (defsubst company-dabbrev-code--make-regexp (prefix)
[elpa] 25/28: Document `company-dabbrev-ignore-case' better
dgutov pushed a commit to branch master in repository elpa. commit d072a391ccfba12c639558ba22eaea548c1425d0 Author: Dmitry Gutov Date: Wed Aug 27 05:09:52 2014 +0400 Document `company-dabbrev-ignore-case' better Closes #134 --- company-dabbrev.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/company-dabbrev.el b/company-dabbrev.el index 08a13f6..84da305 100644 --- a/company-dabbrev.el +++ b/company-dabbrev.el @@ -51,7 +51,9 @@ See also `company-dabbrev-time-limit'." :type 'regexp) (defcustom company-dabbrev-ignore-case 'keep-prefix - "The value of `ignore-case' returned by `company-dabbrev'.") + "Non-nil to ignore case when collecting completion candidates. +When it's `keep-prefix', the text before point will remain unchanged after +candidate is inserted, even some of its characters have different case.") (defcustom company-dabbrev-downcase 'case-replace "Whether to downcase the returned candidates.
[elpa] 27/28: Bump the version
dgutov pushed a commit to branch master in repository elpa. commit f4ffe2b47cf6854ff3bc3ca1717efe1258c01547 Author: Dmitry Gutov Date: Wed Aug 27 05:11:33 2014 +0400 Bump the version --- NEWS.md|2 +- company.el |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index c966ce5..8a0bec2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # History of user-visible changes -# Next +## 2014-08-27 (0.8.3) * On Emacs 24.4 or newer, tooltip positioning takes line-spacing into account. * New face `company-tooltip-search`, used for the search string in the tooltip. diff --git a/company.el b/company.el index c1671aa..9d53cd7 100644 --- a/company.el +++ b/company.el @@ -5,7 +5,7 @@ ;; Author: Nikolaj Schumacher ;; Maintainer: Dmitry Gutov ;; URL: http://company-mode.github.io/ -;; Version: 0.8.3-cvs +;; Version: 0.8.3 ;; Keywords: abbrev, convenience, matching ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
[elpa] 16/28: company-buffer-lines: handle multiline display better
dgutov pushed a commit to branch master in repository elpa. commit e40329f6b4af7557c4651d33fcf7d3ba93c58041 Author: Dmitry Gutov Date: Mon Aug 18 05:51:10 2014 +0400 company-buffer-lines: handle multiline display better Improves #136. --- company-tests.el | 14 ++ company.el |8 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/company-tests.el b/company-tests.el index 898fb92..33e0c98 100644 --- a/company-tests.el +++ b/company-tests.el @@ -597,6 +597,20 @@ (company-plainify (propertize "foobar" 'line-prefix "-*-")) "-*-foobar"))) +(ert-deftest company-buffer-lines-with-lines-folded () + (with-temp-buffer +(insert (propertize "aaa\nbbb\nccc\nddd\n" 'display "aaa+\n")) +(insert "eee\nfff\nggg") +(should (equal (company-buffer-lines (point-min) (point-max)) + '("aaa" "eee" "fff" "ggg") + +(ert-deftest company-buffer-lines-with-multiline-display () + (with-temp-buffer +(insert (propertize "a" 'display "bbb\nccc\n\n")) +(insert "eee\nfff\nggg") +(should (equal (company-buffer-lines (point-min) (point-max)) + '("" "" "" "eee" "fff" "ggg") + (ert-deftest company-modify-line () (let ((str "-*-foobar")) (should (equal-including-properties diff --git a/company.el b/company.el index e9ada82..bbaea00 100644 --- a/company.el +++ b/company.el @@ -2169,8 +2169,8 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (defun company-buffer-lines (beg end) (goto-char beg) - (let (lines) -(while (and (= 1 (vertical-motion 1)) + (let (lines lines-moved) +(while (and (> (setq lines-moved (vertical-motion 1)) 0) (<= (point) end)) (let ((bound (min end (1- (point) ;; A visual line can contain several physical lines (e.g. with outline's @@ -2181,6 +2181,10 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (re-search-forward "$" bound 'move) (point))) lines)) + ;; One physical line can be displayed as several visual ones as well: + ;; add empty strings to the list, to even the count. + (dotimes (_ (1- lines-moved)) +(push "" lines)) (setq beg (point))) (unless (eq beg end) (push (buffer-substring beg end) lines))
[elpa] 05/28: company--show-inline-p: never ignore case
dgutov pushed a commit to branch master in repository elpa. commit 1b705a0f32ab83931ecaecddb6c9e4ba4d47c643 Author: Dmitry Gutov Date: Mon Aug 4 01:25:57 2014 +0400 company--show-inline-p: never ignore case Fixes #162 --- company.el |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/company.el b/company.el index ac49892..732226a 100644 --- a/company.el +++ b/company.el @@ -2550,8 +2550,7 @@ Returns a negative number if the tooltip should be displayed above point." (defun company--show-inline-p () (and (not (cdr company-candidates)) company-common - (string-prefix-p company-prefix company-common -(company-call-backend 'ignore-case + (string-prefix-p company-prefix company-common))) ;;; echo ;;;
[elpa] branch master updated (b6a1a9e -> 2d6cddf)
dgutov pushed a change to branch master in repository elpa. from b6a1a9e Upgrade to version 1.3. new 43b05ff company-fill-propertize: tuncate the common part new a5a6eee company-dabbrev--search-buffer: Use `syntax-ppss' to get to the beg of str-or-cmt new 8a70025 company-dabbrev-minimum-length: change the initvalue and document better new 47a4acf Remove the "download ERT" logic; should be unused at this point new 1b705a0 company--show-inline-p: never ignore case new 0233a0c Use `window-body-width' instead of the now-alias `window-width' new e7f4324 company--window-inner-height: remove, use `window-body-height' new f9c62e5 Assign a face for the tooltip search string new 9282c03 Merge pull request #164 from holomorph/tooltip-search new c757a2b Mention company-tooltip-search in NEWS new 308cf47 Use window-screen-lines when available new c2d4a0f Tweak wording new 6468e89 Use `posn-actual-col-row' to determine the current col and row new bb0a1d5 Work around http://debbugs.gnu.org/18285 new 5f64175 Fix the tests new e40329f company-buffer-lines: handle multiline display better new 7e1ca8e company-input-noop still seems to be needed in the terminal new 2154da0 Skip company-buffer-lines tests in terminal new 782d1ec company-pseudo-tooltip-unhide: use local vars new 8cdc59c company-pseudo-tooltip-unhide: fix rendering at eob new 3427e26 Add a comment new d6e4cc2 company--capf-data: use caching new 82b53c5 Fix WRT `keep-prefix' new 11241a3 Use `company-dabbrev-ignore-case' when searching for candidates new d072a39 Document `company-dabbrev-ignore-case' better new b5ee68f company-dabbrev-code-ignore-case: rephrase a bit new f4ffe2b Bump the version new 2d6cddf Merge commit 'f4ffe2b47cf6854ff3bc3ca1717efe1258c01547' from company The 28 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: packages/company/.travis.yml |3 - packages/company/Makefile|6 -- packages/company/NEWS.md |7 ++ packages/company/company-capf.el | 13 packages/company/company-dabbrev-code.el |2 +- packages/company/company-dabbrev.el | 31 + packages/company/company-tests.el| 89 packages/company/company.el | 111 +++-- 8 files changed, 171 insertions(+), 91 deletions(-)
[elpa] 19/28: company-pseudo-tooltip-unhide: use local vars
dgutov pushed a commit to branch master in repository elpa. commit 782d1ec3d29d0b96398a6f417cc3f76f411fcf84 Author: Dmitry Gutov Date: Sun Aug 24 02:52:43 2014 +0400 company-pseudo-tooltip-unhide: use local vars --- company.el | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/company.el b/company.el index d5e500d..777dd31 100644 --- a/company.el +++ b/company.el @@ -2447,13 +2447,14 @@ Returns a negative number if the tooltip should be displayed above point." (defun company-pseudo-tooltip-unhide () (when company-pseudo-tooltip-overlay -;; Beat outline's folding overlays, at least. -(overlay-put company-pseudo-tooltip-overlay 'priority 1) -;; No (extra) prefix for the first line. -(overlay-put company-pseudo-tooltip-overlay 'line-prefix "") -(overlay-put company-pseudo-tooltip-overlay 'display - (overlay-get company-pseudo-tooltip-overlay 'company-display)) -(overlay-put company-pseudo-tooltip-overlay 'window (selected-window +(let* ((ov company-pseudo-tooltip-overlay) + (disp (overlay-get ov 'company-display))) + ;; Beat outline's folding overlays, at least. + (overlay-put ov 'priority 1) + ;; No (extra) prefix for the first line. + (overlay-put ov 'line-prefix "") + (overlay-put ov 'display disp) + (overlay-put ov 'window (selected-window) (defun company-pseudo-tooltip-guard () (list
[elpa] 20/28: company-pseudo-tooltip-unhide: fix rendering at eob
dgutov pushed a commit to branch master in repository elpa. commit 8cdc59c68182a5192e68830db2070fa9dd0e4125 Author: Dmitry Gutov Date: Sun Aug 24 02:56:47 2014 +0400 company-pseudo-tooltip-unhide: fix rendering at eob Regression from bb0a1d5 --- company.el |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/company.el b/company.el index 777dd31..9a0c72a 100644 --- a/company.el +++ b/company.el @@ -2443,7 +2443,8 @@ Returns a negative number if the tooltip should be displayed above point." (defun company-pseudo-tooltip-hide-temporarily () (when (overlayp company-pseudo-tooltip-overlay) (overlay-put company-pseudo-tooltip-overlay 'line-prefix nil) -(overlay-put company-pseudo-tooltip-overlay 'display nil))) +(overlay-put company-pseudo-tooltip-overlay 'display nil) +(overlay-put company-pseudo-tooltip-overlay 'after-string nil))) (defun company-pseudo-tooltip-unhide () (when company-pseudo-tooltip-overlay @@ -2453,7 +2454,9 @@ Returns a negative number if the tooltip should be displayed above point." (overlay-put ov 'priority 1) ;; No (extra) prefix for the first line. (overlay-put ov 'line-prefix "") - (overlay-put ov 'display disp) + (if (/= (overlay-start ov) (overlay-end ov)) + (overlay-put ov 'display disp) +(overlay-put ov 'after-string disp)) (overlay-put ov 'window (selected-window) (defun company-pseudo-tooltip-guard ()
[elpa] 14/28: Work around http://debbugs.gnu.org/18285
dgutov pushed a commit to branch master in repository elpa. commit bb0a1d57ae2dc4b8778dd594c85b557f3198dd0b Author: Dmitry Gutov Date: Mon Aug 18 05:14:17 2014 +0400 Work around http://debbugs.gnu.org/18285 Closes #136 --- company.el | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/company.el b/company.el index f5598cc..e9ada82 100644 --- a/company.el +++ b/company.el @@ -2408,7 +2408,7 @@ Returns a negative number if the tooltip should be displayed above point." (overlay-put ov 'company-replacement-args args) (let ((lines (company--create-lines selection (abs height - (overlay-put ov 'company-after + (overlay-put ov 'company-display (apply 'company--replacement-string lines args)) (overlay-put ov 'company-width (string-width (car lines @@ -2426,7 +2426,7 @@ Returns a negative number if the tooltip should be displayed above point." (lines (company--create-lines selection (abs height (overlay-put company-pseudo-tooltip-overlay 'company-width (string-width (car lines))) -(overlay-put company-pseudo-tooltip-overlay 'company-after +(overlay-put company-pseudo-tooltip-overlay 'company-display (apply 'company--replacement-string lines (overlay-get company-pseudo-tooltip-overlay @@ -2439,19 +2439,17 @@ Returns a negative number if the tooltip should be displayed above point." (defun company-pseudo-tooltip-hide-temporarily () (when (overlayp company-pseudo-tooltip-overlay) -(overlay-put company-pseudo-tooltip-overlay 'invisible nil) (overlay-put company-pseudo-tooltip-overlay 'line-prefix nil) -(overlay-put company-pseudo-tooltip-overlay 'after-string nil))) +(overlay-put company-pseudo-tooltip-overlay 'display nil))) (defun company-pseudo-tooltip-unhide () (when company-pseudo-tooltip-overlay -(overlay-put company-pseudo-tooltip-overlay 'invisible t) ;; Beat outline's folding overlays, at least. (overlay-put company-pseudo-tooltip-overlay 'priority 1) ;; No (extra) prefix for the first line. (overlay-put company-pseudo-tooltip-overlay 'line-prefix "") -(overlay-put company-pseudo-tooltip-overlay 'after-string - (overlay-get company-pseudo-tooltip-overlay 'company-after)) +(overlay-put company-pseudo-tooltip-overlay 'display + (overlay-get company-pseudo-tooltip-overlay 'company-display)) (overlay-put company-pseudo-tooltip-overlay 'window (selected-window (defun company-pseudo-tooltip-guard ()
[elpa] 22/28: company--capf-data: use caching
dgutov pushed a commit to branch master in repository elpa. commit d6e4cc24161fd727cc2256da038afa55c492d4a3 Author: Dmitry Gutov Date: Sun Aug 24 20:51:52 2014 +0400 company--capf-data: use caching #170 --- company-capf.el | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/company-capf.el b/company-capf.el index e27ae7a..b630025 100644 --- a/company-capf.el +++ b/company-capf.el @@ -28,7 +28,20 @@ (require 'company) (require 'cl-lib) +(defvar company--capf-cache nil) + (defun company--capf-data () + (let ((cache company--capf-cache)) +(if (and (equal (current-buffer) (car cache)) + (equal (point) (car (setq cache (cdr cache + (equal (buffer-chars-modified-tick) (car (setq cache (cdr cache) +(cadr cache) + (let ((data (company--capf-data-real))) +(setq company--capf-cache + (list (current-buffer) (point) (buffer-chars-modified-tick) data)) +data + +(defun company--capf-data-real () (cl-letf* (((default-value 'completion-at-point-functions) ;; Ignore tags-completion-at-point-function because it subverts ;; company-etags in the default value of company-backends, where
[elpa] 15/28: Fix the tests
dgutov pushed a commit to branch master in repository elpa. commit 5f64175f54e9d003cef8cde4f80c395681caeb41 Author: Dmitry Gutov Date: Mon Aug 18 05:23:27 2014 +0400 Fix the tests --- company-tests.el | 40 ++-- 1 files changed, 26 insertions(+), 14 deletions(-) diff --git a/company-tests.el b/company-tests.el index fd2a42b..898fb92 100644 --- a/company-tests.el +++ b/company-tests.el @@ -30,6 +30,9 @@ (require 'company-keywords) (require 'company-clang) +(defun company--column (&optional pos) + (car (company--col-row pos))) + ;;; Core (ert-deftest company-sorted-keywords () @@ -415,7 +418,7 @@ ;; FIXME: Make it 2? (should (eq (overlay-get ov 'company-height) company-tooltip-limit)) (should (eq (overlay-get ov 'company-column) col)) -(should (string= (overlay-get ov 'company-after) +(should (string= (overlay-get ov 'company-display) " 123 \nc 45 c\nddd\n"))) (ert-deftest company-pseudo-tooltip-edit-updates-width () @@ -465,7 +468,7 @@ (let ((ov company-pseudo-tooltip-overlay)) ;; With margins. (should (eq (overlay-get ov 'company-width) 8)) - (should (string= (overlay-get ov 'company-after) + (should (string= (overlay-get ov 'company-display) " 123(4) \n 45 \n"))) (ert-deftest company-pseudo-tooltip-show-with-annotations-right-aligned () @@ -486,7 +489,7 @@ (let ((ov company-pseudo-tooltip-overlay)) ;; With margins. (should (eq (overlay-get ov 'company-width) 13)) - (should (string= (overlay-get ov 'company-after) + (should (string= (overlay-get ov 'company-display) " 123 (4) \n 45 \n 67 (891011) \n"))) (ert-deftest company-create-lines-shows-numbers () @@ -556,23 +559,32 @@ ))) (ert-deftest company-column-with-composition () + :tags '(interactive) (with-temp-buffer -(insert "lambda ()") -(compose-region 1 (1+ (length "lambda")) "\\") -(should (= (company--column) 4 +(save-window-excursion + (set-window-buffer nil (current-buffer)) + (insert "lambda ()") + (compose-region 1 (1+ (length "lambda")) "\\") + (should (= (company--column) 4) (ert-deftest company-column-with-line-prefix () + :tags '(interactive) (with-temp-buffer -(insert "foo") -(put-text-property (point-min) (point) 'line-prefix " ") -(should (= (company--column) 5 +(save-window-excursion + (set-window-buffer nil (current-buffer)) + (insert "foo") + (put-text-property (point-min) (point) 'line-prefix " ") + (should (= (company--column) 5) -(ert-deftest company-column-wth-line-prefix-on-empty-line () +(ert-deftest company-column-with-line-prefix-on-empty-line () + :tags '(interactive) (with-temp-buffer -(insert "\n") -(forward-char -1) -(put-text-property (point-min) (point-max) 'line-prefix " ") -(should (= (company--column) 2 +(save-window-excursion + (set-window-buffer nil (current-buffer)) + (insert "\n") + (forward-char -1) + (put-text-property (point-min) (point-max) 'line-prefix " ") + (should (= (company--column) 2) (ert-deftest company-plainify () (let ((tab-width 8))
[elpa] 08/28: Assign a face for the tooltip search string
dgutov pushed a commit to branch master in repository elpa. commit f9c62e5025752a8134d278289f0e75eed498fbc2 Author: Mark Oteiza Date: Mon Aug 4 18:21:55 2014 -0400 Assign a face for the tooltip search string --- company.el |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/company.el b/company.el index ac49892..577049f 100644 --- a/company.el +++ b/company.el @@ -117,6 +117,10 @@ buffer-local wherever it is set." (t (:background "green"))) "Face used for the selection in the tooltip.") +(defface company-tooltip-search + '((default :inherit company-tooltip-selection)) + "Face used for the search string in the tooltip.") + (defface company-tooltip-mouse '((default :inherit highlight)) "Face used for the tooltip item under the mouse.") @@ -2156,7 +2160,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (length company-prefix))) (let ((beg (+ margin (match-beginning 0))) (end (+ margin (match-end 0 -(add-text-properties beg end '(face company-tooltip-selection) +(add-text-properties beg end '(face company-tooltip-search) line) (when (< beg common) (add-text-properties beg common
[elpa] 04/28: Remove the "download ERT" logic; should be unused at this point
dgutov pushed a commit to branch master in repository elpa. commit 47a4acf4b910944bd6af2dbcdbd590b86e1ac711 Author: Dmitry Gutov Date: Thu Jul 31 19:46:17 2014 +0300 Remove the "download ERT" logic; should be unused at this point --- .travis.yml |3 --- Makefile|6 -- 2 files changed, 0 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 11d7fd4..ed76f79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,5 @@ install: sudo apt-get install -qq emacs-snapshot; fi -before_script: - make downloads - script: make test-batch EMACS=${EMACS} diff --git a/Makefile b/Makefile index 4d7a9ad..c52be4b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ EMACS=emacs -CURL=curl --silent -ERT_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=emacs-24.3 .PHONY: ert test test-batch @@ -29,9 +27,5 @@ test-batch: ${EMACS} -Q --batch -L . -l company-tests.el -l company-elisp-tests.el \ --eval "(ert-run-tests-batch-and-exit '(not (tag interactive)))" -downloads: - ${EMACS} -Q --batch -l ert || \ - ${CURL} ${ERT_URL} > ert.el - compile: ${EMACS} -Q --batch -L . -f batch-byte-compile company.el company-*.el
[elpa] 11/28: Use window-screen-lines when available
dgutov pushed a commit to branch master in repository elpa. commit 308cf47d1533234b9fe2261a60e90048802ced53 Author: Dmitry Gutov Date: Wed Aug 6 08:35:00 2014 +0400 Use window-screen-lines when available Fixes #160 --- NEWS.md|1 + company.el |7 ++- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/NEWS.md b/NEWS.md index 33e1e68..e2a5c48 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ # Next +* On Emacs 24.4 or newer, tooltip positioning takes line-spacing into account. * New face `company-tooltip-search`, used for the search string in the tooltip. * The default value of `company-dabbrev-minimum-length` is set to 4, independent of what `company-minimum-prefix-length` is set to. diff --git a/company.el b/company.el index 7d5ec8c..4b59655 100644 --- a/company.el +++ b/company.el @@ -2363,6 +2363,11 @@ If SHOW-VERSION is non-nil, show the version in the echo area." ;; show +(defsubst company--window-height () + (if (fboundp 'window-screen-lines) + (floor (window-screen-lines)) +(window-body-height))) + (defsubst company--window-width () (let ((ww (window-body-width))) ;; Account for the line continuation column. @@ -2382,7 +2387,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area." "Calculate the appropriate tooltip height. Returns a negative number if the tooltip should be displayed above point." (let* ((lines (company--row)) - (below (- (window-body-height) 1 lines))) + (below (- (company--window-height) 1 lines))) (if (and (< below (min company-tooltip-minimum company-candidates-length)) (> lines below)) (- (max 3 (min company-tooltip-limit lines)))
[elpa] 06/28: Use `window-body-width' instead of the now-alias `window-width'
dgutov pushed a commit to branch master in repository elpa. commit 0233a0c41139c2bfabc4265dfdc7730c6395ce4d Author: Dmitry Gutov Date: Mon Aug 4 02:34:29 2014 +0400 Use `window-body-width' instead of the now-alias `window-width' --- company.el |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/company.el b/company.el index 732226a..3f90a48 100644 --- a/company.el +++ b/company.el @@ -2364,7 +2364,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (- (nth 3 edges) (nth 1 edges (defsubst company--window-width () - (let ((ww (window-width))) + (let ((ww (window-body-width))) ;; Account for the line continuation column. (when (zerop (cadr (window-fringes))) (cl-decf ww)) @@ -2579,7 +2579,7 @@ Returns a negative number if the tooltip should be displayed above point." (defun company-echo-format () - (let ((limit (window-width (minibuffer-window))) + (let ((limit (window-body-width (minibuffer-window))) (len -1) ;; Roll to selection. (candidates (nthcdr company-selection company-candidates)) @@ -2609,7 +2609,7 @@ Returns a negative number if the tooltip should be displayed above point." (defun company-echo-strip-common-format () - (let ((limit (window-width (minibuffer-window))) + (let ((limit (window-body-width (minibuffer-window))) (len (+ (length company-prefix) 2)) ;; Roll to selection. (candidates (nthcdr company-selection company-candidates))
[elpa] 09/28: Merge pull request #164 from holomorph/tooltip-search
dgutov pushed a commit to branch master in repository elpa. commit 9282c0318c03af805ce201a7dfc7b4007883a859 Merge: e7f4324 f9c62e5 Author: Dmitry Gutov Date: Tue Aug 5 03:05:56 2014 +0400 Merge pull request #164 from holomorph/tooltip-search Assign a face for the tooltip search string company.el |6 +- 1 files changed, 5 insertions(+), 1 deletions(-)
[elpa] 18/28: Skip company-buffer-lines tests in terminal
dgutov pushed a commit to branch master in repository elpa. commit 2154da01c6acee11f2b356d90bb2f5cd9e4a89f4 Author: Dmitry Gutov Date: Mon Aug 18 06:26:06 2014 +0400 Skip company-buffer-lines tests in terminal They seem to freeze. --- company-tests.el |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/company-tests.el b/company-tests.el index 33e0c98..afd4156 100644 --- a/company-tests.el +++ b/company-tests.el @@ -598,6 +598,7 @@ "-*-foobar"))) (ert-deftest company-buffer-lines-with-lines-folded () + :tags '(interactive) (with-temp-buffer (insert (propertize "aaa\nbbb\nccc\nddd\n" 'display "aaa+\n")) (insert "eee\nfff\nggg") @@ -605,6 +606,7 @@ '("aaa" "eee" "fff" "ggg") (ert-deftest company-buffer-lines-with-multiline-display () + :tags '(interactive) (with-temp-buffer (insert (propertize "a" 'display "bbb\nccc\n\n")) (insert "eee\nfff\nggg")
[elpa] 28/28: Merge commit 'f4ffe2b47cf6854ff3bc3ca1717efe1258c01547' from company
dgutov pushed a commit to branch master in repository elpa. commit 2d6cddf98aab030de279e007d07b23d838f6cd62 Merge: b6a1a9e f4ffe2b Author: Dmitry Gutov Date: Wed Aug 27 05:25:46 2014 +0400 Merge commit 'f4ffe2b47cf6854ff3bc3ca1717efe1258c01547' from company packages/company/.travis.yml |3 - packages/company/Makefile|6 -- packages/company/NEWS.md |7 ++ packages/company/company-capf.el | 13 packages/company/company-dabbrev-code.el |2 +- packages/company/company-dabbrev.el | 31 + packages/company/company-tests.el| 89 packages/company/company.el | 111 +++-- 8 files changed, 171 insertions(+), 91 deletions(-)
[elpa] 01/28: company-fill-propertize: tuncate the common part
dgutov pushed a commit to branch master in repository elpa. commit 43b05ffa8a72d3bcce763285f8b1f4a907fa4011 Author: Dmitry Gutov Date: Mon Jul 28 17:22:14 2014 +0300 company-fill-propertize: tuncate the common part Fixes #156 --- company-tests.el | 33 + company.el |7 --- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/company-tests.el b/company-tests.el index 005bf3a..fd2a42b 100644 --- a/company-tests.el +++ b/company-tests.el @@ -522,6 +522,39 @@ (format " %s " (make-string (- ww 2) ?4))) (company--create-lines 0 999)) +(ert-deftest company-create-lines-truncates-common-part () + (let* ((ww (company--window-width)) + (company-candidates-length 2) + (company-tooltip-margin 1) + (company-backend #'ignore)) +(let* ((company-common (make-string (- ww 3) ?1)) + (company-candidates `(,(concat company-common "2") + ,(concat company-common "3" + (should (equal (list (format " %s2 " (make-string (- ww 3) ?1)) + (format " %s3 " (make-string (- ww 3) ?1))) + (company--create-lines 0 999 +(let* ((company-common (make-string (- ww 2) ?1)) + (company-candidates `(,(concat company-common "2") + ,(concat company-common "3" + (should (equal (list (format " %s " company-common) + (format " %s " company-common)) + (company--create-lines 0 999 +(let* ((company-common (make-string ww ?1)) + (company-candidates `(,(concat company-common "2") + ,(concat company-common "3"))) + (res (company--create-lines 0 999))) + (should (equal (list (format " %s " (make-string (- ww 2) ?1)) + (format " %s " (make-string (- ww 2) ?1))) + res)) + (should (eq 'company-tooltip-common-selection +(get-text-property (- ww 2) 'face + (car res + (should (eq 'company-tooltip-selection + (get-text-property (1- ww) 'face + (car res + +))) + (ert-deftest company-column-with-composition () (with-temp-buffer (insert "lambda ()") diff --git a/company.el b/company.el index 7b48347..ac49892 100644 --- a/company.el +++ b/company.el @@ -5,7 +5,7 @@ ;; Author: Nikolaj Schumacher ;; Maintainer: Dmitry Gutov ;; URL: http://company-mode.github.io/ -;; Version: 0.8.2 +;; Version: 0.8.3-cvs ;; Keywords: abbrev, convenience, matching ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5")) @@ -2110,8 +2110,8 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (defun company-fill-propertize (value annotation width selected left right) (let* ((margin (length left)) - (common (+ (or (company-call-backend 'match value) -(length company-common)) margin)) + (common (or (company-call-backend 'match value) + (length company-common))) (ann-ralign company-tooltip-align-annotations) (ann-truncate (< width (+ (length value) (length annotation) @@ -2135,6 +2135,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (- width (length annotation))) annotation)) right))) +(setq common (+ (min common width) margin)) (setq width (+ width margin (length right))) (add-text-properties 0 width '(face company-tooltip