monnier pushed a commit to branch master in repository elpa. commit 170111814c0bd342c50ab84d3e3bf699c1bd1f1d Author: Stefan Monnier <monn...@iro.umontreal.ca> Date: Wed Oct 15 17:07:03 2014 -0400
* packages/company/company-xcode.el (company-xcode-fetch): Avoid add-to-list on local var. * packages/company/company.el (company--window-height) (company--window-width): Move before first use. --- packages/company/company-xcode.el | 4 +- packages/company/company.el | 43 +++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/packages/company/company-xcode.el b/packages/company/company-xcode.el index 91ae60b..c7a6f80 100644 --- a/packages/company/company-xcode.el +++ b/packages/company/company-xcode.el @@ -1,6 +1,6 @@ ;;; company-xcode.el --- company-mode completion back-end for Xcode projects -;; Copyright (C) 2009-2011 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011, 2014 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -80,7 +80,7 @@ valid in most contexts." "\t[^\t\n]*\t[^\t\n]*")) candidates) (while (re-search-forward regexp nil t) - (add-to-list 'candidates (match-string 1))) + (cl-pushnew (match-string 1) candidates :test #'equal)) (message "Retrieving dump from %s...done" project-bundle) candidates)))) diff --git a/packages/company/company.el b/packages/company/company.el index 36086d0..11a083d 100644 --- a/packages/company/company.el +++ b/packages/company/company.el @@ -2208,6 +2208,26 @@ If SHOW-VERSION is non-nil, show the version in the echo area." limit (length lst))) +(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. + (when (zerop (cadr (window-fringes))) + (cl-decf ww)) + (unless (or (display-graphic-p) + (version< "24.3.1" emacs-version)) + ;; Emacs 24.3 and earlier included margins + ;; in window-width when in TTY. + (cl-decf ww + (let ((margins (window-margins))) + (+ (or (car margins) 0) + (or (cdr margins) 0))))) + ww)) + (defun company--replacement-string (lines old column nl &optional align-top) (cl-decf column company-tooltip-margin) @@ -2232,7 +2252,8 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (while old (push (company-modify-line (pop old) (company--offset-line (pop lines) offset) - column) new)) + column) + new)) ;; Append whole new lines. (while lines (push (concat (company-space-string column) @@ -2367,26 +2388,6 @@ 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. - (when (zerop (cadr (window-fringes))) - (cl-decf ww)) - (unless (or (display-graphic-p) - (version< "24.3.1" emacs-version)) - ;; Emacs 24.3 and earlier included margins - ;; in window-width when in TTY. - (cl-decf ww - (let ((margins (window-margins))) - (+ (or (car margins) 0) - (or (cdr margins) 0))))) - ww)) - (defun company--pseudo-tooltip-height () "Calculate the appropriate tooltip height. Returns a negative number if the tooltip should be displayed above point."