Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I disable emacs indent warnings ?

109 views
Skip to first unread message

JohnT

unread,
Oct 17, 2012, 4:43:05 AM10/17/12
to

I have been happily using emacs to edit php files for too many years to
count.

However, the newer versions of emacs insist on constantly warning me that
php-mode doesn't indent mixed html/php well, and tells me to install one
of three other modes: mumamo, mmm-mode or multi-mode.

I've been using emacs for long enough to know all about the indenting
issues, so I don't need this warning and emacs keeps replacing on of my
frames with the warning, which is very irritating. So, how do I get rid
of it ?

In desperation I have had a look at the three suggested modes, and all of
them seem like a real PITA to install, and it really isn't worth the
effort just to get indenting working. However, I have found another mode:

multi-web-mode

which is easy to install, and works well.

However, despite this, I'm still getting the irritating warnings.

I'd rather just switch off warnings completely if that gets rid of the
error.

Any ideas ?

Thanks
JohnT

Dave Gibson

unread,
Oct 17, 2012, 7:12:24 AM10/17/12
to
JohnT <jo...@example.com> wrote:
>
> I have been happily using emacs to edit php files for too many years to
> count.
>
> However, the newer versions of emacs insist on constantly warning me that
> php-mode doesn't indent mixed html/php well, and tells me to install one
> of three other modes: mumamo, mmm-mode or multi-mode.
>
> I've been using emacs for long enough to know all about the indenting
> issues, so I don't need this warning and emacs keeps replacing on of my
> frames with the warning, which is very irritating. So, how do I get rid
> of it ?

Edit php-mode.el. Look for (defvar php-warned-bad-indent nil). Replace
nil with t.

Untested, no warranty etc.

> Any ideas ?

:wq

JohnT

unread,
Oct 17, 2012, 10:40:01 AM10/17/12
to
On Wed, 17 Oct 2012 12:12:24 +0100, Dave Gibson wrote:

> JohnT <jo...@example.com> wrote:

>> I've been using emacs for long enough to know all about the indenting
>> issues, so I don't need this warning and emacs keeps replacing on of my
>> frames with the warning, which is very irritating. So, how do I get rid
>> of it ?
>
> Edit php-mode.el. Look for (defvar php-warned-bad-indent nil). Replace
> nil with t.
>

That seems to have done the job - thanks.
Been quite a few years since I've dirtied my hands with elisp!

> Untested, no warranty etc.
>
>> Any ideas ?
>
> :wq

Thanks

^X^S


JohnT

unread,
Oct 18, 2012, 5:12:53 AM10/18/12
to
On Wed, 17 Oct 2012 14:40:01 +0000, JohnT wrote:

> On Wed, 17 Oct 2012 12:12:24 +0100, Dave Gibson wrote:
>
>> JohnT <jo...@example.com> wrote:
>
>>> I've been using emacs for long enough to know all about the indenting
>>> issues, so I don't need this warning and emacs keeps replacing on of
>>> my frames with the warning, which is very irritating. So, how do I get
>>> rid of it ?
>>
>> Edit php-mode.el. Look for (defvar php-warned-bad-indent nil).
>> Replace nil with t.
>>
>>
> That seems to have done the job - thanks. Been quite a few years since
> I've dirtied my hands with elisp!
>

Nope - sorry - didn't test it enough.
Still get the irritating error sometimes. Seems to be when I open a new
<?php tag

I'll see if I can rip the message out completely.

Regards
JohnT

Dave Gibson

unread,
Oct 18, 2012, 6:52:25 AM10/18/12
to
JohnT <jo...@example.com> wrote:
> On Wed, 17 Oct 2012 14:40:01 +0000, JohnT wrote:
>
>> On Wed, 17 Oct 2012 12:12:24 +0100, Dave Gibson wrote:
>>
>>> JohnT <jo...@example.com> wrote:
>>
>>>> I've been using emacs for long enough to know all about the indenting
>>>> issues, so I don't need this warning and emacs keeps replacing on of
>>>> my frames with the warning, which is very irritating. So, how do I get
>>>> rid of it ?
>>>
>>> Edit php-mode.el. Look for (defvar php-warned-bad-indent nil).
>>> Replace nil with t.
>>>
>>>
>> That seems to have done the job - thanks. Been quite a few years since
>> I've dirtied my hands with elisp!
>>
>
> Nope - sorry - didn't test it enough.

Uggreb.

> Still get the irritating error sometimes. Seems to be when I open a new
> <?php tag
>
> I'll see if I can rip the message out completely.

It should be possible to side-step the entire check -- both the php-indent
functions drop through to the c-indent equivalents so replace (somewhere
near line 379)

(setq indent-line-function 'php-cautious-indent-line)
(setq indent-region-function 'php-cautious-indent-region)

with

(setq indent-line-function 'c-indent-line)
(setq indent-region-function 'c-indent-region)

JohnT

unread,
Oct 19, 2012, 5:00:41 AM10/19/12
to
On Thu, 18 Oct 2012 11:52:25 +0100, Dave Gibson wrote:


>
> It should be possible to side-step the entire check -- both the
> php-indent functions drop through to the c-indent equivalents so replace
> (somewhere near line 379)
>
> (setq indent-line-function 'php-cautious-indent-line) (setq
> indent-region-function 'php-cautious-indent-region)
>
> with
>
> (setq indent-line-function 'c-indent-line) (setq
> indent-region-function 'c-indent-region)

It seems the problem is that emacs is using the complied version, so is
ignoring all my changes. Just need to figure out how to complile .elc
files now.






Dave Gibson

unread,
Oct 19, 2012, 6:00:49 AM10/19/12
to
JohnT <jo...@example.com> wrote:

[ modifying php-mode.el to silence warnings ]

> It seems the problem is that emacs is using the complied version, so is
> ignoring all my changes. Just need to figure out how to complile .elc
> files now.

On the command line:

emacs -batch -f batch-byte-compile /path/to/modified/php-mode.el

Within emacs:

(byte-compile-file "/path/to/modified/php-mode.el")

Details in:

info elisp 'Compilation Functions'

JohnT

unread,
Oct 19, 2012, 6:29:27 AM10/19/12
to
Yup, already found that thanks.
All worked fine.

Regards
JohnT
0 new messages