Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8001973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:14:17+00:00 2026-06-04T16:14:17+00:00

I have emacs 23.3.1, running on windows. php-mode 1.5 from http://php-mode.sourceforge.net/ , Modified: 2008-11-04

  • 0

I have emacs 23.3.1, running on windows.

php-mode 1.5 from http://php-mode.sourceforge.net/,
Modified: 2008-11-04

I think this used to work, but now, when I try to comment out a block of code, using
comment-region, which is an interactive
compiled Lisp function in `newcomment.el’, I get poor results.

Example:

before:

enter image description here

after:

enter image description here

You can see that each line in the commented block has the single-line comment start sequence //, and the multi-line comment-end sequence */.

This is not a huge problem, though it is ugly. The problem comes in when I try to uncomment the block. I get an error, “Can’t find comment end”. In other words, comment-region is not reversible with C-u comment-region.

I’ll see if I can figure this out, but is there a setting I am missing in php-mode?

Anyone know?


MORE

I didn’t put anything in my php-mode-hook function to change the comment-start and comment-end variables. When I debug comment-region I can see they get set to the mismatched pair of // and */ somehow. That explains the weird results of comment-region. I don’t believe it’s my code that does sets those variables like that.

I tried setting them explicitly in my hook to // and (empty string). In that case, the comment-region looks prettier but it still does not uncomment. I also tried the matched pair of /* and */, but that gave the same results. Uncomment does not succeed; the error is can't find comment end. .

MORE2

I think my syntax table is correct. It shows this:

enter image description here

…which seems right to me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:14:18+00:00Added an answer on June 4, 2026 at 4:14 pm

    This solved it for me:

    (setq comment-use-syntax t)
    

    I put that in my php-mode hook.

    Not sure if this was necessary, but I als included statements to modify the syntax table. The entire hook looks like this:

    (defun cheeso-php-mode-fn ()
      "Function to run when php-mode is initialized for a buffer."
      (require 'flymake)
      (flymake-mode 1)
    
      (setq c-default-style "bsd"
          c-basic-offset 2)
    
      ;; not sure if necessary or not.
      (modify-syntax-entry ?/ ". 124b" php-mode-syntax-table)
      (modify-syntax-entry ?* ". 23" php-mode-syntax-table)
      (modify-syntax-entry ?\n "> b"  php-mode-syntax-table)
      (modify-syntax-entry ?\^m "> b" php-mode-syntax-table)
    
      (setq comment-multi-line nil ;; maybe
            comment-start "// "
            comment-end ""
            comment-style 'indent
            comment-use-syntax t))
    

    The help statement for comment-use-syntax says that major modes should set it.
    In the php buffer I was editing, the variable was set to nil. I’m guessing it was set by php-mode; in any case it was not set by me. Setting this to t and insuring that the syntax table had the appropriate values did the trick.

    I should say that I only use C-style comments in php; I don’t use the # .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying out http://emacspeak.sourceforge.net now that I have it running on windows. I'd like
I have used emacs for erlang programming. According to http://emacswiki.org/emacs/CompileCommand , I have configure
I'm running Emacs 23.3.1 on Mac OS X. When I have linum-mode enable some
I have a setting in my .emacs like this (display-battery-mode 1) . It displays
I'm running Windows Vista and Emacs 23.1.1 and I have installed Ruby using the
I'm running emacs-nox 23.3 in Konsole (from kde) emulator, the most color themes have
I want to have two Emacs windows on the screen: one for Dired and
When running emacs in terminal mode (usually over a remote login) I can see
I have been trying to get slimv (http://www.vim.org/scripts/script.php?script_id=2531) working for a while now, but
I have XWin Server running on my local computer (Windows 7). When I open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.