From 6e2fd11672162c59e643415ea0a6072c14e9bc35 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Wed, 20 May 2009 13:00:52 -0700 Subject: [PATCH 1/9] [Emacs] Fix the Haml indentation for Ruby block openers. --- extra/haml-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/haml-mode.el b/extra/haml-mode.el index 57a84767..7a8f3b4e 100644 --- a/extra/haml-mode.el +++ b/extra/haml-mode.el @@ -64,7 +64,7 @@ a specific level to which the current line could be indented.") (defvar haml-block-openers `("^ *\\([%\\.#][a-z0-9_:\\-]*\\)+\\({.*}\\)?\\(\\[.*\\]\\)?[><]*[ \t]*$" "^ *[&!]?[-=~].*do[ \t]*\\(|.*|[ \t]*\\)?$" - ,(concat "^ *[&!][-=~][ \t]*\\(" + ,(concat "^ *[&!]?[-=~][ \t]*\\(" (regexp-opt '("if" "unless" "while" "until" "else" "begin" "elsif" "rescue" "ensure" "when")) "\\)") From 82e1bebea2b1eb87e503bda5eed048c872b68435 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 24 May 2009 13:09:00 -0700 Subject: [PATCH 2/9] [Emacs] Fix an infinite loop bug in multiline-hash indentation. --- extra/haml-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/haml-mode.el b/extra/haml-mode.el index 7a8f3b4e..29db2d8d 100644 --- a/extra/haml-mode.el +++ b/extra/haml-mode.el @@ -146,7 +146,7 @@ For example, this will highlight all of the following: (haml-limited-forward-sexp eol) ;; Check for multiline - (while (and (eolp) (eq (char-before) ?,)) + (while (and (eolp) (eq (char-before) ?,) (not (eobp))) (forward-line) (let ((eol (save-excursion (end-of-line) (point)))) ;; If no sexps are closed, @@ -229,7 +229,7 @@ whichever comes first." ;; Move through multiline attrs (when (eq (char-before) ?,) (save-excursion - (while (progn (end-of-line) (eq (char-before) ?,)) + (while (progn (end-of-line) (eq (char-before) ?,) (not (eobp))) (forward-line)) (forward-line -1) From dde54ed9354a1d7298bbafbdab7f188af422fb46 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 24 May 2009 14:33:03 -0700 Subject: [PATCH 3/9] [Emacs] Fix a silly error. --- extra/haml-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/haml-mode.el b/extra/haml-mode.el index 29db2d8d..201e3a25 100644 --- a/extra/haml-mode.el +++ b/extra/haml-mode.el @@ -142,7 +142,7 @@ For example, this will highlight all of the following: ;; Highlight attr hashes (when (eq (char-after) ?\{) - (let ((beg (+ 1 (point)))) + (let ((beg (point))) (haml-limited-forward-sexp eol) ;; Check for multiline @@ -158,7 +158,7 @@ For example, this will highlight all of the following: (goto-char beg) (haml-limited-forward-sexp eol)))) - (haml-fontify-region-as-ruby beg (point)))) + (haml-fontify-region-as-ruby (+ 1 beg) (point)))) ;; Move past end chars (when (looking-at "[<>&!]+") (goto-char (match-end 0))) From 381e824213d87cc00738fe726d001c985ee2e857 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Mon, 25 May 2009 00:23:10 -0700 Subject: [PATCH 4/9] [Emacs] Indent multiline attribute hashes better. --- extra/haml-mode.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/extra/haml-mode.el b/extra/haml-mode.el index 201e3a25..fa767017 100644 --- a/extra/haml-mode.el +++ b/extra/haml-mode.el @@ -445,7 +445,7 @@ character of the next line." (return-from haml-indent-p (if (eq (char-before) ?,) (cdr (assq 'hash-indent attr-props)) (beginning-of-line) - (+ (cdr (assq 'indent attr-props)) haml-indent-offset))))) + (list (+ (cdr (assq 'indent attr-props)) haml-indent-offset) nil))))) (loop for opener in haml-block-openers if (looking-at opener) return t finally return nil)) @@ -483,13 +483,14 @@ beginning the hash." "Calculate the maximum sensible indentation for the current line." (save-excursion (beginning-of-line) - (if (bobp) 0 + (if (bobp) (list 0 nil) (haml-forward-through-whitespace t) (let ((indent (funcall haml-indent-function))) (cond - ((integerp indent) indent) - (indent (+ (current-indentation) haml-indent-offset)) - (t (current-indentation))))))) + ((consp indent) indent) + ((integerp indent) (list indent t)) + (indent (list (+ (current-indentation) haml-indent-offset) nil)) + (t (list (current-indentation) nil))))))) (defun haml-indent-region (start end) "Indent each nonblank line in the region. @@ -507,7 +508,7 @@ between possible indentations." (next-line-column (if (and (equal last-command this-command) (/= (current-indentation) 0)) (* (/ (- (current-indentation) 1) haml-indent-offset) haml-indent-offset) - (haml-compute-indentation)))) + (car (haml-compute-indentation))))) (while (< (point) end) (setq this-line-column next-line-column current-column (current-indentation)) @@ -532,16 +533,16 @@ back-dent the line by `haml-indent-offset' spaces. On reaching column 0, it will cycle back to the maximum sensible indentation." (interactive "*") (let ((ci (current-indentation)) - (cc (current-column)) - (need (haml-compute-indentation))) - (save-excursion - (beginning-of-line) - (delete-horizontal-space) - (if (and (equal last-command this-command) (/= ci 0)) - (indent-to (* (/ (- ci 1) haml-indent-offset) haml-indent-offset)) - (indent-to need))) - (if (< (current-column) (current-indentation)) - (forward-to-indentation 0)))) + (cc (current-column))) + (destructuring-bind (need strict) (haml-compute-indentation) + (save-excursion + (beginning-of-line) + (delete-horizontal-space) + (if (and (not strict) (equal last-command this-command) (/= ci 0)) + (indent-to (* (/ (- ci 1) haml-indent-offset) haml-indent-offset)) + (indent-to need)))) + (when (< (current-column) (current-indentation)) + (forward-to-indentation 0)))) (defun haml-reindent-region-by (n) "Add N spaces to the beginning of each line in the region. From 1eb878c447b747788b113dd9bfbb1902dd655414 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Tue, 26 May 2009 14:19:12 -0700 Subject: [PATCH 5/9] Make edge-gem list the version number in the commit. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 186a95b0..dff6a5e1 100644 --- a/Rakefile +++ b/Rakefile @@ -104,7 +104,7 @@ task :release_edge do end edge_version = edge_version.join('.') File.open('EDGE_GEM_VERSION', 'w') {|f| f.puts(edge_version)} - sh %{git commit -m "Bump edge gem version." EDGE_GEM_VERSION} + sh %{git commit -m "Bump edge gem version to #{edge_version}." EDGE_GEM_VERSION} sh %{git push origin edge-gem} # Package the edge gem with the proper version From 1c88719ead03ad33b105f417bc99fd768e7ae5e5 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Wed, 27 May 2009 02:03:23 -0700 Subject: [PATCH 6/9] [Sass] Don't add a line for empty @import statements. --- lib/sass/tree/file_node.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sass/tree/file_node.rb b/lib/sass/tree/file_node.rb index 6785894f..9d8c9706 100644 --- a/lib/sass/tree/file_node.rb +++ b/lib/sass/tree/file_node.rb @@ -7,12 +7,14 @@ module Sass end def to_s(*args) - super() + @to_s ||= super() rescue Sass::SyntaxError => e e.add_backtrace_entry(@filename) raise e end + def invisible?; to_s.empty?; end + protected def perform!(environment) From e1817a03bfff7a65b36378ee5418ac34016f6e6e Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Wed, 27 May 2009 11:38:40 -0700 Subject: [PATCH 7/9] [Emacs] Properly highlight Sass stuff with underscores. --- extra/sass-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/sass-mode.el b/extra/sass-mode.el index 837b2d76..6bb50cb4 100644 --- a/extra/sass-mode.el +++ b/extra/sass-mode.el @@ -72,6 +72,7 @@ text nested beneath them.") (defconst sass-syntax-table (let ((st (make-syntax-table))) (modify-syntax-entry ?- "w" st) + (modify-syntax-entry ?_ "w" st) st)) (defconst sass-script-syntax-table From 3976fb508453d5a01d598ea902be311c6c2cba91 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Mon, 1 Jun 2009 00:31:46 -0700 Subject: [PATCH 8/9] [Sass] Allow absolute-path imports. --- lib/sass/files.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/sass/files.rb b/lib/sass/files.rb index f1a970f3..9c5bea21 100644 --- a/lib/sass/files.rb +++ b/lib/sass/files.rb @@ -1,4 +1,5 @@ require 'digest/sha1' +require 'pathname' module Sass # This module contains various bits of functionality @@ -88,9 +89,15 @@ module Sass end def find_full_path(filename, load_paths) - segments = filename.split(File::SEPARATOR) - segments.push "_#{segments.pop}" - partial_name = segments.join(File::SEPARATOR) + partial_name = File.join(File.dirname(filename), "_#{File.basename(filename)}") + + if Pathname.new(filename).absolute? + [partial_name, filename].each do |name| + return name if File.readable?(name) + end + return nil + end + load_paths.each do |path| [partial_name, filename].each do |name| full_path = File.join(path, name) From 1a6df373e547f8e13cbda74fc9331f77eb8ca6fc Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Mon, 1 Jun 2009 00:50:07 -0700 Subject: [PATCH 9/9] [Sass] Properly strip whitespace from imported files in :compressed mode. --- lib/sass/tree/file_node.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sass/tree/file_node.rb b/lib/sass/tree/file_node.rb index 9d8c9706..a752762e 100644 --- a/lib/sass/tree/file_node.rb +++ b/lib/sass/tree/file_node.rb @@ -7,7 +7,7 @@ module Sass end def to_s(*args) - @to_s ||= super() + @to_s ||= (style == :compressed ? super().strip : super()) rescue Sass::SyntaxError => e e.add_backtrace_entry(@filename) raise e