haml-edge 2.1.12 → 2.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/VERSION +1 -1
  3. data/extra/haml-mode.el +21 -20
  4. metadata +2 -2
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.12
1
+ 2.1.13
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.12
1
+ 2.1.13
data/extra/haml-mode.el CHANGED
@@ -142,11 +142,11 @@ For example, this will highlight all of the following:
142
142
 
143
143
  ;; Highlight attr hashes
144
144
  (when (eq (char-after) ?\{)
145
- (let ((beg (+ 1 (point))))
145
+ (let ((beg (point)))
146
146
  (haml-limited-forward-sexp eol)
147
147
 
148
148
  ;; Check for multiline
149
- (while (and (eolp) (eq (char-before) ?,))
149
+ (while (and (eolp) (eq (char-before) ?,) (not (eobp)))
150
150
  (forward-line)
151
151
  (let ((eol (save-excursion (end-of-line) (point))))
152
152
  ;; If no sexps are closed,
@@ -158,7 +158,7 @@ For example, this will highlight all of the following:
158
158
  (goto-char beg)
159
159
  (haml-limited-forward-sexp eol))))
160
160
 
161
- (haml-fontify-region-as-ruby beg (point))))
161
+ (haml-fontify-region-as-ruby (+ 1 beg) (point))))
162
162
 
163
163
  ;; Move past end chars
164
164
  (when (looking-at "[<>&!]+") (goto-char (match-end 0)))
@@ -229,7 +229,7 @@ whichever comes first."
229
229
  ;; Move through multiline attrs
230
230
  (when (eq (char-before) ?,)
231
231
  (save-excursion
232
- (while (progn (end-of-line) (eq (char-before) ?,))
232
+ (while (progn (end-of-line) (eq (char-before) ?,) (not (eobp)))
233
233
  (forward-line))
234
234
 
235
235
  (forward-line -1)
@@ -445,7 +445,7 @@ character of the next line."
445
445
  (return-from haml-indent-p
446
446
  (if (eq (char-before) ?,) (cdr (assq 'hash-indent attr-props))
447
447
  (beginning-of-line)
448
- (+ (cdr (assq 'indent attr-props)) haml-indent-offset)))))
448
+ (list (+ (cdr (assq 'indent attr-props)) haml-indent-offset) nil)))))
449
449
  (loop for opener in haml-block-openers
450
450
  if (looking-at opener) return t
451
451
  finally return nil))
@@ -483,13 +483,14 @@ beginning the hash."
483
483
  "Calculate the maximum sensible indentation for the current line."
484
484
  (save-excursion
485
485
  (beginning-of-line)
486
- (if (bobp) 0
486
+ (if (bobp) (list 0 nil)
487
487
  (haml-forward-through-whitespace t)
488
488
  (let ((indent (funcall haml-indent-function)))
489
489
  (cond
490
- ((integerp indent) indent)
491
- (indent (+ (current-indentation) haml-indent-offset))
492
- (t (current-indentation)))))))
490
+ ((consp indent) indent)
491
+ ((integerp indent) (list indent t))
492
+ (indent (list (+ (current-indentation) haml-indent-offset) nil))
493
+ (t (list (current-indentation) nil)))))))
493
494
 
494
495
  (defun haml-indent-region (start end)
495
496
  "Indent each nonblank line in the region.
@@ -507,7 +508,7 @@ between possible indentations."
507
508
  (next-line-column
508
509
  (if (and (equal last-command this-command) (/= (current-indentation) 0))
509
510
  (* (/ (- (current-indentation) 1) haml-indent-offset) haml-indent-offset)
510
- (haml-compute-indentation))))
511
+ (car (haml-compute-indentation)))))
511
512
  (while (< (point) end)
512
513
  (setq this-line-column next-line-column
513
514
  current-column (current-indentation))
@@ -532,16 +533,16 @@ back-dent the line by `haml-indent-offset' spaces. On reaching column
532
533
  0, it will cycle back to the maximum sensible indentation."
533
534
  (interactive "*")
534
535
  (let ((ci (current-indentation))
535
- (cc (current-column))
536
- (need (haml-compute-indentation)))
537
- (save-excursion
538
- (beginning-of-line)
539
- (delete-horizontal-space)
540
- (if (and (equal last-command this-command) (/= ci 0))
541
- (indent-to (* (/ (- ci 1) haml-indent-offset) haml-indent-offset))
542
- (indent-to need)))
543
- (if (< (current-column) (current-indentation))
544
- (forward-to-indentation 0))))
536
+ (cc (current-column)))
537
+ (destructuring-bind (need strict) (haml-compute-indentation)
538
+ (save-excursion
539
+ (beginning-of-line)
540
+ (delete-horizontal-space)
541
+ (if (and (not strict) (equal last-command this-command) (/= ci 0))
542
+ (indent-to (* (/ (- ci 1) haml-indent-offset) haml-indent-offset))
543
+ (indent-to need))))
544
+ (when (< (current-column) (current-indentation))
545
+ (forward-to-indentation 0))))
545
546
 
546
547
  (defun haml-reindent-region-by (n)
547
548
  "Add N spaces to the beginning of each line in the region.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.12
4
+ version: 2.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-05-20 00:00:00 -04:00
13
+ date: 2009-05-25 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16