diff options
| author | Simeon Simeonov | 2022-06-22 16:47:41 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2022-06-22 16:47:41 +0200 |
| commit | 4efa8ef4d3617973b2883605461ffa514675e5b2 (patch) | |
| tree | cd09c2b39509ce4d9387fc9c1311600fa3844592 | |
| parent | 9bffdc9ae2c69b2656e905cba8dc7c6b9790ae73 (diff) | |
Update markdown-mode
| -rw-r--r-- | .emacs.d/lisp/markdown-mode.el | 136 |
1 files changed, 85 insertions, 51 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el index 009eed3..2162e4f 100644 --- a/.emacs.d/lisp/markdown-mode.el +++ b/.emacs.d/lisp/markdown-mode.el | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | ;;; markdown-mode.el --- Major mode for Markdown-formatted text -*- lexical-binding: t; -*- | 1 | ;;; markdown-mode.el --- Major mode for Markdown-formatted text -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2007-2020 Jason R. Blevins and markdown-mode | 3 | ;; Copyright (C) 2007-2022 Jason R. Blevins and markdown-mode |
| 4 | ;; contributors (see the commit log for details). | 4 | ;; contributors (see the commit log for details). |
| 5 | 5 | ||
| 6 | ;; Author: Jason R. Blevins <jblevins@xbeta.org> | 6 | ;; Author: Jason R. Blevins <jblevins@xbeta.org> |
| 7 | ;; Maintainer: Jason R. Blevins <jblevins@xbeta.org> | 7 | ;; Maintainer: Jason R. Blevins <jblevins@xbeta.org> |
| 8 | ;; Created: May 24, 2007 | 8 | ;; Created: May 24, 2007 |
| 9 | ;; Version: 2.5-dev | 9 | ;; Version: 2.6-dev |
| 10 | ;; Package-Requires: ((emacs "25.1")) | 10 | ;; Package-Requires: ((emacs "26.1")) |
| 11 | ;; Keywords: Markdown, GitHub Flavored Markdown, itex | 11 | ;; Keywords: Markdown, GitHub Flavored Markdown, itex |
| 12 | ;; URL: https://jblevins.org/projects/markdown-mode/ | 12 | ;; URL: https://jblevins.org/projects/markdown-mode/ |
| 13 | 13 | ||
| @@ -55,7 +55,7 @@ | |||
| 55 | 55 | ||
| 56 | ;;; Constants ================================================================= | 56 | ;;; Constants ================================================================= |
| 57 | 57 | ||
| 58 | (defconst markdown-mode-version "2.5-dev" | 58 | (defconst markdown-mode-version "2.6-dev" |
| 59 | "Markdown mode version number.") | 59 | "Markdown mode version number.") |
| 60 | 60 | ||
| 61 | (defconst markdown-output-buffer-name "*markdown-output*" | 61 | (defconst markdown-output-buffer-name "*markdown-output*" |
| @@ -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]. |
| 191 | Possible settings are nil, t, and 'indent-and-new-item. | 191 | Possible settings are nil, t, and `indent-and-new-item'. |
| 192 | 192 | ||
| 193 | When non-nil, pressing \\[newline] will call `newline-and-indent' | 193 | When non-nil, pressing \\[newline] will call `newline-and-indent' |
| 194 | to indent the following line according to the context using | 194 | to 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 |
| 197 | a newline without indentation. | 197 | a newline without indentation. |
| 198 | 198 | ||
| 199 | When set to 'indent-and-new-item and the point is in a list item | 199 | When set to `indent-and-new-item' and the point is in a list item |
| 200 | when \\[newline] is pressed, the list will be continued on the next | 200 | when \\[newline] is pressed, the list will be continued on the next |
| 201 | line, where a new item will be inserted. | 201 | line, 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. |
| 493 | The default value is 'any, which instructs Emacs to use | 493 | The 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 |
| 495 | windows based on the values of `split-width-threshold' and | 495 | windows 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 |
| 497 | vertically split (left and right) windows, set this to 'vertical | 497 | vertically split (left and right) windows, set this to `vertical' |
| 498 | or 'right. To force horizontally split (top and bottom) windows, | 498 | or `right'. To force horizontally split (top and bottom) windows, |
| 499 | set this to 'horizontal or 'below. | 499 | set this to `horizontal' or `below'. |
| 500 | 500 | ||
| 501 | If this value is 'any and `display-buffer-alist' is set then | 501 | If 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'. |
| 519 | If set to 'delete-on-export, delete on every export. When set to | 519 | If 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 |
| @@ -637,6 +637,15 @@ This variable must be set before loading markdown-mode." | |||
| 637 | :safe 'booleanp | 637 | :safe 'booleanp |
| 638 | :package-version '(markdown-mode . "2.5")) | 638 | :package-version '(markdown-mode . "2.5")) |
| 639 | 639 | ||
| 640 | (defcustom markdown-fontify-whole-heading-line nil | ||
| 641 | "Non-nil means fontify the whole line for headings. | ||
| 642 | This is useful when setting a background color for the | ||
| 643 | markdown-header-face-* faces." | ||
| 644 | :group 'markdown | ||
| 645 | :type 'boolean | ||
| 646 | :safe 'booleanp | ||
| 647 | :package-version '(markdown-mode . "2.5")) | ||
| 648 | |||
| 640 | 649 | ||
| 641 | ;;; Markdown-Specific `rx' Macro ============================================== | 650 | ;;; Markdown-Specific `rx' Macro ============================================== |
| 642 | 651 | ||
| @@ -855,7 +864,7 @@ Group 3 matches the text.") | |||
| 855 | (defconst markdown-regex-wiki-link | 864 | (defconst markdown-regex-wiki-link |
| 856 | "\\(?:^\\|[^\\]\\)\\(?1:\\(?2:\\[\\[\\)\\(?3:[^]|]+\\)\\(?:\\(?4:|\\)\\(?5:[^]]+\\)\\)?\\(?6:\\]\\]\\)\\)" | 865 | "\\(?:^\\|[^\\]\\)\\(?1:\\(?2:\\[\\[\\)\\(?3:[^]|]+\\)\\(?:\\(?4:|\\)\\(?5:[^]]+\\)\\)?\\(?6:\\]\\]\\)\\)" |
| 857 | "Regular expression for matching wiki links. | 866 | "Regular expression for matching wiki links. |
| 858 | This matches typical bracketed [[WikiLinks]] as well as 'aliased' | 867 | This matches typical bracketed [[WikiLinks]] as well as `aliased' |
| 859 | wiki links of the form [[PageName|link text]]. | 868 | wiki links of the form [[PageName|link text]]. |
| 860 | The meanings of the first and second components depend | 869 | The meanings of the first and second components depend |
| 861 | on the value of `markdown-wiki-link-alias-first'. | 870 | on the value of `markdown-wiki-link-alias-first'. |
| @@ -1335,7 +1344,7 @@ block construct when it is matched using | |||
| 1335 | to the text matching START-REGEX-OR-FUN, END-PROPERTY to END-REGEX-OR-FUN, and | 1344 | to the text matching START-REGEX-OR-FUN, END-PROPERTY to END-REGEX-OR-FUN, and |
| 1336 | MIDDLE-PROPERTY to the text in between the two. The value of *-PROPERTY is the | 1345 | MIDDLE-PROPERTY to the text in between the two. The value of *-PROPERTY is the |
| 1337 | `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 |
| 1338 | MIDDLE-PROPERTY, the value is a false match data of the form '(begin end), with | 1347 | MIDDLE-PROPERTY, the value is a false match data of the form `(begin end)', with |
| 1339 | begin and end set to the edges of the \"middle\" text. This makes fontification | 1348 | begin and end set to the edges of the \"middle\" text. This makes fontification |
| 1340 | easier.") | 1349 | easier.") |
| 1341 | 1350 | ||
| @@ -1574,6 +1583,13 @@ MIDDLE-BEGIN is the start of the \"middle\" section of the block." | |||
| 1574 | (put-text-property close-begin close-end | 1583 | (put-text-property close-begin close-end |
| 1575 | (cl-cadadr fence-spec) close-data)))) | 1584 | (cl-cadadr fence-spec) close-data)))) |
| 1576 | 1585 | ||
| 1586 | (defun markdown--triple-quote-single-line-p (begin) | ||
| 1587 | (save-excursion | ||
| 1588 | (goto-char begin) | ||
| 1589 | (save-match-data | ||
| 1590 | (and (search-forward "```" nil t) | ||
| 1591 | (search-forward "```" (line-end-position) t))))) | ||
| 1592 | |||
| 1577 | (defun markdown-syntax-propertize-fenced-block-constructs (start end) | 1593 | (defun markdown-syntax-propertize-fenced-block-constructs (start end) |
| 1578 | "Propertize according to `markdown-fenced-block-pairs' from START to END. | 1594 | "Propertize according to `markdown-fenced-block-pairs' from START to END. |
| 1579 | If unable to propertize an entire block (if the start of a block is within START | 1595 | If unable to propertize an entire block (if the start of a block is within START |
| @@ -1608,7 +1624,8 @@ start which was previously propertized." | |||
| 1608 | (while (re-search-forward start-reg end t) | 1624 | (while (re-search-forward start-reg end t) |
| 1609 | ;; we assume the opening constructs take up (only) an entire line, | 1625 | ;; we assume the opening constructs take up (only) an entire line, |
| 1610 | ;; so we re-check the current line | 1626 | ;; so we re-check the current line |
| 1611 | (let* ((cur-line (buffer-substring (point-at-bol) (point-at-eol))) | 1627 | (let* ((block-start (match-beginning 0)) |
| 1628 | (cur-line (buffer-substring (point-at-bol) (point-at-eol))) | ||
| 1612 | ;; find entry in `markdown-fenced-block-pairs' corresponding | 1629 | ;; find entry in `markdown-fenced-block-pairs' corresponding |
| 1613 | ;; to regex which was matched | 1630 | ;; to regex which was matched |
| 1614 | (correct-entry | 1631 | (correct-entry |
| @@ -1625,18 +1642,20 @@ start which was previously propertized." | |||
| 1625 | (cl-caadr correct-entry) | 1642 | (cl-caadr correct-entry) |
| 1626 | (if (and (match-beginning 1) (match-end 1)) | 1643 | (if (and (match-beginning 1) (match-end 1)) |
| 1627 | (- (match-end 1) (match-beginning 1)) | 1644 | (- (match-end 1) (match-beginning 1)) |
| 1628 | 0)))) | 1645 | 0))) |
| 1629 | ;; get correct match data | 1646 | (prop (cl-cadar correct-entry))) |
| 1630 | (save-excursion | 1647 | (when (or (not (eq prop 'markdown-gfm-block-begin)) |
| 1631 | (beginning-of-line) | 1648 | (not (markdown--triple-quote-single-line-p block-start))) |
| 1632 | (re-search-forward | 1649 | ;; get correct match data |
| 1633 | (markdown-maybe-funcall-regexp (caar correct-entry)) | 1650 | (save-excursion |
| 1634 | (point-at-eol))) | 1651 | (beginning-of-line) |
| 1635 | ;; mark starting, even if ending is outside of region | 1652 | (re-search-forward |
| 1636 | (put-text-property (match-beginning 0) (match-end 0) | 1653 | (markdown-maybe-funcall-regexp (caar correct-entry)) |
| 1637 | (cl-cadar correct-entry) (match-data t)) | 1654 | (point-at-eol))) |
| 1638 | (markdown-propertize-end-match | 1655 | ;; mark starting, even if ending is outside of region |
| 1639 | end-reg end correct-entry enclosed-text-start)))))) | 1656 | (put-text-property (match-beginning 0) (match-end 0) prop (match-data t)) |
| 1657 | (markdown-propertize-end-match | ||
| 1658 | end-reg end correct-entry enclosed-text-start))))))) | ||
| 1640 | 1659 | ||
| 1641 | (defun markdown-syntax-propertize-blockquotes (start end) | 1660 | (defun markdown-syntax-propertize-blockquotes (start end) |
| 1642 | "Match blockquotes from START to END." | 1661 | "Match blockquotes from START to END." |
| @@ -2218,6 +2237,11 @@ Depending on your font, some reasonable choices are: | |||
| 2218 | 2237 | ||
| 2219 | ;;; Compatibility ============================================================= | 2238 | ;;; Compatibility ============================================================= |
| 2220 | 2239 | ||
| 2240 | (defun markdown--pandoc-reference-p () | ||
| 2241 | (let ((bounds (bounds-of-thing-at-point 'word))) | ||
| 2242 | (when (and bounds (char-before (car bounds))) | ||
| 2243 | (= (char-before (car bounds)) ?@)))) | ||
| 2244 | |||
| 2221 | (defun markdown-flyspell-check-word-p () | 2245 | (defun markdown-flyspell-check-word-p () |
| 2222 | "Return t if `flyspell' should check word just before point. | 2246 | "Return t if `flyspell' should check word just before point. |
| 2223 | Used for `flyspell-generic-check-word-predicate'." | 2247 | Used for `flyspell-generic-check-word-predicate'." |
| @@ -2233,7 +2257,8 @@ Used for `flyspell-generic-check-word-predicate'." | |||
| 2233 | markdown-markup-face | 2257 | markdown-markup-face |
| 2234 | markdown-plain-url-face | 2258 | markdown-plain-url-face |
| 2235 | markdown-inline-code-face | 2259 | markdown-inline-code-face |
| 2236 | markdown-url-face))) | 2260 | markdown-url-face)) |
| 2261 | (markdown--pandoc-reference-p)) | ||
| 2237 | (prog1 nil | 2262 | (prog1 nil |
| 2238 | ;; If flyspell overlay is put, then remove it | 2263 | ;; If flyspell overlay is put, then remove it |
| 2239 | (let ((bounds (bounds-of-thing-at-point 'word))) | 2264 | (let ((bounds (bounds-of-thing-at-point 'word))) |
| @@ -2622,7 +2647,7 @@ The return value has the same form as that of | |||
| 2622 | 2647 | ||
| 2623 | (defun markdown-bounds-of-thing-at-point (thing) | 2648 | (defun markdown-bounds-of-thing-at-point (thing) |
| 2624 | "Call `bounds-of-thing-at-point' for THING with slight modifications. | 2649 | "Call `bounds-of-thing-at-point' for THING with slight modifications. |
| 2625 | Does not include trailing newlines when THING is 'line. Handles the | 2650 | Does not include trailing newlines when THING is `line'. Handles the |
| 2626 | end of buffer case by setting both endpoints equal to the value of | 2651 | end of buffer case by setting both endpoints equal to the value of |
| 2627 | `point-max', since an empty region will trigger empty markup insertion. | 2652 | `point-max', since an empty region will trigger empty markup insertion. |
| 2628 | Return bounds of form (beg . end) if THING is found, or nil otherwise." | 2653 | Return bounds of form (beg . end) if THING is found, or nil otherwise." |
| @@ -3003,13 +3028,13 @@ Restore match data previously stored in PROPERTY." | |||
| 3003 | 3028 | ||
| 3004 | (defun markdown-match-pre-blocks (last) | 3029 | (defun markdown-match-pre-blocks (last) |
| 3005 | "Match preformatted blocks from point to LAST. | 3030 | "Match preformatted blocks from point to LAST. |
| 3006 | Use data stored in 'markdown-pre text property during syntax | 3031 | Use data stored in `markdown-pre' text property during syntax |
| 3007 | analysis." | 3032 | analysis." |
| 3008 | (markdown-match-propertized-text 'markdown-pre last)) | 3033 | (markdown-match-propertized-text 'markdown-pre last)) |
| 3009 | 3034 | ||
| 3010 | (defun markdown-match-gfm-code-blocks (last) | 3035 | (defun markdown-match-gfm-code-blocks (last) |
| 3011 | "Match GFM quoted code blocks from point to LAST. | 3036 | "Match GFM quoted code blocks from point to LAST. |
| 3012 | Use data stored in 'markdown-gfm-code text property during syntax | 3037 | Use data stored in `markdown-gfm-code' text property during syntax |
| 3013 | analysis." | 3038 | analysis." |
| 3014 | (markdown-match-propertized-text 'markdown-gfm-code last)) | 3039 | (markdown-match-propertized-text 'markdown-gfm-code last)) |
| 3015 | 3040 | ||
| @@ -3031,7 +3056,7 @@ analysis." | |||
| 3031 | 3056 | ||
| 3032 | (defun markdown-match-blockquotes (last) | 3057 | (defun markdown-match-blockquotes (last) |
| 3033 | "Match blockquotes from point to LAST. | 3058 | "Match blockquotes from point to LAST. |
| 3034 | Use data stored in 'markdown-blockquote text property during syntax | 3059 | Use data stored in `markdown-blockquote' text property during syntax |
| 3035 | analysis." | 3060 | analysis." |
| 3036 | (markdown-match-propertized-text 'markdown-blockquote last)) | 3061 | (markdown-match-propertized-text 'markdown-blockquote last)) |
| 3037 | 3062 | ||
| @@ -3416,13 +3441,17 @@ SEQ may be an atom or a sequence." | |||
| 3416 | (add-text-properties | 3441 | (add-text-properties |
| 3417 | (match-beginning 3) (match-end 3) rule-props))) | 3442 | (match-beginning 3) (match-end 3) rule-props))) |
| 3418 | ;; atx heading | 3443 | ;; atx heading |
| 3419 | (add-text-properties | 3444 | (if markdown-fontify-whole-heading-line |
| 3420 | (match-beginning 4) (match-end 4) left-markup-props) | 3445 | (let ((header-end (min (point-max) (1+ (match-end 0))))) |
| 3421 | (add-text-properties | 3446 | (add-text-properties |
| 3422 | (match-beginning 5) (match-end 5) heading-props) | 3447 | (match-beginning 0) header-end heading-props)) |
| 3423 | (when (match-end 6) | 3448 | (add-text-properties |
| 3449 | (match-beginning 4) (match-end 4) left-markup-props) | ||
| 3424 | (add-text-properties | 3450 | (add-text-properties |
| 3425 | (match-beginning 6) (match-end 6) right-markup-props)))) | 3451 | (match-beginning 5) (match-end 5) heading-props) |
| 3452 | (when (match-end 6) | ||
| 3453 | (add-text-properties | ||
| 3454 | (match-beginning 6) (match-end 6) right-markup-props))))) | ||
| 3426 | t)) | 3455 | t)) |
| 3427 | 3456 | ||
| 3428 | (defun markdown-fontify-tables (last) | 3457 | (defun markdown-fontify-tables (last) |
| @@ -4508,7 +4537,7 @@ at the beginning of the block." | |||
| 4508 | (defun markdown-insert-foldable-block () | 4537 | (defun markdown-insert-foldable-block () |
| 4509 | "Insert details disclosure element to make content foldable. | 4538 | "Insert details disclosure element to make content foldable. |
| 4510 | If a region is active, wrap this region with the disclosure | 4539 | If a region is active, wrap this region with the disclosure |
| 4511 | element. More detais here 'https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details'." | 4540 | element. More detais here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details." |
| 4512 | (interactive) | 4541 | (interactive) |
| 4513 | (let ((details-open-tag "<details>") | 4542 | (let ((details-open-tag "<details>") |
| 4514 | (details-close-tag "</details>") | 4543 | (details-close-tag "</details>") |
| @@ -4953,7 +4982,7 @@ If the point is at a table, move to the next row. Otherwise, | |||
| 4953 | indent according to value of `markdown-indent-on-enter'. | 4982 | indent according to value of `markdown-indent-on-enter'. |
| 4954 | When it is nil, simply call `newline'. Otherwise, indent the next line | 4983 | When it is nil, simply call `newline'. Otherwise, indent the next line |
| 4955 | following RET using `markdown-indent-line'. Furthermore, when it | 4984 | following RET using `markdown-indent-line'. Furthermore, when it |
| 4956 | is set to 'indent-and-new-item and the point is in a list item, | 4985 | is set to `indent-and-new-item' and the point is in a list item, |
| 4957 | start a new item with the same indentation. If the point is in an | 4986 | start a new item with the same indentation. If the point is in an |
| 4958 | empty list item, remove it (so that pressing RET twice when in a | 4987 | empty list item, remove it (so that pressing RET twice when in a |
| 4959 | list simply adds a blank line)." | 4988 | list simply adds a blank line)." |
| @@ -7341,7 +7370,11 @@ Return the name of the output buffer used." | |||
| 7341 | (if (not (null command-args)) | 7370 | (if (not (null command-args)) |
| 7342 | (apply #'call-process-region begin-region end-region command nil buf nil command-args) | 7371 | (apply #'call-process-region begin-region end-region command nil buf nil command-args) |
| 7343 | (call-process-region begin-region end-region command nil buf)) | 7372 | (call-process-region begin-region end-region command nil buf)) |
| 7344 | (funcall markdown-command begin-region end-region buf) | 7373 | (if markdown-command-needs-filename |
| 7374 | (if (not buffer-file-name) | ||
| 7375 | (user-error "Must be visiting a file") | ||
| 7376 | (funcall markdown-command begin-region end-region buf buffer-file-name)) | ||
| 7377 | (funcall markdown-command begin-region end-region buf)) | ||
| 7345 | ;; If the ‘markdown-command’ function didn’t signal an | 7378 | ;; If the ‘markdown-command’ function didn’t signal an |
| 7346 | ;; error, assume it succeeded by binding ‘exit-code’ to 0. | 7379 | ;; error, assume it succeeded by binding ‘exit-code’ to 0. |
| 7347 | 0)))))) | 7380 | 0)))))) |
| @@ -7645,20 +7678,19 @@ displaying the rendered output." | |||
| 7645 | (setq markdown-live-preview-source-buffer nil)))) | 7678 | (setq markdown-live-preview-source-buffer nil)))) |
| 7646 | 7679 | ||
| 7647 | (defun markdown-live-preview-switch-to-output () | 7680 | (defun markdown-live-preview-switch-to-output () |
| 7648 | "Switch to output buffer." | 7681 | "Turn on `markdown-live-preview-mode' and switch to output buffer. |
| 7682 | The output buffer is opened in another window." | ||
| 7649 | (interactive) | 7683 | (interactive) |
| 7650 | "Turn on `markdown-live-preview-mode' if not already on, and switch to its | ||
| 7651 | output buffer in another window." | ||
| 7652 | (if markdown-live-preview-mode | 7684 | (if markdown-live-preview-mode |
| 7653 | (markdown-display-buffer-other-window (markdown-live-preview-export))) | 7685 | (markdown-display-buffer-other-window (markdown-live-preview-export))) |
| 7654 | (markdown-live-preview-mode)) | 7686 | (markdown-live-preview-mode)) |
| 7655 | 7687 | ||
| 7656 | (defun markdown-live-preview-re-export () | 7688 | (defun markdown-live-preview-re-export () |
| 7657 | "Re export source buffer." | 7689 | "Re-export the current live previewed content. |
| 7658 | (interactive) | 7690 | If the current buffer is a buffer displaying the exported version of a |
| 7659 | "If the current buffer is a buffer displaying the exported version of a | ||
| 7660 | `markdown-live-preview-mode' buffer, call `markdown-live-preview-export' and | 7691 | `markdown-live-preview-mode' buffer, call `markdown-live-preview-export' and |
| 7661 | update this buffer's contents." | 7692 | update this buffer's contents." |
| 7693 | (interactive) | ||
| 7662 | (when markdown-live-preview-source-buffer | 7694 | (when markdown-live-preview-source-buffer |
| 7663 | (with-current-buffer markdown-live-preview-source-buffer | 7695 | (with-current-buffer markdown-live-preview-source-buffer |
| 7664 | (markdown-live-preview-export)))) | 7696 | (markdown-live-preview-export)))) |
| @@ -9636,7 +9668,7 @@ rows and columns and the column alignment." | |||
| 9636 | 9668 | ||
| 9637 | ;;; ElDoc Support ============================================================= | 9669 | ;;; ElDoc Support ============================================================= |
| 9638 | 9670 | ||
| 9639 | (defun markdown-eldoc-function () | 9671 | (defun markdown-eldoc-function (&rest _ignored) |
| 9640 | "Return a helpful string when appropriate based on context. | 9672 | "Return a helpful string when appropriate based on context. |
| 9641 | * Report URL when point is at a hidden URL. | 9673 | * Report URL when point is at a hidden URL. |
| 9642 | * Report language name when point is a code block with hidden markup." | 9674 | * Report language name when point is a code block with hidden markup." |
| @@ -9776,8 +9808,10 @@ rows and columns and the column alignment." | |||
| 9776 | ;; Cause use of ellipses for invisible text. | 9808 | ;; Cause use of ellipses for invisible text. |
| 9777 | (add-to-invisibility-spec '(outline . t)) | 9809 | (add-to-invisibility-spec '(outline . t)) |
| 9778 | ;; ElDoc support | 9810 | ;; ElDoc support |
| 9779 | (add-function :before-until (local 'eldoc-documentation-function) | 9811 | (if (boundp 'eldoc-documentation-functions) |
| 9780 | #'markdown-eldoc-function) | 9812 | (add-hook 'eldoc-documentation-functions #'markdown-eldoc-function nil t) |
| 9813 | (add-function :before-until (local 'eldoc-documentation-function) | ||
| 9814 | #'markdown-eldoc-function)) | ||
| 9781 | ;; Inhibiting line-breaking: | 9815 | ;; Inhibiting line-breaking: |
| 9782 | ;; Separating out each condition into a separate function so that users can | 9816 | ;; Separating out each condition into a separate function so that users can |
| 9783 | ;; override if desired (with remove-hook) | 9817 | ;; override if desired (with remove-hook) |
