diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-11-06 11:12:40 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-11-06 11:12:40 +0000 |
commit | 2c322fa0879bb1d22b6ce09b698562d8d7cae36d (patch) | |
tree | 25a4380a068212b79efba1d8dc79a4d36ba3c98d /tools/emacs/gyp.el | |
parent | 86a67f445a64a7baaa8aee66b6a5859c00289462 (diff) | |
parent | b5b4ce2b9f579f0944ddc21801187e8efb458ca4 (diff) | |
download | gyp-master.tar.gz |
Merge from Chromium at DEPS revision db3f05efe0f9HEADwebview-m40_r4webview-m40_r3webview-m40_r2webview-m40_r1android-m-preview-2android-m-preview-1android-m-previewub-webview-m40-releasemaster-soongmastermain
This commit was generated by merge_to_master.py.
Change-Id: I60d0e38401d2444cd8c029e28b930554938d39c7
Diffstat (limited to 'tools/emacs/gyp.el')
-rw-r--r-- | tools/emacs/gyp.el | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/tools/emacs/gyp.el b/tools/emacs/gyp.el index 60619b52..b98b155c 100644 --- a/tools/emacs/gyp.el +++ b/tools/emacs/gyp.el @@ -23,7 +23,28 @@ (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) (setf (first python-indent-levels) - (- (first python-indent-levels) python-indent-offset)))) + (- (first python-indent-levels) python-continuation-offset)))) + +(defadvice python-indent-guess-indent-offset (around + gyp-indent-guess-indent-offset + activate) + "Guess correct indent offset in gyp-mode." + (or (and (not (eq major-mode 'gyp-mode)) + ad-do-it) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + ;; Find first line ending with an opening brace that is not a comment. + (or (and (re-search-forward "\\(^[[{]$\\|^.*[^#].*[[{]$\\)") + (forward-line) + (/= (current-indentation) 0) + (set (make-local-variable 'python-indent-offset) + (current-indentation)) + (set (make-local-variable 'python-continuation-offset) + (current-indentation))) + (message "Can't guess gyp indent offset, using default: %s" + python-continuation-offset)))))) (define-derived-mode gyp-mode python-mode "Gyp" "Major mode for editing .gyp files. See http://code.google.com/p/gyp/" @@ -36,9 +57,10 @@ (defun gyp-set-indentation () "Hook function to configure python indentation to suit gyp mode." - (setq python-continuation-offset 2 - python-indent-offset 2 - python-indent-guess-indent-offset nil)) + (set (make-local-variable 'python-indent-offset) 2) + (set (make-local-variable 'python-continuation-offset) 2) + (set (make-local-variable 'python-indent-guess-indent-offset) t) + (python-indent-guess-indent-offset)) (add-hook 'gyp-mode-hook 'gyp-set-indentation) @@ -223,7 +245,7 @@ "copies" "defines" "dependencies" "destination" "direct_dependent_settings" "export_dependent_settings" "extension" "files" - "include_dirs" "includes" "inputs" "libraries" + "include_dirs" "includes" "inputs" "ldflags" "libraries" "link_settings" "mac_bundle" "message" "msvs_external_rule" "outputs" "product_name" "process_outputs_as_sources" "rules" "rule_name" |