summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMarcin Borkowski <mbork@mbork.pl>2014-02-03 22:52:08 +0100
committerMarcin Borkowski <mbork@mbork.pl>2014-02-03 22:52:08 +0100
commitb1cfeb00156c5b42a3d760bc860ddc119fdd53e5 (patch)
tree72a09aa249834669150854e704c40288590f4ca7 /lisp
parentdcb24fbb5c9b35b36b7e66da6b5cbce6ff150ed4 (diff)
downloadfork-ledger-b1cfeb00156c5b42a3d760bc860ddc119fdd53e5.tar.gz
fork-ledger-b1cfeb00156c5b42a3d760bc860ddc119fdd53e5.tar.bz2
fork-ledger-b1cfeb00156c5b42a3d760bc860ddc119fdd53e5.zip
Add option ledger-complete-ignore-case
and change ledger-pcomplete accordingly
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-complete.el78
1 files changed, 42 insertions, 36 deletions
diff --git a/lisp/ledger-complete.el b/lisp/ledger-complete.el
index 0335f761..ae3dfb78 100644
--- a/lisp/ledger-complete.el
+++ b/lisp/ledger-complete.el
@@ -213,49 +213,55 @@ Does not use ledger xact"
(goto-char (match-end 0))))))
+(defcustom ledger-complete-ignore-case t
+ "Non-nil means that ledger-complete-at-point will be case-insensitive"
+ :type 'boolean
+ :group 'ledger)
+
(defun ledger-pcomplete (&optional interactively)
"Complete rip-off of pcomplete from pcomplete.el, only added
ledger-magic-tab in the previous commands list so that
ledger-magic-tab would cycle properly"
(interactive "p")
- (if (and interactively
- pcomplete-cycle-completions
- pcomplete-current-completions
- (memq last-command '(ledger-magic-tab
- ledger-pcomplete
- pcomplete-expand-and-complete
- pcomplete-reverse)))
- (progn
- (delete-backward-char pcomplete-last-completion-length)
- (if (eq this-command 'pcomplete-reverse)
- (progn
- (push (car (last pcomplete-current-completions))
- pcomplete-current-completions)
- (setcdr (last pcomplete-current-completions 2) nil))
- (nconc pcomplete-current-completions
- (list (car pcomplete-current-completions)))
- (setq pcomplete-current-completions
- (cdr pcomplete-current-completions)))
- (pcomplete-insert-entry pcomplete-last-completion-stub
- (car pcomplete-current-completions)
- nil pcomplete-last-completion-raw))
+ (let ((pcomplete-ignore-case ledger-complete-ignore-case))
+ (if (and interactively
+ pcomplete-cycle-completions
+ pcomplete-current-completions
+ (memq last-command '(ledger-magic-tab
+ ledger-pcomplete
+ pcomplete-expand-and-complete
+ pcomplete-reverse)))
+ (progn
+ (delete-backward-char pcomplete-last-completion-length)
+ (if (eq this-command 'pcomplete-reverse)
+ (progn
+ (push (car (last pcomplete-current-completions))
+ pcomplete-current-completions)
+ (setcdr (last pcomplete-current-completions 2) nil))
+ (nconc pcomplete-current-completions
+ (list (car pcomplete-current-completions)))
+ (setq pcomplete-current-completions
+ (cdr pcomplete-current-completions)))
+ (pcomplete-insert-entry pcomplete-last-completion-stub
+ (car pcomplete-current-completions)
+ nil pcomplete-last-completion-raw))
(setq pcomplete-current-completions nil
- pcomplete-last-completion-raw nil)
+ pcomplete-last-completion-raw nil)
(catch 'pcompleted
- (let* ((pcomplete-stub)
- pcomplete-seen pcomplete-norm-func
- pcomplete-args pcomplete-last pcomplete-index
- (pcomplete-autolist pcomplete-autolist)
- (pcomplete-suffix-list pcomplete-suffix-list)
- (completions (pcomplete-completions))
- (result (pcomplete-do-complete pcomplete-stub completions)))
- (and result
- (not (eq (car result) 'listed))
- (cdr result)
- (pcomplete-insert-entry pcomplete-stub (cdr result)
- (memq (car result)
- '(sole shortest))
- pcomplete-last-completion-raw))))))
+ (let* ((pcomplete-stub)
+ pcomplete-seen pcomplete-norm-func
+ pcomplete-args pcomplete-last pcomplete-index
+ (pcomplete-autolist pcomplete-autolist)
+ (pcomplete-suffix-list pcomplete-suffix-list)
+ (completions (pcomplete-completions))
+ (result (pcomplete-do-complete pcomplete-stub completions)))
+ (and result
+ (not (eq (car result) 'listed))
+ (cdr result)
+ (pcomplete-insert-entry pcomplete-stub (cdr result)
+ (memq (car result)
+ '(sole shortest))
+ pcomplete-last-completion-raw)))))))
(provide 'ledger-complete)