Add simple multiplication table function

This commit is contained in:
Tom Willemse 2014-12-10 17:11:31 +01:00
parent d8eb322ca7
commit 0dc3fe0410

View file

@ -752,6 +752,16 @@ If no direction is given, don't split."
(define-key yas-minor-mode-map [(tab)] nil)
(define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand))
(defun multiplication-table (number &optional upto)
""
(interactive "nMultiplication table for: \nP")
(let ((upto (or upto 10))
(buffer (get-buffer-create "*Multiplication*")))
(with-current-buffer buffer
(erase-buffer)
(cl-loop for i from 1 to upto do (insert (format "%5d: %d\n" i (* number i)))))
(pop-to-buffer buffer)))
;;;; Tests
(stante-after ert