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

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

[elpa] externals/cape df9067ca3b 2/2: Minor cleanup


From: ELPA Syncer
Subject: [elpa] externals/cape df9067ca3b 2/2: Minor cleanup
Date: Sat, 22 Oct 2022 14:57:22 -0400 (EDT)

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

    Minor cleanup
---
 cape.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/cape.el b/cape.el
index 834549aa4b..485926c3a4 100644
--- a/cape.el
+++ b/cape.el
@@ -210,6 +210,8 @@ VALID is the input comparator, see `cape--input-valid-p'."
 (declare-function ring-elements "ring")
 (declare-function eshell-bol "eshell")
 (declare-function comint-bol "comint")
+(defvar eshell-history-ring)
+(defvar comint-input-ring)
 
 (defvar cape--history-properties
   (list :company-kind (lambda (_) 'text)
@@ -224,24 +226,23 @@ See also `consult-history' for a more flexible variant 
based on
   (interactive (list t))
   (if interactive
       (cape--interactive #'cape-history)
-    (let ((history)
-          (start-pos))
+    (let (history bol)
       (cond
        ((derived-mode-p 'eshell-mode)
-        (setq history (bound-and-true-p eshell-history-ring)
-              start-pos (save-excursion (eshell-bol) (point))))
+        (setq history eshell-history-ring
+              bol (save-excursion (eshell-bol) (point))))
        ((derived-mode-p 'comint-mode)
-        (setq history (bound-and-true-p comint-input-ring)
-              start-pos (save-excursion (comint-bol) (point))))
+        (setq history comint-input-ring
+              bol (save-excursion (comint-bol) (point))))
        ((and (minibufferp) (not (eq minibuffer-history-variable t)))
         (setq history (symbol-value minibuffer-history-variable)
-              start-pos (line-beginning-position))))
+              bol (line-beginning-position))))
       (when (ring-p history)
         (setq history (ring-elements history)))
       (when history
-        `( ,start-pos ,(point)
-           ,(cape--table-with-properties history :sort nil)
-           ,@cape--history-properties)))))
+        `(,bol ,(point)
+          ,(cape--table-with-properties history :sort nil)
+          ,@cape--history-properties)))))
 
 ;;;;; cape-file
 



reply via email to

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