diff options
Diffstat (limited to '.emacs.d/lisp/markdown-mode.el')
| -rw-r--r-- | .emacs.d/lisp/markdown-mode.el | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el index 9c52cd3..a4d08fd 100644 --- a/.emacs.d/lisp/markdown-mode.el +++ b/.emacs.d/lisp/markdown-mode.el | |||
| @@ -2656,7 +2656,8 @@ intact additional processing." | |||
| 2656 | (match-beginning 5) (match-end 5))))))))) | 2656 | (match-beginning 5) (match-end 5))))))))) |
| 2657 | 2657 | ||
| 2658 | (defun markdown-get-defined-references () | 2658 | (defun markdown-get-defined-references () |
| 2659 | "Return all defined reference labels and their line numbers (not including square brackets)." | 2659 | "Return all defined reference labels and their line numbers. |
| 2660 | They does not include square brackets)." | ||
| 2660 | (save-excursion | 2661 | (save-excursion |
| 2661 | (goto-char (point-min)) | 2662 | (goto-char (point-min)) |
| 2662 | (let (refs) | 2663 | (let (refs) |
| @@ -3916,7 +3917,7 @@ This is an internal function called by | |||
| 3916 | (markdown-insert-uri uri)))))) | 3917 | (markdown-insert-uri uri)))))) |
| 3917 | 3918 | ||
| 3918 | (defun markdown-insert-link () | 3919 | (defun markdown-insert-link () |
| 3919 | "Insert new or update an existing link, with interactive prompts. | 3920 | "Insert new or update an existing link, with interactive prompt. |
| 3920 | If the point is at an existing link or URL, update the link text, | 3921 | If the point is at an existing link or URL, update the link text, |
| 3921 | URL, reference label, and/or title. Otherwise, insert a new link. | 3922 | URL, reference label, and/or title. Otherwise, insert a new link. |
| 3922 | The type of link inserted (inline, reference, or plain URL) | 3923 | The type of link inserted (inline, reference, or plain URL) |
| @@ -3951,7 +3952,7 @@ selectively adding or removing information via the prompts." | |||
| 3951 | (markdown--insert-link-or-image nil)) | 3952 | (markdown--insert-link-or-image nil)) |
| 3952 | 3953 | ||
| 3953 | (defun markdown-insert-image () | 3954 | (defun markdown-insert-image () |
| 3954 | "Insert new or update an existing image, with interactive prompts. | 3955 | "Insert new or update an existing image, with interactive prompt. |
| 3955 | If the point is at an existing image, update the alt text, URL, | 3956 | If the point is at an existing image, update the alt text, URL, |
| 3956 | reference label, and/or title. Otherwise, insert a new image. | 3957 | reference label, and/or title. Otherwise, insert a new image. |
| 3957 | The type of image inserted (inline or reference) depends on which | 3958 | The type of image inserted (inline or reference) depends on which |
| @@ -8233,6 +8234,9 @@ markers and footnote text." | |||
| 8233 | ;; Reference definition | 8234 | ;; Reference definition |
| 8234 | ((thing-at-point-looking-at markdown-regex-reference-definition) | 8235 | ((thing-at-point-looking-at markdown-regex-reference-definition) |
| 8235 | (markdown-reference-goto-link (match-string-no-properties 2))) | 8236 | (markdown-reference-goto-link (match-string-no-properties 2))) |
| 8237 | ;; Link | ||
| 8238 | ((or (markdown-link-p) (markdown-wiki-link-p)) | ||
| 8239 | (markdown-follow-thing-at-point nil)) | ||
| 8236 | ;; GFM task list item | 8240 | ;; GFM task list item |
| 8237 | ((markdown-gfm-task-list-item-at-point) | 8241 | ((markdown-gfm-task-list-item-at-point) |
| 8238 | (markdown-toggle-gfm-checkbox)) | 8242 | (markdown-toggle-gfm-checkbox)) |
| @@ -8797,7 +8801,8 @@ at the END of code blocks." | |||
| 8797 | (goto-char (- beg 1)) | 8801 | (goto-char (- beg 1)) |
| 8798 | (let ((block-indentation (current-indentation))) | 8802 | (let ((block-indentation (current-indentation))) |
| 8799 | (when (> block-indentation 0) | 8803 | (when (> block-indentation 0) |
| 8800 | (indent-rigidly beg end block-indentation)))) | 8804 | (indent-rigidly beg end block-indentation))) |
| 8805 | (font-lock-ensure)) | ||
| 8801 | 8806 | ||
| 8802 | (defun markdown-edit-code-block () | 8807 | (defun markdown-edit-code-block () |
| 8803 | "Edit Markdown code block in an indirect buffer." | 8808 | "Edit Markdown code block in an indirect buffer." |
| @@ -8805,8 +8810,8 @@ at the END of code blocks." | |||
| 8805 | (save-excursion | 8810 | (save-excursion |
| 8806 | (if (fboundp 'edit-indirect-region) | 8811 | (if (fboundp 'edit-indirect-region) |
| 8807 | (let* ((bounds (markdown-get-enclosing-fenced-block-construct)) | 8812 | (let* ((bounds (markdown-get-enclosing-fenced-block-construct)) |
| 8808 | (begin (and bounds (goto-char (nth 0 bounds)) (point-at-bol 2))) | 8813 | (begin (and bounds (not (null (nth 0 bounds))) (goto-char (nth 0 bounds)) (point-at-bol 2))) |
| 8809 | (end (and bounds (goto-char (nth 1 bounds)) (point-at-bol 1)))) | 8814 | (end (and bounds(not (null (nth 1 bounds))) (goto-char (nth 1 bounds)) (point-at-bol 1)))) |
| 8810 | (if (and begin end) | 8815 | (if (and begin end) |
| 8811 | (let* ((indentation (and (goto-char (nth 0 bounds)) (current-indentation))) | 8816 | (let* ((indentation (and (goto-char (nth 0 bounds)) (current-indentation))) |
| 8812 | (lang (markdown-code-block-lang)) | 8817 | (lang (markdown-code-block-lang)) |
| @@ -8816,7 +8821,7 @@ at the END of code blocks." | |||
| 8816 | (lambda (_parent-buffer _beg _end) | 8821 | (lambda (_parent-buffer _beg _end) |
| 8817 | (funcall mode))) | 8822 | (funcall mode))) |
| 8818 | (indirect-buf (edit-indirect-region begin end 'display-buffer))) | 8823 | (indirect-buf (edit-indirect-region begin end 'display-buffer))) |
| 8819 | ;; reset `sh-shell' when indirect buffer | 8824 | ;; reset `sh-shell' when indirect buffer |
| 8820 | (when (and (not (member system-type '(ms-dos windows-nt))) | 8825 | (when (and (not (member system-type '(ms-dos windows-nt))) |
| 8821 | (member mode '(shell-script-mode sh-mode)) | 8826 | (member mode '(shell-script-mode sh-mode)) |
| 8822 | (member lang (append | 8827 | (member lang (append |
| @@ -9640,22 +9645,21 @@ rows and columns and the column alignment." | |||
| 9640 | (thing-at-point-looking-at markdown-regex-link-reference)) | 9645 | (thing-at-point-looking-at markdown-regex-link-reference)) |
| 9641 | (or markdown-hide-urls markdown-hide-markup)) | 9646 | (or markdown-hide-urls markdown-hide-markup)) |
| 9642 | (let* ((imagep (string-equal (match-string 1) "!")) | 9647 | (let* ((imagep (string-equal (match-string 1) "!")) |
| 9648 | (referencep (string-equal (match-string 5) "[")) | ||
| 9649 | (link (match-string-no-properties 6)) | ||
| 9643 | (edit-keys (markdown--substitute-command-keys | 9650 | (edit-keys (markdown--substitute-command-keys |
| 9644 | (if imagep | 9651 | (if imagep |
| 9645 | "\\[markdown-insert-image]" | 9652 | "\\[markdown-insert-image]" |
| 9646 | "\\[markdown-insert-link]"))) | 9653 | "\\[markdown-insert-link]"))) |
| 9647 | (edit-str (propertize edit-keys 'face 'font-lock-constant-face)) | 9654 | (edit-str (propertize edit-keys 'face 'font-lock-constant-face)) |
| 9648 | (referencep (string-equal (match-string 5) "[")) | ||
| 9649 | (object (if referencep "reference" "URL"))) | 9655 | (object (if referencep "reference" "URL"))) |
| 9650 | (format "Hidden %s (%s to edit): %s" object edit-str | 9656 | (format "Hidden %s (%s to edit): %s" object edit-str |
| 9651 | (if referencep | 9657 | (if referencep |
| 9652 | (concat | 9658 | (concat |
| 9653 | (propertize "[" 'face 'markdown-markup-face) | 9659 | (propertize "[" 'face 'markdown-markup-face) |
| 9654 | (propertize (match-string-no-properties 6) | 9660 | (propertize link 'face 'markdown-reference-face) |
| 9655 | 'face 'markdown-reference-face) | ||
| 9656 | (propertize "]" 'face 'markdown-markup-face)) | 9661 | (propertize "]" 'face 'markdown-markup-face)) |
| 9657 | (propertize (match-string-no-properties 6) | 9662 | (propertize link 'face 'markdown-url-face))))) |
| 9658 | 'face 'markdown-url-face))))) | ||
| 9659 | ;; Hidden language name for fenced code blocks | 9663 | ;; Hidden language name for fenced code blocks |
| 9660 | ((and (markdown-code-block-at-point-p) | 9664 | ((and (markdown-code-block-at-point-p) |
| 9661 | (not (get-text-property (point) 'markdown-pre)) | 9665 | (not (get-text-property (point) 'markdown-pre)) |
