From: Rasmus Date: Fri, 12 Nov 2021 08:02:28 +0000 (+0100) Subject: lisp/icomplete.el (icomplete-fido-backward-updir): Expand "~/" X-Git-Tag: emacs-29.0.90~3668^2~14 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=87e53578861a37748cdfc7cb017b73c2bcf572a4;p=emacs.git lisp/icomplete.el (icomplete-fido-backward-updir): Expand "~/" * lisp/icomplete.el (icomplete-fido-backward-updir): Expand "~/" (bug#43925). --- diff --git a/lisp/icomplete.el b/lisp/icomplete.el index a61c9d6354c..f909a3b1771 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -380,13 +380,17 @@ if that doesn't produce a completion match." (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)))