(defun icomplete-fido-backward-updir ()
"Delete char before or go up directory, like `ido-mode'."
(interactive)
- (if (and (eq (char-before) ?/)
- (eq (icomplete--category) 'file))
- (save-excursion
- (goto-char (1- (point)))
- (when (search-backward "/" (point-min) t)
- (delete-region (1+ (point)) (point-max))))
- (call-interactively 'backward-delete-char)))
+ (cond ((and (eq (char-before) ?/)
+ (eq (icomplete--category) 'file))
+ (when (string-equal (icomplete--field-string) "~/")
+ (delete-region (icomplete--field-beg) (icomplete--field-end))
+ (insert (expand-file-name "~/"))
+ (goto-char (line-end-position)))
+ (save-excursion
+ (goto-char (1- (point)))
+ (when (search-backward "/" (point-min) t)
+ (delete-region (1+ (point)) (point-max)))))
+ (t (call-interactively 'backward-delete-char))))
(defvar icomplete-fido-mode-map
(let ((map (make-sparse-keymap)))