Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Add Emacs Cask support #73

Merged
merged 3 commits into from
Nov 13, 2017
Merged

Add Emacs Cask support #73

merged 3 commits into from
Nov 13, 2017

Conversation

jcouyang
Copy link
Contributor

As a Emacs user, I'm using orgmode to generate
my blog. And, I really like switch to netlify from github page
and circleci(emacs will compile orgmode files to html on the CI).

I've really like to have Emacs installed as part of netlify's build
tool(hugo can support partially orgmode parsing, but not native completely
support like emacs), and Cask as package management tool for Emacs.

So I can compile
Emacs orgmode files with command such as cask exec emacs --batch -l my-emacs-config.el -f org-publish-all on netlify build, just like any ruby command bundle exec blah

@kaushalmodi
Copy link

Can you also update this to install the latest version of stable Org?

Copy link
Contributor

@Benaiah Benaiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with the choice of PPA here - I'd rather have a non-patched version from official repositories without the major version hardcoded into the package name. I do understand the motivation, since distro versions of Emacs typically lag behind the current Emacs version, but I see this causing more problems than it solves.

Other than that, this LGTM.

Dockerfile Outdated
USER root
RUN add-apt-repository ppa:kelleyk/emacs
Copy link
Contributor

@Benaiah Benaiah Jul 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty non-standard version of Emacs - it's a third-party (AFAICT, neither the Ubuntu team nor the Emacs maintainers are involved at all), patched version that releases newer versions of Emacs than those available in official Ubuntu repos. If this PPA is ever abandoned, we'll need to find a different one. If Ubuntu updates to the latest version of Emacs, we'll likely want to switch to their version anyway. Using the distro versions off the bat sounds like a better idea to me, and v25.2 isn't all that different from v24.4 (which is, I believe, the current version in the official Ubuntu repos).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v25.2 isn't all that different from v24.4

v25.2 has a lot of changes since 24.4. See NEWS.25.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a ubuntu user, I'm happy to hear any suggest on how to install emacs 25 on ubuntu officially.

AFAICT ubuntu 14 officially only provide emacs 24.3, but most moden emacs packages require at lease 24.4.

CMIIW i think kelleyk/emacs just provide deb pacakge, it's still build from official emacs source

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True - I meant changes that would affect using Emacs as a build tool, though that's admittedly hard to predict. If the 24->25 upgrade is really affecting build, would it be possible to use the emacs25 package used in newer Ubuntu versions (see https://packages.ubuntu.com/zesty/editors/emacs)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the 24->25 upgrade is really affecting build

sorry I'm not following, this is not an upgrade, the Ubuntu 14 docker don't have any emacs preinstalled, how it's gonna affect v24 build?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like orgmode should work just fine with v24.4:

http://orgmode.org/Changes.html

From now on, Org expects at least Emacs 24.3, although Emacs 24.4 or above is suggested.

I'd rather use the distro version if the library works the same. We don't need all the emacs features in this case.

Copy link
Contributor Author

@jcouyang jcouyang Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, v24.4 would work just fine, but distro version is 24.3, which is too old and useless, even some common package like scala-mode or clojure-mode (for code highlight in org export) will not work.

