|

Atom under Ubuntu 20.04

I am a loyal soul. But my patience is limited: On Ubuntu 20.04, the tips from Eclipse are displayed in black on black. Hmm. Markdown editors are cumbersome. Oops. And the ‘spell-check’ for German-English texts still doesn’t work. Grrr. So, it is time to conquer new frontiers: everyone is already talking about ‘Atom‘. Let us give it a try even if – on Ubuntu 04/20 – we have to circumnavigate some cliffs.

First, let’s specify what Atom has to offer in order to please us:

  • Spell checker for German-English texts …
  • with simultaneous syntax highlighting …
  • and code completion for Latex, Markdown, HTML PHP, C / C ++, Java, bash.
  • Seamless integration into a mobile laptop work environment.
  • Good markdown support.

Then let’s install and configure this editor:

The standard Ubuntu method doesn’t work straight ahead!

At least since version 20.04, the new snap package format becomes a standard that you can hardly avoid. Many programs – including ‘Atom’ – are no longer offered as Debian packages but have to be installed via the Ubuntu software center as snap packages. Sometimes, that works – but sometimes it doesn’t:

My first installation ran into a trap: After a few days, it was no longer listed. Neither snap list atom nor snap list --all mentioned ‘Atom’ although I could still call the editor. Thus, the package was cut off from all automatic updates. My solution was ‘simple’: I successfully reinstalled ‘Atom’ via the Ubuntu Software Center. Then, the editor could be found again, could be removed without leaving any residue using snap remove atom (and could be reinstalled)

But – as described on the internet – the version offered by the Ubuntu Software Center behaved ugly: with every call it unavoidably opened two completely useless documents. So I had to rule out this variant: If I wanted to be further annoyed, I could have stayed with Eclipse.

The .deb detour also fails.

The official Atom documentation describes two ways to install ‘Atom‘. The easier way is to download the .deb package and install it with sudo dpkg -i atom-amd64.deb. Unfortunately, that method fails because of unresolved dependencies.

But at least a complex methods works …

According to the second method, described by the Atom documentation, you have to download the key, to expand the apt sources and to update the system before you can install the package:

1. wget -qO - https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
2. sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
3. sudo apt-get update
4. sudo apt-get install atom

By this method you successfully get an editor integrated into the Ubuntu GNOME 3 desktop.

… which still requires some additional packages …

Atom can officially be expanded by packages. The respective interface can be accessed via Edit / Preferences / Install (Linux) or via File / Settings / Install (Windows): In the upper text field one inserts the name of the desired package. Then, the system searches for the appropriate ‘index card’, which offers an install-button.

But occasionally, the integrated search does not work. Every call ends with the error i.filter is not a function [object Object]. This error is not evoked by Ubuntu, but – as the community assumes – by the Atom server.

In such cases, you reach your goal in a roundabout way: you search for the respective package via Google. Mostly, you will be offered a hit pointing to https://atom.io/packages/. The readme-file of the respective package often also describes how you can install it manually. Usually, you only have to type inapm install $packagename at your console. This command installs the package under .atom/packages.

By this method we can get the extra packages we need:

  • First, we want to use ‘Atom’ as a LaTeX editor. To do this, we have to teach it the LaTeX syntax: apm install language-latex
  • Second, we may want to use ‘Atom’ as a LaTeX IDE, so we have to make the LaTeX build commands accessible to it apm install latex
  • Additionally, ‘Atom’ should check our spelling, in German and English texts. We will configure the multilingualism later. But then, ‘Atom’ shall not show us every LaTeX command as an error. But simultaneously, it’s supposed to verify our (LaTeX) code. Hence, we have to teach him that language via linter and its respective sub-modules: apm install linter linter-spell linter-ui-default linter-spell-latex. For the other languages, there is a corresponding command, e.g. apt install linter-
  • After all, we also want to use ‘Atom’ while we are working on a sunny terrace. The dark mode makes this extremely difficult. Fortunately, there is a package with which you can quickly switch between light and dark: apm install dark-mode. As usual, you find the respective toggle command under Packages/dark mode.
  • Fortunately, we hardly need to do anything for our Markdown activities: Syntax highlighting runs out-of-the-box. And by using the entry Packages/Markdown Preview we can directly view the HTML equivalent. But to convert a file into the PDF format without switching to the shell, we still need a package: apm install markdown-pdf. After having restarted Atom, we can configure the package under File/Settings/Packages#markdown-pdf and can call the conversion by Packages/Markdown To PDF.

… and some adjustments to the configuration:

‘Atom’ can be configured in two ways: By calling Edit/Preferences (Linux) or File/Settings/ (Windows) you open the configuration dialogues. In the sections #Core and #Editor you find the general properties you can set. But under Edit/Preferences/#Packages (Linux) or File/Settings/#Packages (Windows) you get access to the installed packages and their specific configuration options.

We need both methods:

  • First, our ‘Atom’ should apply a soft line wrap, i.e. automatically wrap long text lines without inserting LFs (Linux) or CRs/LFs (Windows) into the text line itself. To activate such a behavior, we set a respective hook under …/Preferences#Editor.
  • Additionally, we also specify that the virtual break should not be at the edge of the window, but at the maximum line width by activating Soft Wrap At Preferred Line Length.
  • Furthermore, our ‘atom’ should be able to check the spelling in mixed-language texts. For activating such a capacity, we have to configure the package…/Preferences/Package/spell-check accordingly:
    • We activate Use Locales with a tick.
    • We insert en-US, de_DE in the field Locales.

So, we got what we wanted to get:

‘Atom’ specifies itself as a hackable text editor. The network knows its best extensions. Be inspired by such reviews. The methods to install them are those with which we achieved our goals:

FeatureStatus
1.)Spell checking for multilingual texts
2.)Context-sensitive spell checking for programming languages
3.)Syntax highlighting for Latex, HTML PHP, C/C++, Java, bash
4.)Code completion for Latex, HTML PHP, C/C++, Java, bash
5.)Integration in a mobile system even for sunny working places
6.)Markdown support

A last confession

Completely replacing Eclipse is impossible and unnecessary. Because no other system supports the development of domain-specific languages in a better way. It’s a blessing to have XText and XTend.

2 annotations for “Atom under Ubuntu 20.04”

  1. Peter Mueller says:

    Any idea of how to get babel-commands-dependent spellchecking? That is, the German document

    Das ist ein langer Satz (engl. \foreignlanguage{USenglish}{sentence}).

    should invoke no spellchecker warnings, whereas

    Das ist ein langer sentence (engl. \foreignlanguage{USenglish}{Satz}).

    should invoke two spellchecker warnings.

  2. Karsten Reincke says:

    Ok. I see, what you want to get: a context sensitive fault message in between a sentence. Does ‘Babel’ offer such a feature in general? I have not used ‘Babel’ actively. So, unfortunately, I can’t help you.

    And my solution is indeed much weaker than that you want to get:

    A) ‘Das ist ein langer Satz (engl. sentence)’ only marks the abbreviation ‘engl.’

    B) And in ‘Das ist ein langer sentence …’ my solution does not see that
    a)’sentence’ normally is not a word in a German sentence as well as
    b) it does not see that ‘Satz’ isn’t an English word.

    So, if you find a way, to get what your need, please let us know your solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

4 + 2 =