Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keywords found in block comments are highlighted according to keyword coloring, not comment coloring #47

Closed
mitc0185 opened this issue Dec 27, 2012 · 12 comments
Labels

Comments

@mitc0185
Copy link

In a block comment, such as:

/* foo and bar */

The "and" is colored as if it's a keyword, when in that context it should be colored as a comment.

@ejmr
Copy link
Collaborator

ejmr commented Dec 27, 2012

Sorry but I am unable to reproduce this. What version of Emacs and php-mode are you using? Also is there anything else around the comment, or does it just happen with the comment in isolation? I ask because I just want to make sure no error with highlighting code is spilling over into comments through error.

@mitc0185
Copy link
Author

GNU Emacs 23.4.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-09-09 on murphy, modified by Debian

Here's the code. In the comment "and" and "for" are treated as keywords.

<?php
/*
  Plugin Name: Locator
  Depends: Pods - Custom Content Types and Fields
  Plugin URI: http://www.foobar.com/
  Description: Provides an interactive locator page for finding retailers that sell foobar products.
  Version: 1.0
  Author: Fooman
  Author URI: http://fooman.net
  License: Proprietary
*/


define( 'LOCATOR_PATH', plugin_dir_path(__FILE__) );
define( 'LOCATOR_VERSION', "1.0" );
define( 'LOCATOR_SHORTCODE', 'locator' );

if (is_admin()) {
    require LOCATOR_PATH . "class-locator-admin.php";
    $locator = new Locator_Admin();
    register_activation_hook( __FILE__, array( $locator, 'activate' ));
 } else {
    require LOCATOR_PATH . "class-locator-front.php";
    $locator = new Locator_Front();
 }

$locator->init();

@ejmr
Copy link
Collaborator

ejmr commented Dec 27, 2012

Thank you for the information and the test case. We are using different versions of Emacs, so I will try to duplicate the problem using yours. Could you also please tell me the values you have for php-mode-version-number and php-mode-modified? You can either use C-h v or just look at the top of the php-mode.el file you are using.

@mitc0185
Copy link
Author

Here is that info -- sorry I didn't include it before.

(defconst php-mode-version-number "1.9"
  "PHP Mode version number.")

(defconst php-mode-modified "2012-12-20"
  "PHP Mode build date.")

@ejmr
Copy link
Collaborator

ejmr commented Dec 28, 2012

No problem, thanks for the info and bug report. It reminds me actually---I should add a command that automatically prints out all of the data that may be useful for debugging php-mode, like the things above.

@mitc0185
Copy link
Author

Ok, just saw the issue happen in my stock version of php-mode as well, so it is not specific to your version.

Restarted emacs, and loaded your version, and did not see the problem.

So, something is happening during the course of using the plugin that is causing the syntax highlighting to stop working correctly. I'm not sure what it is. I will follow up if I get a better idea of a cause.

@mitc0185
Copy link
Author

Another note -- when this happens, it also affects highlighting in other modes. For example, I'll load my .emacs and comments are not correctly colored.

@ejmr
Copy link
Collaborator

ejmr commented Dec 30, 2012

Thank you for the updates @mitc0185

So it sounds like the problem is not with php-mode. But whatever it is, it can affect php-mode so I am still curious to figure out the cause. Is it possible for you to post your .emacs file somewhere? I am wondering if it is a conflict/issue caused by another library.

@mitc0185
Copy link
Author

Here is my .emacs: http://pastebin.com/XEvvgwcD

I've upgraded Emacs to the latest version from GNU,

GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-12-29 on hemingway

I haven't seen the issue re-occur with the new version.

@ejmr
Copy link
Collaborator

ejmr commented Dec 30, 2012

Thanks for posting. I don't see anything obvious there which would cause that problem. Since it sounds like the issue was outside of the scope of php-mode I am going to close this bug report, but please let me know if the same problem happens again now that you have upgraded Emacs itself.

@ejmr ejmr closed this as completed Dec 30, 2012
@NateEag
Copy link
Member

NateEag commented Jan 1, 2013

For anyone who's interested, I believe the issue here is probably due to web-mode:

fxbois/web-mode#13

I know I've seen this issue happen while using web-mode, and I see that mitc0185 uses it as well.

@mitc0185
Copy link
Author

mitc0185 commented Jan 1, 2013

@NateEag that's a good catch. Interesting that they closed that bug, but I was/am using a current version of web-mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants