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

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

[nongnu] elpa/recomplete 2b38ca25e3 12/14: Add optional argument to step


From: ELPA Syncer
Subject: [nongnu] elpa/recomplete 2b38ca25e3 12/14: Add optional argument to step onto the second item when completing
Date: Thu, 7 Jul 2022 12:02:22 -0400 (EDT)

branch: elpa/recomplete
commit 2b38ca25e3392636fe936d3edad447970279a463
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Add optional argument to step onto the second item when completing
    
    This is more appropriate for cycling over elements where
    the current item is included in the list.
---
 recomplete.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/recomplete.el b/recomplete.el
index 09f3c43c14..e983d48e79 100644
--- a/recomplete.el
+++ b/recomplete.el
@@ -5,7 +5,7 @@
 ;; Author: Campbell Barton <ideasman42@gmail.com>
 
 ;; URL: https://gitlab.com/ideasman42/emacs-recomplete
-;; Version: 0.1
+;; Version: 0.2
 ;; Package-Requires: ((emacs "26.1"))
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -346,11 +346,16 @@ Argument FN-CACHE stores the result for reuse."
 ;; Make public since users may want to add their own callbacks.
 
 ;;;###autoload
-(defun recomplete-with-callback (fn-symbol cycle-offset)
+(defun recomplete-with-callback (fn-symbol cycle-offset &optional 
cycle-index-init)
   "Run FN-SYMBOL, chaining executions for any function in FN-GROUP.
 
 Argument CYCLE-OFFSET The offset for cycling words,
-1 or -1 for forward/backward."
+1 or -1 for forward/backward.
+
+Optional argument CYCLE-INDEX-INIT The initial index to use,
+defaulting to zero (which makes sense for corrections) you may wish to set
+the value to 1 when the current symbol is included in the list
+(so as to step onto the next item)."
 
   ;; Default to 1 (one step forward).
   (setq cycle-offset (or cycle-offset 1))
@@ -365,7 +370,7 @@ Argument CYCLE-OFFSET The offset for cycling words,
       (point-init (point))
       (buffer-undo-list-init buffer-undo-list)
       (pending-undo-list-init pending-undo-list)
-      (cycle-index 0)
+      (cycle-index (or cycle-index-init 0))
       (cycle-reverse nil)
       (fn-cache nil)
 



reply via email to

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