;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/minibuffer-complete-files.el ;; ;; (keymap-global-set "M-8" #'minibuffer-complete-files) ;; ;; Discontinued, this whole idea - ah, just don't believe in ;; it anymore. (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)