Characters are numbers (non-negative integers under some limit), in Emacs. If you want to increment a single character, including a digit character, then just increment it as a character:
(defun increment-char-at-point ()
"Increment number or character at point."
(interactive)
(condition-case nil
(save-excursion
(let ((chr (1+ (char-after))))
(unless (characterp chr) (error "Cannot increment char by one"))
(delete-char 1)
(insert chr)))
(error (error "No character at point"))))
But if you want to increment either a sequence of digits (a numeral) or a single character, then use something like this:
(defun increment-number-or-char-at-point ()
"Increment number or character at point."
(interactive)
(let ((nump nil))
(save-excursion
(skip-chars-backward "0123456789")
(when (looking-at "[0123456789]+")
(replace-match (number-to-string (1+ (string-to-number (match-string 0)))))
(setq nump t)))
(unless nump
(save-excursion
(condition-case nil
(let ((chr (1+ (char-after))))
(unless (characterp chr) (error "Cannot increment char by one"))
(delete-char 1)
(insert chr))
(error (error "No character at point")))))))
If you want point to advance after the command, remove the uses of save-excursion
.
The code inside the first save-excursion
here is from the first increment-number-at-point
definition at the wiki page you referenced. Choose different increment-number code for that if you prefer. Note that the increment-number code shown here takes no account of decimal or exponential format, or other bases besides base 10.