emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/company dff5856 4/6: Bump minimum required Emacs versio


From: ELPA Syncer
Subject: [elpa] externals/company dff5856 4/6: Bump minimum required Emacs version
Date: Sat, 27 Mar 2021 21:57:13 -0400 (EDT)

branch: externals/company
commit dff5856ed16a52d6ff00b70ba603a33dfdd3d55a
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Bump minimum required Emacs version
---
 .travis.yml         |   2 +-
 NEWS.md             |   1 +
 company-clang.el    |   7 ++--
 company.el          | 114 +++++++++++++---------------------------------------
 test/async-tests.el |   6 +--
 5 files changed, 38 insertions(+), 92 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 18e928d..5d79d12 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,9 +4,9 @@ env:
   global:
     - CURL="curl -fsSkL --retry 9 --retry-delay 9"
   matrix:
-    - EMACS_VERSION=24.5
     - EMACS_VERSION=25.3
     - EMACS_VERSION=26.1
+    - EMACS_VERSION=27.1
     - EMACS_VERSION=master
     
 matrix:
diff --git a/NEWS.md b/NEWS.md
index 2ac85a7..38098ab 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 ## Next
 
+* The minimum required version of Emacs is now 25.1.
 * Both built-in options for `company-format-margin-function` require Emacs
   compiled with SVG support.
 * Added support for icons
diff --git a/company-clang.el b/company-clang.el
index 24e5977..183eb7a 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -230,6 +230,8 @@ or automatically through a custom 
`company-clang-prefix-guesser'."
   (let* ((objc (derived-mode-p 'objc-mode))
          (buf (get-buffer-create "*clang-output*"))
          ;; Looks unnecessary in Emacs 25.1 and later.
+         ;; (Inconclusive, needs more testing):
+         ;; 
https://github.com/company-mode/company-mode/pull/288#issuecomment-72491808
          (process-adaptive-read-buffering nil)
          (existing-process (get-buffer-process buf)))
     (when existing-process
@@ -336,10 +338,9 @@ or automatically through a custom 
`company-clang-prefix-guesser'."
    (company-clang--check-version 2.9 3.1)))
 
 (defun company-clang--check-version (min apple-min)
-  (pcase company-clang--version
+  (pcase-exhaustive company-clang--version
     (`(apple . ,ver) (>= ver apple-min))
-    (`(normal . ,ver) (>= ver min))
-    (_ (error "pcase-exhaustive is not in Emacs 24.3!"))))
+    (`(normal . ,ver) (>= ver min))))
 
 (defsubst company-clang-version ()
   "Return the version of `company-clang-executable'."
diff --git a/company.el b/company.el
index fd7715f..19e22b9 100644
--- a/company.el
+++ b/company.el
@@ -1,13 +1,13 @@
 ;;; company.el --- Modular text completion framework  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2009-2020  Free Software Foundation, Inc.
+;; Copyright (C) 2009-2021  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 ;; Maintainer: Dmitry Gutov <dgutov@yandex.ru>
 ;; URL: http://company-mode.github.io/
 ;; Version: 0.9.13
 ;; Keywords: abbrev, convenience, matching
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "25.1"))
 
 ;; This file is part of GNU Emacs.
 
@@ -62,22 +62,9 @@
 ;;; Code:
 
 (require 'cl-lib)
-(require 'newcomment)
+(require 'subr-x)
 (require 'pcase)
 
-;;; Compatibility
-(eval-and-compile
-  ;; Defined in Emacs 24.4
-  (unless (fboundp 'string-suffix-p)
-    (defun string-suffix-p (suffix string  &optional ignore-case)
-      "Return non-nil if SUFFIX is a suffix of STRING.
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences."
-      (let ((start-pos (- (length string) (length suffix))))
-        (and (>= start-pos 0)
-             (eq t (compare-strings suffix nil nil
-                                    string start-pos nil ignore-case)))))))
-
 (defgroup company nil
   "Extensible inline text completion mechanism."
   :group 'abbrev
@@ -335,9 +322,7 @@ This doesn't include the margins and the scroll bar."
                         (assq backend company-safe-backends))
                 (cl-return t))))))
 
