reddit / emacs
ChatGPT can help with Emacs
onearmedphil · 2022-12-09 14:29
phr46 · 2022-12-09 14:33
That's broken. It deletes the line before saving it, so it ends up saving an empty line.
cellular--automaton · 2022-12-09 14:41
How dare you. It looks so cool. And it's made available for free by amazing billionaire visionaries. As a GNU Emacs user you should be grateful the rich have control of such awesome and dependable technology.
phr46 · 2022-12-09 14:45
Perhaps this is a sign. We should delete whatever lines we have in our GNU Emacs and move to VSCode, to better align with our rich overlords' grand vision. The AI was right all along.
cellular--automaton · 2022-12-09 14:58
You mean we should copy them to the clipboard. The AI will know what to do.
Vscode also integrates well with copilot. Thiele + Gates = win for the nonbillionaires 😍
onearmedphil · 2022-12-09 15:22
I mean I guess it followed my instructions to a tee.
Likhon-BaRoy · 2022-12-09 15:28
Where do you generate this?
onearmedphil · 2022-12-09 17:54
https://chat.openai.com/chat - I believe this may be the biggest leap in technology I've ever seen
hcalves · 2022-12-09 18:41
AI can be both clever and stupid simultaneously.
noman_032018 · 2022-12-09 19:38
That's got to be the most verbose (and incorrect) way to do it possible when kill-line already does that.
qualiaqq · 2022-12-09 20:26
Yesterday I asked it how to reverse lines in Emacs Lisp and it told me correctly about the built in function `reverse-region` which I had no idea it existed.
It often tells me things that are plausible, but incorrect. However I can often get the answers faster than online search engines because it's NLP understands better what I want.
Another simple example: "Is there a way to flatten the type `Some(Ok(x))` in Rust?"
heathm55 · 2022-12-09 20:35
On the surface it looks impressive, but 3 / 4 things I asked were bad info (but related... which in itself is impressive)
m0na_lisa_overdrive · 2022-12-09 20:44
but i was told by derek, mba on linkedin that chatgpt was going to take my job and bang my wife.
Catvert · 2022-12-09 21:40
Okay that's pretty crazy. I had the idea earlier this morning to create a function to open an orgmode file in a sidebar window with a keyboard shortcut to toggle it. Being quite unfamiliar with elisp, I asked ChatGPT to create the function for me and here is the result:
(defun my-toggle-sidebar-and-narrow (file sidebar-name heading)
(interactive "FFile to open in sidebar: \nBName of the sidebar buffer: \nMHeading to narrow to: ")
(let ((sidebar-window (get-buffer-window sidebar-name)))
(if (not sidebar-window) ; Check if sidebar-window is non-nil
(let ((buffer (find-file-noselect file)))
(with-current-buffer buffer
(rename-buffer sidebar-name)) ; Give the buffer a name
(display-buffer-in-side-window buffer '((side . left) (window-width . 80))) ; Set the sidebar width to 80 characters
(select-window (get-buffer-window sidebar-name)) ; Put the focus on the sidebar window
(let ((heading-obj (org-find-exact-headline-in-buffer heading))) ; Find the specified heading
(org-narrow-to-subtree heading-obj))) ; Narrow to the specified heading
(delete-window sidebar-window) ; Close the window
(kill-buffer sidebar-name)))) ; Delete the buffer
(global-set-key (kbd "C-c t") 'my-toggle-sidebar-and-narrow)
He didn't give me this function from the start, I had to guide him little by little (about ten messages, telling him for example that the kill-buffer-and-window function doesn't take any argument and therefore can't be used ; or for example to create a 'sidebar-name' and 'heading' parameter). But in the end it works!
Edit :
there was a bug with the org-narrow-to-subtree, here is the corrected version after about twenty minutes of discussions+tests :
(defun my-toggle-sidebar (file sidebar-name heading)
(interactive "ffile to open in sidebar: \nbname of the sidebar buffer: ")
(let ((sidebar-window (get-buffer-window sidebar-name)))
(if (not sidebar-window) ; check if sidebar-window is non-nil
(let ((buffer (find-file-noselect file)))
(with-current-buffer buffer
(rename-buffer sidebar-name)) ; give the buffer a nam ; turn off save-place-mode
(display-buffer-in-side-window buffer '((side . left) (window-width . 80))) ; set the sidebar width to 80 characters
(select-window (get-buffer-window sidebar-name))
(let ((marker (org-find-exact-headline-in-buffer heading))) ; find the specified heading
(goto-char marker) ; move the cursor to the position of the marker
(let ((heading-obj (org-element-at-point))) ; convert the org element at the cursor position into an org element
(org-narrow-to-subtree heading-obj)))) ; narrow to the specified heading
(delete-window sidebar-window) ; close the window
(kill-buffer sidebar-name)))) ; delete the buffer
this time, the function seems to work perfectly with :
(defun toggle-dashboard ()
"toggle dashboard"
(interactive)
(my-toggle-sidebar "/nas/documents/notes/dashboard.org" "dashboard-sidebar" "dashboard")
GreenSubstantial4469 · 2022-12-09 22:07
We are safe, chatgpt proposes braincead code that not only doesn’t work, it doesn’t even follow best practices.
cellular--automaton · 2022-12-10 01:38
A half-truth.
7890yuiop · 2022-12-10 01:41
Which apparently users have then been posting to Stack Overflow as Answers... https://stackoverflow.com/help/gpt-policy
Awkward_Tradition · 2022-12-10 01:54
Dude calls himself chatgpt, what a madlad
[deleted] · 2022-12-10 03:03
[deleted]
Lord_John_Marbury · 2022-12-10 03:24
Wife-banging confirmed.
field_thought_slight · 2022-12-10 04:53
Can we not, though? I really don't want half-coherent AI sludge in my life.
jqbr · 2022-12-10 05:39
ChatGPT is unreliable and known to hallucinate, so be sure you thoroughly test anything it gives you--and even if it gives you a working result, it may not be at all efficient (as here).
(The same goes for other areas--it will happily produce authoritative-sounding but false claims, invent nonexistent citations, etc. ... it's terrible at math and inconsistent. Don't be fooled by the fact that it often gets the right result.)
[deleted] · 2022-12-10 11:18
[deleted]
wewbull · 2022-12-10 12:11
It's really confidently wrong a lot of the time.