Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun increment-number-at-point (&optional arg)
- "Increment a number at point."
- (interactive "*P")
- (let* ((bounds (bounds-of-thing-at-point 'word))
- (beg (car bounds))
- (end (cdr bounds))
- (num (string-to-number (buffer-substring beg end)))
- (incr (cond ((null arg) 1)
- ((listp arg) -1)
- (t arg)))
- (value (+ num incr)))
- (delete-region beg end)
- (insert (format "%d" value))))
- (global-set-key "\C-zi" 'increment-number-at-point)
Add Comment
Please, Sign In to add comment