summaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-12-10 17:11:31 +0100
committerGravatar Tom Willemse2014-12-10 17:11:31 +0100
commit0dc3fe0410145a85ac6979164572d8a1512dad21 (patch)
tree5a7ab5b610417ef42c46b0ec5fbc5e6c10183e84 /emacs
parentd8eb322ca70154bdbd31f70ffdfbfe8c9afa097f (diff)
downloaddotfiles-0dc3fe0410145a85ac6979164572d8a1512dad21.tar.gz
dotfiles-0dc3fe0410145a85ac6979164572d8a1512dad21.zip
Add simple multiplication table function
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
index 3dea91e..099f2b1 100644
--- a/emacs/.emacs.d/init.el
+++ b/emacs/.emacs.d/init.el
@@ -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