Function: number-to-register

number-to-register is an interactive and byte-compiled function defined in register.el.gz.

Signature

(number-to-register NUMBER REGISTER)

Documentation

Store NUMBER in REGISTER.

REGISTER is a character, the name of the register. If NUMBER is nil, a decimal number is read from the buffer at point, and point moves to the end of that number. Interactively, NUMBER is the prefix arg (none means nil).

Interactively, prompt for REGISTER using register-read-with-preview.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/register.el.gz
(defun number-to-register (number register)
  "Store NUMBER in REGISTER.
REGISTER is a character, the name of the register.
If NUMBER is nil, a decimal number is read from the buffer
at point, and point moves to the end of that number.
Interactively, NUMBER is the prefix arg (none means nil).

Interactively, prompt for REGISTER using `register-read-with-preview'."
  (interactive (list current-prefix-arg
		     (register-read-with-preview "Number to register: ")))
  (set-register register
		(if number
		    (prefix-numeric-value number)
		  (if (looking-at "\\s-*-?[0-9]+")
		      (progn
			(goto-char (match-end 0))
			(string-to-number (match-string 0)))
		    0))))