Update version and first function

This commit is contained in:
Andros Fenollosa 2021-01-08 22:40:33 +01:00
parent 74edb9ab15
commit 95100f4051

43
burn.el
View File

@ -1,9 +1,9 @@
;;; burn.el --- Burn your code by replacing it with 🔥 ;;; burn.el --- Burn your code by replacing it with 🔥
;; Copyright © 2020 Erick Navarro ;; Copyright © 2020 Erick Navarro
;; Author: Erick Navarro <erick@navarro.io> ;; Authors: Erick Navarro <erick@navarro.io>, Andros Fenollosa <andros@fenollosa.email>
;; URL: https://github.com/erickgnavar/burn.el ;; URL: https://github.com/erickgnavar/burn.el
;; Version: 0.1.0 ;; Version: 0.2.0
;; SPDX-License-Identifier: GNU General Public License v3.0 or later ;; SPDX-License-Identifier: GNU General Public License v3.0 or later
;;; Commentary: ;;; Commentary:
@ -11,24 +11,33 @@
;;; Code: ;;; Code:
(defun burn--replace-at-point () (setf burn--emoji "🔥")
"Replace the character at point with 🔥."
(delete-char 1)
(insert "🔥"))
(defun burn--replace-line () (defun burn--is-exist-emoji ()
"Burn code in the current line." (goto-char 1)
(while (< (point) (line-end-position)) (search-forward burn--emoji)
(sit-for 0.05) (equal (point) 1))
(burn--replace-at-point)))
(defun burn--replace-backward-at-point ()
"Replace the backwards character at point with burn--emoji."
(re-search-backward (concat "[^" burn--emoji "]") 1)
(delete-char 1)
(insert burn--emoji))
(defun burn--replace-forward-at-point ()
"Replace the forward character at point with burn--emoji."
(re-search-forward (concat "[^" burn--emoji "]") 1)
(delete-char 1)
(insert burn--emoji))
(defun burn-code () (defun burn-code ()
"Replace code with 🔥 emoji." "Replace code with burn--emoji."
(interactive) (interactive)
(while (< (line-number-at-pos) (line-number-at-pos (point-max))) (while burn--is-exist-emoji
(progn (sit-for 1.05)
(beginning-of-line) (burn--replace-backward-at-point)
(burn--replace-line) (burn--replace-forward-at-point)
(forward-line)))) ))
;;; burn.el ends here ;;; burn.el ends here