branch: elpa/yaml-mode
commit fc7bac0f10ca5779117376e717c3c2206cf4d708
Author: Vasilij Schneidermann <[email protected]>
Commit: Vasilij Schneidermann <[email protected]>
Formatting fixes
---
yaml-mode.el | 47 +++++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/yaml-mode.el b/yaml-mode.el
index 25848e8..fd6b087 100644
--- a/yaml-mode.el
+++ b/yaml-mode.el
@@ -290,23 +290,26 @@ artificially limitted to the value of
(let ((begin (point))
(end (min (1+ (point-at-eol)) bound)))
(goto-char (point-at-bol))
- (while (and (looking-at yaml-blank-line-re) (not (bobp)))
+ (while (and (looking-at yaml-blank-line-re)
+ (not (bobp)))
(forward-line -1))
(let ((nlines yaml-block-literal-search-lines)
(min-level (current-indentation)))
- (forward-line -1)
- (while (and (/= nlines 0)
- (/= min-level 0)
- (not (looking-at yaml-block-literal-re))
- (not (bobp)))
- (set 'nlines (1- nlines))
- (unless (looking-at yaml-blank-line-re)
- (set 'min-level (min min-level (current-indentation))))
- (forward-line -1))
- (cond
- ((and (< (current-indentation) min-level)
- (looking-at yaml-block-literal-re))
- (goto-char end) (set-match-data (list begin end)) t)
+ (forward-line -1)
+ (while (and (/= nlines 0)
+ (/= min-level 0)
+ (not (looking-at yaml-block-literal-re))
+ (not (bobp)))
+ (setq nlines (1- nlines))
+ (unless (looking-at yaml-blank-line-re)
+ (setq min-level (min min-level (current-indentation))))
+ (forward-line -1))
+ (cond
+ ((and (< (current-indentation) min-level)
+ (looking-at yaml-block-literal-re))
+ (goto-char end)
+ (set-match-data (list begin end))
+ t)
((progn
(goto-char begin)
(re-search-forward (concat yaml-block-literal-re
@@ -347,8 +350,8 @@ back-dent the line by `yaml-indent-offset' spaces. On
reaching column
(if (and (equal last-command this-command) (/= ci 0))
(indent-to (* (/ (- ci 1) yaml-indent-offset) yaml-indent-offset))
(indent-to need)))
- (if (< (current-column) (current-indentation))
- (forward-to-indentation 0))))
+ (if (< (current-column) (current-indentation))
+ (forward-to-indentation 0))))
(defun yaml-electric-backspace (arg)
"Delete characters or back-dent the current line.
@@ -392,8 +395,8 @@ margin."
(self-insert-command (prefix-numeric-value arg))
(save-excursion
(beginning-of-line)
- (if (and (not arg) (looking-at yaml-document-delimiter-re))
- (delete-horizontal-space))))
+ (when (and (not arg) (looking-at yaml-document-delimiter-re))
+ (delete-horizontal-space))))
(defun yaml-narrow-to-block-literal ()
"Narrow the buffer to block literal if the point is in it,
@@ -411,13 +414,13 @@ otherwise do nothing."
(/= min-level 0)
(not (looking-at-p yaml-block-literal-re))
(not (bobp)))
- (set 'nlines (1- nlines))
+ (setq nlines (1- nlines))
(unless (looking-at-p yaml-blank-line-re)
- (set 'min-level (min min-level (current-indentation))))
+ (setq min-level (min min-level (current-indentation))))
(forward-line -1))
(when (and (< (current-indentation) min-level)
- (looking-at-p yaml-block-literal-re))
- (set 'min-level (current-indentation))
+ (looking-at-p yaml-block-literal-re))
+ (setq min-level (current-indentation))
(forward-line)
(setq beg (point))
(while (and (not (eobp))