You may not think me very impressive, but I'll have you know that I'm a successful restauranteur in an obscure text-based multi-user virtual reality.
#LambdaMOO
#LambdaMOO
like this
Digital Mark λ ☕️ 🕹 👽 reshared this.
God, my tab completion function is a hacky mess:
#emacs #lisp #moo #mud #LambdaMOO
(defun lambdamoo-tab-complete ()
"Complete user input using text from the buffer"
(interactive)
(when (memq (char-before) '(? ?\r ?\n ?\t ?\v))
(user-error "Point must follow non-whitespace character"))
(let (replace-start
(replace-end (point))
replace-text found-pos found-text)
(save-excursion
(backward-word)
(setq replace-start (point)
replace-text (buffer-substring replace-start replace-end))
(when (or (null lambdamoo--search-text)
(not (string-prefix-p lambdamoo--search-text replace-text t)))
(setq-local lambdamoo--search-text replace-text)
(set-marker lambdamoo--found-point (point)))
(goto-char lambdamoo--found-point)
(unless
(setq found-pos
(re-search-backward
(concat "\\b" (regexp-quote lambdamoo--search-text))
(point-min) t))
(setq-local lambdamoo--found-point (make-marker))
(user-error "No match found"))
(set-marker lambdamoo--found-point found-pos)
(forward-word)
(setq found-text (buffer-substring found-pos (point))))
(delete-region replace-start replace-end)
(insert found-text)))#emacs #lisp #moo #mud #LambdaMOO
reshared this
Popped into #LambdaMOO for a birthday celebration that took place inside my sushi restaurant. This got me to thinking. I wonder if it's possible to tie my restaurant's code into the birthday machine somehow so that people can get free food on their birthday.
Omar Antolín
in reply to Jonathan Lamothe • • •Jonathan Lamothe
in reply to Omar Antolín • •Jonathan Lamothe
in reply to Jonathan Lamothe • •@Omar Antolín Actually, looking more closely at it, it might just do the trick.
I love it when I spend hours re-writing code that essentially already exists. ;)
Jonathan Lamothe
in reply to Jonathan Lamothe • •In the end, I wound up just binding tab to
dabbrev-expand. 🙃It might seem like I wasted a bunch of time writing that, but at least I learned a bunch along the way.