#58 keywords miscolored as part of variable names


If a variable or function name begins with a keyword, it is colored incorrectly. For example:


$parent_id = 5;


the two occurrences of "parent" as well as the "var" are colored as keywords, when they ought not to be.

php-mode version 1.4.0

GNU Emacs 22.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.8.20) of 2008-02-26 on vlinux, modified by Debian


  • Nobody/Anonymous

    Logged In: NO

    Also, inside a comment, some variables are still highlighted.

    varname is highlighted

    //$a is a var.....
    correctly colored

  • Mytskine

    Mytskine - 2008-09-24

    After the line 302 of php-mode.el, add:
    (modify-syntax-entry ?_ "w" php-mode-syntax-table)
    This makes the underscore character a part of words instead of a separator.

  • Aaron S. Hawley

    Aaron S. Hawley - 2008-10-21
    • assigned_to: nobody --> ashawley
    • status: open --> open-accepted
  • Aaron S. Hawley

    Aaron S. Hawley - 2008-10-21

    Chaning the sntax table with modify-syntax-entry looks like it would make the most sense and the simplest change, but this would modify the behavior of forward-word and backward-word in PHP mode. Changing Emacs default behaviors should be avoided.

  • Aaron S. Hawley

    Aaron S. Hawley - 2008-11-04
    • labels: --> Syntax highlighting
    • status: open-accepted --> closed-fixed
  • Aaron S. Hawley

    Aaron S. Hawley - 2008-11-04

    This was fixed in the latest release. Please try using the latest version to make sure it works as you expected. If it does not, please kindly submit another bug report. Thank you again for reporting this.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks