23 September 2017

Writing, because Emacs

Blogging is writing and publishing. I've not been writing here much for lack of a relatively frictionless process. And also because, well, translators on Mac don't seem to have so many issues anymore with the platform. Or maybe they don't really exist. I'm not sure.

Some people say they've moved to Emacs because of org-mode. Emacs? org-mode? The names are probably unknown to most translators. But they're what brought me back to writing, and eventually to publishing, at least here and other places.

Emacs is a venerable text editor. It is one of the first "officially" free programs published ever, and it is the beginning of the Free software movement, in a way. Emacs is in fact more than a text editor. And a lot of people are confused by that because Emacs is before anything a Lisp virtual machine that was made to run on any platform.

Lisp machines used to be hot in the 80s, when research on AI was at its peak. Lisp machines were computers that understood Lisp down to the CPU... And Lisp was the language of choice for AI back then. Lisp itself is the second-oldest programming language still in use today. Its implementation started in autumn 1958 explicitly as a language to research AI at the MIT. A few years later, copyright issues and headhunting resulted in fewer and fewer people able to freely use and develop Lisp, and that's when Emacs was conceived, at first as a way to put Lisp on any possible machine without limiting them to Lisp Machines, to fight against the people who were attempting to close access to that knowledge.

Emacs now looks like a text editor because a text editor is a required tool to write Lisp code. But besides for Lisp code writing, which it does very well, Emacs is able to write any kind of things. And programs in Lisp written for Emacs have been extending Emacs functions to areas that were never envisioned by the original creators.

org-mode is one such program. It does not look like a program, of course. It looks like you're doing things in Emacs and it's easy to organize them because org-mode is here to help you.

I wrote above that a lot of people have moved to Emacs because of org-mode. In Emacs talk, a mode is a group of specialized functions. In my Emacs, I have installed a chess mode, that allows me to play chess in Emacs, a "deft" mode that emulates in Emacs the behavior of Notational Velocity, the famous note taking app for OSX, I also have apples-mode that transforms Emacs into an Applescript editor or writeroom-mode, that works like all the "distraction-less editors" around, except that it turns Emacs into that distraction-less editor. Some people say that Emacs is an operating system and that you don't have to leave it to do your computing. You can browse the web, do your mail, write text, read PDF files, etc.

org-mode was created over the outliner-mode that Emacs provides. Outliners exist everywhere. Mac has many nice outlining applications where you can put notes in a given hierarchy, sort them, search their contents, use them as reminders or as todo lists, etc. org-mode original creators started to add functions to the Emacs outliner, and then everything grew so big that a separate mode was born.

I am just a beginner in Emacs. Although I started using it about 20 years ago, I never got to actually use it because most of my "writing" work then involved regular expressions and the tool of choice on Mac at the time was BBEdit Lite. I still don't do regular expressions in Emacs. When I need to do relatively complex searches, I still switch to BBEdit (Textwrangler is going to be discontinued and BareBones is planning to default BBEdit to a lite version, except for the paying users who'll be able to unlock the full thing).

I am just a beginner but I have traces of Emacs edited files on my machine dating back at least 10 years. I remember meeting a then not yet world-famous Emacs contributor/blogger in Tokyo, almost 13 years ago and showing her an Emacs book in Japanese I had just bought. And I remember reading about and using Emacs at the end of the 90s when I was attempting to install and run Linux on that IBM/Lenovo machine I had just bought when I came to Japan. It worked eventually, but Unicode was not widely spread then and I had to constantly switch between a French environment and a Japanese environment to do my work on Linux, and that was not convenient. So I moved (back) to Mac, which I had started using a few years before, where Emacs then was not as attractive for the casual writer as it is today.

Why Emacs? For me it was not org-mode, which did not exist then. It was just the intuition that Lisp was an amazing language and that I ought to learn it. 12 years ago there was another peak Lisp with the publishing of "Practical Common Lisp". There were Emacs distributions that were tweaked to include the latest Lisp editing environment, there were blogs that discussed the marvels of writing Lisp in Emacs. There were beginning attempts at curating the various libraries that were spread all over the place. There were discussions about creating the best Lisp ever... It was like a Lisp rebirth, and the Emacs mode that everybody talked about then was slime, the best Lisp editing environment.

