|Subject:||icomplete-fido-backward-updir litters kill-ring|
|Date:||Fri, 12 Jun 2020 21:20:54 -0700|
Please tell me if this should be redirected to the bug report mailing list. It’s less a bug and more an undesired behavior. While using fido-mode, I noticed my kill-ring just getting littered with…stuff. Turns out that icomplete-fido-backward-updir uses zap-up-to-char, which kills instead of deletes:
(defun icomplete-fido-backward-updir ()
"Delete char before or go up directory, like `ido-mode'."
(if (and (eq (char-before) ?/)
(eq (icomplete--category) 'file))
(zap-up-to-char -1 ?/)
(defun zap-up-to-char (arg char)
"Kill up to, but not including ARGth occurrence of CHAR.
Case is ignored if `case-fold-search' is non-nil in the current buffer.
Goes backward if ARG is negative; error if CHAR not found.
Ignores CHAR at point."
(interactive "p\ncZap up to char: ")
(let ((direction (if (>= arg 0) 1 -1)))
(search-forward (char-to-string char) nil nil arg)
Since the function zap-up-to-char does a kill, if you’ve typed out a path /foo/bar/baz/, then decide to look elsewhere and hit DEL DEL DEL, they all get killed (not just deleted).
We could an optional arg to zap-up-to-char so that it can call delete-region instead of kill-region, or duplicate the code in it, or something else entirely.
João, what do you think? Perhaps this was intended behavior, but it doesn’t seem like it.
P.S. With Emacs 28 I’m super happy with how much 3rdparty stuff I’m getting to replace with GNU code, either built-in or in ELPA. Like fido-mode :)
|[Prev in Thread]||Current Thread||[Next in Thread]|