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

'live preview' like Brackets #4

Open
Taariqq opened this issue Jul 14, 2018 · 6 comments
Open

'live preview' like Brackets #4

Taariqq opened this issue Jul 14, 2018 · 6 comments

Comments

@Taariqq
Copy link

Taariqq commented Jul 14, 2018

Guys, this is wonderful to see. I would much rather use Emacs than VS Code ... but there is one thing holding me back from leaving Brackets. It is the absolutely fantastic 'live preview' where the browser would automatically switch to the file that you are editing and would auto-update upon save.

I see impatient-mode as part option but it is for html/css only. Is there any way to implement Brackets-like live preview?

@Taariqq
Copy link
Author

Taariqq commented Jul 14, 2018

All I need is, with PHP, 'refresh browser on save' and 'switch browser to the file that is being edited in emacs'.
If I have these two features, I will be happy.

@ejmr
Copy link

ejmr commented Jul 15, 2018

Is there any way to implement Brackets-like live preview?

Years ago when I used Conkeror as my browser I had some code hacked together which did those things, albeit in a rough and ugly way, and that wasn't exactly error-proof either. So yes, it is possible to implement; I suspect a browser-agnostic approach would be more difficult though, which is what I am assuming Brackets does. There are other modes for GNU Emacs which provide live preview support for their respective content---I apologize for not being able to think of any off the top of my head. But examining those could possibly serve as a model or example for PHP Mode to follow, or ideally someone awesome has written a mode which already does exactly this and I'm just unaware of it.

But anyways, yes, those two features are technically possible. Thank you for bringing them up for discussion.

--ejmr

@Taariqq
Copy link
Author

Taariqq commented Jul 16, 2018

@ejmr That part about perhaps someone has already implemented it -- that would just be ideal.
Good to know that you had something similar implemented, so at least I have reached out to the correct people.
Adam Taylor from Boston Emacs Meetup group pointed me to you guys.
Also, someone on reddit responded with something that might be a good starting point.

One way or the other, I'd like to see this implemented. Brackets' Git integration sucks and VS Code ... well, that is Microsoft!

@ejmr
Copy link

ejmr commented Jul 16, 2018

One way of the other, I'd like to see this implemented.

If you have never done any Emacs Lisp programming---or even if you have---this would be a great way to start. The overwhelming majority of functionality in PHP Mode was implemented by the users who wanted that specific functionality. And in my experience that process accounts for most features in every open-source project.

Do not be dissuaded if you have little to no experience with Emacs Lisp. Instead embrace this as a fantastic learning opporotunity. Even if you cannot completely implement this functionality on your own, attempting to implement it anyway would...

  1. Be greatly appreciated by the the maintainer (@zonuexe). I try not to speak for other people but I feel very confident in saying that in this situation.

  2. Teach you a number of important concepts and techniques in GNU Emacs, all of which will empower you as a GNU Emacs user.

  3. Earn you valuable lessons and advice from the many, many friendly contributors to this project, who would be happy to help you in your study of Emacs Lisp.

I no longer actively contribute to or maintain this project. However, if you attempt to implement this functionality yourself, I will personally do what I can to mentor and advise you along the way, time and health permitting.

--ejmr

@cyrialize
Copy link

@Taariqq I've been planning on contributing to php-mode and php-suite for some time now. As someone just getting started in emacs-lisp I find creating my own tiny functions in my config files a great way to learn. For example, https://github.com/jonnycyr/.emacs.d/blob/master/code/jonny-php.el. I work with legacy code a lot and most of the time I don't want Emacs automatically deleting whitespace - so I wrote a function that made it so Emacs didn't do that.

Also, http://ergoemacs.org/emacs/elisp.html - Xah's tutorial is pretty great. I find it to be right to the point, I'd suggest looking through it if you want to get hacking immediately.

@Taariqq
Copy link
Author

Taariqq commented Jul 17, 2018

Eric and Jonny,

It is very heartening to read your posts, especially Eric's. Even though I have been exposed to emacs and the world of programming since the 90's, when it comes to the practicality of the things, I am just a newbie to both. Meaning I have not done anything significant in either.

Currently, I have gone on a learning path to PHP. If I decide to do this, it would mean that I learn Emacs well, first, and then take a crack at Elisp ... and then try to break down the problem and implement a solution.
Sounds like a great little experiment that will give me a real life like experience. The flip side is if I can't break down the problem I would have lost a lot of time from my PHP path.

On a side note, I do remember RMS mentioning that you should learn Emacs and Lisp and that will teach you the principles of how to program a computer. That could be an incentive!

  • Believe it or not, I think I got in touch with Stallman over the newsgroups back in 1991 or something, over some issue. If I remember correctly, it was him. I had written the Muslim salutation of I begin in the name of Allaah, the most gracious, the most merciful and RMS would argue that -aha, you see there is more than one God .. Muslims say most gracious- lol

I am still undecided about diving into this, as even after it is implemented, next target is WordPress development. I am not sure how suited Emacs would be for that kind of work. Not sure. I am 50/50.
And then I just saw some PHP7mode, kind of abandoned. I am hoping that the functionality is ported into the main PHP-mode, but if not, that would be another disaster. Lots to think before I jump in.

For starters I am watching this Elisp video for now and will decide later, God willing.

Thank you very so much for helping motive me. I will keep you guys posted either way.

taariqq

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

No branches or pull requests

3 participants