Info

Emacs…I Finally Got It

Updated on 2022-11-09

I was a member of a team working on an Oracle project the last nine months of my last job. My company was the prime contractor and we didn’t have any available company staff who knew Oracle, so the Oracle work was subcontracted to an Oracle subcontractor. One of the Oracle subcontractor employees sat in a cubicle next to me and we began talking about Linux one day. As our conversation went on, he began talking about Emacs, how he loved using it, and how powerful it was. He was contemplating starting a blog about Emacs.

At the time I had installed Crunchbang Linux in a virtual machine environment on my personal laptop, so I installed Emacs to see what was so fantastic about it. I quickly became disoriented because to use Emacs proficiently, you need to learn keyboard shortcuts. I was so lost, I had trouble just exiting the program. I quickly dismissed Emacs as an extreme geek tool and uninstalled it.

I’ve used Rainlendar for years, beginning back when I used the Windows operating system. Rainlendar has a *.deb download available, but there were too many times when I ran into dependency issues, having to resort to pulling deprecated (no longer used) dependencies from the Debian snapshot archive. In 2019, I became fed up with the constant dependency fiddling and decided it was time to find another solution. My Internet searching led me to using the Agenda view under Emacs Org mode. I was hesitant to try Emacs again given my previous experience using it, but I decided to give it a try once again.

As happened previously, I quickly became disoriented. Using the tutorial that came with the Emacs installation wasn’t very helpful because I still had trouble navigating due to not being able to remember keyboard shortcuts.

YouTube contains a treasure-trove of how-to videos on a variety of subjects, so I did a search on the YouTube site to see what was available. I discovered three videos that quickly helped me become proficient at using Emacs and Emacs Org mode. Following is a list of the videos that I discovered:

I spent quite a bit of time taking notes as I went through each video because there was quite a bit of information and I knew I would need to refresh my memory about something I couldn’t remember. I still refer back to my notes from time to time.

Feel free to download an Emacs Tips database that I put together using Emacs Org mode. The Emacs Tips database includes my notes from the aforementioned tutorials. You should also download and decompress the GPG signature for the database to verify that the file has not been tampered with. You will also need the Shared Bits public key and verification software.

My decision to take another look at Emacs and Org mode turned out to be a good and timely one. In the past, I’ve used Treepad to keep all of my notes, tips, information, etc. Treepad runs on the Windows operating system, so I run it under Wine. A Wine upgrade under Debian introduced a bug where the fonts were somewhat garbled, making it difficult to use Treepad. As an interim measure, I used Cherrytree, but I soon learned that Cherrytree was slated to be removed from the Debian repositories because the developer had not upgraded the program to use a newer version of Python.

Emacs has been around for years, although Org mode is a more recent development. I decided to begin migrating all of my Treepad databases to Emacs Org mode format, which would be no simple task.

In Treepad, images can be included in a database page by importing the image and the image is then stored within the database. Images can be included in an Emacs Org mode file (hereinafter referred to as a database), but they’re stored as links to the actual physical image file.

When I want to include images in an Emacs Org mode database, I create a folder with a similar name as the database. For example, I have a tech tips database with images, so I created a folder named tech_tips and then within the folder is the database named tech–tips.org. Then I create another folder within the database folder named images. Images for my tech tips database are stored under tech_tips/images.

I manually add image links in an Emacs Org mode database using the following syntax:

[[./images/image-filename.ext]]

After entering the last right bracket, the code converts to a link.

If you have added the appropriate Emacs initialization file setting to always display inline images, the image link will then be displayed as follows after restarting Emacs and re-opening the database.

Copying the images stored within my Treepad databases will involve the following process:

  1. Export the image from the Treepad database to the appropriate Emacs Org mode database images folder, giving it an appropriate file name to include a date.
  2. Create a link to the image file within the appropriate Emacs Org mode database.

I will also have to read through each Treepad article to insure that I include formatting such as bold and italics in the replacement Emacs Org mode database. I’m not sure how I’m going to handle instances where I used different colored text in Treepad.

To date, the most complex features I’ve used in Emacs Org mode are the following:

  • creating internal links
  • creating external links
  • creating image links
  • managing repeating tasks with due dates
  • using Agenda views

However, if you’d like to see an example of how powerful Emacs Org mode can be, check out Aaron Bieber’s post, An Agenda for Life With Org Mode.

While I generally love Emacs, specifically Emacs Org mode, and plan to continue using it for my personal information storage needs as well as general text editing, there are some things I don’t like about Emacs Org mode.

Search results in an Emacs Org mode database seems kind of funky or maybe I’m ignorant to some setting(s) or method(s) that might make it better. Following are a couple of screenshots of before and after using search in an Org mode database that should give you an idea of what I’m talking about.

Normal tree structure
Tree structure after searching

The tree concept used in Emacs Org mode sometimes gets in the way of how I want to organize my notes. I sometimes would like to create an image that is hidden under it’s own headline within another headline of text. However, once you create a headline, then all text following that headline falls under the headline until the next headline is encountered. So, if I created a headline specifically for an image in the middle of a headline of text, all of the text following the image headline would fall under it until the next headline is encountered. Therefore, in such instances I usually create the image headline at the end of the text headline and refer to the image headline in the text.

Just organizing text in an Emacs Org mode database can require some organization planning beforehand due to the headline functionality. For example, if you want to include a note about something in a paragraph, you can’t just add the note as a headline because all text after that up to the next headline becomes part of the headline you created for the note. For example, you can’t do something like the following in Emacs Org mode, or at least I don’t currently know of a way to do it:

In the above example, the continuation of the headline 01 text would become part of the note headline.

You have to be really careful when changing the level of a headline(s) or you can quickly hose an entire Emacs Org mode database. I speak from personal experience. For example, say you have a number of headlines at one level and you decide that you want to combine them as child headlines under another headline.

Separate headlines
Separate headlines as child headlines

You can use the key combination ALT and RIGHT arrow with the cursor at the beginning of a headline to demote the headline to a lower headline level, but if you have child headlines under the existing headline, the headline will not get demoted and a statement will be displayed in the echo area telling you that there is a hidden subtree. Therefore, you have to manually demote headlines by adding asterisk(s), being careful to demote any child headlines first.

Buffers are used in Emacs, including while using Org mode. Once you open a file, it is held in a buffer, even when you close the file. I find the buffer concept useful, but it can result in undesirable consequences if you forget about how it works and the files you have previously opened.

I discovered a great app in the Google Play store a few months ago that reads Emacs Org mode files natively. The app is called Orgzly and it works wonderfully, although I haven’t yet figured out how to get images to display in my databases. Sorry Apple fans, Orgzly is not currently available for the iOS platform…Android beckons you.

I’ve just scratched the surface of everything Emacs and Emacs Org mode can do. I look forward to learning more about both in the future. Also be sure to check out my post on how I use Emacs and Emacs Org mode to log Linux installs, removals, and upgrades. If you have a question or comment, leave it in the comment box at the bottom of the page.

Additional Emacs and Emacs Org mode resources:

Post header image courtesy of snogglethorpe, at DeviantArt.

2021-004

Leave a Reply

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