]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/icomplete.el (icomplete-fido-backward-updir): Expand "~/"
authorRasmus <rasmus@gmx.us>
Fri, 12 Nov 2021 08:02:28 +0000 (09:02 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Nov 2021 08:02:28 +0000 (09:02 +0100)
* lisp/icomplete.el (icomplete-fido-backward-updir): Expand "~/"
(bug#43925).

lisp/icomplete.el

index a61c9d6354c133775f302962086004c708c6da1b..f909a3b17712c933175db0da38959c6266ded4f6 100644 (file)
@@ -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)))