all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#43925: 28.0.50; fido-mode can't find-file further back than ~/
@ 2020-10-11 15:30 Rasmus
  2021-06-11 23:07 ` João Távora
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2020-10-11 15:30 UTC (permalink / raw)
  To: 43925

[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]

Hi,

I am trying to replace ido with fido.

One heuristic that I miss from ido is the ability to easily get to 
root via find(ing)-file.

In particular, from emacs -q, I might do something like this

    (let ((default-directory "~/")) 
      (fido-mode) (call-interactively 'find-file) ;; click 
      <backspace><backspace> to get to root )

Being an ido-user, I would expect to be able to go to /home/ by 
clicking backspace and then to root.  But I doesn’t work with 
fido.

I don’t know if I have missed some obvious configuration-step 
here?  I looked through the customization groups of both icomplete 
and minibuffer.

The attached patch expand the file-name if it is “~/”.

I am not really familiar with this part of Emacs so I am not sure 
it’s the right way to go about it.  In particular, I am really not 
sure whether the internal functions (e.g. ‘icomplete--field-beg’) 
are used correctly.


Aside: Another annoyance with fido is that $HOME isn’t being 
abbreviated
to “~” when browsing from root.  E.g.
 
    (let ((default-directory "/home/")) 
      (fido-mode) (call-interactively 'find-file) ;; now select 
      your username ) 

I would like “/home/$USER” to be abbreviated to “~” (like ido) to 
conserve space.

Any ideas as to where such a change migh be injected to fido?  I 
didn’t see an obvious place.

Thanks in advance,
Rasmus

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.23, cairo version 1.17.3) 
 of 2020-10-06 built on X260 
Repository revision: d36cfa21b6b695862dae772a94c63ce3aca8467e 
Repository branch: makepkg Windowing system distributor 'The X.Org 
Foundation', version 11.0.12009000 System Description: Arch Linux 

-- 
Tack, ni svenska vakttorn. Med plutonium tvingar vi dansken på 
knä!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-icomplete.el-icomplete-fido-backward-updir-Expa.patch --]
[-- Type: text/x-patch, Size: 1577 bytes --]

From fbf036230d092b4a1e5f7dadd3bf7ad0dea47ed4 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sun, 11 Oct 2020 13:54:20 +0200
Subject: [PATCH] * lisp/icomplete.el (icomplete-fido-backward-updir): Expand
 "~/"

---
 lisp/icomplete.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 4e546807b7..1687404eef 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -312,13 +312,17 @@ icomplete-fido-exit
 (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)))
--
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-13 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-11 15:30 bug#43925: 28.0.50; fido-mode can't find-file further back than ~/ Rasmus
2021-06-11 23:07 ` João Távora
2021-11-12  8:03   ` Lars Ingebrigtsen
2021-11-13 11:08     ` bug#43925: " Rasmus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.