Fork me on GitHub
#emacs
<
2022-12-23
>
Benjamin C05:12:54

Wow, for me as an elisp newbie, this is actually saving me a lot of time, even if it might be easy to find this stuff with a simple online search: > me: can you write me an emacs function to copy the current file link to the kill ring? > > chatgpg: Certainly! Here is an Emacs Lisp function that you can use to copy the link to the current file to the kill ring: >

(defun copy-current-file-link ()
>   "Copy the link to the current file to the kill ring."
>   (interactive)
>   (let ((file-name (buffer-file-name)))
>     (when file-name
>       (kill-new (concat "file://" file-name))
>       (message "Copied link to current file: %s" file-name))))
> me: Can you also have it make it an org-mode link? > Certainly! Here is an updated version of the function that converts the file link to an org-mode link before copying it to the kill ring: >
(defun copy-current-file-link-as-org-link ()
>   "Copy the link to the current file as an org-mode link to the kill ring."
>   (interactive)
>   (let ((file-name (buffer-file-name)))
>     (when file-name
>       (kill-new (concat "[[file://" file-name "][" (file-name-nondirectory file-name) "]]"))
>       (message "Copied link to current file as org-mode link: %s" file-name))))

😟 1
👍 1
😄 1
Benjamin09:12:24

https://github.com/benjamin-asdf/openai-api.el I had quite some fun with having the api in emacs. It is great for when you don't know a lang so well. You can also ask things like "what does x do?" And just "explain this".

upvote 2
alandipert17:12:58

heck yeah, love it

alandipert17:12:09

being able to program stuff: A+

jakemcc20:12:54

I've used ChatGPT to help with some elisp as well. It was quite useful

👋 2