Skip to content

Commit 9e96a34

Browse files
authored
Merge pull request #529 from emacs-php/move/php-flymake
Move php-flymake-php-init definition
2 parents 095987a + 1cbb720 commit 9e96a34

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

php-mode.el

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
(require 'font-lock)
8181
(require 'add-log)
8282
(require 'custom)
83-
(require 'flymake)
8483
(require 'etags)
8584
(require 'speedbar)
8685
(require 'imenu)
@@ -1491,34 +1490,12 @@ a completion list."
14911490
(defvar php-font-lock-keywords php-font-lock-keywords-3
14921491
"Default expressions to highlight in PHP Mode.")
14931492

1494-
;;; Provide support for Flymake so that users can see warnings and
1495-
;;; errors in real-time as they write code.
1496-
1497-
(defun php-flymake-php-init ()
1498-
"PHP specific init-cleanup routines.
1499-
1500-
This is an alternative function of `flymake-php-init'.
1501-
Look at the `php-executable' variable instead of the constant \"php\" command."
1502-
(let* ((temp-file
1503-
(funcall
1504-
(eval-when-compile
1505-
(if (fboundp 'flymake-proc-init-create-temp-buffer-copy)
1506-
'flymake-proc-init-create-temp-buffer-copy
1507-
'flymake-init-create-temp-buffer-copy))
1508-
'flymake-create-temp-inplace))
1509-
(local-file (file-relative-name
1510-
temp-file
1511-
(file-name-directory buffer-file-name))))
1512-
(list php-executable (list "-f" local-file "-l"))))
1513-
1514-
(add-to-list 'flymake-allowed-file-name-masks
1515-
'("\\.php[345s]?\\'"
1516-
php-flymake-php-init
1517-
flymake-simple-cleanup
1518-
flymake-get-real-file-name))
1519-
1520-
(add-to-list 'flymake-err-line-patterns
1521-
'("\\(Parse\\|Fatal\\) error: \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)" 3 4 nil 2))
1493+
(add-to-list
1494+
(eval-when-compile
1495+
(if (boundp 'flymake-proc-allowed-file-name-masks)
1496+
'flymake-proc-allowed-file-name-masks
1497+
'flymake-allowed-file-name-masks))
1498+
'("\\.php[345s]?\\'" php-flymake-php-init))
15221499

15231500

15241501
(defun php-send-region (start end)

php.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
;; This file provides common variable and functions for PHP packages.
2929

3030
;;; Code:
31+
(require 'flymake)
3132

3233
;;;###autoload
3334
(defgroup php nil
@@ -173,6 +174,19 @@ can be used to match against definitions for that classlike."
173174
(when (re-search-backward re-pattern nil t)
174175
(match-string-no-properties 1))))
175176

177+
;;; Provide support for Flymake so that users can see warnings and
178+
;;; errors in real-time as they write code.
179+
(defun php-flymake-php-init ()
180+
"PHP specific init-cleanup routines.
181+
182+
This is an alternative function of `flymake-php-init'.
183+
Look at the `php-executable' variable instead of the constant \"php\" command."
184+
(let* ((init (funcall (eval-when-compile
185+
(if (fboundp 'flymake-proc-php-init)
186+
'flymake-proc-php-init
187+
'flymake-php-init)))))
188+
(list php-executable (cdr init))))
189+
176190
;;;###autoload
177191
(defun php-current-class ()
178192
"Insert current class name if cursor in class context."

0 commit comments

Comments
 (0)