aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/icomplete.el
diff options
context:
space:
mode:
authorDmitry Gutov2015-05-19 15:52:27 +0300
committerDmitry Gutov2015-05-19 15:53:32 +0300
commit08033db08bc2bc75221b0dde97257c987d4efa00 (patch)
treee476efa54d991602dd92574b57f1a997418ab54e /lisp/icomplete.el
parente0fec8d3cad6efbcc39c5c9d1d53cef40f27a250 (diff)
downloademacs-08033db08bc2bc75221b0dde97257c987d4efa00.tar.gz
emacs-08033db08bc2bc75221b0dde97257c987d4efa00.zip
New command icomplete-force-complete-and-exit
* lisp/icomplete.el (icomplete-force-complete-and-exit): New command (http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00461.html) (http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00516.html). (icomplete-minibuffer-map): Bind C-j to it. (icomplete-forward-completions, icomplete-backward-completions): Mention the new command in the docstring. * lisp/minibuffer.el (minibuffer-force-complete-and-exit): Revert the previous fix for bug#17545.
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r--lisp/icomplete.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index ee281122852..b1894ca5874 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -149,16 +149,26 @@ icompletion is occurring."
149(defvar icomplete-minibuffer-map 149(defvar icomplete-minibuffer-map
150 (let ((map (make-sparse-keymap))) 150 (let ((map (make-sparse-keymap)))
151 (define-key map [?\M-\t] 'minibuffer-force-complete) 151 (define-key map [?\M-\t] 'minibuffer-force-complete)
152 (define-key map [?\C-j] 'minibuffer-force-complete-and-exit) 152 (define-key map [?\C-j] 'icomplete-force-complete-and-exit)
153 (define-key map [?\C-.] 'icomplete-forward-completions) 153 (define-key map [?\C-.] 'icomplete-forward-completions)
154 (define-key map [?\C-,] 'icomplete-backward-completions) 154 (define-key map [?\C-,] 'icomplete-backward-completions)
155 map) 155 map)
156 "Keymap used by `icomplete-mode' in the minibuffer.") 156 "Keymap used by `icomplete-mode' in the minibuffer.")
157 157
158(defun icomplete-force-complete-and-exit ()
159 "Complete the minibuffer and exit.
160Use the first of the matches if there are any displayed, and use
161the default otherwise."
162 (interactive)
163 (if (or icomplete-show-matches-on-no-input
164 (> (icomplete--field-end) (icomplete--field-beg)))
165 (minibuffer-force-complete-and-exit)
166 (minibuffer-complete-and-exit)))
167
158(defun icomplete-forward-completions () 168(defun icomplete-forward-completions ()
159 "Step forward completions by one entry. 169 "Step forward completions by one entry.
160Second entry becomes the first and can be selected with 170Second entry becomes the first and can be selected with
161`minibuffer-force-complete-and-exit'." 171`icomplete-force-complete-and-exit'."
162 (interactive) 172 (interactive)
163 (let* ((beg (icomplete--field-beg)) 173 (let* ((beg (icomplete--field-beg))
164 (end (icomplete--field-end)) 174 (end (icomplete--field-end))
@@ -171,7 +181,7 @@ Second entry becomes the first and can be selected with
171(defun icomplete-backward-completions () 181(defun icomplete-backward-completions ()
172 "Step backward completions by one entry. 182 "Step backward completions by one entry.
173Last entry becomes the first and can be selected with 183Last entry becomes the first and can be selected with
174`minibuffer-force-complete-and-exit'." 184`icomplete-force-complete-and-exit'."
175 (interactive) 185 (interactive)
176 (let* ((beg (icomplete--field-beg)) 186 (let* ((beg (icomplete--field-beg))
177 (end (icomplete--field-end)) 187 (end (icomplete--field-end))