Skip to content

Commit 8521913

Browse files
committed
Documentation of function and version bump to 0.2
1 parent f743225 commit 8521913

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

fireplace.el

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
;;; fireplace.el --- A cozy fireplace for emacs -*- lexical-binding: t; -*-
22

33
;; Copyright (C) 2015 Johan Sivertsen
4-
;;; Version: 0.1
4+
;;; Version: 0.2
55
;;; Author: Johan Sivertsen <[email protected]>
66
;;; URL: https://github.com/johanvts/emacs-fireplace
77
;;; Released: December 2015
@@ -23,7 +23,7 @@
2323

2424
;;; Commentary:
2525

26-
;; Puts your emacs on fire
26+
;; Puts your Emacs on fire
2727

2828
;;; Code:
2929

@@ -72,16 +72,20 @@
7272
;; Helper routines
7373

7474
(defun fireplace--make-grid ()
75+
"Redraw backgound of buffer."
7576
(erase-buffer)
7677
(dotimes (i fireplace--bkgd-height)
7778
(insert-char fireplace-background-char fireplace--bkgd-width)
7879
(newline)))
7980

8081
(defun fireplace--gotoxy(x y)
81-
(goto-char (+ 1 x (* (- fireplace--bkgd-height (+ 1 y)) (+ 1 fireplace--bkgd-width)))))
82+
"Move pointer to position X Y."
83+
(goto-char (+ 1 x (* (- fireplace--bkgd-height (+ 1 y))
84+
(+ 1 fireplace--bkgd-width)))))
8285

8386

8487
(defun draw-flame-stripe (x y width)
88+
"Draw fire stripes."
8589
(fireplace--gotoxy x y)
8690
(let* ((actual-width (min width (1+ (- fireplace--bkgd-width x))))
8791
(hot-core (/ actual-width 2)))
@@ -95,6 +99,7 @@
9599
'face `(:background ,"dark orange"))))))
96100

97101
(defun fireplace--smoke (x height)
102+
"Draw fire smoke."
98103
(fireplace--gotoxy (if (>(random 3) 1)
99104
(+ x (random (/ fireplace--bkgd-width 5)))
100105
(max 0 (- x (random (/ fireplace--bkgd-width 5)))))
@@ -104,6 +109,7 @@
104109
'face `(:foreground, "slate grey"))))
105110

106111
(defun fireplace--flame (middle h)
112+
"Draw fire flames."
107113
(setq cursor-type nil)
108114
(let* ((width h)
109115
(lower (truncate(* 0.2 h)))
@@ -132,6 +138,7 @@
132138
(when fireplace-smoke-on (fireplace--smoke x h)))))
133139

134140
(defun draw-fireplace (buffer-name flame-pos flame-width)
141+
"Draw the whole fireplace in BUFFER-NAME from FLAME-POS with FLAME-WIDTH."
135142
(with-current-buffer (get-buffer-create buffer-name)
136143
(setq buffer-read-only nil)
137144
(fireplace--make-grid)
@@ -169,26 +176,26 @@
169176
(kill-buffer fireplace-buffer-name)))
170177

171178
(defun fireplace-down ()
172-
(interactive)
173179
"Push the fire further down"
180+
(interactive)
174181
(setq fireplace--bkgd-height (+ fireplace--bkgd-height 1)))
175182

176183

177184
(defun fireplace-up ()
185+
"Move the fire further up."
178186
(interactive)
179-
"Move the fire further up"
180187
(setq fireplace--bkgd-height (max 0 (- fireplace--bkgd-height 1))))
181188

182189
(defun fireplace-toggle-smoke ()
190+
"Toggle smoke on/off."
183191
(interactive)
184-
"Toggle smoke on/off"
185192
(if fireplace-smoke-on
186193
(setq fireplace-smoke-on nil)
187194
(setq fireplace-smoke-on t)))
188195

189-
;;Key-bindings
196+
;;; Key-bindings
190197

191-
(define-derived-mode fireplace-mode special-mode "A cozy fireplace")
198+
(define-derived-mode fireplace-mode special-mode "A cozy fireplace.")
192199

193200
(define-key fireplace-mode-map (kbd "C-+") 'fireplace-down)
194201
(define-key fireplace-mode-map (kbd "C--") 'fireplace-up)

0 commit comments

Comments
 (0)