summaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/yaml-mode.el
diff options
context:
space:
mode:
authorSimeon Simeonov2022-01-10 20:42:06 +0100
committerSimeon Simeonov2022-01-10 20:42:06 +0100
commitae4133cda70f515a2d2930dd7e29bcd92ad7d058 (patch)
tree9ce29c05b85a54933b164e7de76d5025bac2bf1f /.emacs.d/lisp/yaml-mode.el
parentd2789616d100fdf4cc5263c75719616b4f4cbb7a (diff)
Update markdown-mode and yaml-mode
Diffstat (limited to '.emacs.d/lisp/yaml-mode.el')
-rw-r--r--.emacs.d/lisp/yaml-mode.el56
1 files changed, 27 insertions, 29 deletions
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
3670, it will cycle back to the maximum sensible indentation." 3660, 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.