-(defcustom company-backends `(,@(unless (version< "24.3.51" emacs-version)
-                                  (list 'company-elisp))
-                              company-bbdb
+(defcustom company-backends `(company-bbdb
                               ,@(unless (version<= "26" emacs-version)
                                   (list 'company-nxml))
                               ,@(unless (version<= "26" emacs-version)
@@ -888,20 +873,6 @@ means that `company-mode' is always turned on except in 
`message-mode' buffers."
   (or (equal [company-dummy-event] keys)
       (commandp (lookup-key company-my-keymap keys))))
 
-;; 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
-;; Apparently, starting with emacs-mirror/emacs@99d0d6dc23.
-(defun company-ignore ()
-  (interactive)
-  (setq this-command last-command))
-
-(global-set-key '[company-dummy-event] 'company-ignore)
-
-(defun company-input-noop ()
-  (push 'company-dummy-event unread-command-events))
-
 ;; To avoid warnings in Emacs < 26.
 (declare-function line-number-display-width "indent.c")
 
@@ -912,9 +883,6 @@ means that `company-mode' is always turned on except in 
`message-mode' buffers."
         (row (cdr (or (posn-actual-col-row posn)
                       ;; When position is non-visible for some reason.
                       (posn-col-row posn)))))
-    (when (and header-line-format (version< emacs-version "24.3.93.3"))
-      ;; http://debbugs.gnu.org/18384
-      (cl-decf row))
     (when (bound-and-true-p display-line-numbers)
       (cl-decf col (+ 2 (line-number-display-width))))
     (cons (+ col (window-hscroll)) row)))
@@ -1577,8 +1545,6 @@ prefix match (same case) will be prioritized."
        (eq tick (buffer-chars-modified-tick))
        (eq pos (point))
        (when (company-auto-begin)
-         (when (version< emacs-version "24.3.50")
-           (company-input-noop))
          (let ((this-command 'company-idle-begin))
            (company-post-command)))))
 
@@ -2696,27 +2662,26 @@ If SHOW-VERSION is non-nil, show the version in the 
echo area."
                        right)))
     (setq width (+ width margin (length right)))
 
