Emacs in place of filename / path insertion

I am looking for a way to insert a file / path name while editing. Something like inline ido-style file selection would be ideal. Is there anything similar?

+5
source share
3 answers

I always use comint-dynamic-complete-filenamefor this. By default, this does not load, but is provided comint-mode. So you can add something like

(autoload 'comint-dynamic-complete-filename "comint" nil t)
(global-set-key "\M-]" 'comint-dynamic-complete-filename)

in yours ~/.emacsor the like. Of course, use your preferred keybinding.

+4
source

Well, if you just want to insert the current file name into a dot, then

 (insert (expand-file-name (buffer-file-name)))

must do it.

, find-file-noselect files.el 1714.

, , , ,

 (defun insert-file-name-at-point ()
    (interactive) .... )
+1
(defun insert-file-name (file &optional relativep)
  "Read file name and insert it at point.
With a prefix argument, insert only the non-directory part."
  (interactive "fFile: \nP")
  (when relativep (setq file  (file-name-nondirectory file)))
  (insert file))
+1
source

All Articles