all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: Re: find-file-dwim.el
Date: Thu, 25 Jul 2024 11:24:44 +0200	[thread overview]
Message-ID: <87plr1hlib.fsf@dataswamp.org> (raw)
In-Reply-To: 87a5i8poy2.fsf@gmx.de

Michael Albinus wrote:

> If you are saying something on a public ML, be prepared
> people respond. Or be quiet.

The socialization process is in full swing.

Suggestion: Apply the rules to everyone equally, or what will
happen is everyone will start to behave like that.

Anyway, this whole idea - make the collection smaller, by
recomputing it - I realized, if you gonna do that, why not do
it every time?

Like below, instead of `minibuffer-complete'.

Maybe I misunderstood the idea? I'm over discussing things on
this list, but use e-mail by all means if this is something
you would like to discuss.

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/minibuffer-complete-files.el
;;
;; (keymap-global-set "M-8" #'minibuffer-complete-files)

(require 'cl-lib)

(defun string-to-dir (s)
  (if (file-directory-p s)
      s
    (let ((new (replace-regexp-in-string "\\(.*/\\).*$" "\\1" s)))
      (when (file-directory-p new)
        new) )))

(defun minibuffer-complete-files ()
  (interactive)
  (let* ((beg (minibuffer-prompt-end))
         (end (point-max))
         (str (buffer-substring-no-properties beg end))
         (dir (string-to-dir str))
         (col (when dir (directory-files dir t)))
         (abr (mapcar #'abbreviate-file-name col))
         (all (cl-union col abr)) )
    (when all
      (completion-in-region (minibuffer--completion-prompt-end) end all) )))

(provide 'minibuffer-complete-files)

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2024-07-25  9:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-21 22:10 find-file-dwim.el Emanuel Berg
2024-07-22  3:33 ` find-file-dwim.el Emanuel Berg
2024-07-22 14:02   ` find-file-dwim.el Philip Kaludercic
2024-07-22 15:40     ` find-file-dwim.el Emanuel Berg
2024-07-23  0:47     ` find-file-dwim.el Emanuel Berg
2024-07-23  6:41       ` find-file-dwim.el Philip Kaludercic
     [not found]         ` <87jzhcqw4a.fsf@dataswamp.org>
2024-07-23 10:20           ` find-file-dwim.el Philip Kaludercic
2024-07-23 13:08             ` find-file-dwim.el Emanuel Berg
2024-07-23 13:01         ` find-file-dwim.el Emanuel Berg
2024-07-23  7:06       ` find-file-dwim.el Michael Albinus
2024-07-25  9:24         ` Emanuel Berg [this message]
2024-07-22  5:32 ` find-file-dwim.el Emanuel Berg

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=87plr1hlib.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=emacs-devel@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.