to get 24.4 or above IMO there're 3 options:

  1. ppa
  2. build from source code(there's already build-essentials installed, so I guess it would just work)
  3. change the base image from Ubuntu 14 to 16, which have emacs 24.5 included(but could be big impact to other packages in build-image)

what would you prefer? @calavera

Dockerfile Outdated
USER root
RUN add-apt-repository ppa:kelleyk/emacs
RUN apt-get -y update
RUN apt-get -y install emacs25-nox
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line will have to be updated when Emacs gets past 25 (though that's admittedly a ways out at the moment). IMO it'd be better not to use a package with the major version hardcoded. Also, does this install the binary as emacs or emacs25?

Also, this is the nox version, which drops X dependencies. I'm not aware of any implications this would have on somebody using Emacs as a build tool, but this is not the most common build configuration. I think that's fine, since I can't imagine anybody needing graphical frames as part of an automated build, but I wanted to note that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the nox version here.

@jcouyang
Copy link
Contributor Author

jcouyang commented Jul 25, 2017

@kaushalmodi

Can you also update this to install the latest version of stable Org?

org is a package, should be installed as package by user in Cask file

just like ruby or any other lang, you define packages in Gemfile, not when you install ruby

@Benaiah
Copy link
Contributor

Benaiah commented Jul 25, 2017

@kaushalmodi while Cask files are not what I'd personally recommend (it's infrequently updated, written in Python instead of Elisp for no real reason, and I don't have a great experience working with it), Emacs also has built-in packaging utilities, which include the ability to upgrade to a newer version of org. I personally use use-package with quelpa and quelpa-use-package, but the packaging facilities built into Emacs are decent as well. I don't see a need to upgrade Org in the Dockerfile, particularly since people using the default version may see their scripts break.

@DamienCassou
Copy link

Do you know about EVM? Here is how to use it in travis:

before_install:
  - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
  - evm install $EVM_EMACS --use --skip
  - cask

env:
  - EVM_EMACS=emacs-25.1-travis
  - EVM_EMACS=emacs-25.2-travis
  - EVM_EMACS=emacs-git-snapshot-travis

@jcouyang
Copy link
Contributor Author

jcouyang commented Aug 8, 2017

@DamienCassou
EVM looks awesome, but from it's source code, it still build from source, so I think build one on docker is more reasonable to me if ppa is a concern.

@calavera

I'd rather use the distro version if the library works the same

distro version is 24.3, most modern emacs packages require at lease 24.4

@Benaiah configure it as without-x we don't need x window for emacs batch mode

the environment variable CANNOT_DUMP=yes is because the issue moby/moby#22801 but it doesn't affect anything in batch mode so I think that's fine for orgmode parser purpose here.

@kaushalmodi
Copy link

I'd love to see Emacs being available on Netlify even more now that I have a stable blogging flow of exporting Hugo posts directly from Org (https://ox-hugo.scripter.co).

Any update on this please?

@kaushalmodi
Copy link

@Benaiah It would be nice if a minimal emacs binary is available on Netlify as we won't need GUI frames, etc. .. just enough to run it in batch mode, and load/run other libraries like org-mode.

Emacs is more than a text editor.. it's a lisp environment.

@Benaiah
Copy link
Contributor

Benaiah commented Nov 7, 2017

@kaushalmodi to be clear - I'm totally in favor of having Emacs support (I've used it as an SSG myself in the past). The only major issue I originally had with this PR is that 24.4 (which is different from 24.3 in very significant ways) isn't available from the default Ubuntu repos for our version of Ubuntu, but I'm not comfortable building Emacs out of a random PPA. I suggested above (in the discussion on the review comments) that we see if we can get Emacs 25 by pulling it from the source of a newer Ubuntu version - that seems like the simplest option to me. Building from source (as the PR is currently doing) is also acceptable, but @calavera would have to chime in on how feasible that is within our infrastructure, as I'm not an expert on it.

Dockerfile Outdated
RUN apt-get -y update
RUN apt-get -y install emacs25-nox

RUN wget http://ftpmirror.gnu.org/emacs/emacs-25.2.tar.gz && \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Benaiah Looks like PPA is no longer used in the updated PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, so understood.. you don't have any issue with the updated PR, and we are waiting on feedback from @calavera.

@calavera Please look at this PR.

@calavera
Copy link
Contributor

calavera commented Nov 8, 2017

I'll test it out this week with a bunch of other updates we have in the queue to production.

@kaushalmodi
Copy link

Very cool! While you are testing it, can you change that URL to get Emacs 25.3 instead of 25.2? @jcouyang Can you update the PR?

@jcouyang
Copy link
Contributor Author

jcouyang commented Nov 8, 2017

Thanks @calavera, looking forward to hearing good news from you soon.
great idea, @kaushalmodi I just update and parameterize the emacs version so future upgrade will be easier as well

@calavera
Copy link
Contributor

This seems to be working on my tests. I'm going to merge it, but we won't deploy it just yet. I'll leave another comment here when that happens.

@calavera calavera merged commit 9380310 into netlify:master Nov 13, 2017
@kaushalmodi
Copy link

@calavera Looks like now emacs available for a while on Netlify! I was waiting for a followup comment to happen here, and I just noticed that emacs from Netlify was being used instead of my version. :)

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants