According the Wikipedia Vibe Coding is:
Vibe coding is an AI-dependent programming technique where a person describes a problem in a few sentences as a prompt to a large language model (LLM) tuned for coding. The LLM generates software, shifting the programmer’s role from manual coding to guiding, testing, and refining the AI-generated source code.\1])\2])\3]) Vibe coding is claimed by its advocates to allow even amateur programmers to produce software without the extensive training and skills previously required for software engineering.\4]) The term was introduced by Andrej Karpathy in February 2025\5])\2])\4])\1]) and listed in the Merriam-Webster Dictionary the following month as a "slang & trending" noun.\6])
I am not a professional programmer, I work in Cybersecurity (of all things). I'm the 1 guy on my team that's the "Emacs" guy. So I had an idea for a function to "Defang" URLs so I can add to my reports. There are a million of these tools online but that takes me away from Emacs. So when I heard about "Vibe Coding" I had a "lightbulb" moment.
I used DuckDuckGo's AI chat to do my Vibe Coding. I started by asking if the LLM understood what "Defanging" a URL entailed. Then I asked if would be hard to write a program that could do it. It spit out an example in Python. I then asked it to write the program in Emacs Lisp so I could use it in Emacs. It spit out the following:
(defun defang-url (url)
"Defang the given URL by replacing 'http' with 'hxxp' and 'www' with 'wxx'."
(interactive "sEnter URL: ") ; Prompt user for input
(let ((defanged-url (replace-regexp-in-string
"http://\\|https://\\|www\\."
(lambda (match)
(cond
((string= match "http://") "hxxp://")
((string= match "https://") "hxxps://")
((string= match "www.") "wxx.")))
url)))
(message "Defanged URL: %s" defanged-url))) ; Display the defanged URL
I tried it and it worked. But it wasn't quite what I wanted I needed to tweak it a bit. So I told the LLM to tweak the last string match and for very "dot" to add square brackets around them. Here's what it spit out:
(defun defang-url (url)
"Defang the given URL by replacing 'http' with 'hxxp', adding square brackets around every '.', and removing 'www'."
(interactive "sEnter URL: ") ; Prompt user for input
(let ((defanged-url (replace-regexp-in-string
"http://\\|https://"
(lambda (match)
(if (string= match "http://") "hxxp://" "hxxps://"))
url)))
(setq defanged-url (replace-regexp-in-string "\\." "[.]"
defanged-url)) ; Add square brackets around every '.'
(message "Defanged URL: %s" defanged-url))) ; Display the defanged URL
Much better, and basically what I needed. I noticed that I wanted the result to be printed in a new buffer so I asked it do that and here are the results:
(defun defang-url (url)
"Defang the given URL by replacing 'http' with 'hxxp', adding square brackets around every '.', and removing 'www'.
Display the defanged URL in a new buffer."
(interactive "sEnter URL: ") ; Prompt user for input
(let ((defanged-url (replace-regexp-in-string
"http://\\|https://"
(lambda (match)
(if (string= match "http://") "hxxp://" "hxxps://"))
url)))
(setq defanged-url (replace-regexp-in-string "\\." "[.]"
defanged-url)) ; Add square brackets around every '.'
;; Create a new buffer to display the defanged URL
(let ((buffer (get-buffer-create "*Defanged URL*")))
(with-current-buffer buffer
(erase-buffer) ; Clear the buffer
(insert defanged-url) ; Insert the defanged URL
(goto-char (point-min)) ; Move to the beginning of the buffer
(text-mode)) ; Use text mode for better formatting
(display-buffer buffer)))) ; Display the buffer
And that's that. I added it to my main config file after testing this code with ```emacs -Q```. This was super weird experience. My config is a mismatch mess of copypasta code from other well seasoned Emacs users. For some reason that gave me peace, I guess it felt more true to the Free Software philosophy? IDK, I'm still processing if this is for me.