I never got to go beyond the cover of the Lisp books I kept buying though. And it is only many years later, that org-mode and the articles I kept reading about it finally got me started, along with the nagging feeling that I should be better organized and that I should start writing, not just resume blogging, but write my own stuff. And for that I needed no bells and whistles, no fancy WYSIWYG application, just white characters on a black screen with wide margins and nothing else.

I'm writing this article from org-mode. The article is one "node" in a big "blog.org" file where all the nodes are listed in chronological order, with the date and time I started them in the header title. I start writing an article by calling a "capture template". This one has the name of this blog. I have 9 different templates. One for a big TODO file, one for a personal FAQ where I add questions and answers about all the stuff that I want to know about Emacs, org-mode, git, and various other things. Then I have one for taking various notes, I have a daily journal for things that won't be published, then 2 templates for 2 different blogs (including this one), 2 others for 2 novels I have in mind and a last one for an introduction to Emacs Lisp that I've wanted to write for a long time now.

It took me a while to realize that the feature that would hook me to Emacs was this "capture" thing. org-mode is a lot about headers, subheaders, TODO states, lists, deadlines and calendars and timers. It is a huge planner machine that goes in so many directions that it is not possible to fully use it all. The terms used in the manual are sometimes obscure and the manual itself goes into a lot of details not relevant to the beginning user. So you really have to wander on the net to find the tutorial that works for you, tweak some settings and start. I have 51 documents on my machine that I tagged with "org". I've browsed them all at least once. I keep them for easy reference to see what people do with org-mode, but the documents I consult the most now are the Org Manual and the Emacs manual.

When you start tweaking, it never ends, but it's OK. Your documents are being written in a live Lisp environment. Everything you do, from typing a single letter to reorganizing your paragraphs or checking your calendar is done by calling functions that you can modify right away by just editing and evaluating them. Assigning shortcuts is also a Lisp function away. But you don't have to worry about learning Lisp before you start using Emacs. It just comes, almost naturally, little by little. And it is not difficult. It took me just a few days of reading and researching before proposing code that fixed a bug in an OSX service Emacs.app provided, and that code was eventually accepted for release in Emacs. I was totally new to Emacs Lisp and even though it was only a few lines of trivial code the whole thing was not trivial, but it was not hard to find the issue, understand it, and fix it, because I could do that right there, inside that live Lisp environment that Emacs is.

I wish there was a powerful translation mode in Emacs. There is a po-mode that does interesting things, but it is nowhere near what professional translators use. There was an attempt a long time ago at linking the current target segment of an OmegaT project to Emacs, but the device involved a lot of intermediate technologies (a bridge from Java to Python and then one from python to Emacs it I remember well). Doing CAT based translation work in Emacs is not possible now, as far as I can tell. But that's fine. I just need to know that I have found a pretty good writing environment and that I can just "capture" my thoughts, put them on virtual paper and move on.

17 September 2015

Safari Extensions

