1 2 3 4 5 6 7 8 9 |
(defun string-dec-to-hex () "replaces decimal number under cursor with hexadecimal equivalent" (interactive) (let* ((dec-string (thing-at-point 'word)) (bounds (bounds-of-thing-at-point 'word)) (dec (string-to-number dec-string)) (hex (format "%x" dec))) (delete-region (car bounds) (cdr bounds)) (insert hex))) |