• 1 Post
  • 3 Comments
Joined 1 year ago
cake
Cake day: October 11th, 2023

help-circle
  • For minibuffer completion, I created this, kind of works, but if there is an already developed, fully working solution, I’d rather use that. And I’m still interested in for a solution to use in a normal buffer that corfu could use.

    (defun my-consult-fd-string (&optional dir initial)
      (interactive "P")
      (setq this-command 'consult-fd)
      (pcase-let* ((`(,prompt ,paths ,dir) (consult--directory-prompt "Fd" dir))
    	   (default-directory dir)
    	   (builder (consult--fd-make-builder paths)))
    (concat dir (consult--find prompt builder initial))))
    
    (defun my-consult-insert-fd-string ()
      (interactive)
      (insert
       (abbreviate-file-name
    (let ((f (bounds-of-thing-at-point 'filename)))
      (if f
          (let ((r (my-consult-fd-string (buffer-substring-no-properties (car f) (cdr f)) nil)))
    	(delete-region (car f) (cdr f))
    	r)
        (my-consult-fd-string t nil))))))
    (define-key minibuffer-local-map (kbd "M-f") 'my-consult-insert-fd-string)
    


  • I think one has to be pragmatic, and only put effort to features that are actually useful. Don’t put hours writing an elisp function which only saves you 10 seconds in a month. I’m saying this, because I had to stop myself from spending time on Emacs. I realized that my config is OK for me. I still have a lot of ideas how to make it better, but I simply don’t do them, because it doesn’t matter too much. Of course, I still do smaller tweaks, but otherwise I spend my time on more useful things. If someone had told me this before I started using emacs, they would have saved several days of not-too-useful emacs configuration for me. Of course, it was fun, I did it as a hobby, but still, it wasn’t the smartest way to spend my free time.