From: Rasmus <rasmus@gmx.us>
To: 43925@debbugs.gnu.org
Subject: bug#43925: 28.0.50; fido-mode can't find-file further back than ~/
Date: Sun, 11 Oct 2020 17:30:21 +0200 [thread overview]
Message-ID: <87r1q43hma.fsf@gmx.us> (raw)
[-- 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
next reply other threads:[~2020-10-11 15:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 15:30 Rasmus [this message]
2021-06-11 23:07 ` bug#43925: 28.0.50; fido-mode can't find-file further back than ~/ João Távora
2021-11-12 8:03 ` Lars Ingebrigtsen
2021-11-13 11:08 ` bug#43925: " Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1q43hma.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=43925@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.