emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/mct f344dff 4/4: Refine mct-backward-updir


From: ELPA Syncer
Subject: [elpa] externals/mct f344dff 4/4: Refine mct-backward-updir
Date: Tue, 16 Nov 2021 06:59:36 -0500 (EST)

branch: externals/mct
commit f344dffc64fa817f9e166cd652727a68814ae383
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Refine mct-backward-updir
    
    Based on the latest state of icomplete-fido-backward-updir.
---
 mct.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/mct.el b/mct.el
index 9ca4bf2..46e50ae 100644
--- a/mct.el
+++ b/mct.el
@@ -447,13 +447,18 @@ by `mct-completion-windows-regexp'."
 (defun mct-backward-updir ()
   "Delete char before point or go up a directory."
   (interactive nil mct-mode)
-  (if (and (eq (char-before) ?/)
-           (eq (mct--completion-category) 'file))
-      (save-excursion
-        (goto-char (1- (point)))
-        (when (search-backward "/" (minibuffer-prompt-end) t)
-          (delete-region (1+ (point)) (point-max))))
-    (call-interactively 'backward-delete-char)))
+  (cond
+   ((and (eq (char-before) ?/)
+         (eq (mct--completion-category) 'file))
+    (when (string-equal (minibuffer-contents) "~/")
+      (delete-region (mct--minibuffer-field-beg) (mct--minibuffer-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))))
 
 ;;;;; Cyclic motions between minibuffer and completions' buffer
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]