I was trying Omniweb the other day on a very standard page (from the Emacs lisp tutorial by Xah Lee at http://www.ergoemacs.org/emacs/elisp.html) and I was shocked to see adverts in a box on the right side of the screen.

Safari and its extensions had got me used to a web without adverts invasions, without irrelevant contents, and with much less energy use when I'm unhooked.

I guess other browsers have similar features but after a bit of hesitation, I quit Omniweb and reverted to Safari.

The extensions I use are the following:

Adblock blocks ads on all websites.
Adblock Plus seems to block even more stuff
Directlinks makes indirect links on Google and Facebook direct
Ghostery stops tracking engines and shows you which were going to track you
StartPage HTTPS enables the StartPage search engine, through HTTPS
ClicktoFlash prevents Flash contents from loading automatically
ClicktoPlugin does the same for various plugins
Facebook Cleaner removes a lot of cruft from Facebook pages
Facebook improved improves on that experience
Clea.nr YouTube removes a lot of cruft on YouTube

That's pretty much it.

The site specific plugins are only icing on the experience since Adblock and Adblock Plus do most of the heavy work. Directlinks and Ghostery are important too, to keep sites from tracking you against your will.

Here is a good piece on ad blocking, via Daring Fireball:

"Welcome to the Block Party"
http://www.theawl.com/2015/09/welcome-to-the-block-party

06 January 2013

Free vs. Proprietary software

2012 was the year when I bought the most proprietary software licenses.

Such purchases were mostly prompted by special needs that seemingly could not be answered by available free software.

I bought a license for Infix (PDF editor), for Abbyy FineReader Express and Readiris (Japanese and English OCR), for Antidote (French spelling and grammar checker), for Pdiff (visual comparison for PDF files), for Kaleidoscope (visual comparison for image files) and for Transform (XSL transformation).

Antidote from Druide is the software that I use the most often, after OmegaT. I could not work without it.

Infix from Inceni comes as a very distant second. I use it on some PDF files that I need to translate as PDF. I export the contents to Infix export format and translate that file in OmegaT thanks to the Infix XML filter that was developed a while ago. Infix does not come without problems (crashes, clunky user interface), but it works most of the time.

Abbyy and Readiris were bought when I needed to OCR a few important files, sometimes PDF, sometimes plain images. I then translated the exported files with OmegaT.

I bought Kaleidoscope from Black pixel because I needed to compare a set of multipage PDF documents. Kaleidoscope does not support PDF, but I thought I'd be able to easily convert the files to a compatible image format. That was not the case. Even though my machine is quite powerful, I could not find a practical way (free software or not) to convert two 400 pages PDF files into a single image file with a good enough resolution to process the file set in Kaleidoscope.

Then I bought Pdiff from Csci. Since there was no trial version, I asked the developers to try it on my file set and send me an excerpt of the result. What they sent me was very satisfying, but was made in the "pro" version that had an Export to PDF feature for reports, while the "lite" version had nothing like that. I bought the lite version anyway, but its report function was nowhere close to what the pro version offered at a priced that did not justify a purchase (999€). There is no way to export the report in the lite to anything useful and there is even no way to copy it for conversion to a different format.

Eventually, I did the comparison with diffpdf a free software from Mark Summerfield. diffpdf has a problem: it does the comparison page by page but does not notice when data is spread on 2 pages. To fix that, you have to manually add white pages in places where you want diffpdf to do a dummy comparison so that most of the pages are kept in sync. This is slightly cumbersome but took only about 1 hour to complete on the 400 pages x 2 pages set. The resulting comparison report in PDF was easy to read and exactly what I needed to proceed with my work.

Transform is from Neil Lang, an individual developer. I was being lazy and I wanted something more than what XSLPalette offered so I checked the App Store and found Transform. I paid the license, installed it, tried it, send a request for feature to the developer who promptly answered by telling me that the feature was already there, but "hidden" from the eyes of the user. After playing with it a bit I decided to use xsltproc on the command line to proceed with my work.


I learned 3 things:

1) Free software ended up being good enough for what I needed and I wasted money on software I did not really need.

2) Good proprietary software does not come in "lite" and "pro" versions. Either it does what you need it to do, and it does it well, or it is not worth bothering.

3) There is a business selling software output when users don't want to buy a license to a software they'll use only once every few months. I could see myself spending a few (dozen ?) euros on a nicely output PDF comparison report, or on some nicely OCRed files.

27 October 2011

Oracle JDK7 for OSX

You remember when Apple said they would not maintain Java anymore ? That was just 12 months ago:

Java is dead! Long live Java? (on this blog)

I just noticed that Oracle released a new preview edition of JDK7 for OSX yesterday (b215).

http://jdk7.java.net/macportpreview/

I installed it and after changing my Java preferences (search for "Java Preferences" in SpotLight), I tried the preview version of OmegaT.

The result ?


54443: Info: OmegaT-2.5.0_1 (Thu Oct 27 15:05:55 JST 2011) Locale en_US
54443: Info: Java: Oracle Corporation ver. 1.7.0-ea, executed from '/Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home/jre' (LOG_STARTUP_INFO)


It works !

