From 289ec2d911c0a723c0c131ac9cf3407c71a4b15c Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 16 Apr 2021 14:28:10 +0200 Subject: ; Remove some useless comments --- lisp/filecache.el | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lisp/filecache.el') diff --git a/lisp/filecache.el b/lisp/filecache.el index 67d2939dd3c..62184e1a0ae 100644 --- a/lisp/filecache.el +++ b/lisp/filecache.el @@ -674,10 +674,6 @@ match REGEXP." (insert (nth 1 item) (nth 0 item) "\n")) (pop-to-buffer buf)))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Keybindings -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (provide 'filecache) ;;; filecache.el ends here -- cgit v1.2.3 From 12af7ee46d47152a2c499e24970a6ab4a94aed61 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 1 Aug 2021 11:38:51 +0300 Subject: * lisp/filecache.el: Fix cycling (bug#49761). (file-cache-cycle): Refactor from file-cache-minibuffer-complete. (file-cache-minibuffer-complete): Use file-cache-cycle in 2 old places, and in 1 following new place. When last-command is equal to this-command, use file-cache-cycle to continue cycling the previous completion as long as the user continues typing C-TAB. Also when displaying a list of completions, don't try to move point to the common prefix. --- etc/NEWS | 2 +- lisp/filecache.el | 35 ++++++++++++++--------------------- 2 files changed, 15 insertions(+), 22 deletions(-) (limited to 'lisp/filecache.el') diff --git a/etc/NEWS b/etc/NEWS index 78e4e472480..bd5c803d376 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3096,7 +3096,7 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el. 'erc-announced-server-name', 'erc-default-coding-system', 'erc-process', 'erc-send-command', 'eshell-report-bug', 'eval-next-after-load', 'exchange-dot-and-mark', 'ffap-bug', -'ffap-submit-bug', 'ffap-version', 'file-cache-choose-completion', +'ffap-submit-bug', 'ffap-version', 'file-cache-mouse-choose-completion', 'forward-point', 'generic-char-p', 'global-highlight-changes', 'hi-lock-face-history', 'hi-lock-regexp-history', 'highlight-changes-active-string', 'highlight-changes-initial-state', diff --git a/lisp/filecache.el b/lisp/filecache.el index 62184e1a0ae..4223878b0e7 100644 --- a/lisp/filecache.el +++ b/lisp/filecache.el @@ -516,6 +516,16 @@ If called interactively, read the directory names one by one." (concat directory "/") directory))) +(defun file-cache-cycle (name) + "Cycle through the directories that NAME is available in." + (let ((file-name (file-cache-file-name name))) + (if (string= file-name (minibuffer-contents)) + (minibuffer-message file-cache-sole-match-message) + (delete-minibuffer-contents) + (insert file-name) + (if file-cache-multiple-directory-message + (minibuffer-message file-cache-multiple-directory-message))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Minibuffer functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -545,13 +555,7 @@ the name is considered already unique; only the second substitution (cond ;; If it's the only match, replace the original contents ((or arg (eq completion t)) - (let ((file-name (file-cache-file-name string))) - (if (string= file-name (minibuffer-contents)) - (minibuffer-message file-cache-sole-match-message) - (delete-minibuffer-contents) - (insert file-name) - (if file-cache-multiple-directory-message - (minibuffer-message file-cache-multiple-directory-message))))) + (file-cache-cycle string)) ;; If it's the longest match, insert it ((consp completion) @@ -564,10 +568,7 @@ the name is considered already unique; only the second substitution file-cache-ignore-case)) (if (and (eq last-command this-command) (string= file-cache-last-completion newstring)) - (progn - (delete-minibuffer-contents) - (insert (file-cache-file-name newstring)) - (setq file-cache-last-completion nil)) + (file-cache-cycle newstring) (minibuffer-message file-cache-non-unique-message) (setq file-cache-last-completion string)) (setq file-cache-last-completion string) @@ -579,20 +580,12 @@ the name is considered already unique; only the second substitution (if (> (length completion-list) 1) (progn (delete-region (- (point-max) (length string)) (point-max)) - (save-excursion (insert newstring)) - (forward-char newpoint) + (insert newstring) (with-output-to-temp-buffer file-cache-completions-buffer (display-completion-list completion-list) ;; Add our own setup function to the Completions Buffer (file-cache-completion-setup-function))) - (let ((file-name (file-cache-file-name newstring))) - (if (string= file-name (minibuffer-contents)) - (minibuffer-message file-cache-sole-match-message) - (delete-minibuffer-contents) - (insert file-name) - (if file-cache-multiple-directory-message - (minibuffer-message - file-cache-multiple-directory-message))))))))) + (file-cache-cycle newstring)))))) ;; No match ((eq completion nil) -- cgit v1.2.3