-    ;; TODO: Use add-face-text-property in Emacs 24.4
     (font-lock-append-text-property 0 width 'mouse-face
                                     'company-tooltip-mouse
                                     line)
     (when (< ann-start ann-end)
-      (font-lock-append-text-property ann-start ann-end 'face
-                                      (if selected
-                                          'company-tooltip-annotation-selection
-                                        'company-tooltip-annotation)
-                                      line))
+      (add-face-text-property ann-start ann-end
+                              (if selected
+                                  'company-tooltip-annotation-selection
+                                'company-tooltip-annotation)
+                              t line))
     (cl-loop
      with width = (- width (length right))
      for (comp-beg . comp-end) in (if (integerp common) `((0 . ,common)) 
common)
      for inline-beg = (+ margin comp-beg)
      for inline-end = (min (+ margin comp-end) width)
      when (< inline-beg width)
-     do (font-lock-prepend-text-property inline-beg inline-end 'face
-                                         (if selected
-                                             'company-tooltip-common-selection
-                                           'company-tooltip-common)
-                                         line))
+     do (add-face-text-property inline-beg inline-end
+                                (if selected
+                                    'company-tooltip-common-selection
+                                  'company-tooltip-common)
+                                nil line))
     (when (let ((re (funcall company-search-regexp-function
                              company-search-string)))
             (and (not (string= re ""))
@@ -2726,18 +2691,14 @@ If SHOW-VERSION is non-nil, show the version in the 
echo area."
               (end (+ margin mend))
               (width (- width (length right))))
           (when (< beg width)
-            (font-lock-prepend-text-property beg (min end width) 'face
-                                             (if selected
-                                                 
'company-tooltip-search-selection
-                                               'company-tooltip-search)
-                                             line)))))
+            (add-face-text-property beg (min end width)
+                                    (if selected
+                                        'company-tooltip-search-selection
+                                      'company-tooltip-search)
+                                    nil line)))))
     (when selected
-      (font-lock-append-text-property 0 width 'face
-                                      'company-tooltip-selection
-                                      line))
-    (font-lock-append-text-property 0 width 'face
-                                    'company-tooltip
-                                    line)
+      (add-face-text-property 0 width 'company-tooltip-selection t line))
+    (add-face-text-property 0 width 'company-tooltip t line)
     line))
 
 (defun company--search-chunks ()
@@ -2829,18 +2790,6 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
       (cl-decf ww))
     (when (bound-and-true-p display-line-numbers)
       (cl-decf ww (+ 2 (line-number-display-width))))
-    (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)))))
-    (when (and word-wrap
-               (version< emacs-version "24.4.51.5"))
-      ;; http://debbugs.gnu.org/19300
-      (cl-decf ww))
     ;; whitespace-mode with newline-mark
     (when (and buffer-display-table
                (aref buffer-display-table ?\n))
@@ -2915,9 +2864,8 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
                         ;; 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42552#23
                         (lambda (line) (list line (propertize "\n" 'face 
nl-face)))
                         (nreverse new)))))
-      ;; Use add-face-text-property in Emacs 24.4
       ;; https://debbugs.gnu.org/38563
-      (font-lock-append-text-property 0 (length str) 'face 'default str)
+      (add-face-text-property 0 (length str) 'default t str)
       (when nl (put-text-property 0 1 'cursor t str))
       str)))
 
@@ -2981,8 +2929,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
           (setq annotation (company--clean-string annotation))
           (when company-tooltip-align-annotations
             ;; `lisp-completion-at-point' adds a space.
-            ;; FIXME: Use `string-trim' in Emacs 24.4
-            (setq annotation (comment-string-strip annotation t nil))))
+            (setq annotation (string-trim-left annotation))))
         (push (list value annotation candidate-prefix) items)
         (setq width (max (+ (length value)
                             (length candidate-prefix)
@@ -3242,21 +3189,18 @@ Delay is determined by `company-tooltip-idle-delay'."
   (company-preview-hide)
 
   (setq completion (copy-sequence (company--pre-render completion)))
-  (font-lock-append-text-property 0 (length completion)
-                                  'face 'company-preview
-                                  completion)
-    (font-lock-prepend-text-property 0 (length company-common)
-                                     'face 'company-preview-common
-                                     completion)
+  (add-face-text-property 0 (length completion) 'company-preview
+                          nil completion)
+  (add-face-text-property 0 (length company-common) 'company-preview-common
+                          nil completion)
 
     ;; Add search string
     (and (string-match (funcall company-search-regexp-function
                                 company-search-string)
                        completion)
          (pcase-dolist (`(,mbeg . ,mend) (company--search-chunks))
-           (font-lock-prepend-text-property mbeg mend
-                                            'face 'company-preview-search
-                                            completion)))
+           (add-face-text-property mbeg mend 'company-preview-search
+                                   nil completion)))
 
     (setq completion (company-strip-prefix completion))
 
diff --git a/test/async-tests.el b/test/async-tests.el
index be9c2b5..7beb116 100644
--- a/test/async-tests.el
+++ b/test/async-tests.el
@@ -1,6 +1,6 @@
 ;;; async-tests.el --- company-mode tests  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015, 2016, 2018  Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016, 2018, 2020-2021  Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov
 
@@ -83,7 +83,7 @@
     (let (company-frontends
           (company-backends (list 'company-async-backend))
           noninteractive
-          (unread-command-events (list 'company-dummy-event)))
+          (unread-command-events (list ?a)))
       (company-idle-begin (current-buffer) (selected-window)
                           (buffer-chars-modified-tick) (point))
       (should (null company-candidates)))))
@@ -102,7 +102,7 @@
                               (lambda (cb) (funcall cb c)))))
                      (`no-cache t)))))
           (company-minimum-prefix-length 0)
-          (unread-command-events (list 'company-dummy-event)))
+          (unread-command-events (list ?a)))
       (company-idle-begin (current-buffer) (selected-window)
                           (buffer-chars-modified-tick) (point))
       (should (equal '("abc" "def") company-candidates))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]