No crash yet so I think I'll finish the current job with that new version of Java.

Be extra cautious though when you use preview versions of software. A bug can bite you in the middle of a job...

Update (a few hours later)
It works, but there are a few issues that make it not practical to work with this preview right now. I've reverted to Java 1.6 until Oracle delivers something closer to a release candidate :-)

Detailed information is here:

http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Project+Status

Update (a few days later)
Apple has just released a new update for Java 1.6 for Snow Leopard and Lion. Check software Update. The JDK7 port just released a new build: b217.

New fun to come with OmegaT 2.5...

OmegaT 2.5, the preview version that you can get from:

https://sourceforge.net/projects/omegat/files/OmegaT%20-%20Latest/

includes a really nice new feature that, unfortunately, is not yet available for Mac users...

(Nov. 10 update: the latest version of the plugin works fine on Mac now)


If it is not, then you can rightly ask why bother mentioning it here at all ? Well, the answer is simple. It is kind of available, but because of an user interface design issue, the buttons that make it run are not available on Mac... This is going to be fixed real soon. In the meanwhile, get ready for...

A scripting interface to OmegaT's internals.

See the announcement here:

http://tech.groups.yahoo.com/group/OmegaT/message/22988

People who know what they are doing can already check this Java documentation page:

Scripting for the Java Platform

According to the scripting plugin source code, the possible languages for use in OmegaT are:

  • JavaScript
  • Jacl
  • NetRexx
  • Java
  • BML
  • VBScript
  • JScript
  • PerlScript
  • Perl
  • JPython
  • Jython
  • LotusScript
  • XSLT
  • Pnuts
  • BeanBasic
  • BeanShell
  • Ruby
  • JudoScript
  • Groovy
  • ObjectScript
  • Prolog
  • Rexx


There are already plenty of exchanges on the OmegaT mailing list regarding the scripting extension. Check this thread for example:

http://tech.groups.yahoo.com/group/OmegaT/message/23260

We'll have an announcement here when the feature works on Mac...

Dennis Ritchie and John McCarthy too...

A few days after Jobs, Dennis Ritchie and John McCarthy passed away too, but that did not trigger international interest.

Dennis Ritchie is called the "father of C", C as in "C language". Everyone who's done a little bit of programming knows about the importance of C in the computing world.

http://en.wikipedia.org/wiki/C_(programming_language)

A few days after Ritchie, John McCarthy, the "father of Lisp" passed away too. Lisp is the language that was mostly used for artificial intelligence works "back then".

http://en.wikipedia.org/wiki/Lisp_(programming_language)

Lisp is 11 years older than C. Lisp was born in 1958 and C in 1969. But both languages are still commonly used in computing today...

Of course, both languages can be used on Macs. If you install the developer's tools that come with your DVD, you have access to a C compiler. Lisp, being a family of languages, requires to make a few choices (either get an ANSI standardized Lisp, or a Scheme, or a new Lisp like Clojure, that runs in Java etc.)

As for introductory books, "Land of Lisp" by Conrad Barski, M.D., from No Starch Press has been very well reviewed.

http://nostarch.com/lisp.htm

"Practical COmmon Lisp" by Peter Seibel from Apress is really nice too and sparked a renewed interest in the language. Plus, the PDF is freely available.

http://www.gigamonkeys.com/book

As for C, well, there are so many books about C programming that the only one I can think of is Kerninghan and Ritchie's "The C Programming Language, Second Edition" from Prentice Hall.

http://cm.bell-labs.com/cm/cs/cbook/

Objective-C is a strict super-set of C and is mostly known for being the language behind OSX applications.

A good introduction I found is "Programming in Objective-C" by Stephen G Kochan, from Pearson Education.

http://www.pearsonhighered.com/educator/product/Programming-in-ObjectiveC-3E/9780321711397.page

Of course, you can find plenty of free tutorial that can get you started in both languages.


Programming is fun and if it is not already the case, you should really give it a try.

06 October 2011

Steve Jobs passed away

It's going to be analyzed all over the world. Daringfireball linked to Job's Commencement Address in 2005. Here it is:

'You've got to find what you love,' Jobs says