mirror of
https://github.com/tanrax/burn.el.git
synced 2024-09-19 22:27:21 +02:00
Fix cursor point
This commit is contained in:
parent
7dccf4b928
commit
dbd6a655f8
22
burn.el
22
burn.el
@ -4,7 +4,7 @@
|
|||||||
;; Authors: Erick Navarro <erick@navarro.io>, Andros Fenollosa <andros@fenollosa.email>
|
;; 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.2.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:
|
||||||
;; Replace the buffer content with 🔥.
|
;; Replace the buffer content with 🔥.
|
||||||
@ -13,23 +13,20 @@
|
|||||||
|
|
||||||
(setf burn--emoji "🔥")
|
(setf burn--emoji "🔥")
|
||||||
|
|
||||||
(defun burn--is-exist-emoji ()
|
|
||||||
(not (null (string-match-p burn--emoji (buffer-string)))))
|
|
||||||
|
|
||||||
(defun burn--is-empty ()
|
(defun burn--is-empty ()
|
||||||
(= 0 (length (replace-regexp-in-string (concat "\\`[ \t\n" burn--emoji "]*") "" (replace-regexp-in-string (concat "[ \t\n" burn--emoji "]*\\'") "" (buffer-string))))))
|
(= 0 (length
|
||||||
|
(replace-regexp-in-string (concat "\\`[ \t\n" burn--emoji "]*") ""
|
||||||
|
(replace-regexp-in-string (concat "[ \t\n" burn--emoji "]*\\'") "" (buffer-string))))))
|
||||||
|
|
||||||
(defun burn--replace-backward-at-point ()
|
(defun burn--replace-backward-at-point ()
|
||||||
"Replace the backwards character at point with burn--emoji."
|
"Replace the backwards character at point with burn--emoji."
|
||||||
(re-search-backward (concat "[^" burn--emoji " \t\n]") 1)
|
(when (re-search-backward (concat "[^ \t\n" burn--emoji "]") nil :noerr)
|
||||||
(delete-char 1)
|
(replace-match burn--emoji)))
|
||||||
(insert burn--emoji))
|
|
||||||
|
|
||||||
(defun burn--replace-forward-at-point ()
|
(defun burn--replace-forward-at-point ()
|
||||||
"Replace the forward character at point with burn--emoji."
|
"Replace the forward character at point with burn--emoji."
|
||||||
(re-search-forward (concat "[^" burn--emoji " \t\n]") 1)
|
(when (re-search-forward (concat "[^ \t\n" burn--emoji "]") nil :noerr)
|
||||||
(delete-char 1)
|
(replace-match burn--emoji)))
|
||||||
(insert burn--emoji))
|
|
||||||
|
|
||||||
(defun burn-code ()
|
(defun burn-code ()
|
||||||
"Replace code with burn--emoji."
|
"Replace code with burn--emoji."
|
||||||
@ -39,7 +36,8 @@
|
|||||||
(burn--replace-backward-at-point)
|
(burn--replace-backward-at-point)
|
||||||
(burn--replace-forward-at-point)
|
(burn--replace-forward-at-point)
|
||||||
)
|
)
|
||||||
)
|
;; Clear burn--emoji
|
||||||
|
(set-buffer-modified-p ""))
|
||||||
|
|
||||||
;;; burn.el ends here
|
;;; burn.el ends here
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user