From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andrew Schwartzmeyer Newsgroups: gmane.emacs.devel Subject: icomplete-fido-backward-updir litters kill-ring Date: Fri, 12 Jun 2020 21:20:54 -0700 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_89E14239-0744-4696-BCA0-259847F8B65C" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="118830"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 13 06:24:52 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjxiu-000UpH-0g for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Jun 2020 06:24:52 +0200 Original-Received: from localhost ([::1]:37376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjxit-00083k-0S for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Jun 2020 00:24:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjxfF-0000Sc-NY for emacs-devel@gnu.org; Sat, 13 Jun 2020 00:21:05 -0400 Original-Received: from mout02.posteo.de ([185.67.36.142]:46273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjxfC-0007vR-HQ for emacs-devel@gnu.org; Sat, 13 Jun 2020 00:21:05 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id B7FA32400FC for ; Sat, 13 Jun 2020 06:20:58 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 49kPXn17Jkz9rxP; Sat, 13 Jun 2020 06:20:56 +0200 (CEST) X-Mailer: Apple Mail (2.3608.80.23.2.2) Received-SPF: pass client-ip=185.67.36.142; envelope-from=andrew@schwartzmeyer.com; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/13 00:20:59 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252152 Archived-At: --Apple-Mail=_89E14239-0744-4696-BCA0-259847F8B65C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello, Please tell me if this should be redirected to the bug report mailing = list. It=E2=80=99s less a bug and more an undesired behavior. While = using fido-mode, I noticed my kill-ring just getting littered = with=E2=80=A6stuff. 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'." (interactive) (if (and (eq (char-before) ?/) (eq (icomplete--category) 'file)) (zap-up-to-char -1 ?/) (call-interactively 'backward-delete-char))) (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 (>=3D arg 0) 1 -1))) (kill-region (point) (progn (forward-char direction) (unwind-protect (search-forward (char-to-string char) nil nil = arg) (backward-char direction)) (point))))) Since the function zap-up-to-char does a kill, if you=E2=80=99ve 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=C3=A3o, what do you think? Perhaps this was intended behavior, but it = doesn=E2=80=99t seem like it. Thanks, Andy P.S. With Emacs 28 I=E2=80=99m super happy with how much 3rdparty stuff = I=E2=80=99m getting to replace with GNU code, either built-in or in = ELPA. Like fido-mode :)= --Apple-Mail=_89E14239-0744-4696-BCA0-259847F8B65C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello,

Please tell me if this should be redirected to the bug report = mailing list. It=E2=80=99s less a bug and more an undesired behavior. = While using fido-mode, I noticed my kill-ring just getting littered = with=E2=80=A6stuff. 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'."
  (interactive)
  (if (and (eq (char-before) ?/)
           (eq = (icomplete--category) 'file))
      = (zap-up-to-char -1 ?/)
    = (call-interactively 'backward-delete-char)))

(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 (>=3D arg 0) 1 -1)))
    (kill-region (point)
= (progn
  (forward-char = direction)
  = (unwind-protect
      = (search-forward (char-to-string char) nil nil arg)
=     (backward-char direction))
=   (point)))))

Since the function zap-up-to-char does a kill, if you=E2=80=99ve= 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=C3=A3o, what do you think? Perhaps this = was intended behavior, but it doesn=E2=80=99t seem like = it.

Thanks,

Andy

P.S. With Emacs 28 I=E2=80=99= m super happy with how much 3rdparty stuff I=E2=80=99m getting to = replace with GNU code, either built-in or in ELPA. Like fido-mode = :)
= --Apple-Mail=_89E14239-0744-4696-BCA0-259847F8B65C--