Functions I've Written

Insert relative name of a file in project

Used for taking notes.

(defun insert-file-name-from-project (filename &optional args)
  (interactive "P")
  (let* ((project-root (projectile-ensure-project (projectile-project-root)))
         (file (projectile-completing-read "Find file: "
                                           (projectile-project-files project-root))))
    (when file
      (funcall #'insert (file-relative-name (expand-file-name file project-root)))
      )))

let* takes two arguments, the first is a list of variables to bind and the second is a function to execute.

Notes

  • interactive is not a function call but a decleration that this function is to be called interactively, and the results are passed in to the function that's being called.

The emacs docs are amazing. describe-function will elucidate almost any uncertainty

built with nextjs, mdx, and typescript view source