unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: joaotavora@gmail.com
Cc: fernandodemorais.jf@gmail.com, 72210@debbugs.gnu.org
Subject: bug#72210: 31.0.50; Feature request: multi-category support in `icomplete-fido-kill'.
Date: Sat, 17 Aug 2024 11:08:14 +0300	[thread overview]
Message-ID: <86sev34ln5.fsf@gnu.org> (raw)
In-Reply-To: <86bk2l6hoo.fsf@gnu.org> (message from Eli Zaretskii on Thu, 25 Jul 2024 10:42:47 +0300)

Ping!  João, any comments to this issue?

> Cc: 72210@debbugs.gnu.org
> Date: Thu, 25 Jul 2024 10:42:47 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Fernando de Morais <fernandodemorais.jf@gmail.com>
> > Date: Sat, 20 Jul 2024 11:22:51 -0300
> > 
> > Dear maintainers,
> > 
> > `icomplete-fido-kill' works very well, but cannot handle the deletion of
> > files or killing buffers when they are behind a multi-category
> > ``situation''.  Add this would be useful for those of us that combine
> > `icomplete' with, e.g., `consult-buffer'.
> > 
> > What follows is just the ``hacky'' approach that's currently being used
> > in my init:
> > 
> > #+begin_src emacs-lisp
> >   ;; Stolen from Embark <https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/embark.el?h=externals/embark#n2108>
> >   (defun icomplete--refine-multi-category (target)
> >     "Refine `multi-category' TARGET to its actual type."
> >     (or (let ((mc (get-text-property 0 'multi-category target)))
> >   	(cond
> >   	 ;; The `cdr' of the `multi-category' property can be a buffer object.
> >   	 ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
> >   	  (cons 'buffer (buffer-name (cdr mc))))
> >   	 ((stringp (cdr mc)) mc)))
> >         (cons 'general target)))
> > 
> >   (defun icomplete-fido-kill ()
> >     "Kill line or current completion, like `ido-mode'.
> >   If killing to the end of line make sense, call `kill-line',
> >   otherwise kill the currently selected completion candidate.
> >   Exactly what killing entails is dependent on the things being
> >   completed.  If completing files, it means delete the file.  If
> >   completing buffers it means kill the buffer.  Both actions
> >   require user confirmation."
> >     (interactive)
> >     (let ((end (icomplete--field-end)))
> >       (if (< (point) end)
> >   	(call-interactively 'kill-line)
> >         (let* ((all (completion-all-sorted-completions))
> >   	     ;; Actual changes (
> >   	     (refined-pair (when (eq 'multi-category (icomplete--category))
> >   			     (icomplete--refine-multi-category (car all))))
> >   	     (cat (or (car-safe refined-pair) (icomplete--category)))
> >   	     (thing (or (cdr-safe refined-pair) (car all)))
> >   	     ;; )
> >   	     (action
> >   	      (cl-case cat
> >   		(buffer
> >   		 (lambda ()
> >   		   (when (yes-or-no-p (concat "Kill buffer " thing "? "))
> >   		     (kill-buffer thing))))
> >   		((project-file file)
> >   		 (lambda ()
> >   		   (let* ((dir (file-name-directory
> >   				(icomplete--field-string)))
> >   			  (path (expand-file-name thing dir)))
> >   		     (when (yes-or-no-p (concat "Delete file " path "? "))
> >   		       (delete-file path) t))))
> >   		(t
> >   		 (error "Sorry, don't know how to kill things for `%s'"
> >   			cat)))))
> >   	(when (let (;; Allow `yes-or-no-p' to work and don't let it
> >   		    ;; `icomplete-exhibit' anything.
> >   		    (enable-recursive-minibuffers t)
> >   		    (icomplete-mode nil))
> >   		(funcall action))
> >   	  (completion--cache-all-sorted-completions
> >   	   (icomplete--field-beg)
> >   	   (icomplete--field-end)
> >   	   (cdr all)))
> >   	(message nil)))))
> > #+end_src
> > 
> > Thank you for any consideration on the matter.
> 
> João, any comments?
> 
> 
> 
> 





  reply	other threads:[~2024-08-17  8:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-20 14:22 bug#72210: 31.0.50; Feature request: multi-category support in `icomplete-fido-kill' Fernando de Morais
2024-07-25  7:42 ` Eli Zaretskii
2024-08-17  8:08   ` Eli Zaretskii [this message]
2024-08-31  7:57     ` Eli Zaretskii
2024-08-31 22:14       ` João Távora
2024-09-01  4:48         ` Eli Zaretskii
2024-09-01 14:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-02 16:23   ` Fernando de Morais
2024-09-14  7:42     ` Eli Zaretskii
2024-09-17 21:15     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 16:19       ` Fernando de Morais
2024-09-24 17:50         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-14  1:57           ` Fernando de Morais
2024-10-14 12:59             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86sev34ln5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72210@debbugs.gnu.org \
    --cc=fernandodemorais.jf@gmail.com \
    --cc=joaotavora@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).