summaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/markdown-mode.el
diff options
context:
space:
mode:
authorSimeon Simeonov2022-10-12 23:21:07 +0200
committerSimeon Simeonov2022-10-12 23:21:07 +0200
commit3ba23d3758e06d95b14ed4e89607e258d15ddbf7 (patch)
treef41ec9ee69791270c8e75e87d7893ad90dd3189b /.emacs.d/lisp/markdown-mode.el
parent4efa8ef4d3617973b2883605461ffa514675e5b2 (diff)
Add Rust mode and update lua-mode, markdown-mode and yaml-mode
Diffstat (limited to '.emacs.d/lisp/markdown-mode.el')
-rw-r--r--.emacs.d/lisp/markdown-mode.el149
1 files changed, 76 insertions, 73 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el
index 2162e4f..aa27e4e 100644
--- a/.emacs.d/lisp/markdown-mode.el
+++ b/.emacs.d/lisp/markdown-mode.el
@@ -188,7 +188,7 @@ line around the header title."
188 188
189(defcustom markdown-indent-on-enter t 189(defcustom markdown-indent-on-enter t
190 "Determines indentation behavior when pressing \\[newline]. 190 "Determines indentation behavior when pressing \\[newline].
191Possible settings are nil, t, and `indent-and-new-item'. 191Possible settings are nil, t, and \\='indent-and-new-item.
192 192
193When non-nil, pressing \\[newline] will call `newline-and-indent' 193When non-nil, pressing \\[newline] will call `newline-and-indent'
194to indent the following line according to the context using 194to indent the following line according to the context using
@@ -196,7 +196,7 @@ to indent the following line according to the context using
196\\[electric-newline-and-maybe-indent] can still be used to insert 196\\[electric-newline-and-maybe-indent] can still be used to insert
197a newline without indentation. 197a newline without indentation.
198 198
199When set to `indent-and-new-item' and the point is in a list item 199When set to \\='indent-and-new-item and the point is in a list item
200when \\[newline] is pressed, the list will be continued on the next 200when \\[newline] is pressed, the list will be continued on the next
201line, where a new item will be inserted. 201line, where a new item will be inserted.
202 202
@@ -490,15 +490,15 @@ completion."
490 490
491(defcustom markdown-split-window-direction 'any 491(defcustom markdown-split-window-direction 'any
492 "Preference for splitting windows for static and live preview. 492 "Preference for splitting windows for static and live preview.
493The default value is `any', which instructs Emacs to use 493The default value is \\='any, which instructs Emacs to use
494`split-window-sensibly' to automatically choose how to split 494`split-window-sensibly' to automatically choose how to split
495windows based on the values of `split-width-threshold' and 495windows based on the values of `split-width-threshold' and
496`split-height-threshold' and the available windows. To force 496`split-height-threshold' and the available windows. To force
497vertically split (left and right) windows, set this to `vertical' 497vertically split (left and right) windows, set this to \\='vertical
498or `right'. To force horizontally split (top and bottom) windows, 498or \\='right. To force horizontally split (top and bottom) windows,
499set this to `horizontal' or `below'. 499set this to \\='horizontal or \\='below.
500 500
501If this value is `any' and `display-buffer-alist' is set then 501If this value is \\='any and `display-buffer-alist' is set then
502`display-buffer' is used for open buffer function" 502`display-buffer' is used for open buffer function"
503 :group 'markdown 503 :group 'markdown
504 :type '(choice (const :tag "Automatic" any) 504 :type '(choice (const :tag "Automatic" any)
@@ -516,8 +516,8 @@ the buffer."
516 516
517(defcustom markdown-live-preview-delete-export 'delete-on-destroy 517(defcustom markdown-live-preview-delete-export 'delete-on-destroy
518 "Delete exported HTML file when using `markdown-live-preview-export'. 518 "Delete exported HTML file when using `markdown-live-preview-export'.
519If set to `delete-on-export', delete on every export. When set to 519If set to \\='delete-on-export, delete on every export. When set to
520`delete-on-destroy' delete when quitting from command 520\\='delete-on-destroy delete when quitting from command
521`markdown-live-preview-mode'. Never delete if set to nil." 521`markdown-live-preview-mode'. Never delete if set to nil."
522 :group 'markdown 522 :group 'markdown
523 :type '(choice 523 :type '(choice
@@ -864,7 +864,7 @@ Group 3 matches the text.")
864(defconst markdown-regex-wiki-link 864(defconst markdown-regex-wiki-link
865 "\\(?:^\\|[^\\]\\)\\(?1:\\(?2:\\[\\[\\)\\(?3:[^]|]+\\)\\(?:\\(?4:|\\)\\(?5:[^]]+\\)\\)?\\(?6:\\]\\]\\)\\)" 865 "\\(?:^\\|[^\\]\\)\\(?1:\\(?2:\\[\\[\\)\\(?3:[^]|]+\\)\\(?:\\(?4:|\\)\\(?5:[^]]+\\)\\)?\\(?6:\\]\\]\\)\\)"
866 "Regular expression for matching wiki links. 866 "Regular expression for matching wiki links.
867This matches typical bracketed [[WikiLinks]] as well as `aliased' 867This matches typical bracketed [[WikiLinks]] as well as \\='aliased
868wiki links of the form [[PageName|link text]]. 868wiki links of the form [[PageName|link text]].
869The meanings of the first and second components depend 869The meanings of the first and second components depend
870on the value of `markdown-wiki-link-alias-first'. 870on the value of `markdown-wiki-link-alias-first'.
@@ -1344,7 +1344,7 @@ block construct when it is matched using
1344to the text matching START-REGEX-OR-FUN, END-PROPERTY to END-REGEX-OR-FUN, and 1344to the text matching START-REGEX-OR-FUN, END-PROPERTY to END-REGEX-OR-FUN, and
1345MIDDLE-PROPERTY to the text in between the two. The value of *-PROPERTY is the 1345MIDDLE-PROPERTY to the text in between the two. The value of *-PROPERTY is the
1346`match-data' when the regexp was matched to the text. In the case of 1346`match-data' when the regexp was matched to the text. In the case of
1347MIDDLE-PROPERTY, the value is a false match data of the form `(begin end)', with 1347MIDDLE-PROPERTY, the value is a false match data of the form \\='(begin end), with
1348begin and end set to the edges of the \"middle\" text. This makes fontification 1348begin and end set to the edges of the \"middle\" text. This makes fontification
1349easier.") 1349easier.")
1350 1350
@@ -1614,7 +1614,7 @@ start which was previously propertized."
1614 (markdown-maybe-funcall-regexp 1614 (markdown-maybe-funcall-regexp
1615 (caar correct-entry)) 1615 (caar correct-entry))
1616 (buffer-substring 1616 (buffer-substring
1617 (point-at-bol) (point-at-eol))) 1617 (line-beginning-position) (line-end-position)))
1618 (- (match-end 1) (match-beginning 1)))) 1618 (- (match-end 1) (match-beginning 1))))
1619 (end-reg (markdown-maybe-funcall-regexp 1619 (end-reg (markdown-maybe-funcall-regexp
1620 (cl-caadr correct-entry) start-length))) 1620 (cl-caadr correct-entry) start-length)))
@@ -1625,7 +1625,7 @@ start which was previously propertized."
1625 ;; we assume the opening constructs take up (only) an entire line, 1625 ;; we assume the opening constructs take up (only) an entire line,
1626 ;; so we re-check the current line 1626 ;; so we re-check the current line
1627 (let* ((block-start (match-beginning 0)) 1627 (let* ((block-start (match-beginning 0))
1628 (cur-line (buffer-substring (point-at-bol) (point-at-eol))) 1628 (cur-line (buffer-substring (line-beginning-position) (line-end-position)))
1629 ;; find entry in `markdown-fenced-block-pairs' corresponding 1629 ;; find entry in `markdown-fenced-block-pairs' corresponding
1630 ;; to regex which was matched 1630 ;; to regex which was matched
1631 (correct-entry 1631 (correct-entry
@@ -1636,7 +1636,7 @@ start which was previously propertized."
1636 cur-line)) 1636 cur-line))
1637 markdown-fenced-block-pairs)) 1637 markdown-fenced-block-pairs))
1638 (enclosed-text-start 1638 (enclosed-text-start
1639 (save-excursion (1+ (point-at-eol)))) 1639 (save-excursion (1+ (line-end-position))))
1640 (end-reg 1640 (end-reg
1641 (markdown-maybe-funcall-regexp 1641 (markdown-maybe-funcall-regexp
1642 (cl-caadr correct-entry) 1642 (cl-caadr correct-entry)
@@ -1651,7 +1651,7 @@ start which was previously propertized."
1651 (beginning-of-line) 1651 (beginning-of-line)
1652 (re-search-forward 1652 (re-search-forward
1653 (markdown-maybe-funcall-regexp (caar correct-entry)) 1653 (markdown-maybe-funcall-regexp (caar correct-entry))
1654 (point-at-eol))) 1654 (line-end-position)))
1655 ;; mark starting, even if ending is outside of region 1655 ;; mark starting, even if ending is outside of region
1656 (put-text-property (match-beginning 0) (match-end 0) prop (match-data t)) 1656 (put-text-property (match-beginning 0) (match-end 0) prop (match-data t))
1657 (markdown-propertize-end-match 1657 (markdown-propertize-end-match
@@ -2563,7 +2563,7 @@ the returned list would be
2563 (1 14 3 5 \"- \" nil (1 6 1 4 4 5 5 6)) 2563 (1 14 3 5 \"- \" nil (1 6 1 4 4 5 5 6))
2564 2564
2565If the point is not inside a list item, return nil." 2565If the point is not inside a list item, return nil."
2566 (car (get-text-property (point-at-bol) 'markdown-list-item))) 2566 (car (get-text-property (line-beginning-position) 'markdown-list-item)))
2567 2567
2568(defun markdown-list-item-at-point-p () 2568(defun markdown-list-item-at-point-p ()
2569 "Return t if there is a list item at the point and nil otherwise." 2569 "Return t if there is a list item at the point and nil otherwise."
@@ -2647,7 +2647,7 @@ The return value has the same form as that of
2647 2647
2648(defun markdown-bounds-of-thing-at-point (thing) 2648(defun markdown-bounds-of-thing-at-point (thing)
2649 "Call `bounds-of-thing-at-point' for THING with slight modifications. 2649 "Call `bounds-of-thing-at-point' for THING with slight modifications.
2650Does not include trailing newlines when THING is `line'. Handles the 2650Does not include trailing newlines when THING is \\='line. Handles the
2651end of buffer case by setting both endpoints equal to the value of 2651end of buffer case by setting both endpoints equal to the value of
2652`point-max', since an empty region will trigger empty markup insertion. 2652`point-max', since an empty region will trigger empty markup insertion.
2653Return bounds of form (beg . end) if THING is found, or nil otherwise." 2653Return bounds of form (beg . end) if THING is found, or nil otherwise."
@@ -2764,7 +2764,7 @@ data. See `markdown-code-block-at-point-p' for code blocks."
2764Uses text properties at the beginning of the line position. 2764Uses text properties at the beginning of the line position.
2765This includes pre blocks, tilde-fenced code blocks, and GFM 2765This includes pre blocks, tilde-fenced code blocks, and GFM
2766quoted code blocks. Return nil otherwise." 2766quoted code blocks. Return nil otherwise."
2767 (let ((bol (save-excursion (goto-char pos) (point-at-bol)))) 2767 (let ((bol (save-excursion (goto-char pos) (line-beginning-position))))
2768 (or (get-text-property bol 'markdown-pre) 2768 (or (get-text-property bol 'markdown-pre)
2769 (let* ((bounds (markdown-get-enclosing-fenced-block-construct pos)) 2769 (let* ((bounds (markdown-get-enclosing-fenced-block-construct pos))
2770 (second (cl-second bounds))) 2770 (second (cl-second bounds)))
@@ -2795,7 +2795,7 @@ Set match data for `markdown-regex-header'."
2795(defun markdown-pipe-at-bol-p () 2795(defun markdown-pipe-at-bol-p ()
2796 "Return non-nil if the line begins with a pipe symbol. 2796 "Return non-nil if the line begins with a pipe symbol.
2797This may be useful for tables and Pandoc's line_blocks extension." 2797This may be useful for tables and Pandoc's line_blocks extension."
2798 (char-equal (char-after (point-at-bol)) ?|)) 2798 (char-equal (char-after (line-beginning-position)) ?|))
2799 2799
2800 2800
2801;;; Markdown Font Lock Matching Functions ===================================== 2801;;; Markdown Font Lock Matching Functions =====================================
@@ -2978,7 +2978,7 @@ $..$ or `markdown-regex-math-inline-double' for matching $$..$$."
2978 (set-match-data (cl-seventh bounds)) 2978 (set-match-data (cl-seventh bounds))
2979 ;; Step at least one character beyond point. Otherwise 2979 ;; Step at least one character beyond point. Otherwise
2980 ;; `font-lock-fontify-keywords-region' infloops. 2980 ;; `font-lock-fontify-keywords-region' infloops.
2981 (goto-char (min (1+ (max (point-at-eol) first)) 2981 (goto-char (min (1+ (max (line-end-position) first))
2982 (point-max))) 2982 (point-max)))
2983 t))) 2983 t)))
2984 2984
@@ -3028,13 +3028,13 @@ Restore match data previously stored in PROPERTY."
3028 3028
3029(defun markdown-match-pre-blocks (last) 3029(defun markdown-match-pre-blocks (last)
3030 "Match preformatted blocks from point to LAST. 3030 "Match preformatted blocks from point to LAST.
3031Use data stored in `markdown-pre' text property during syntax 3031Use data stored in \\='markdown-pre text property during syntax
3032analysis." 3032analysis."
3033 (markdown-match-propertized-text 'markdown-pre last)) 3033 (markdown-match-propertized-text 'markdown-pre last))
3034 3034
3035(defun markdown-match-gfm-code-blocks (last) 3035(defun markdown-match-gfm-code-blocks (last)
3036 "Match GFM quoted code blocks from point to LAST. 3036 "Match GFM quoted code blocks from point to LAST.
3037Use data stored in `markdown-gfm-code' text property during syntax 3037Use data stored in \\='markdown-gfm-code text property during syntax
3038analysis." 3038analysis."
3039 (markdown-match-propertized-text 'markdown-gfm-code last)) 3039 (markdown-match-propertized-text 'markdown-gfm-code last))
3040 3040
@@ -3056,7 +3056,7 @@ analysis."
3056 3056
3057(defun markdown-match-blockquotes (last) 3057(defun markdown-match-blockquotes (last)
3058 "Match blockquotes from point to LAST. 3058 "Match blockquotes from point to LAST.
3059Use data stored in `markdown-blockquote' text property during syntax 3059Use data stored in \\='markdown-blockquote text property during syntax
3060analysis." 3060analysis."
3061 (markdown-match-propertized-text 'markdown-blockquote last)) 3061 (markdown-match-propertized-text 'markdown-blockquote last))
3062 3062
@@ -3108,8 +3108,8 @@ processed elements."
3108 (match-beginning 0) (match-end 2) 'face prohibited-faces) 3108 (match-beginning 0) (match-end 2) 'face prohibited-faces)
3109 (markdown-range-property-any 3109 (markdown-range-property-any
3110 (match-beginning 4) (match-end 0) 'face prohibited-faces) 3110 (match-beginning 4) (match-end 0) 'face prohibited-faces)
3111 (and (char-equal (char-after (point-at-bol)) ?<) 3111 (and (char-equal (char-after (line-beginning-position)) ?<)
3112 (char-equal (char-after (1+ (point-at-bol))) ?<))) 3112 (char-equal (char-after (1+ (line-beginning-position))) ?<)))
3113 (set-match-data nil) 3113 (set-match-data nil)
3114 (setq found t)))) 3114 (setq found t))))
3115 ;; Match opening exclamation point (optional) and left bracket. 3115 ;; Match opening exclamation point (optional) and left bracket.
@@ -4478,13 +4478,13 @@ code block in an indirect buffer after insertion."
4478 (markdown-ensure-blank-line-before) 4478 (markdown-ensure-blank-line-before)
4479 (indent-to indent) 4479 (indent-to indent)
4480 (insert "```" gfm-open-brace lang gfm-close-brace) 4480 (insert "```" gfm-open-brace lang gfm-close-brace)
4481 (markdown-syntax-propertize-fenced-block-constructs (point-at-bol) end)) 4481 (markdown-syntax-propertize-fenced-block-constructs (line-beginning-position) end))
4482 (let ((indent (current-indentation)) 4482 (let ((indent (current-indentation))
4483 start-bol) 4483 start-bol)
4484 (delete-horizontal-space :backward-only) 4484 (delete-horizontal-space :backward-only)
4485 (markdown-ensure-blank-line-before) 4485 (markdown-ensure-blank-line-before)
4486 (indent-to indent) 4486 (indent-to indent)
4487 (setq start-bol (point-at-bol)) 4487 (setq start-bol (line-beginning-position))
4488 (insert "```" gfm-open-brace lang gfm-close-brace "\n") 4488 (insert "```" gfm-open-brace lang gfm-close-brace "\n")
4489 (indent-to indent) 4489 (indent-to indent)
4490 (unless edit (insert ?\n)) 4490 (unless edit (insert ?\n))
@@ -4982,7 +4982,7 @@ If the point is at a table, move to the next row. Otherwise,
4982indent according to value of `markdown-indent-on-enter'. 4982indent according to value of `markdown-indent-on-enter'.
4983When it is nil, simply call `newline'. Otherwise, indent the next line 4983When it is nil, simply call `newline'. Otherwise, indent the next line
4984following RET using `markdown-indent-line'. Furthermore, when it 4984following RET using `markdown-indent-line'. Furthermore, when it
4985is set to `indent-and-new-item' and the point is in a list item, 4985is set to \\='indent-and-new-item and the point is in a list item,
4986start a new item with the same indentation. If the point is in an 4986start a new item with the same indentation. If the point is in an
4987empty list item, remove it (so that pressing RET twice when in a 4987empty list item, remove it (so that pressing RET twice when in a
4988list simply adds a blank line)." 4988list simply adds a blank line)."
@@ -5786,7 +5786,7 @@ See `imenu-create-index-function' and `imenu--index-alist' for details."
5786 ;; Headings 5786 ;; Headings
5787 (goto-char (point-min)) 5787 (goto-char (point-min))
5788 (while (re-search-forward markdown-regex-header (point-max) t) 5788 (while (re-search-forward markdown-regex-header (point-max) t)
5789 (when (and (not (markdown-code-block-at-point-p (point-at-bol))) 5789 (when (and (not (markdown-code-block-at-point-p (line-beginning-position)))
5790 (not (markdown-text-property-at-point 'markdown-yaml-metadata-begin))) 5790 (not (markdown-text-property-at-point 'markdown-yaml-metadata-begin)))
5791 (cond 5791 (cond
5792 ((setq heading (match-string-no-properties 1)) 5792 ((setq heading (match-string-no-properties 1))
@@ -6236,7 +6236,7 @@ increase the indentation by one level."
6236 ((string-match-p "[\\*\\+-]\\|#\\." marker) 6236 ((string-match-p "[\\*\\+-]\\|#\\." marker)
6237 (insert new-indent marker)))) 6237 (insert new-indent marker))))
6238 ;; Propertize the newly inserted list item now 6238 ;; Propertize the newly inserted list item now
6239 (markdown-syntax-propertize-list-items (point-at-bol) (point-at-eol))))) 6239 (markdown-syntax-propertize-list-items (line-beginning-position) (line-end-position)))))
6240 6240
6241(defun markdown-move-list-item-up () 6241(defun markdown-move-list-item-up ()
6242 "Move the current list item up in the list when possible. 6242 "Move the current list item up in the list when possible.
@@ -6486,7 +6486,7 @@ means move forward N blocks."
6486 (beginning-of-line) 6486 (beginning-of-line)
6487 ;; Skip over code block endings. 6487 ;; Skip over code block endings.
6488 (when (markdown-range-properties-exist 6488 (when (markdown-range-properties-exist
6489 (point-at-bol) (point-at-eol) 6489 (line-beginning-position) (line-end-position)
6490 '(markdown-gfm-block-end 6490 '(markdown-gfm-block-end
6491 markdown-tilde-fence-end)) 6491 markdown-tilde-fence-end))
6492 (forward-line -1)) 6492 (forward-line -1))
@@ -6515,11 +6515,11 @@ means move forward N blocks."
6515 (not (markdown-cur-line-blank-p)) 6515 (not (markdown-cur-line-blank-p))
6516 (not (looking-at markdown-regex-blockquote)) 6516 (not (looking-at markdown-regex-blockquote))
6517 (not (markdown-range-properties-exist 6517 (not (markdown-range-properties-exist
6518 (point-at-bol) (point-at-eol) 6518 (line-beginning-position) (line-end-position)
6519 '(markdown-gfm-block-end 6519 '(markdown-gfm-block-end
6520 markdown-tilde-fence-end)))) 6520 markdown-tilde-fence-end))))
6521 (setq skip (markdown-range-properties-exist 6521 (setq skip (markdown-range-properties-exist
6522 (point-at-bol) (point-at-eol) 6522 (line-beginning-position) (line-end-position)
6523 '(markdown-gfm-block-begin 6523 '(markdown-gfm-block-begin
6524 markdown-tilde-fence-begin))) 6524 markdown-tilde-fence-begin)))
6525 (forward-line -1)) 6525 (forward-line -1))
@@ -6566,11 +6566,11 @@ means move backward N blocks."
6566 (not (markdown-cur-line-blank-p)) 6566 (not (markdown-cur-line-blank-p))
6567 (not (looking-at markdown-regex-blockquote)) 6567 (not (looking-at markdown-regex-blockquote))
6568 (not (markdown-range-properties-exist 6568 (not (markdown-range-properties-exist
6569 (point-at-bol) (point-at-eol) 6569 (line-beginning-position) (line-end-position)
6570 '(markdown-gfm-block-begin 6570 '(markdown-gfm-block-begin
6571 markdown-tilde-fence-begin)))) 6571 markdown-tilde-fence-begin))))
6572 (setq skip (markdown-range-properties-exist 6572 (setq skip (markdown-range-properties-exist
6573 (point-at-bol) (point-at-eol) 6573 (line-beginning-position) (line-end-position)
6574 '(markdown-gfm-block-end 6574 '(markdown-gfm-block-end
6575 markdown-tilde-fence-end))) 6575 markdown-tilde-fence-end)))
6576 (forward-line)))))))) 6576 (forward-line))))))))
@@ -6594,7 +6594,7 @@ ARG = -N means move forward N blocks."
6594 (cond 6594 (cond
6595 ;; Code blocks 6595 ;; Code blocks
6596 ((and (markdown-code-block-at-pos (point)) ;; this line 6596 ((and (markdown-code-block-at-pos (point)) ;; this line
6597 (markdown-code-block-at-pos (point-at-bol 0))) ;; previous line 6597 (markdown-code-block-at-pos (line-beginning-position 0))) ;; previous line
6598 (forward-line -1) 6598 (forward-line -1)
6599 (while (and (markdown-code-block-at-point-p) (not (bobp))) 6599 (while (and (markdown-code-block-at-point-p) (not (bobp)))
6600 (forward-line -1)) 6600 (forward-line -1))
@@ -6849,7 +6849,7 @@ Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
6849 6849
6850(defun markdown-on-heading-p () 6850(defun markdown-on-heading-p ()
6851 "Return non-nil if point is on a heading line." 6851 "Return non-nil if point is on a heading line."
6852 (get-text-property (point-at-bol) 'markdown-heading)) 6852 (get-text-property (line-beginning-position) 'markdown-heading))
6853 6853
6854(defun markdown-end-of-subtree (&optional invisible-OK) 6854(defun markdown-end-of-subtree (&optional invisible-OK)
6855 "Move to the end of the current subtree. 6855 "Move to the end of the current subtree.
@@ -6895,7 +6895,7 @@ setext header, but should not be folded."
6895 (outline-next-visible-heading 1)) 6895 (outline-next-visible-heading 1))
6896 (while (< (point) (point-max)) 6896 (while (< (point) (point-max))
6897 (when (markdown-code-block-at-point-p) 6897 (when (markdown-code-block-at-point-p)
6898 (outline-flag-region (1- (point-at-bol)) (point-at-eol) t)) 6898 (outline-flag-region (1- (line-beginning-position)) (line-end-position) t))
6899 (outline-next-visible-heading 1)))) 6899 (outline-next-visible-heading 1))))
6900 6900
6901(defvar markdown-cycle-global-status 1) 6901(defvar markdown-cycle-global-status 1)
@@ -7847,8 +7847,7 @@ Translate filenames using `markdown-filename-translate-function'."
7847 (title-end (match-end 7)) 7847 (title-end (match-end 7))
7848 (title (match-string-no-properties 7)) 7848 (title (match-string-no-properties 7))
7849 ;; Markup part 7849 ;; Markup part
7850 (mp (list 'face 'markdown-markup-face 7850 (mp (list 'invisible 'markdown-markup
7851 'invisible 'markdown-markup
7852 'rear-nonsticky t 7851 'rear-nonsticky t
7853 'font-lock-multiline t)) 7852 'font-lock-multiline t))
7854 ;; Link part (without face) 7853 ;; Link part (without face)
@@ -7858,26 +7857,28 @@ Translate filenames using `markdown-filename-translate-function'."
7858 'help-echo (if title (concat title "\n" url) url))) 7857 'help-echo (if title (concat title "\n" url) url)))
7859 ;; URL part 7858 ;; URL part
7860 (up (list 'keymap markdown-mode-mouse-map 7859 (up (list 'keymap markdown-mode-mouse-map
7861 'face 'markdown-url-face
7862 'invisible 'markdown-markup 7860 'invisible 'markdown-markup
7863 'mouse-face 'markdown-highlight-face 7861 'mouse-face 'markdown-highlight-face
7864 'font-lock-multiline t)) 7862 'font-lock-multiline t))
7865 ;; URL composition character 7863 ;; URL composition character
7866 (url-char (markdown--first-displayable markdown-url-compose-char)) 7864 (url-char (markdown--first-displayable markdown-url-compose-char))
7867 ;; Title part 7865 ;; Title part
7868 (tp (list 'face 'markdown-link-title-face 7866 (tp (list 'invisible 'markdown-markup
7869 'invisible 'markdown-markup
7870 'font-lock-multiline t))) 7867 'font-lock-multiline t)))
7871 (dolist (g '(1 2 4 5 8)) 7868 (dolist (g '(1 2 4 5 8))
7872 (when (match-end g) 7869 (when (match-end g)
7873 (add-text-properties (match-beginning g) (match-end g) mp))) 7870 (add-text-properties (match-beginning g) (match-end g) mp)
7871 (add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
7874 ;; Preserve existing faces applied to link part (e.g., inline code) 7872 ;; Preserve existing faces applied to link part (e.g., inline code)
7875 (when link-start 7873 (when link-start
7876 (add-text-properties link-start link-end lp) 7874 (add-text-properties link-start link-end lp)
7877 (add-face-text-property link-start link-end 7875 (add-face-text-property link-start link-end 'markdown-link-face))
7878 'markdown-link-face 'append)) 7876 (when url-start
7879 (when url-start (add-text-properties url-start url-end up)) 7877 (add-text-properties url-start url-end up)
7880 (when title-start (add-text-properties url-end title-end tp)) 7878 (add-face-text-property url-start url-end 'markdown-url-face))
7879 (when title-start
7880 (add-text-properties url-end title-end tp)
7881 (add-face-text-property url-end title-end 'markdown-link-title-face))
7881 (when (and markdown-hide-urls url-start) 7882 (when (and markdown-hide-urls url-start)
7882 (compose-region url-start (or title-end url-end) url-char)) 7883 (compose-region url-start (or title-end url-end) url-char))
7883 t))) 7884 t)))
@@ -7890,13 +7891,11 @@ Translate filenames using `markdown-filename-translate-function'."
7890 (ref-start (match-beginning 6)) 7891 (ref-start (match-beginning 6))
7891 (ref-end (match-end 6)) 7892 (ref-end (match-end 6))
7892 ;; Markup part 7893 ;; Markup part
7893 (mp (list 'face 'markdown-markup-face 7894 (mp (list 'invisible 'markdown-markup
7894 'invisible 'markdown-markup
7895 'rear-nonsticky t 7895 'rear-nonsticky t
7896 'font-lock-multiline t)) 7896 'font-lock-multiline t))
7897 ;; Link part 7897 ;; Link part
7898 (lp (list 'keymap markdown-mode-mouse-map 7898 (lp (list 'keymap markdown-mode-mouse-map
7899 'face 'markdown-link-face
7900 'mouse-face 'markdown-highlight-face 7899 'mouse-face 'markdown-highlight-face
7901 'font-lock-multiline t 7900 'font-lock-multiline t
7902 'help-echo (lambda (_ __ pos) 7901 'help-echo (lambda (_ __ pos)
@@ -7908,16 +7907,20 @@ Translate filenames using `markdown-filename-translate-function'."
7908 ;; URL composition character 7907 ;; URL composition character
7909 (url-char (markdown--first-displayable markdown-url-compose-char)) 7908 (url-char (markdown--first-displayable markdown-url-compose-char))
7910 ;; Reference part 7909 ;; Reference part
7911 (rp (list 'face 'markdown-reference-face 7910 (rp (list 'invisible 'markdown-markup
7912 'invisible 'markdown-markup
7913 'font-lock-multiline t))) 7911 'font-lock-multiline t)))
7914 (dolist (g '(1 2 4 5 8)) 7912 (dolist (g '(1 2 4 5 8))
7915 (when (match-end g) 7913 (when (match-end g)
7916 (add-text-properties (match-beginning g) (match-end g) mp))) 7914 (add-text-properties (match-beginning g) (match-end g) mp)
7917 (when link-start (add-text-properties link-start link-end lp)) 7915 (add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
7918 (when ref-start (add-text-properties ref-start ref-end rp) 7916 (when link-start
7919 (when (and markdown-hide-urls (> (- ref-end ref-start) 2)) 7917 (add-text-properties link-start link-end lp)
7920 (compose-region ref-start ref-end url-char))) 7918 (add-face-text-property link-start link-end 'markdown-link-face))
7919 (when ref-start
7920 (add-text-properties ref-start ref-end rp)
7921 (add-face-text-property ref-start ref-end 'markdown-reference-face)
7922 (when (and markdown-hide-urls (> (- ref-end ref-start) 2))
7923 (compose-region ref-start ref-end url-char)))
7921 t))) 7924 t)))
7922 7925
7923(defun markdown-fontify-angle-uris (last) 7926(defun markdown-fontify-angle-uris (last)
@@ -8376,7 +8379,7 @@ return the number of paragraphs left to move."
8376 (while (and (not (eobp)) 8379 (while (and (not (eobp))
8377 (> arg 0) 8380 (> arg 0)
8378 (= (forward-paragraph 1) 0) 8381 (= (forward-paragraph 1) 0)
8379 (or (markdown-code-block-at-pos (point-at-bol 0)) 8382 (or (markdown-code-block-at-pos (line-beginning-position 0))
8380 (setq arg (1- arg))))) 8383 (setq arg (1- arg)))))
8381 ;; Move backward by one paragraph with negative ARG (always -1). 8384 ;; Move backward by one paragraph with negative ARG (always -1).
8382 (let ((start (point))) 8385 (let ((start (point)))
@@ -8394,7 +8397,7 @@ return the number of paragraphs left to move."
8394 ((looking-at "^|\\s-*") 8397 ((looking-at "^|\\s-*")
8395 (goto-char (match-end 0))) 8398 (goto-char (match-end 0)))
8396 ;; Return point if the paragraph passed was a code block. 8399 ;; Return point if the paragraph passed was a code block.
8397 ((markdown-code-block-at-pos (point-at-bol 2)) 8400 ((markdown-code-block-at-pos (line-beginning-position 2))
8398 (goto-char start))))) 8401 (goto-char start)))))
8399 arg) 8402 arg)
8400 8403
@@ -8520,7 +8523,7 @@ Returns nil if non-applicable."
8520 (insert markup)) 8523 (insert markup))
8521 (goto-char pos) 8524 (goto-char pos)
8522 (insert markup)) 8525 (insert markup))
8523 (syntax-propertize (point-at-eol)) 8526 (syntax-propertize (line-end-position))
8524 t))))) 8527 t)))))
8525 8528
8526(defun markdown-toggle-gfm-checkbox () 8529(defun markdown-toggle-gfm-checkbox ()
@@ -8755,9 +8758,9 @@ Use matching function MATCHER."
8755 (end (match-end 0)) 8758 (end (match-end 0))
8756 ;; Find positions outside opening and closing backquotes. 8759 ;; Find positions outside opening and closing backquotes.
8757 (bol-prev (progn (goto-char start) 8760 (bol-prev (progn (goto-char start)
8758 (if (bolp) (point-at-bol 0) (point-at-bol)))) 8761 (if (bolp) (line-beginning-position 0) (line-beginning-position))))
8759 (eol-next (progn (goto-char end) 8762 (eol-next (progn (goto-char end)
8760 (if (bolp) (point-at-bol 2) (point-at-bol 3)))) 8763 (if (bolp) (line-beginning-position 2) (line-beginning-position 3))))
8761 lang) 8764 lang)
8762 (if (and markdown-fontify-code-blocks-natively 8765 (if (and markdown-fontify-code-blocks-natively
8763 (or (setq lang (markdown-code-block-lang)) 8766 (or (setq lang (markdown-code-block-lang))
@@ -8843,8 +8846,8 @@ at the END of code blocks."
8843 (save-excursion 8846 (save-excursion
8844 (if (fboundp 'edit-indirect-region) 8847 (if (fboundp 'edit-indirect-region)
8845 (let* ((bounds (markdown-get-enclosing-fenced-block-construct)) 8848 (let* ((bounds (markdown-get-enclosing-fenced-block-construct))
8846 (begin (and bounds (not (null (nth 0 bounds))) (goto-char (nth 0 bounds)) (point-at-bol 2))) 8849 (begin (and bounds (not (null (nth 0 bounds))) (goto-char (nth 0 bounds)) (line-beginning-position 2)))
8847 (end (and bounds(not (null (nth 1 bounds))) (goto-char (nth 1 bounds)) (point-at-bol 1)))) 8850 (end (and bounds(not (null (nth 1 bounds))) (goto-char (nth 1 bounds)) (line-beginning-position 1))))
8848 (if (and begin end) 8851 (if (and begin end)
8849 (let* ((indentation (and (goto-char (nth 0 bounds)) (current-indentation))) 8852 (let* ((indentation (and (goto-char (nth 0 bounds)) (current-indentation)))
8850 (lang (markdown-code-block-lang)) 8853 (lang (markdown-code-block-lang))
@@ -9049,7 +9052,7 @@ This function assumes point is on a table."
9049 (while (and (re-search-forward 9052 (while (and (re-search-forward
9050 markdown-table-dline-regexp end t) 9053 markdown-table-dline-regexp end t)
9051 (setq cnt (1+ cnt)) 9054 (setq cnt (1+ cnt))
9052 (< (point-at-eol) pos)))) 9055 (< (line-end-position) pos))))
9053 cnt)) 9056 cnt))
9054 9057
9055(defun markdown--thing-at-wiki-link (pos) 9058(defun markdown--thing-at-wiki-link (pos)
@@ -9080,7 +9083,7 @@ a table."
9080 (if (looking-at "|[^|\r\n]*") 9083 (if (looking-at "|[^|\r\n]*")
9081 (let* ((pos (match-beginning 0)) 9084 (let* ((pos (match-beginning 0))
9082 (val (buffer-substring (1+ pos) (match-end 0)))) 9085 (val (buffer-substring (1+ pos) (match-end 0))))
9083 (goto-char (min (point-at-eol) (+ 2 pos))) 9086 (goto-char (min (line-end-position) (+ 2 pos)))
9084 ;; Trim whitespaces 9087 ;; Trim whitespaces
9085 (setq val (replace-regexp-in-string "\\`[ \t]+" "" val) 9088 (setq val (replace-regexp-in-string "\\`[ \t]+" "" val)
9086 val (replace-regexp-in-string "[ \t]+\\'" "" val))) 9089 val (replace-regexp-in-string "[ \t]+\\'" "" val)))
@@ -9105,7 +9108,7 @@ beyond the last delimiter. This function assumes point is on a
9105table." 9108table."
9106 (beginning-of-line 1) 9109 (beginning-of-line 1)
9107 (when (> n 0) 9110 (when (> n 0)
9108 (while (and (> n 0) (search-forward "|" (point-at-eol) t)) 9111 (while (and (> n 0) (search-forward "|" (line-end-position) t))
9109 (when (and (not (looking-back "\\\\|" (line-beginning-position))) 9112 (when (and (not (looking-back "\\\\|" (line-beginning-position)))
9110 (not (markdown--thing-at-wiki-link (match-beginning 0)))) 9113 (not (markdown--thing-at-wiki-link (match-beginning 0))))
9111 (cl-decf n))) 9114 (cl-decf n)))
@@ -9260,8 +9263,8 @@ With optional argument ARG, insert below the current row."
9260 (unless (markdown-table-at-point-p) 9263 (unless (markdown-table-at-point-p)
9261 (user-error "Not at a table")) 9264 (user-error "Not at a table"))
9262 (let ((col (current-column))) 9265 (let ((col (current-column)))
9263 (kill-region (point-at-bol) 9266 (kill-region (line-beginning-position)
9264 (min (1+ (point-at-eol)) (point-max))) 9267 (min (1+ (line-end-position)) (point-max)))
9265 (unless (markdown-table-at-point-p) (beginning-of-line 0)) 9268 (unless (markdown-table-at-point-p) (beginning-of-line 0))
9266 (move-to-column col))) 9269 (move-to-column col)))
9267 9270
@@ -9277,8 +9280,8 @@ With optional argument UP, move it up."
9277 (unless (markdown-table-at-point-p) 9280 (unless (markdown-table-at-point-p)
9278 (goto-char pos) (user-error "Cannot move row further")) 9281 (goto-char pos) (user-error "Cannot move row further"))
9279 (goto-char pos) (beginning-of-line 1) (setq pos (point)) 9282 (goto-char pos) (beginning-of-line 1) (setq pos (point))
9280 (setq txt (buffer-substring (point) (1+ (point-at-eol)))) 9283 (setq txt (buffer-substring (point) (1+ (line-end-position))))
9281 (delete-region (point) (1+ (point-at-eol))) 9284 (delete-region (point) (1+ (line-end-position)))
9282 (beginning-of-line tonew) 9285 (beginning-of-line tonew)
9283 (insert txt) (beginning-of-line 0) 9286 (insert txt) (beginning-of-line 0)
9284 (move-to-column col))) 9287 (move-to-column col)))
@@ -9655,7 +9658,7 @@ rows and columns and the column alignment."
9655 (make-list columns (concat align "|"))))) 9658 (make-list columns (concat align "|")))))
9656 (if (string-match 9659 (if (string-match
9657 "^[ \t]*$" (buffer-substring-no-properties 9660 "^[ \t]*$" (buffer-substring-no-properties
9658 (point-at-bol) (point))) 9661 (line-beginning-position) (point)))
9659 (beginning-of-line 1) 9662 (beginning-of-line 1)
9660 (newline)) 9663 (newline))
9661 (dotimes (_ rows) (insert line)) 9664 (dotimes (_ rows) (insert line))