Function: ido-setup-completion-map

ido-setup-completion-map is a byte-compiled function defined in ido.el.gz.

Signature

(ido-setup-completion-map)

Documentation

Set up the completion keymap used by Ido.

Create a keymap, bind ido-completion-map to it, and depending on what is being completed (ido-cur-item) set its parent keymap to one of:

  ido-common-completion-map
  ido-file-dir-completion-map
  ido-file-completion-map
  ido-buffer-completion-map

If option ido-context-switch-command is non-nil or viper-mode(var)/viper-mode(fun) is enabled then some keybindings are changed in the keymap.

Source Code

;; Defined in /usr/src/emacs/lisp/ido.el.gz
(defun ido-setup-completion-map ()
  "Set up the completion keymap used by Ido.

Create a keymap, bind `ido-completion-map' to it, and depending
on what is being completed (`ido-cur-item') set its parent keymap
to one of:

  `ido-common-completion-map'
  `ido-file-dir-completion-map'
  `ido-file-completion-map'
  `ido-buffer-completion-map'

If option `ido-context-switch-command' is non-nil or `viper-mode'
is enabled then some keybindings are changed in the keymap."
  ;; generated every time so that it can inherit new functions.
  (let ((map (make-sparse-keymap))
	(viper-p (if (boundp 'viper-mode) viper-mode)))
    (when viper-p
      (define-key map [remap viper-intercept-ESC-key] 'ignore))
    (pcase ido-cur-item
      ((or 'file 'dir)
       (when ido-context-switch-command
	 (define-key map "\C-x\C-b" ido-context-switch-command)
	 (define-key map "\C-x\C-d" 'ignore))
       (when viper-p
	 (define-key map [remap viper-backward-char]
	   'ido-delete-backward-updir)
	 (define-key map [remap viper-del-backward-char-in-insert]
	   'ido-delete-backward-updir)
	 (define-key map [remap viper-delete-backward-word]
	   'ido-delete-backward-word-updir))
       (set-keymap-parent map
			  (if (eq ido-cur-item 'file)
			      ido-file-completion-map
			    ido-file-dir-completion-map)))
      ('buffer
       (when ido-context-switch-command
	 (define-key map "\C-x\C-f" ido-context-switch-command))
       (set-keymap-parent map ido-buffer-completion-map))
      (_
       (set-keymap-parent map ido-common-completion-map)))
    (setq ido-completion-map map)))