diff options
| author | Simeon Simeonov | 2022-01-10 20:42:06 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2022-01-10 20:42:06 +0100 |
| commit | ae4133cda70f515a2d2930dd7e29bcd92ad7d058 (patch) | |
| tree | 9ce29c05b85a54933b164e7de76d5025bac2bf1f | |
| parent | d2789616d100fdf4cc5263c75719616b4f4cbb7a (diff) | |
Update markdown-mode and yaml-mode
| -rw-r--r-- | .emacs.d/lisp/markdown-mode.el | 28 | ||||
| -rw-r--r-- | .emacs.d/lisp/yaml-mode.el | 56 |
2 files changed, 43 insertions, 41 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)) |
diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el index 9d619d5..666f128 100644 --- a/.emacs.d/lisp/yaml-mode.el +++ b/.emacs.d/lisp/yaml-mode.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; yaml-mode.el --- Major mode for editing YAML files | 1 | ;;; yaml-mode.el --- Major mode for editing YAML files -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2010-2014 Yoshiki Kurihara | 3 | ;; Copyright (C) 2010-2014 Yoshiki Kurihara |
| 4 | 4 | ||
| @@ -12,19 +12,18 @@ | |||
| 12 | 12 | ||
| 13 | ;; This file is not part of Emacs | 13 | ;; This file is not part of Emacs |
| 14 | 14 | ||
| 15 | ;; This file is free software; you can redistribute it and/or modify | 15 | ;; This program is free software; you can redistribute it and/or modify |
| 16 | ;; it under the terms of the GNU General Public License as published by | 16 | ;; it under the terms of the GNU General Public License as published by |
| 17 | ;; the Free Software Foundation; either version 2, or (at your option) | 17 | ;; the Free Software Foundation, either version 3 of the License, or |
| 18 | ;; any later version. | 18 | ;; (at your option) any later version. |
| 19 | 19 | ||
| 20 | ;; This file is distributed in the hope that it will be useful, | 20 | ;; This program is distributed in the hope that it will be useful, |
| 21 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 21 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | ;; GNU General Public License for more details. | 23 | ;; GNU General Public License for more details. |
| 24 | 24 | ||
| 25 | ;; You should have received a copy of the GNU General Public License along | 25 | ;; You should have received a copy of the GNU General Public License |
| 26 | ;; with this program; if not, write to the Free Software Foundation, Inc., | 26 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 27 | ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 28 | 27 | ||
| 29 | ;;; Commentary: | 28 | ;;; Commentary: |
| 30 | 29 | ||
| @@ -103,8 +102,8 @@ that key is pressed to begin a block literal." | |||
| 103 | :group 'yaml) | 102 | :group 'yaml) |
| 104 | 103 | ||
| 105 | (defface yaml-tab-face | 104 | (defface yaml-tab-face |
| 106 | '((((class color)) (:background "red" :foreground "red" :bold t)) | 105 | '((((class color)) (:background "red" :foreground "red" :bold t)) |
| 107 | (t (:reverse-video t))) | 106 | (t (:reverse-video t))) |
| 108 | "Face to use for highlighting tabs in YAML files." | 107 | "Face to use for highlighting tabs in YAML files." |
| 109 | :group 'faces | 108 | :group 'faces |
| 110 | :group 'yaml) | 109 | :group 'yaml) |
| @@ -243,7 +242,7 @@ that key is pressed to begin a block literal." | |||
| 243 | (,yaml-document-delimiter-re . (0 font-lock-comment-face)) | 242 | (,yaml-document-delimiter-re . (0 font-lock-comment-face)) |
| 244 | (,yaml-directive-re . (1 font-lock-builtin-face)) | 243 | (,yaml-directive-re . (1 font-lock-builtin-face)) |
| 245 | ("^[\t]+" 0 'yaml-tab-face t)) | 244 | ("^[\t]+" 0 'yaml-tab-face t)) |
| 246 | "Additional expressions to highlight in YAML mode.") | 245 | "Additional expressions to highlight in YAML mode.") |
| 247 | 246 | ||
| 248 | (defun yaml-mode-syntax-propertize-function (beg end) | 247 | (defun yaml-mode-syntax-propertize-function (beg end) |
| 249 | "Override buffer's syntax table for special syntactic constructs." | 248 | "Override buffer's syntax table for special syntactic constructs." |
| @@ -367,7 +366,6 @@ back-dent the line by `yaml-indent-offset' spaces. On reaching column | |||
| 367 | 0, it will cycle back to the maximum sensible indentation." | 366 | 0, it will cycle back to the maximum sensible indentation." |
| 368 | (interactive "*") | 367 | (interactive "*") |
| 369 | (let ((ci (current-indentation)) | 368 | (let ((ci (current-indentation)) |
| 370 | (cc (current-column)) | ||
| 371 | (need (yaml-compute-indentation))) | 369 | (need (yaml-compute-indentation))) |
| 372 | (save-excursion | 370 | (save-excursion |
| 373 | (beginning-of-line) | 371 | (beginning-of-line) |
| @@ -432,27 +430,27 @@ otherwise do nothing." | |||
| 432 | (while (and (looking-at-p yaml-blank-line-re) (not (bobp))) | 430 | (while (and (looking-at-p yaml-blank-line-re) (not (bobp))) |
| 433 | (forward-line -1)) | 431 | (forward-line -1)) |
| 434 | (let ((nlines yaml-block-literal-search-lines) | 432 | (let ((nlines yaml-block-literal-search-lines) |
| 435 | (min-level (current-indentation)) | 433 | (min-level (current-indentation)) |
| 436 | beg) | 434 | beg) |
| 437 | (forward-line -1) | 435 | (forward-line -1) |
| 438 | (while (and (/= nlines 0) | 436 | (while (and (/= nlines 0) |
| 439 | (/= min-level 0) | 437 | (/= min-level 0) |
| 440 | (not (looking-at-p yaml-block-literal-re)) | 438 | (not (looking-at-p yaml-block-literal-re)) |
| 441 | (not (bobp))) | 439 | (not (bobp))) |
| 442 | (setq nlines (1- nlines)) | 440 | (setq nlines (1- nlines)) |
| 443 | (unless (looking-at-p yaml-blank-line-re) | 441 | (unless (looking-at-p yaml-blank-line-re) |
| 444 | (setq min-level (min min-level (current-indentation)))) | 442 | (setq min-level (min min-level (current-indentation)))) |
| 445 | (forward-line -1)) | 443 | (forward-line -1)) |
| 446 | (when (and (< (current-indentation) min-level) | 444 | (when (and (< (current-indentation) min-level) |
| 447 | (looking-at-p yaml-block-literal-re)) | 445 | (looking-at-p yaml-block-literal-re)) |
| 448 | (setq min-level (current-indentation)) | 446 | (setq min-level (current-indentation)) |
| 449 | (forward-line) | 447 | (forward-line) |
| 450 | (setq beg (point)) | 448 | (setq beg (point)) |
| 451 | (while (and (not (eobp)) | 449 | (while (and (not (eobp)) |
| 452 | (or (looking-at-p yaml-blank-line-re) | 450 | (or (looking-at-p yaml-blank-line-re) |
| 453 | (> (current-indentation) min-level))) | 451 | (> (current-indentation) min-level))) |
| 454 | (forward-line)) | 452 | (forward-line)) |
| 455 | (narrow-to-region beg (point)))))) | 453 | (narrow-to-region beg (point)))))) |
| 456 | 454 | ||
| 457 | (defun yaml-fill-paragraph (&optional justify region) | 455 | (defun yaml-fill-paragraph (&optional justify region) |
| 458 | "Fill paragraph. | 456 | "Fill paragraph. |
