diff options
| author | Simeon Simeonov | 2023-08-17 11:41:36 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2023-08-17 11:41:36 +0200 |
| commit | bb7d0abc12e60aa52c84e36b9fd3200d7f861f8b (patch) | |
| tree | 97405d68a6187fd355058ab7d9888ea4727a4add | |
| parent | b7b77a527e4920389667b1ac90c447f52db70996 (diff) | |
Upgrade lua-mode.el markdown-mode and yaml-mode
| -rw-r--r-- | .emacs.d/lisp/lua-mode.el | 17 | ||||
| -rw-r--r-- | .emacs.d/lisp/markdown-mode.el | 160 | ||||
| -rw-r--r-- | .emacs.d/lisp/yaml-mode.el | 8 |
3 files changed, 134 insertions, 51 deletions
diff --git a/.emacs.d/lisp/lua-mode.el b/.emacs.d/lisp/lua-mode.el index 4c543f5..6ab4d43 100644 --- a/.emacs.d/lisp/lua-mode.el +++ b/.emacs.d/lisp/lua-mode.el | |||
| @@ -396,10 +396,7 @@ If the latter is nil, the keymap translates into `lua-mode-map' verbatim.") | |||
| 396 | "Buffer-local flag saying if this is a Lua REPL buffer.") | 396 | "Buffer-local flag saying if this is a Lua REPL buffer.") |
| 397 | (make-variable-buffer-local 'lua--repl-buffer-p) | 397 | (make-variable-buffer-local 'lua--repl-buffer-p) |
| 398 | 398 | ||
| 399 | 399 | (defun lua--compilation-find-file (fn marker filename directory &rest formats) | |
| 400 | (defadvice compilation-find-file (around lua--repl-find-file | ||
| 401 | (marker filename directory &rest formats) | ||
| 402 | activate) | ||
| 403 | "Return Lua REPL buffer when looking for \"stdin\" file in it." | 400 | "Return Lua REPL buffer when looking for \"stdin\" file in it." |
| 404 | (if (and | 401 | (if (and |
| 405 | lua--repl-buffer-p | 402 | lua--repl-buffer-p |
| @@ -409,13 +406,12 @@ If the latter is nil, the keymap translates into `lua-mode-map' verbatim.") | |||
| 409 | (not (file-exists-p (expand-file-name | 406 | (not (file-exists-p (expand-file-name |
| 410 | filename | 407 | filename |
| 411 | (when directory (expand-file-name directory)))))) | 408 | (when directory (expand-file-name directory)))))) |
| 412 | (setq ad-return-value (current-buffer)) | 409 | (current-buffer) |
| 413 | ad-do-it)) | 410 | (apply fn marker filename directory formats))) |
| 414 | 411 | ||
| 412 | (advice-add 'compilation-find-file :around #'lua--compilation-find-file) | ||
| 415 | 413 | ||
| 416 | (defadvice compilation-goto-locus (around lua--repl-goto-locus | 414 | (defun lua--compilation-goto-locus (fn msg mk end-mk) |
| 417 | (msg mk end-mk) | ||
| 418 | activate) | ||
| 419 | "When message points to Lua REPL buffer, go to the message itself. | 415 | "When message points to Lua REPL buffer, go to the message itself. |
| 420 | Usually, stdin:XX line number points to nowhere." | 416 | Usually, stdin:XX line number points to nowhere." |
| 421 | (let ((errmsg-buf (marker-buffer msg)) | 417 | (let ((errmsg-buf (marker-buffer msg)) |
| @@ -425,8 +421,9 @@ Usually, stdin:XX line number points to nowhere." | |||
| 425 | (progn | 421 | (progn |
| 426 | (compilation-set-window (display-buffer (marker-buffer msg)) msg) | 422 | (compilation-set-window (display-buffer (marker-buffer msg)) msg) |
| 427 | (goto-char msg)) | 423 | (goto-char msg)) |
| 428 | ad-do-it))) | 424 | (funcall fn msg mk end-mk)))) |
| 429 | 425 | ||
| 426 | (advice-add 'compilation-goto-locus :around #'lua--compilation-goto-locus) | ||
| 430 | 427 | ||
| 431 | (defcustom lua-indent-string-contents nil | 428 | (defcustom lua-indent-string-contents nil |
| 432 | "If non-nil, contents of multiline string will be indented. | 429 | "If non-nil, contents of multiline string will be indented. |
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el index 63a86ad..4bb1a57 100644 --- a/.emacs.d/lisp/markdown-mode.el +++ b/.emacs.d/lisp/markdown-mode.el | |||
| @@ -7,7 +7,7 @@ | |||
| 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.6-alpha | 9 | ;; Version: 2.6-alpha |
| 10 | ;; Package-Requires: ((emacs "26.1")) | 10 | ;; Package-Requires: ((emacs "27.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 | ||
| @@ -704,7 +704,7 @@ Group 7 matches the title (optional). | |||
| 704 | Group 8 matches the closing parenthesis.") | 704 | Group 8 matches the closing parenthesis.") |
| 705 | 705 | ||
| 706 | (defconst markdown-regex-link-reference | 706 | (defconst markdown-regex-link-reference |
| 707 | "\\(?1:!\\)?\\(?2:\\[\\)\\(?3:[^]^][^]]*\\|\\)\\(?4:\\]\\)[ ]?\\(?5:\\[\\)\\(?6:[^]]*?\\)\\(?7:\\]\\)" | 707 | "\\(?1:!\\)?\\(?2:\\[\\)\\(?3:[^]^][^]]*\\|\\)\\(?4:\\]\\)\\(?5:\\[\\)\\(?6:[^]]*?\\)\\(?7:\\]\\)" |
| 708 | "Regular expression for a reference link [text][id]. | 708 | "Regular expression for a reference link [text][id]. |
| 709 | Group 1 matches the leading exclamation point (optional). | 709 | Group 1 matches the leading exclamation point (optional). |
| 710 | Group 2 matches the opening square bracket for the link text. | 710 | Group 2 matches the opening square bracket for the link text. |
| @@ -732,7 +732,7 @@ Group 2 matches only the label, without the surrounding markup. | |||
| 732 | Group 3 matches the closing square bracket.") | 732 | Group 3 matches the closing square bracket.") |
| 733 | 733 | ||
| 734 | (defconst markdown-regex-header | 734 | (defconst markdown-regex-header |
| 735 | "^\\(?:\\(?1:[^\r\n\t -].*\\)\n\\(?:\\(?2:=+\\)\\|\\(?3:-+\\)\\)\\|\\(?4:#+[ \t]+\\)\\(?5:.*?\\)\\(?6:[ \t]*#*\\)\\)$" | 735 | "^\\(?:\\(?1:[^\r\n\t -].*\\)\n\\(?:\\(?2:=+\\)\\|\\(?3:-+\\)\\)\\|\\(?4:#+[ \t]+\\)\\(?5:.*?\\)\\(?6:[ \t]+#+\\)?\\)$" |
| 736 | "Regexp identifying Markdown headings. | 736 | "Regexp identifying Markdown headings. |
| 737 | Group 1 matches the text of a setext heading. | 737 | Group 1 matches the text of a setext heading. |
| 738 | Group 2 matches the underline of a level-1 setext heading. | 738 | Group 2 matches the underline of a level-1 setext heading. |
| @@ -861,6 +861,10 @@ Group 3 matches the text.") | |||
| 861 | "[^ \n\t][ \t]*\\( \\)\n" | 861 | "[^ \n\t][ \t]*\\( \\)\n" |
| 862 | "Regular expression for matching line breaks.") | 862 | "Regular expression for matching line breaks.") |
| 863 | 863 | ||
| 864 | (defconst markdown-regex-escape | ||
| 865 | "\\(\\\\\\)." | ||
| 866 | "Regular expression for matching escape sequences.") | ||
| 867 | |||
| 864 | (defconst markdown-regex-wiki-link | 868 | (defconst markdown-regex-wiki-link |
| 865 | "\\(?:^\\|[^\\]\\)\\(?1:\\(?2:\\[\\[\\)\\(?3:[^]|]+\\)\\(?:\\(?4:|\\)\\(?5:[^]]+\\)\\)?\\(?6:\\]\\]\\)\\)" | 869 | "\\(?:^\\|[^\\]\\)\\(?1:\\(?2:\\[\\[\\)\\(?3:[^]|]+\\)\\(?:\\(?4:|\\)\\(?5:[^]]+\\)\\)?\\(?6:\\]\\]\\)\\)" |
| 866 | "Regular expression for matching wiki links. | 870 | "Regular expression for matching wiki links. |
| @@ -1101,6 +1105,29 @@ Group 4 matches the text inside the delimiters.") | |||
| 1101 | 'markdown-metadata-markup nil) | 1105 | 'markdown-metadata-markup nil) |
| 1102 | "Property list of all Markdown syntactic properties.") | 1106 | "Property list of all Markdown syntactic properties.") |
| 1103 | 1107 | ||
| 1108 | (defvar markdown-literal-faces | ||
| 1109 | '(markdown-inline-code-face | ||
| 1110 | markdown-pre-face | ||
| 1111 | markdown-math-face | ||
| 1112 | markdown-url-face | ||
| 1113 | markdown-plain-url-face | ||
| 1114 | markdown-language-keyword-face | ||
| 1115 | markdown-language-info-face | ||
| 1116 | markdown-metadata-key-face | ||
| 1117 | markdown-metadata-value-face | ||
| 1118 | markdown-html-entity-face | ||
| 1119 | markdown-html-tag-name-face | ||
| 1120 | markdown-html-tag-delimiter-face | ||
| 1121 | markdown-html-attr-name-face | ||
| 1122 | markdown-html-attr-value-face | ||
| 1123 | markdown-reference-face | ||
| 1124 | markdown-footnote-marker-face | ||
| 1125 | markdown-line-break-face | ||
| 1126 | markdown-comment-face) | ||
| 1127 | "A list of markdown-mode faces that contain literal text. | ||
| 1128 | Literal text treats backslashes literally, rather than as an | ||
| 1129 | escape character (see `markdown-match-escape').") | ||
| 1130 | |||
| 1104 | (defsubst markdown-in-comment-p (&optional pos) | 1131 | (defsubst markdown-in-comment-p (&optional pos) |
| 1105 | "Return non-nil if POS is in a comment. | 1132 | "Return non-nil if POS is in a comment. |
| 1106 | If POS is not given, use point instead." | 1133 | If POS is not given, use point instead." |
| @@ -2216,6 +2243,7 @@ Depending on your font, some reasonable choices are: | |||
| 2216 | (4 'markdown-highlighting-face) | 2243 | (4 'markdown-highlighting-face) |
| 2217 | (5 markdown-markup-properties))) | 2244 | (5 markdown-markup-properties))) |
| 2218 | (,markdown-regex-line-break . (1 'markdown-line-break-face prepend)) | 2245 | (,markdown-regex-line-break . (1 'markdown-line-break-face prepend)) |
| 2246 | (markdown-match-escape . ((1 markdown-markup-properties prepend))) | ||
| 2219 | (markdown-fontify-sub-superscripts) | 2247 | (markdown-fontify-sub-superscripts) |
| 2220 | (markdown-match-inline-attributes . ((0 markdown-markup-properties prepend))) | 2248 | (markdown-match-inline-attributes . ((0 markdown-markup-properties prepend))) |
| 2221 | (markdown-match-leanpub-sections . ((0 markdown-markup-properties))) | 2249 | (markdown-match-leanpub-sections . ((0 markdown-markup-properties))) |
| @@ -2947,6 +2975,18 @@ When FACELESS is non-nil, do not return matches where faces have been applied." | |||
| 2947 | (when markdown-enable-highlighting-syntax | 2975 | (when markdown-enable-highlighting-syntax |
| 2948 | (re-search-forward markdown-regex-highlighting last t))) | 2976 | (re-search-forward markdown-regex-highlighting last t))) |
| 2949 | 2977 | ||
| 2978 | (defun markdown-match-escape (last) | ||
| 2979 | "Match escape characters (backslashes) from point to LAST. | ||
| 2980 | Backlashes only count as escape characters outside of literal | ||
| 2981 | regions (e.g. code blocks). See `markdown-literal-faces'." | ||
| 2982 | (catch 'found | ||
| 2983 | (while (search-forward-regexp markdown-regex-escape last t) | ||
| 2984 | (let* ((face (get-text-property (match-beginning 1) 'face)) | ||
| 2985 | (face-list (if (listp face) face (list face)))) | ||
| 2986 | ;; Ignore any backslashes with a literal face. | ||
| 2987 | (unless (cl-intersection face-list markdown-literal-faces) | ||
| 2988 | (throw 'found t)))))) | ||
| 2989 | |||
| 2950 | (defun markdown-match-math-generic (regex last) | 2990 | (defun markdown-match-math-generic (regex last) |
| 2951 | "Match REGEX from point to LAST. | 2991 | "Match REGEX from point to LAST. |
| 2952 | REGEX is either `markdown-regex-math-inline-single' for matching | 2992 | REGEX is either `markdown-regex-math-inline-single' for matching |
| @@ -3443,17 +3483,30 @@ SEQ may be an atom or a sequence." | |||
| 3443 | (add-text-properties | 3483 | (add-text-properties |
| 3444 | (match-beginning 3) (match-end 3) rule-props))) | 3484 | (match-beginning 3) (match-end 3) rule-props))) |
| 3445 | ;; atx heading | 3485 | ;; atx heading |
| 3446 | (if markdown-fontify-whole-heading-line | 3486 | (let ((header-end |
| 3447 | (let ((header-end (min (point-max) (1+ (match-end 0))))) | 3487 | (if markdown-fontify-whole-heading-line |
| 3448 | (add-text-properties | 3488 | (min (point-max) (1+ (match-end 0))) |
| 3449 | (match-beginning 0) header-end heading-props)) | 3489 | (match-end 0)))) |
| 3450 | (add-text-properties | 3490 | (add-text-properties |
| 3451 | (match-beginning 4) (match-end 4) left-markup-props) | 3491 | (match-beginning 4) (match-end 4) left-markup-props) |
| 3452 | (add-text-properties | 3492 | |
| 3453 | (match-beginning 5) (match-end 5) heading-props) | 3493 | ;; If closing tag is present |
| 3454 | (when (match-end 6) | 3494 | (if (match-end 6) |
| 3495 | (progn | ||
| 3496 | (if markdown-hide-markup | ||
| 3497 | (progn | ||
| 3498 | (add-text-properties | ||
| 3499 | (match-beginning 5) header-end heading-props) | ||
| 3500 | (add-text-properties | ||
| 3501 | (match-beginning 6) (match-end 6) right-markup-props)) | ||
| 3502 | (add-text-properties | ||
| 3503 | (match-beginning 5) (match-end 5) heading-props) | ||
| 3504 | (add-text-properties | ||
| 3505 | (match-beginning 6) header-end right-markup-props))) | ||
| 3506 | ;; If closing tag is not present | ||
| 3455 | (add-text-properties | 3507 | (add-text-properties |
| 3456 | (match-beginning 6) (match-end 6) right-markup-props))))) | 3508 | (match-beginning 5) header-end heading-props)) |
| 3509 | ))) | ||
| 3457 | t)) | 3510 | t)) |
| 3458 | 3511 | ||
| 3459 | (defun markdown-fontify-tables (last) | 3512 | (defun markdown-fontify-tables (last) |
| @@ -3504,17 +3557,30 @@ SEQ may be an atom or a sequence." | |||
| 3504 | `(display ,display-string)))))))) | 3557 | `(display ,display-string)))))))) |
| 3505 | t)) | 3558 | t)) |
| 3506 | 3559 | ||
| 3560 | (defun markdown--fontify-hrs-view-mode (hr-char) | ||
| 3561 | (if (and hr-char (display-supports-face-attributes-p '(:extend t))) | ||
| 3562 | (add-text-properties | ||
| 3563 | (match-beginning 0) (match-end 0) | ||
| 3564 | `(face | ||
| 3565 | (:inherit markdown-hr-face :underline t :extend t) | ||
| 3566 | font-lock-multiline t | ||
| 3567 | display "\n")) | ||
| 3568 | (let ((hr-len (and hr-char (/ (1- (window-body-width)) (char-width hr-char))))) | ||
| 3569 | (add-text-properties | ||
| 3570 | (match-beginning 0) (match-end 0) | ||
| 3571 | `(face | ||
| 3572 | markdown-hr-face font-lock-multiline t | ||
| 3573 | display ,(make-string hr-len hr-char)))))) | ||
| 3574 | |||
| 3507 | (defun markdown-fontify-hrs (last) | 3575 | (defun markdown-fontify-hrs (last) |
| 3508 | "Add text properties to horizontal rules from point to LAST." | 3576 | "Add text properties to horizontal rules from point to LAST." |
| 3509 | (when (markdown-match-hr last) | 3577 | (when (markdown-match-hr last) |
| 3510 | (let ((hr-char (markdown--first-displayable markdown-hr-display-char))) | 3578 | (let ((hr-char (markdown--first-displayable markdown-hr-display-char))) |
| 3511 | (add-text-properties | 3579 | (if (and markdown-hide-markup hr-char) |
| 3512 | (match-beginning 0) (match-end 0) | 3580 | (markdown--fontify-hrs-view-mode hr-char) |
| 3513 | `(face markdown-hr-face | 3581 | (add-text-properties |
| 3514 | font-lock-multiline t | 3582 | (match-beginning 0) (match-end 0) |
| 3515 | ,@(when (and markdown-hide-markup hr-char) | 3583 | `(face markdown-hr-face font-lock-multiline t))) |
| 3516 | `(display ,(make-string | ||
| 3517 | (1- (window-body-width)) hr-char))))) | ||
| 3518 | t))) | 3584 | t))) |
| 3519 | 3585 | ||
| 3520 | (defun markdown-fontify-sub-superscripts (last) | 3586 | (defun markdown-fontify-sub-superscripts (last) |
| @@ -4539,7 +4605,7 @@ at the beginning of the block." | |||
| 4539 | (defun markdown-insert-foldable-block () | 4605 | (defun markdown-insert-foldable-block () |
| 4540 | "Insert details disclosure element to make content foldable. | 4606 | "Insert details disclosure element to make content foldable. |
| 4541 | If a region is active, wrap this region with the disclosure | 4607 | If a region is active, wrap this region with the disclosure |
| 4542 | element. More detais here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details." | 4608 | element. More details here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details." |
| 4543 | (interactive) | 4609 | (interactive) |
| 4544 | (let ((details-open-tag "<details>") | 4610 | (let ((details-open-tag "<details>") |
| 4545 | (details-close-tag "</details>") | 4611 | (details-close-tag "</details>") |
| @@ -4599,6 +4665,7 @@ element. More detais here https://developer.mozilla.org/en-US/docs/Web/HTML/Elem | |||
| 4599 | (interactive) | 4665 | (interactive) |
| 4600 | (let ((fn (markdown-footnote-counter-inc))) | 4666 | (let ((fn (markdown-footnote-counter-inc))) |
| 4601 | (insert (format "[^%d]" fn)) | 4667 | (insert (format "[^%d]" fn)) |
| 4668 | (push-mark (point) t) | ||
| 4602 | (markdown-footnote-text-find-new-location) | 4669 | (markdown-footnote-text-find-new-location) |
| 4603 | (markdown-ensure-blank-line-before) | 4670 | (markdown-ensure-blank-line-before) |
| 4604 | (unless (markdown-cur-line-blank-p) | 4671 | (unless (markdown-cur-line-blank-p) |
| @@ -5000,9 +5067,10 @@ list simply adds a blank line)." | |||
| 5000 | (setq bounds (markdown-cur-list-item-bounds))) | 5067 | (setq bounds (markdown-cur-list-item-bounds))) |
| 5001 | (let ((beg (cl-first bounds)) | 5068 | (let ((beg (cl-first bounds)) |
| 5002 | (end (cl-second bounds)) | 5069 | (end (cl-second bounds)) |
| 5003 | (length (cl-fourth bounds))) | 5070 | (nonlist-indent (cl-fourth bounds)) |
| 5071 | (checkbox (cl-sixth bounds))) | ||
| 5004 | ;; Point is in a list item | 5072 | ;; Point is in a list item |
| 5005 | (if (= (- end beg) length) | 5073 | (if (= (- end beg) (+ nonlist-indent (length checkbox))) |
| 5006 | ;; Delete blank list | 5074 | ;; Delete blank list |
| 5007 | (progn | 5075 | (progn |
| 5008 | (delete-region beg end) | 5076 | (delete-region beg end) |
| @@ -5716,7 +5784,7 @@ See also `markdown-mode-map'.") | |||
| 5716 | (defun markdown-imenu-create-nested-index () | 5784 | (defun markdown-imenu-create-nested-index () |
| 5717 | "Create and return a nested imenu index alist for the current buffer. | 5785 | "Create and return a nested imenu index alist for the current buffer. |
| 5718 | See `imenu-create-index-function' and `imenu--index-alist' for details." | 5786 | See `imenu-create-index-function' and `imenu--index-alist' for details." |
| 5719 | (let* ((root '(nil . nil)) | 5787 | (let* ((root (list nil)) |
| 5720 | (min-level 9999) | 5788 | (min-level 9999) |
| 5721 | hashes headers) | 5789 | hashes headers) |
| 5722 | (save-excursion | 5790 | (save-excursion |
| @@ -7427,6 +7495,12 @@ Standalone XHTML output is identified by an occurrence of | |||
| 7427 | stylesheet-path) | 7495 | stylesheet-path) |
| 7428 | "\" />")) | 7496 | "\" />")) |
| 7429 | 7497 | ||
| 7498 | (defun markdown-escape-title (title) | ||
| 7499 | "Escape a minimum set of characters in TITLE so they don't clash with html." | ||
| 7500 | (replace-regexp-in-string ">" ">" | ||
| 7501 | (replace-regexp-in-string "<" "<" | ||
| 7502 | (replace-regexp-in-string "&" "&" title)))) | ||
| 7503 | |||
| 7430 | (defun markdown-add-xhtml-header-and-footer (title) | 7504 | (defun markdown-add-xhtml-header-and-footer (title) |
| 7431 | "Wrap XHTML header and footer with given TITLE around current buffer." | 7505 | "Wrap XHTML header and footer with given TITLE around current buffer." |
| 7432 | (goto-char (point-min)) | 7506 | (goto-char (point-min)) |
| @@ -7435,7 +7509,7 @@ Standalone XHTML output is identified by an occurrence of | |||
| 7435 | "\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n" | 7509 | "\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n" |
| 7436 | "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n" | 7510 | "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n" |
| 7437 | "<head>\n<title>") | 7511 | "<head>\n<title>") |
| 7438 | (insert title) | 7512 | (insert (markdown-escape-title title)) |
| 7439 | (insert "</title>\n") | 7513 | (insert "</title>\n") |
| 7440 | (unless (= (length markdown-content-type) 0) | 7514 | (unless (= (length markdown-content-type) 0) |
| 7441 | (insert | 7515 | (insert |
| @@ -7774,19 +7848,19 @@ Value is a list of elements describing the link: | |||
| 7774 | ((thing-at-point-looking-at markdown-regex-link-inline) | 7848 | ((thing-at-point-looking-at markdown-regex-link-inline) |
| 7775 | (setq bang (match-string-no-properties 1) | 7849 | (setq bang (match-string-no-properties 1) |
| 7776 | begin (match-beginning 0) | 7850 | begin (match-beginning 0) |
| 7777 | end (match-end 0) | ||
| 7778 | text (match-string-no-properties 3) | 7851 | text (match-string-no-properties 3) |
| 7779 | url (match-string-no-properties 6)) | 7852 | url (match-string-no-properties 6)) |
| 7780 | (if (match-end 7) | 7853 | ;; consider nested parentheses |
| 7781 | (setq title (substring (match-string-no-properties 7) 1 -1)) | 7854 | ;; if link target contains parentheses, (match-end 0) isn't correct end position of the link |
| 7782 | ;; #408 URL contains close parenthesis case | 7855 | (let* ((close-pos (scan-sexps (match-beginning 5) 1)) |
| 7783 | (goto-char (match-beginning 5)) | 7856 | (destination-part (string-trim (buffer-substring-no-properties (1+ (match-beginning 5)) (1- close-pos))))) |
| 7784 | (let ((paren-end (scan-sexps (point) 1))) | 7857 | (setq end close-pos) |
| 7785 | (when (and paren-end (< end paren-end)) | 7858 | (if (string-match "\\([^ ]+\\)\\s-+\\(.+\\)" destination-part) |
| 7786 | (setq url (buffer-substring (match-beginning 6) (1- paren-end))))))) | 7859 | (setq url (match-string-no-properties 1 destination-part) |
| 7860 | title (substring (match-string-no-properties 2 destination-part) 1 -1)) | ||
| 7861 | (setq url destination-part)))) | ||
| 7787 | ;; Reference link at point. | 7862 | ;; Reference link at point. |
| 7788 | ((or (thing-at-point-looking-at markdown-regex-link-inline) | 7863 | ((thing-at-point-looking-at markdown-regex-link-reference) |
| 7789 | (thing-at-point-looking-at markdown-regex-link-reference)) | ||
| 7790 | (setq bang (match-string-no-properties 1) | 7864 | (setq bang (match-string-no-properties 1) |
| 7791 | begin (match-beginning 0) | 7865 | begin (match-beginning 0) |
| 7792 | end (match-end 0) | 7866 | end (match-end 0) |
| @@ -8755,7 +8829,7 @@ mode to use is `tuareg-mode'." | |||
| 8755 | "Return major mode that should be used for LANG. | 8829 | "Return major mode that should be used for LANG. |
| 8756 | LANG is a string, and the returned major mode is a symbol." | 8830 | LANG is a string, and the returned major mode is a symbol." |
| 8757 | (cl-find-if | 8831 | (cl-find-if |
| 8758 | 'fboundp | 8832 | #'markdown--lang-mode-predicate |
| 8759 | (nconc (list (cdr (assoc lang markdown-code-lang-modes)) | 8833 | (nconc (list (cdr (assoc lang markdown-code-lang-modes)) |
| 8760 | (cdr (assoc (downcase lang) markdown-code-lang-modes))) | 8834 | (cdr (assoc (downcase lang) markdown-code-lang-modes))) |
| 8761 | (and (fboundp 'treesit-language-available-p) | 8835 | (and (fboundp 'treesit-language-available-p) |
| @@ -8767,6 +8841,20 @@ LANG is a string, and the returned major mode is a symbol." | |||
| 8767 | (intern (concat lang "-mode")) | 8841 | (intern (concat lang "-mode")) |
| 8768 | (intern (concat (downcase lang) "-mode")))))) | 8842 | (intern (concat (downcase lang) "-mode")))))) |
| 8769 | 8843 | ||
| 8844 | (defun markdown--lang-mode-predicate (mode) | ||
| 8845 | (and mode | ||
| 8846 | (fboundp mode) | ||
| 8847 | (or | ||
| 8848 | ;; https://github.com/jrblevin/markdown-mode/issues/787 | ||
| 8849 | ;; major-mode-remap-alist was introduced at Emacs 29.1 | ||
| 8850 | (cl-loop for pair in (bound-and-true-p major-mode-remap-alist) | ||
| 8851 | for func = (cdr pair) | ||
| 8852 | thereis (and (atom func) (eq mode func))) | ||
| 8853 | ;; https://github.com/jrblevin/markdown-mode/issues/761 | ||
| 8854 | (cl-loop for pair in auto-mode-alist | ||
| 8855 | for func = (cdr pair) | ||
| 8856 | thereis (and (atom func) (eq mode func)))))) | ||
| 8857 | |||
| 8770 | (defun markdown-fontify-code-blocks-generic (matcher last) | 8858 | (defun markdown-fontify-code-blocks-generic (matcher last) |
| 8771 | "Add text properties to next code block from point to LAST. | 8859 | "Add text properties to next code block from point to LAST. |
| 8772 | Use matching function MATCHER." | 8860 | Use matching function MATCHER." |
| @@ -9667,8 +9755,8 @@ spaces, or alternatively a TAB should be used as the separator." | |||
| 9667 | Optional arguments ROWS, COLUMNS, and ALIGN specify number of | 9755 | Optional arguments ROWS, COLUMNS, and ALIGN specify number of |
| 9668 | rows and columns and the column alignment." | 9756 | rows and columns and the column alignment." |
| 9669 | (interactive) | 9757 | (interactive) |
| 9670 | (let* ((rows (or rows (string-to-number (read-string "Row size: ")))) | 9758 | (let* ((rows (or rows (read-number "Number of Rows: "))) |
| 9671 | (columns (or columns (string-to-number (read-string "Column size: ")))) | 9759 | (columns (or columns (read-number "Number of Columns: "))) |
| 9672 | (align (or align (read-string "Alignment ([l]eft, [r]ight, [c]enter, or RET for default): "))) | 9760 | (align (or align (read-string "Alignment ([l]eft, [r]ight, [c]enter, or RET for default): "))) |
| 9673 | (align (cond ((equal align "l") ":--") | 9761 | (align (cond ((equal align "l") ":--") |
| 9674 | ((equal align "r") "--:") | 9762 | ((equal align "r") "--:") |
diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el index fc46e05..d3c1da8 100644 --- a/.emacs.d/lisp/yaml-mode.el +++ b/.emacs.d/lisp/yaml-mode.el | |||
| @@ -123,7 +123,7 @@ that key is pressed to begin a block literal." | |||
| 123 | "Regexp matching a line containing only (valid) whitespace.") | 123 | "Regexp matching a line containing only (valid) whitespace.") |
| 124 | 124 | ||
| 125 | (defconst yaml-directive-re "^\\(?:--- \\)? *%\\(\\w+\\)" | 125 | (defconst yaml-directive-re "^\\(?:--- \\)? *%\\(\\w+\\)" |
| 126 | "Regexp matching a line contatining a YAML directive.") | 126 | "Regexp matching a line containing a YAML directive.") |
| 127 | 127 | ||
| 128 | (defconst yaml-document-delimiter-re "^\\(?:---\\|[.][.][.]\\)" | 128 | (defconst yaml-document-delimiter-re "^\\(?:---\\|[.][.][.]\\)" |
| 129 | "Rexexp matching a YAML document delimiter line.") | 129 | "Rexexp matching a YAML document delimiter line.") |
| @@ -368,11 +368,9 @@ back-dent the line by `yaml-indent-offset' spaces. On reaching column | |||
| 368 | (let ((ci (current-indentation)) | 368 | (let ((ci (current-indentation)) |
| 369 | (need (yaml-compute-indentation))) | 369 | (need (yaml-compute-indentation))) |
| 370 | (save-excursion | 370 | (save-excursion |
| 371 | (beginning-of-line) | ||
| 372 | (delete-horizontal-space) | ||
| 373 | (if (and (equal last-command this-command) (/= ci 0)) | 371 | (if (and (equal last-command this-command) (/= ci 0)) |
| 374 | (indent-to (* (/ (- ci 1) yaml-indent-offset) yaml-indent-offset)) | 372 | (indent-line-to (* (/ (- ci 1) yaml-indent-offset) yaml-indent-offset)) |
| 375 | (indent-to need))) | 373 | (indent-line-to need))) |
| 376 | (if (< (current-column) (current-indentation)) | 374 | (if (< (current-column) (current-indentation)) |
| 377 | (forward-to-indentation 0)))) | 375 | (forward-to-indentation 0)))) |
| 378 | 376 | ||
