reshared this
like this
reshared this
like this
Digital Mark λ ☕️ 🕹 👽 reshared this.
(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)))reshared this
@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. ;)
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.
Digital Mark λ ☕️ 🕹 👽
in reply to Jonathan Lamothe • • •Jonathan Lamothe
in reply to Digital Mark λ ☕️ 🕹 👽 • •@Digital Mark λ ☕️ 🕹 👽 Well, there's an entrance exam for a job I need to study for so that I can continue to pay for internet (and by extension, access to thr VR). 🙃
Apparently the one I did earlier was only the prequalification exam.