JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.76k stars 5.49k forks source link

incorporate emacs mode changes from ESS in a way that doesn't require emacs 24 #4010

Closed stevengj closed 11 years ago

stevengj commented 11 years ago

commit 2bfcc92a5499a736d5a434ab9616bdf32a8d5950 by @sje30 changed the Julia emacs mode to use prog-mode. Unfortunately, prog-mode was apparently introduced in emacs 24, meaning that the Julia mode is broken for older emacsen (e.g. MacOS X 10.7 ships with emacs 22).

sje30 commented 11 years ago

commit 2bfcc92a5499a736d5a434ab9616bdf32a8d5950 by @sje30 changed the Julia emacs mode to use prog-mode. Unfortunately, prog-mode was introduced in emacs 24, meaning that the Julia mode is broken for older emacsen.

Thanks; if you change "prog-mode" to nil does that work for you on Emacs 22,23? (define-derived-mode julia-mode prog-mode "Julia"

i.e. (define-derived-mode julia-mode nil "Julia"

If so, I can send a refined change. Stephen

stevengj commented 11 years ago

It loads, but then I get another error as soon as I try to tab-indent something: Symbol's function definition is void: ignore-errors.

You probably need to install emacs 22 on your machine and test it with that.

sje30 commented 11 years ago

Ok, thanks. Can you revert the patch for now, as it sounds like I've not helped anyone yet with these updates!

sje30 commented 11 years ago

In general, what is the expectation for the oldest Emacs that you'd like julia-mode to work on? 22.1?

stevengj commented 11 years ago

MacOS 10.7 has emacs 22.1; I'm not sure if older emacsen are common. @ViralBShah?

ViralBShah commented 11 years ago

22.1 is the minimum we should target for now, due to OS X 10.7. I guess we will find out if people are using linux distros with even older emacsen, once the patches land.

BobPortmann commented 11 years ago

I think developing the Emacs mode against a newer version of Emacs (23 or even 24) is the right choice. Version 22.1 is 6 years old! There have been lots of improvements since then (including a package system to distribute modes). Apple has apparently decided not to ship any GPL V3 software so I guess they will never update their shipped version of Emacs. Plus, its a terminal only version (i.e., less friendly for beginners). They would do everyone a service if they just stopped shipping Emacs altogether.

Luckily, installing a newer version of Emacs on OS X is VERY easy. Macports works great and has several variants. I assume Homebrew does as well but I never tried. In addition, there are several binary versions that can be downloaded. These pages are useful:

http://wikemacs.org/index.php/Installing_Emacs_on_OS_X http://www.emacswiki.org/emacs/EmacsForMacOS

ViralBShah commented 11 years ago

I do not think it is right to ask people to install a new version of emacs on mac to use julia. I myself use the system provided one in the terminal. I do agree that we may be better off if they stop shipping emacs altogether.

Can't we have some ifdefs to maintain compatibility with the older emacs?

sje30 commented 11 years ago

I do not think it is right to ask people to install a new version of emacs on mac to use julia. I myself use the system provided one in the terminal. I do agree that we may be better off if they stop shipping emacs altogether.

I am glad that someone else (thanks Bob) chimed in to support the idea of sticking to a more modern Emacs. I can see that Emacs 22.1 is a special case as it is installed by Mac OS X, but my intentions with julia emacs support were to keep the version in contrib fairly minimal (e.g. editing support), but to put most energy into the ESS version.

(I'm hoping to resend my patch to clean up the contrib/julia-mode.el but it might not happen now til after the vacation.)

In particular, as Bob mentioned, modern Emacs comes with a package manager which makes installing packages much easier.

Can't we have some ifdefs to maintain compatibility with the older emacs?

That can be done, but you end up doing a lot of reinventing of the wheel!

Emacs in a terminal is fine, but on my mac laptop, you get a nice modern Emacs e.g. from brew, using:

brew install emacs --with-cocoa

Stephen

ViralBShah commented 11 years ago

I think it is perfectly ok to continue future development on a newer emacs. This may even convince me to get a newer emacs. :-)

Perhaps we can have an old and separate julia-mode-22.el for emacs 22.1 for Mac users to use by default (often a lot of people are just trying out julia for the first time, and just want something that works), and have new development focussed on a more modern emacs and ESS.

sje30 commented 11 years ago

I think it is perfectly ok to continue future development on a newer emacs. This may even convince me to get a newer emacs. :-)

Great! Why not take a look at the following page, to tempt you:

https://github.com/emacs-ess/ESS/wiki/Julia

This is all Vitalie Spinu's (@vitoshka) hard work by the way.

Perhaps we can have an old and separate julia-mode-22.el for emacs 22.1 for Mac users to use by default (often a lot of people are just trying out julia for the first time, and just want something that works), and have new development focussed on a more modern emacs and ESS.

well, as the contrib/julia-mode.el works for 22.1, another solution is just to leave that. I'll monitor that file, and if I see any changes, I can see how to fold them into ESS. My hope would be that gradually keen Emacs/julia users would migrate to trying ESS.

Stephen

vspinu commented 11 years ago

ESS doesn't support Emacs 22. Keeping stuff compatible was too much of a pain. Too many things were missing.

For best experience with ess-julia.el you will need Emacs > 24.1. Otherwise some features, like tab completion, will not work.

porterjamesj commented 11 years ago

I like Viral's idea of moving forward with a Emacs 24+ version while keeping the old one around, for that reason that some people are stuck in situations where they can't easily upgrade from 22 (e.g. me working on my university's lab machines).

johnmyleswhite commented 11 years ago

Splitting things seems like a good idea to me as well.

vspinu commented 11 years ago

With such a simple project there is no much point in splitting it. It is easy to add the compatibility layer. For instance:

(unless (fboundp 'ignore-errors)
  (defmacro ignore-errors (&rest body)
    "Execute BODY; if an error occurs, return nil.
Otherwise, return result of last form in BODY.
See also `with-demoted-errors' that does something similar
without silencing all errors."
    (declare (debug t) (indent 0))
    `(condition-case nil (progn ,@body) (error nil)))
  )

John Myles White notifications@github.com on Mon, 19 Aug 2013 09:30:18 -0700 wrote:

Splitting things seems like a good idea to me as well.

Reply to this email directly or view it on GitHub: https://github.com/JuliaLang/julia/issues/4010#issuecomment-22884802

ViralBShah commented 11 years ago

If this is possible, that would be super. Not being an elisp expert, I could not quite tell what it would take.