Code Monkey home page Code Monkey logo

Comments (9)

haxney avatar haxney commented on July 17, 2024

BTW, I've started working on this.

from php-mode.

ejmr avatar ejmr commented on July 17, 2024

Good idea. Redefining the core of php-mode, particularly how we inform Emacs about the structure of the language, will make it easier to take advantage of things like customizable lineup functions in cc-mode. It also feels like a good direction to go in terms of making the codebase more consistent in structure. After all, php-mode is going on fourteen years now, and lots of people have worked on it, and we certainly haven't all been consistent in the way we've implemented things. And in all those years Elisp and standard libraries have improved as well, like ERT, things we ought to leverage in our favor. So I like this idea a lot, using more of cc-mode.

from php-mode.

haxney avatar haxney commented on July 17, 2024

I'm getting closer! It seems like most fontification can be done with trivial
definitions of php-font-lock-keywords-*, which means the cc-mode machinery
is doing something right.

On my current branch, here are the definitions of the php-font-lock-keywords-*
variables:

(defconst php-font-lock-keywords-1 (c-lang-const c-matchers-1 php)
  "Basic highlighting for PHP mode.")

(defconst php-font-lock-keywords-2 (c-lang-const c-matchers-2 php)
  "Medium level highlighting for PHP mode.")

(defconst php-font-lock-keywords-3 (c-lang-const c-matchers-3 php)
  "Detailed highlighting for PHP mode.")

(defvar php-font-lock-keywords php-font-lock-keywords-3
  "Default expressions to highlight in PHP mode.")

Indentation still needs some work, but is mostly there.

from php-mode.

ejmr avatar ejmr commented on July 17, 2024

Awesome, thanks for the work. :)

from php-mode.

jorissteyn avatar jorissteyn commented on July 17, 2024

After playing around with haxneys changes, I believe this is an excellent course of direction. I rerolled the original changes on current php-mode and made some fixes to make it pass the test suite.

In case anyone's interested: https://github.com/jorissteyn/php-mode/tree/work/ccmode

It seems to work really well, but I still have some fixes upcoming -- if only PHP had chosen :: as namespace separator :). Feedback is very welcome!

from php-mode.

ejmr avatar ejmr commented on July 17, 2024

Great submission :)

I pushed it in a new branch for people to test and mentioned that in the README.

Thanks for the effort!

from php-mode.

jorissteyn avatar jorissteyn commented on July 17, 2024

Great idea to mention this experiment in the README, but if it's not on master, the only people who will read it are the people that already know about it :)

from php-mode.

ejmr avatar ejmr commented on July 17, 2024

Great point. I'm in such a habit of looking at all the different branches that people not doing that honestly didn't cross my mind at the time. I've copied the mention into the README on the master branch.

from php-mode.

jorissteyn avatar jorissteyn commented on July 17, 2024

As discussed in PR #168, the hard require 'cl I added to get this branch pass CI is bogus. It should work with:

(unless (require 'cl-lib nil t)
   (require 'cl))

But I don't know what difference between master and the cc-mode branch causes this, I'm not calling set-difference anywhere in php-mode/php-mode-test.

Error output: https://travis-ci.org/jorissteyn/php-mode/jobs/34121887

from php-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.