all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* making Flymake work with PHP
@ 2009-05-14 14:35 Ig0r
  2009-05-14 15:37 ` Lennart Borgman
       [not found] ` <mailman.7163.1242315464.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Ig0r @ 2009-05-14 14:35 UTC (permalink / raw
  To: help-gnu-emacs

Hello, GNU Emacs Community!
I'm new to emacs and I try to make Flymake work in php-mode.
I have nXhtml installed (it has its flymake)
I've took the flymake-php from:
http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-checking-with-flymake/
and added those lines to my ~/.emacs

If I use M-x flymake-display-err-menu-for-current-line it displays an
error in format:
parse error
parse error

But in flymake-php I can see lines:
add-to-list 'flymake-err-line-patterns  '("\\(Parse\\|Fatal\\) error: +
\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))

So PHP errors should look like:
"Parse | Fatal error ... in ....php  on line ..  "  ?

What may be the problem for that?

In my ~/.emacs I load nXhtml first:

;;nXHTML mode and all that comes with it (MuMaMo...)
(setq rng-schema-loader-alist '(("rnc" . rng-c-load-schema)))
(add-hook 'nxml-mode-hook 'rng-nxml-mode-init)
(add-hook 'nxml-mode-hook 'nxml-enable-unicode-char-name-sets)

(load "c:/program files/emacs-22.3/site-lisp/nxhtml/autostart.el")

(define-key global-map "\C-cd" 'flymake-display-err-menu-for-current-
line)
(define-key global-map "\C-cn" 'flymake-goto-next-error)

(require 'flymake)

(defun flymake-php-init ()
  "Use php to check the syntax of the current file."
  (let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-
temp-inplace))
	 (local (file-relative-name temp (file-name-directory buffer-file-
name))))
    (list "php" (list "-f" local "-l"))))

(add-to-list 'flymake-err-line-patterns
  '("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\
([0-9]+\\)$" 3 4 nil 2))

(add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-
init))

(add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-
init))

