How can I change a word in a buffer using elisp? -
how can change word @ point using elisp? quite (upcase-word) using own function?
background: i've written function detects base of number @ point , can convert other base. change number directly in buffer.
tia markus
try code. i've included sample interactive function using upcase
:
(defun change-word-at-point (fun) (cl-destructuring-bind (beg . end) (bounds-of-thing-at-point 'word) (let ((str (buffer-substring-no-properties beg end))) (delete-region beg end) (insert (funcall fun str))))) (defun upcase-word () (interactive) (change-word-at-point 'upcase))
Comments
Post a Comment