From ae4133cda70f515a2d2930dd7e29bcd92ad7d058 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 10 Jan 2022 20:42:06 +0100 Subject: Update markdown-mode and yaml-mode --- .emacs.d/lisp/markdown-mode.el | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to '.emacs.d/lisp/markdown-mode.el') 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." (match-beginning 5) (match-end 5))))))))) (defun markdown-get-defined-references () - "Return all defined reference labels and their line numbers (not including square brackets)." + "Return all defined reference labels and their line numbers. +They does not include square brackets)." (save-excursion (goto-char (point-min)) (let (refs) @@ -3916,7 +3917,7 @@ This is an internal function called by (markdown-insert-uri uri)))))) (defun markdown-insert-link () - "Insert new or update an existing link, with interactive prompts. + "Insert new or update an existing link, with interactive prompt. If the point is at an existing link or URL, update the link text, URL, reference label, and/or title. Otherwise, insert a new link. The type of link inserted (inline, reference, or plain URL) @@ -3951,7 +3952,7 @@ selectively adding or removing information via the prompts." (markdown--insert-link-or-image nil)) (defun markdown-insert-image () - "Insert new or update an existing image, with interactive prompts. + "Insert new or update an existing image, with interactive prompt. If the point is at an existing image, update the alt text, URL, reference label, and/or title. Otherwise, insert a new image. The type of image inserted (inline or reference) depends on which @@ -8233,6 +8234,9 @@ markers and footnote text." ;; Reference definition ((thing-at-point-looking-at markdown-regex-reference-definition) (markdown-reference-goto-link (match-string-no-properties 2))) + ;; Link + ((or (markdown-link-p) (markdown-wiki-link-p)) + (markdown-follow-thing-at-point nil)) ;; GFM task list item ((markdown-gfm-task-list-item-at-point) (markdown-toggle-gfm-checkbox)) @@ -8797,7 +8801,8 @@ at the END of code blocks." (goto-char (- beg 1)) (let ((block-indentation (current-indentation))) (when (> block-indentation 0) - (indent-rigidly beg end block-indentation)))) + (indent-rigidly beg end block-indentation))) + (font-lock-ensure)) (defun markdown-edit-code-block () "Edit Markdown code block in an indirect buffer." @@ -8805,8 +8810,8 @@ at the END of code blocks." (save-excursion (if (fboundp 'edit-indirect-region) (let* ((bounds (markdown-get-enclosing-fenced-block-construct)) - (begin (and bounds (goto-char (nth 0 bounds)) (point-at-bol 2))) - (end (and bounds (goto-char (nth 1 bounds)) (point-at-bol 1)))) + (begin (and bounds (not (null (nth 0 bounds))) (goto-char (nth 0 bounds)) (point-at-bol 2))) + (end (and bounds(not (null (nth 1 bounds))) (goto-char (nth 1 bounds)) (point-at-bol 1)))) (if (and begin end) (let* ((indentation (and (goto-char (nth 0 bounds)) (current-indentation))) (lang (markdown-code-block-lang)) @@ -8816,7 +8821,7 @@ at the END of code blocks." (lambda (_parent-buffer _beg _end) (funcall mode))) (indirect-buf (edit-indirect-region begin end 'display-buffer))) - ;; reset `sh-shell' when indirect buffer + ;; reset `sh-shell' when indirect buffer (when (and (not (member system-type '(ms-dos windows-nt))) (member mode '(shell-script-mode sh-mode)) (member lang (append @@ -9640,22 +9645,21 @@ rows and columns and the column alignment." (thing-at-point-looking-at markdown-regex-link-reference)) (or markdown-hide-urls markdown-hide-markup)) (let* ((imagep (string-equal (match-string 1) "!")) + (referencep (string-equal (match-string 5) "[")) + (link (match-string-no-properties 6)) (edit-keys (markdown--substitute-command-keys (if imagep "\\[markdown-insert-image]" "\\[markdown-insert-link]"))) (edit-str (propertize edit-keys 'face 'font-lock-constant-face)) - (referencep (string-equal (match-string 5) "[")) (object (if referencep "reference" "URL"))) (format "Hidden %s (%s to edit): %s" object edit-str (if referencep (concat (propertize "[" 'face 'markdown-markup-face) - (propertize (match-string-no-properties 6) - 'face 'markdown-reference-face) + (propertize link 'face 'markdown-reference-face) (propertize "]" 'face 'markdown-markup-face)) - (propertize (match-string-no-properties 6) - 'face 'markdown-url-face))))) + (propertize link 'face 'markdown-url-face))))) ;; Hidden language name for fenced code blocks ((and (markdown-code-block-at-point-p) (not (get-text-property (point) 'markdown-pre)) -- cgit v1.3