diff --git a/.travis.yml b/.travis.yml index 88b3b49..68bb672 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,3 +13,8 @@ env: script: - emacs --version - make test +notifications: + webhooks: https://webhooks.gitter.im/e/fa0500ce49cab8dc8144 + on_success: change + on_failure: always + on_start: never diff --git a/drupal-mode.el b/drupal-mode.el index 091cd49..f8da836 100644 --- a/drupal-mode.el +++ b/drupal-mode.el @@ -252,8 +252,6 @@ See `drupal-mode-map'.") ;; mode map on C-c C-v C-`mnemonic-key'. (dolist (elem drupal-mode-map-alist) (define-key map `[(control c) (control v) (control ,(car elem))] (cdr elem))) - - (define-key map [(control a)] #'drupal-mode-beginning-of-line) map) "Keymap for `drupal-mode'") @@ -336,7 +334,8 @@ function arguments.") (require-final-newline . t) (c-offsets-alist . ((arglist-close . 0) (arglist-cont-nonempty . c-lineup-math) - (arglist-intro . +))) + (arglist-intro . +) + (statement-cont . +))) (c-doc-comment-style . (php-mode . javadoc)) (c-label-minimum-indentation . 1) (c-special-indent-hook . c-gnu-impose-minimum) @@ -699,35 +698,6 @@ instead." ((fboundp 'php-extras-eldoc-documentation-function) (php-extras-eldoc-documentation-function)))))) -(defun drupal-mode-beginning-of-line (&optional n) - "Move point to beginning of property value or to beginning of line. -The prefix argument N is passed directly to `beginning-of-line'. - -This command is identical to `beginning-of-line' if not in a mode -derived from `conf-mode'. - -If point is on a (non-continued) property line, move point to the -beginning of the property value or the beginning of line, -whichever is closer. If point is already at beginning of line, -move point to beginning of property value. Therefore, repeated -calls will toggle point between beginning of property value and -beginning of line. - -Heavily based on `message-beginning-of-line' from Gnus." - (interactive "p") - (let ((zrs 'zmacs-region-stays)) - (when (and (featurep 'xemacs) (interactive-p) (boundp zrs)) - (set zrs t))) - (if (derived-mode-p 'conf-mode) - (let* ((here (point)) - (bol (progn (beginning-of-line n) (point))) - (eol (point-at-eol)) - (eoh (re-search-forward "= *" eol t))) - (goto-char - (if (and eoh (or (< eoh here) (= bol here))) - eoh bol))) - (beginning-of-line n))) - (defvar drupal-local-variables (make-hash-table :test 'equal) @@ -898,8 +868,7 @@ If major version number is 4 - return both major and minor." (defun drupal-mode-bootstrap () "Activate Drupal minor mode if major mode is supported. The command will activate `drupal-mode' if the current major mode -is a mode supported by `drupal-mode' (currently only -`php-mode'). +is a mode supported by `drupal-mode'. The function is suitable for adding to the supported major modes mode-hook." diff --git a/drupal/flycheck.el b/drupal/flycheck.el index 1eb3675..42b2252 100644 --- a/drupal/flycheck.el +++ b/drupal/flycheck.el @@ -49,21 +49,24 @@ The Drupal standard includes checks for non-PHP files, this checker runs those. See URL `http://pear.php.net/package/PHP_CodeSniffer/'." - :command ("phpcs" "--report=emacs" - (option "--standard=" drupal/phpcs-standard concat) - source-inplace) - ;; Though phpcs supports Checkstyle output which we could feed to - ;; `flycheck-parse-checkstyle', we are still using error patterns here, - ;; because PHP has notoriously unstable output habits. See URL - ;; `https://github.com/lunaryorn/flycheck/issues/78' and URL - ;; `https://github.com/lunaryorn/flycheck/issues/118' - :error-patterns - ((error line-start - (file-name) ":" line ":" column ": error - " (message) - line-end) - (warning line-start - (file-name) ":" line ":" column ": warning - " (message) - line-end)) + :command ("phpcs" "--report=checkstyle" + (option "--standard=" flycheck-phpcs-standard concat) + ;; Pass original file name to phpcs. We need to concat explicitly + ;; here, because phpcs really insists to get option and argument as + ;; a single command line argument :| + (eval (when (buffer-file-name) + (concat "--stdin-path=" (buffer-file-name))))) + :standard-input t + :error-parser flycheck-parse-checkstyle + :error-filter + (lambda (errors) + (flycheck-sanitize-errors + (flycheck-remove-error-file-names "STDIN" errors))) + ;; Hardcoded for the moment, as this doesn't work: + ;; :modes (append drupal-css-modes drupal-js-modes drupal-info-modes) + ;; As they're reworking the checker selection code, we're letting this + ;; lie for the moment. + :modes (css-mode javascript-mode js-mode js2-mode conf-windows-mode) :predicate (lambda () (and drupal-mode drupal/phpcs-standard))) @@ -73,7 +76,7 @@ See URL `http://pear.php.net/package/PHP_CodeSniffer/'." (let ((modes (append drupal-css-modes drupal-js-modes drupal-info-modes))) (dolist (checker (flycheck-defined-checkers)) (dolist (mode (flycheck-checker-get checker 'modes)) - (if (memq mode modes) + (if (and (memq mode modes) (not (eq checker 'drupal-phpcs))) (flycheck-add-next-checker checker 'drupal-phpcs)))))