summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org>2014-09-12 00:06:30 +0000
committerthakis@chromium.org <thakis@chromium.org>2014-09-12 00:06:30 +0000
commit80a221d3ac203103385d7ad0d67454f0b0b6a3ae (patch)
tree2c72c0c3226074b2193ddae6f63a148cd95f04ec
parent94b57d39a88ceb03e228804eec4b9013c5ea8b4c (diff)
downloadgyp-80a221d3ac203103385d7ad0d67454f0b0b6a3ae.tar.gz
Fix indentation for emacs and add missing keyword.
Closing brackets are now properly indented with the opening bracket. Also adds "cflags_cc" in the list of keywords BUG= Review URL: https://codereview.chromium.org/560263003/ R=gavinp@chromium.org Patch from Fabrice de Gans-Riberi <fdegans@chromium.org>! git-svn-id: http://gyp.googlecode.com/svn/trunk@1975 78cadc50-ecff-11dd-a971-7dbc132099af
-rw-r--r--tools/emacs/gyp.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/emacs/gyp.el b/tools/emacs/gyp.el
index 3db9f645..60619b52 100644
--- a/tools/emacs/gyp.el
+++ b/tools/emacs/gyp.el
@@ -15,14 +15,15 @@
"recent emacsen), not from the older and less maintained "
"python-mode.el")))
-(defadvice python-calculate-indentation (after ami-outdent-closing-parens
- activate)
+(defadvice python-indent-calculate-levels (after gyp-outdent-closing-parens
+ activate)
"De-indent closing parens, braces, and brackets in gyp-mode."
- (if (and (eq major-mode 'gyp-mode)
- (string-match "^ *[])}][],)}]* *$"
- (buffer-substring-no-properties
- (line-beginning-position) (line-end-position))))
- (setq ad-return-value (- ad-return-value 2))))
+ (when (and (eq major-mode 'gyp-mode)
+ (string-match "^ *[])}][],)}]* *$"
+ (buffer-substring-no-properties
+ (line-beginning-position) (line-end-position))))
+ (setf (first python-indent-levels)
+ (- (first python-indent-levels) python-indent-offset))))
(define-derived-mode gyp-mode python-mode "Gyp"
"Major mode for editing .gyp files. See http://code.google.com/p/gyp/"
@@ -36,8 +37,8 @@
(defun gyp-set-indentation ()
"Hook function to configure python indentation to suit gyp mode."
(setq python-continuation-offset 2
- python-indent 2
- python-guess-indent nil))
+ python-indent-offset 2
+ python-indent-guess-indent-offset nil))
(add-hook 'gyp-mode-hook 'gyp-set-indentation)
@@ -218,8 +219,8 @@
;; Top-level keywords
(list (concat "['\"]\\("
(regexp-opt (list "action" "action_name" "actions" "cflags"
- "conditions" "configurations" "copies" "defines"
- "dependencies" "destination"
+ "cflags_cc" "conditions" "configurations"
+ "copies" "defines" "dependencies" "destination"
"direct_dependent_settings"
"export_dependent_settings" "extension" "files"
"include_dirs" "includes" "inputs" "libraries"