lang/markdown: refactor & reformat autoloads file
This commit is contained in:
parent
3ef05d95ca
commit
3595ff62ee
1 changed files with 33 additions and 21 deletions
|
@ -1,26 +1,5 @@
|
||||||
;;; lang/markdown/autoload.el -*- lexical-binding: t; -*-
|
;;; lang/markdown/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Implement strike-through formatting
|
|
||||||
(defvar +markdown--regex-del
|
|
||||||
"\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)")
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +markdown/insert-del ()
|
|
||||||
"Surround region in github strike-through delimiters."
|
|
||||||
(interactive)
|
|
||||||
(let ((delim "~~"))
|
|
||||||
(if (markdown-use-region-p)
|
|
||||||
;; Active region
|
|
||||||
(cl-destructuring-bind (beg . end)
|
|
||||||
(markdown-unwrap-things-in-region
|
|
||||||
(region-beginning) (region-end)
|
|
||||||
+markdown--regex-del 2 4)
|
|
||||||
(markdown-wrap-or-insert delim delim nil beg end))
|
|
||||||
;; Bold markup removal, bold word at point, or empty markup insertion
|
|
||||||
(if (thing-at-point-looking-at +markdown--regex-del)
|
|
||||||
(markdown-unwrap-thing-at-point nil 2 4)
|
|
||||||
(markdown-wrap-or-insert delim delim 'word nil nil)))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +markdown-flyspell-word-p ()
|
(defun +markdown-flyspell-word-p ()
|
||||||
"Return t if point is on a word that should be spell checked.
|
"Return t if point is on a word that should be spell checked.
|
||||||
|
@ -95,3 +74,36 @@ available. Returns its exit code."
|
||||||
shell-file-name nil output-buffer nil
|
shell-file-name nil output-buffer nil
|
||||||
shell-command-switch
|
shell-command-switch
|
||||||
exe)))
|
exe)))
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Commands
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +markdown/insert-del ()
|
||||||
|
"Surround region in github strike-through delimiters."
|
||||||
|
(interactive)
|
||||||
|
(let ((regexp "\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)")
|
||||||
|
(delim "~~"))
|
||||||
|
(if (markdown-use-region-p)
|
||||||
|
;; Active region
|
||||||
|
(cl-destructuring-bind (beg . end)
|
||||||
|
(markdown-unwrap-things-in-region
|
||||||
|
(region-beginning) (region-end)
|
||||||
|
regexp 2 4)
|
||||||
|
(markdown-wrap-or-insert delim delim nil beg end))
|
||||||
|
;; Bold markup removal, bold word at point, or empty markup insertion
|
||||||
|
(if (thing-at-point-looking-at regexp)
|
||||||
|
(markdown-unwrap-thing-at-point nil 2 4)
|
||||||
|
(markdown-wrap-or-insert delim delim 'word nil nil)))))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Advice
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +markdown-disable-front-matter-fontification-a (&rest _)
|
||||||
|
"Prevent fontification of YAML metadata blocks in `markdown-mode'.
|
||||||
|
This prevents a mis-feature wherein if the first line of a Markdown document has
|
||||||
|
a colon in it, then it's distractingly and usually wrongly fontified as a
|
||||||
|
metadata block. See https://github.com/jrblevin/markdown-mode/issues/328."
|
||||||
|
(ignore (goto-char (point-max))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue