branch: externals/cape
commit bbc399e4724c86d80ee04c5d3af1567683c2b87c
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    Require the compat library
---
 cape-char.el |  2 +-
 cape.el      | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/cape-char.el b/cape-char.el
index 5f49a54098..873a004394 100644
--- a/cape-char.el
+++ b/cape-char.el
@@ -56,7 +56,7 @@ REGEXP is the regular expression matching the names."
                   (when (and (get-text-property beg 'face line) (< ename len) 
(<= echar len))
                     (let ((name (string-trim (substring-no-properties line beg 
ename)))
                           (char (string-trim (substring-no-properties line 
ename echar))))
-                      (when (and (string-match-p regexp name) (= (length char) 
1))
+                      (when (and (string-match-p regexp name) (length= char 1))
                         (puthash name (aref char 0) hash))))
                   (setq beg echar)))))
           (kill-buffer)
diff --git a/cape.el b/cape.el
index 0389c88fb2..10cf1b5a34 100644
--- a/cape.el
+++ b/cape.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Daniel Mendler <m...@daniel-mendler.de>
 ;; Created: 2021
 ;; Version: 0.12
-;; Package-Requires: ((emacs "27.1"))
+;; Package-Requires: ((emacs "27.1") (compat "29.1.1.0"))
 ;; Homepage: https://github.com/minad/cape
 
 ;; This file is part of GNU Emacs.
@@ -44,6 +44,7 @@
 
 ;;; Code:
 
+(require 'compat)
 (eval-when-compile
   (require 'cl-lib)
   (require 'subr-x))
@@ -187,7 +188,7 @@ The CMP argument determines how the new input is compared 
to the old input.
         ('never nil)
         ((or 'prefix 'nil) (string-prefix-p old-input new-input))
         ('equal (equal old-input new-input))
-        ('substring (string-match-p (regexp-quote old-input) new-input)))))
+        ('substring (string-search old-input new-input)))))
 
 (defun cape--cached-table (beg end fun valid)
   "Create caching completion table.
@@ -285,7 +286,7 @@ If INTERACTIVE is nil the function acts like a Capf."
       (when org (setcar bounds (+ 5 (car bounds))))
       (when (or org
                 (not cape-file-directory-must-exist)
-                (and (string-match-p "/" file)
+                (and (string-search "/" file)
                      (file-exists-p (file-name-directory file))))
         `(,(car bounds) ,(cdr bounds)
           ,(cape--nonessential-table #'read-file-name-internal)
@@ -536,7 +537,7 @@ If INTERACTIVE is nil the function acts like a Capf."
         (curr-buf (current-buffer))
         (buffers (funcall cape-line-buffer-function))
         lines)
-    (dolist (buf (if (listp buffers) buffers (list buffers)))
+    (dolist (buf (ensure-list buffers))
       (with-current-buffer buf
         (let ((beg (point-min))
               (max (point-max))
@@ -545,7 +546,7 @@ If INTERACTIVE is nil the function acts like a Capf."
           (save-excursion
             (while (< beg max)
               (goto-char beg)
-              (setq end (line-end-position))
+              (setq end (pos-eol))
               (unless (<= beg pt end)
                 (let ((line (buffer-substring-no-properties beg end)))
                   (unless (or (string-blank-p line) (gethash line ht))
@@ -562,7 +563,7 @@ If INTERACTIVE is nil the function acts like a Capf."
   (interactive (list t))
   (if interactive
       (cape--interactive #'cape-line)
-    `(,(line-beginning-position) ,(point)
+    `(,(pos-bol) ,(point)
       ,(cape--table-with-properties (cape--line-list) :sort nil)
       ,@cape--line-properties)))
 

Reply via email to