[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find-file-dwim.el
From: |
Emanuel Berg |
Subject: |
Re: find-file-dwim.el |
Date: |
Thu, 25 Jul 2024 11:24:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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
Re: find-file-dwim.el, Emanuel Berg, 2024/07/22