(add-hook 'php-mode-hook (lambda () (flymake-mode 1)))

Is someone familiar with this?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
  2009-05-14 14:35 making Flymake work with PHP Ig0r
@ 2009-05-14 15:37 ` Lennart Borgman
       [not found] ` <mailman.7163.1242315464.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Lennart Borgman @ 2009-05-14 15:37 UTC (permalink / raw
  To: Ig0r; +Cc: help-gnu-emacs

On Thu, May 14, 2009 at 4:35 PM, Ig0r <ryzhkov.igor@gmail.com> wrote:
> Hello, GNU Emacs Community!
> I'm new to emacs and I try to make Flymake work in php-mode.
> I have nXhtml installed (it has its flymake)
> I've took the flymake-php from:
> http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-checking-with-flymake/
> and added those lines to my ~/.emacs
>
> If I use M-x flymake-display-err-menu-for-current-line it displays an
> error in format:
> parse error
> parse error
>
> But in flymake-php I can see lines:
> add-to-list 'flymake-err-line-patterns  '("\\(Parse\\|Fatal\\) error: +
> \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
>
> So PHP errors should look like:
> "Parse | Fatal error ... in ....php  on line ..  "  ?
>
> What may be the problem for that?
>
> In my ~/.emacs I load nXhtml first:
>
> ;;nXHTML mode and all that comes with it (MuMaMo...)
> (setq rng-schema-loader-alist '(("rnc" . rng-c-load-schema)))
> (add-hook 'nxml-mode-hook 'rng-nxml-mode-init)
> (add-hook 'nxml-mode-hook 'nxml-enable-unicode-char-name-sets)
>
> (load "c:/program files/emacs-22.3/site-lisp/nxhtml/autostart.el")
>
> (define-key global-map "\C-cd" 'flymake-display-err-menu-for-current-
> line)
> (define-key global-map "\C-cn" 'flymake-goto-next-error)
>
> (require 'flymake)
>
> (defun flymake-php-init ()
>  "Use php to check the syntax of the current file."
>  (let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-
> temp-inplace))
>         (local (file-relative-name temp (file-name-directory buffer-file-
> name))))
>    (list "php" (list "-f" local "-l"))))
>
> (add-to-list 'flymake-err-line-patterns
>  '("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\
> ([0-9]+\\)$" 3 4 nil 2))
>
> (add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-
> init))
>
> (add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-
> init))
>
> (add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
>
> Is someone familiar with this?
>

Hi Igor,

There is a flymake-php.el included in nXhtml. You turn that on from the menus:

   nXhtml
       Tools
            Flymake Mode

Can you please try that?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
       [not found] ` <mailman.7163.1242315464.31690.help-gnu-emacs@gnu.org>
@ 2009-05-14 16:08   ` Ig0r
  2009-05-14 18:58     ` Anselm Helbig
  0 siblings, 1 reply; 8+ messages in thread
From: Ig0r @ 2009-05-14 16:08 UTC (permalink / raw
  To: help-gnu-emacs

On May 14, 6:37 pm, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> On Thu, May 14, 2009 at 4:35 PM, Ig0r <ryzhkov.i...@gmail.com> wrote:
> > Hello, GNU Emacs Community!
> > I'm new to emacs and I try to make Flymake work in php-mode.
> > I have nXhtml installed (it has its flymake)
> > I've took the flymake-php from:
> >http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-ch...
> > and added those lines to my ~/.emacs
>
> > If I use M-x flymake-display-err-menu-for-current-line it displays an
> > error in format:
> > parse error
> > parse error
>
> > But in flymake-php I can see lines:
> > add-to-list 'flymake-err-line-patterns  '("\\(Parse\\|Fatal\\) error: +
> > \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
>
> > So PHP errors should look like:
> > "Parse | Fatal error ... in ....php  on line ..  "  ?
>
> > What may be the problem for that?
>
> > In my ~/.emacs I load nXhtml first:
>
> > ;;nXHTML mode and all that comes with it (MuMaMo...)
> > (setq rng-schema-loader-alist '(("rnc" . rng-c-load-schema)))
> > (add-hook 'nxml-mode-hook 'rng-nxml-mode-init)
> > (add-hook 'nxml-mode-hook 'nxml-enable-unicode-char-name-sets)
>
> > (load "c:/program files/emacs-22.3/site-lisp/nxhtml/autostart.el")
>
> > (define-key global-map "\C-cd" 'flymake-display-err-menu-for-current-
> > line)
> > (define-key global-map "\C-cn" 'flymake-goto-next-error)
>
> > (require 'flymake)
>
> > (defun flymake-php-init ()
> >  "Use php to check the syntax of the current file."
> >  (let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-
> > temp-inplace))
> >         (local (file-relative-name temp (file-name-directory buffer-file-
> > name))))
> >    (list "php" (list "-f" local "-l"))))
>
> > (add-to-list 'flymake-err-line-patterns
> >  '("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\
> > ([0-9]+\\)$" 3 4 nil 2))
>
> > (add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-
> > init))
>
> > (add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-
> > init))
>
> > (add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
>
> > Is someone familiar with this?
>
> Hi Igor,
>
> There is a flymake-php.el included in nXhtml. You turn that on from the menus:
>
>    nXhtml
>        Tools
>             Flymake Mode
>
> Can you please try that?


Thanks for you reply!

I actually do that, but it's behavior is the same. Not a word from
php :(


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
  2009-05-14 16:08   ` Ig0r
@ 2009-05-14 18:58     ` Anselm Helbig
  2009-05-14 21:17       ` Ig0r
  0 siblings, 1 reply; 8+ messages in thread
From: Anselm Helbig @ 2009-05-14 18:58 UTC (permalink / raw
  To: help-gnu-emacs

Hi!

> > > I'm new to emacs and I try to make Flymake work in php-mode.
> > > I have nXhtml installed (it has its flymake)
> > > I've took the flymake-php from:
> > >http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-ch...
> > > and added those lines to my ~/.emacs
> >
> > > If I use M-x flymake-display-err-menu-for-current-line it displays an
> > > error in format:
> > > parse error
> > > parse error
> >
> > > But in flymake-php I can see lines:
> > > add-to-list 'flymake-err-line-patterns  '("\\(Parse\\|Fatal\\) error: +
> > > \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
> >
> > > So PHP errors should look like:
> > > "Parse | Fatal error ... in ....php  on line ..  "  ?
> >
> > > What may be the problem for that?
> >
> > > In my ~/.emacs I load nXhtml first:
> >
> > > ;;nXHTML mode and all that comes with it (MuMaMo...)
> > > [...]
> >
> > > Is someone familiar with this?
> >
> > Hi Igor,
> >
> > There is a flymake-php.el included in nXhtml. You turn that on from the menus:
> >
> >    nXhtml
> >        Tools
> >             Flymake Mode
> >
> > Can you please try that?
> 
> 
> Thanks for you reply!
> 
> I actually do that, but it's behavior is the same. Not a word from
> php :(

Your config files seems to work fine for me. Are the php-files you're
looking at opened in php-mode or nxhtml-mode? What version of emacs
and nxhtml are you using? Obviously, if you're using nxhtml you should
try to configure flymake for php a second time. 

You seem to be running windows. Are you sure that emacs can find your
php executable? What happens if you enter this line:

  M-: (executable-find "php")<RET>

Kind regards, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
  2009-05-14 18:58     ` Anselm Helbig
@ 2009-05-14 21:17       ` Ig0r
  2009-05-14 22:43         ` Lennart Borgman
       [not found]         ` <mailman.7179.1242341015.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Ig0r @ 2009-05-14 21:17 UTC (permalink / raw
  To: help-gnu-emacs

On May 14, 9:58 pm, Anselm Helbig <anselm.helbig
+news2...@googlemail.com> wrote:
> Hi!
>
>
>
> > > > I'm new to emacs and I try to make Flymake work in php-mode.
> > > > I have nXhtml installed (it has its flymake)
> > > > I've took the flymake-php from:
> > > >http://sachachua.com/wp/2008/07/31/emacs-and-php-on-the-fly-syntax-ch...
> > > > and added those lines to my ~/.emacs
>
> > > > If I use M-x flymake-display-err-menu-for-current-line it displays an
> > > > error in format:
> > > > parse error
> > > > parse error
>
> > > > But in flymake-php I can see lines:
> > > > add-to-list 'flymake-err-line-patterns  '("\\(Parse\\|Fatal\\) error: +
> > > > \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
>
> > > > So PHP errors should look like:
> > > > "Parse | Fatal error ... in ....php  on line ..  "  ?
>
> > > > What may be the problem for that?
>
> > > > In my ~/.emacs I load nXhtml first:
>
> > > > ;;nXHTML mode and all that comes with it (MuMaMo...)
> > > > [...]
>
> > > > Is someone familiar with this?
>
> > > Hi Igor,
>
> > > There is a flymake-php.el included in nXhtml. You turn that on from the menus:
>
> > >    nXhtml
> > >        Tools
> > >             Flymake Mode
>
> > > Can you please try that?
>
> > Thanks for you reply!
>
> > I actually do that, but it's behavior is the same. Not a word from
> > php :(
>
> Your config files seems to work fine for me. Are the php-files you're
> looking at opened in php-mode or nxhtml-mode? What version of emacs
> and nxhtml are you using? Obviously, if you're using nxhtml you should
> try to configure flymake for php a second time.
>
> You seem to be running windows. Are you sure that emacs can find your
> php executable? What happens if you enter this line:
>
>   M-: (executable-find "php")<RET>
>
> Kind regards,
>
> Anselm
>
> --
> Anselm Helbig
> mailto:anselm.helbig+news2...@googlemail.com


Anselm, Thank you for your reply!

> Are the php-files you're
> looking at opened in php-mode or nxhtml-mode?
They are opening in php-mode

>What version of emacs
>and nxhtml are you using?
emacs-22.3
nXhtml 1.76-090226

>Obviously, if you're using nxhtml you should
>try to configure flymake for php a second time.
Can you please explain this?

>Are you sure that emacs can find your
>php executable? What happens if you enter this line:
>  M-: (executable-find "php")<RET>
Yes, I'm sure, That command returns path to my php.exe

Cheers,
Igor!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
  2009-05-14 21:17       ` Ig0r
@ 2009-05-14 22:43         ` Lennart Borgman
       [not found]         ` <mailman.7179.1242341015.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Lennart Borgman @ 2009-05-14 22:43 UTC (permalink / raw
  To: Ig0r; +Cc: help-gnu-emacs

On Thu, May 14, 2009 at 11:17 PM, Ig0r <ryzhkov.igor@gmail.com> wrote:
>> Are the php-files you're
>> looking at opened in php-mode or nxhtml-mode?
> They are opening in php-mode

It should open in html-mumamo-mode (in Emacs 22), but that does not
matter much here.


>>What version of emacs
>>and nxhtml are you using?
> emacs-22.3
> nXhtml 1.76-090226

It would be good if you could try the latest beta 1.77 of nXhtml.


>>Obviously, if you're using nxhtml you should
>>try to configure flymake for php a second time.
> Can you please explain this?

It do not know what Anselm meant (but it would be interesting to
know). However you should not have to configure anything (except
perhaps the path to php.exe).

Could you please try commenting out the elisp code you have in your
.emacs for configuring flymake for php?


>>Are you sure that emacs can find your
>>php executable? What happens if you enter this line:
>>  M-: (executable-find "php")<RET>
> Yes, I'm sure, That command returns path to my php.exe
>
> Cheers,
> Igor!




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
       [not found]         ` <mailman.7179.1242341015.31690.help-gnu-emacs@gnu.org>
@ 2009-05-15  0:25           ` Ig0r
  2009-05-16 13:38             ` Ig0r
  0 siblings, 1 reply; 8+ messages in thread
From: Ig0r @ 2009-05-15  0:25 UTC (permalink / raw
  To: help-gnu-emacs

> It should open in html-mumamo-mode (in Emacs 22), but that does not
> matter much here.
Hm... maybe that is where it all begins...


> It would be good if you could try the latest beta 1.77 of nXhtml.

I've installed it - it is all the same :(
Oh, I haven't mentioned - nXhtml mode tries to include rng-auto.el -
which I don't have anywhere (but I've read in forums that this is not
needed anymore), so I just commented all lines in autoload22.el  Have
you done the same?

> Could you please try commenting out the elisp code you have in your
> .emacs for configuring flymake for php?

Yes, I've done that already - no luck :(
And I also run M-x customize-option RET flymake-php-on RET and now
flymake loads everytime I'm in php-code.
But all errors what I see are: http://img193.imageshack.us/img193/7307/error.jpg

Igor.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: making Flymake work with PHP
  2009-05-15  0:25           ` Ig0r
@ 2009-05-16 13:38             ` Ig0r
  0 siblings, 0 replies; 8+ messages in thread
From: Ig0r @ 2009-05-16 13:38 UTC (permalink / raw
  To: help-gnu-emacs

On May 15, 3:25 am, Ig0r <ryzhkov.i...@gmail.com> wrote:
> > It should open in html-mumamo-mode (in Emacs 22), but that does not
> > matter much here.
>
> Hm... maybe that is where it all begins...
>
> > It would be good if you could try the latest beta 1.77 of nXhtml.
>
> I've installed it - it is all the same :(
> Oh, I haven't mentioned - nXhtml mode tries to include rng-auto.el -
> which I don't have anywhere (but I've read in forums that this is not
> needed anymore), so I just commented all lines in autoload22.el  Have
> you done the same?
>
> > Could you please try commenting out the elisp code you have in your
> > .emacs for configuring flymake for php?
>
> Yes, I've done that already - no luck :(
> And I also run M-x customize-option RET flymake-php-on RET and now
> flymake loads everytime I'm in php-code.
> But all errors what I see are:http://img193.imageshack.us/img193/7307/error.jpg
>
> Igor.

Guys, I've also noticed strange thing:
When I open my *.php files which content html code (It opens in PHP
major mode). And when I try to edit the code it tells me:
"
Please answer y or n. Indentation fails badly with mixed HTML/PHP  in
the HTML part in plain `php-mode'. To get indentation to work you must
use an Emacs library that supports 'multiply major modes' in a
buffer.
Parts of the buffer will then be `php-mode' and parts in for example
`html-mode'. Known such libraries are:
mumamo, mmm-mode, multi-mode

You have these available in your `load-path':
mumamo

Do you want to turn any of those on? (y or n)
"
So this means that my mumamo mode isn't started automatically, what
might bу causing it?

Here is my ~/.emacs if that's a help:  http://docs.google.com/Doc?id=df7znpq9_26vhcdh6g3

I also tried to remove all php-mode hooks. The *.php files then open
in PHP/nXhtml mode, but the flymake still isn't working properly.

Thanks!


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-16 13:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 14:35 making Flymake work with PHP Ig0r
2009-05-14 15:37 ` Lennart Borgman
     [not found] ` <mailman.7163.1242315464.31690.help-gnu-emacs@gnu.org>
2009-05-14 16:08   ` Ig0r
2009-05-14 18:58     ` Anselm Helbig
2009-05-14 21:17       ` Ig0r
2009-05-14 22:43         ` Lennart Borgman
     [not found]         ` <mailman.7179.1242341015.31690.help-gnu-emacs@gnu.org>
2009-05-15  0:25           ` Ig0r
2009-05-16 13:38             ` Ig0r

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.