summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Jason McBrayer 2020-05-29 10:33:55 -0400
committerGravatar Jason McBrayer 2020-05-29 10:33:55 -0400
commite8f69cad28cc17bcbb6d239e2130ed74a9dac705 (patch)
treebc558751c250094aa1717a138e43d7a297cc64f3
parente13e4179e9c334b28754ee5de24b788029778695 (diff)
downloadgemini.el-e8f69cad28cc17bcbb6d239e2130ed74a9dac705.tar.gz
gemini.el-e8f69cad28cc17bcbb6d239e2130ed74a9dac705.tar.xz
gemini.el-e8f69cad28cc17bcbb6d239e2130ed74a9dac705.zip
Add gemini-insert-list-item
-rw-r--r--gemini-mode.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/gemini-mode.el b/gemini-mode.el
index bc7de0d..7c5bfba 100644
--- a/gemini-mode.el
+++ b/gemini-mode.el
@@ -4,7 +4,7 @@
;; Author: Jason McBrayer <jmcbray@carcosa.net>, tastytea <tastytea@tastytea.de>
;; Created: 20 May 2020
-;; Version: 0.3.0
+;; Version: 0.4.0
;; Keywords: languages
;; Homepage: https://git.carcosa.net/jmcbray/gemini.el
@@ -68,6 +68,7 @@
(defvar gemini-mode-map
(let ((map (make-keymap)))
(define-key map (kbd "C-c C-l") #'gemini-insert-link)
+ (define-key map (kbd "C-c RET") #'gemini-insert-list-item)
map)
"Keymap for `gemini-mode'.")
@@ -113,6 +114,18 @@ it seems to be a URL, or link text value otherwise."
(unless (string= text "")
(insert " " text)))))
+(defun gemini-insert-list-item ()
+ "Insert a new list item.
+If at the beginning of a line, just insert it. Otherwise
+go to the end of the current line, insert a newline, and
+insert a list item."
+ (interactive)
+ (if (equal (line-beginning-position) (point))
+ (insert "* ")
+ (end-of-line)
+ (newline)
+ (insert "* ")))
+
;;;###autoload
(define-derived-mode gemini-mode text-mode "gemini"
"Major mode for editing text/gemini 'geminimap' documents"