Added cleanup of whitespaces to Emacs's gadialog mode.
--- a/contrib/gadialog.el Sun May 31 00:16:58 2020 +0300
+++ b/contrib/gadialog.el Wed Jun 10 10:27:11 2020 +0300
@@ -49,6 +49,10 @@
(insert "## 1\n")
1))))
+(defun gadialog-cleaup-whitespaves-forward ()
+ (while (memq (char-before) '(?\ ?\n ?\t))
+ (delete-char -1)))
+
(defun gadialog-insert-template ()
(interactive)
(forward-line 0)
@@ -57,8 +61,7 @@
(unless (re-search-forward "^# " (+ (point) 10240) t)
(goto-char (point-max)))
(forward-line 0)
- (while (memq (char-before) '(?\ ?\n ?\t))
- (delete-char -1))
+ (gadialog-cleaup-whitespaves-forward)
(insert "\n# ")
(insert (int-to-string (gadialog-next-num)))
(insert "\n- \n")
@@ -70,9 +73,9 @@
(while (not (or (eobp)
(memq (char-after) (list ?- ?#))))
(forward-line 1))
- (insert ?\n)
- (backward-char)
- (insert "- "))
+ (gadialog-cleaup-whitespaves-forward)
+ (insert "\n- \n")
+ (backward-char))
(define-derived-mode gadialog-mode fundamental-mode "gadialog"