Emacs org-mode

    I wanted to fix company-mode for Emacs, and on the way I remembered that was something Emacs already comes with. Yep, and it has a name you’d not guess in 100 years: hippie-expand. Added to my config. See Mickey’s post about it if you don’t believe me.

    Emacs org-mode category

    I’ve been following 404 media for a while, and after they recently offered a discount, I decided to become a paying subscriber for a year. This is a unique publication with a small, dedicated team of journalists behind it.

    With the subscription, they also offered a private RSS feed for full articles. Since I can’t share that private feed with the world, I decided it’s time to migrate my feeds out of my main emacs settings and into its own dedicated org-mode file, using elfeed-org.

    As this is yet another Emacs org-mode update, and several people comments on those, I created Emacs org-mode category on my blog with its own dedicated RSS feed: taonaw.com/categorie… This post should be on it as a test.

    Updating my Emacs settings file. As this is now in an org file, it’s so easy to write comments there. It helps since comments on the blog get lost over time. If you’re an Emacs nutcase, let me know what you think ๐Ÿ˜ฌ

    Sharing my CSS Tweaks and Emacs Configurations

    And now it’s my to complete a milestone:

    Uploading my Emacs config! That’s right. And with it, side by side, the CSS customizations I’ve made to my blog (I’ve made a couple of changes since I last talked about it).

    Find them in my public folder on GitLab or just read the new welcome note there.

    He did it! Prot created a function that converts denote links back to “regular” org-mode links, using some regex magic.

    This means I can now upload org-mode files directly into GitLab, which displays org files natively. Take a look

    I’m happy with how my org-mode notes look like in GitLab:

    I need to resolve a few things, like creating another folder for these notes and tying it into my repository, but after I’m done, the hope is for much more streamlined informational notes.

    Another Emacs org-mode re-discovered feature as I’m improving my workflow:

    Org-agenda is org-mode’s search engine. I include user names as metadata in work-related tasks.

    to search tags & properties: C-c a m. For properties though: <name of property>: "<value>"

    My

    Another thing I enjoy doing with Emacs org-mode is my habit of watching movies. Emacs reminds me it’s time to watch a good movie in a range of every three days to 10 days. When I watch a movie, I write the title and the year down and reset the clock - which will remind me to watch a movie again in 3 days.

    On Emacs, it looks like this:

    a colorful line of squares; an explanation follows below in the text:

    This is a habit graph. Each rectangle represents a day. The asterisk is when I watched a movie last; the exclamation point represents today. The green bar represents the time range (3 to 10 days), with the last day being in yellow, reminding me it’s the last day to complete the habit before I’m “in the red.”

    So, in this case, I have today, tomorrow, and the day after tomorrow to watch a movie before I’m “in the red” for this habit. Don’t worry! It won’t happen.

    When you open this habit up, you can see a list of the movies I watched and when:

    a log listing movies watched. Listed are the titles, year of production, and the date & time they were watched.

    Nifty.

    I talked about making some changes to my project workflow in Emacs, and here are some changes I’ve implemented:

    ("p" "Personal Related")
    		  ("pt" "Personal Task" entry
    		    (file "~/Sync/Personal/Projects.org") "* ACTIVE %^{What?} \n*** TODO Probes:\n %^t--%^t \n\n %U:\n %?" :kill-buffer t)
    

    I talked about making some changes to my project workflow in Emacs, and here are some changes I’ve implemented:

    The %t^ org-mode expansion tells Emacs to prompt for a date without a time. It calls a calendar in Emacs with the current day marked, which can be adjusted. In my case, you see two of those: the project’s start and the end (double dashes are how org-mode phrases a time range).

    So, let’s say I have a new photography project I want to do throughout February. I call this capture template and enter the first day of February, followed by its last day. This will display the project (say, “photography project”) on my agenda every day throughout the month of February.

    In the past, each project (which is an active task with sub-tasks marked by “TODO” items) had several of its subtasks scheduled at specific times. This has been my process for years, though it’s not very useful: I almost never get to work on my TODOs exactly at the time of my choosing.

    The idea is that instead of having a list of 20 items that I need to do clutter my agenda with times in the day that don’t make sense, I will only have a couple of highlighted projects I know I’m working on. I can then go into each project from the agenda and see what the next action item I need to do there. This would be a TODO keyword without a scheduled timestamp.

    Denote and org-mode instead of my TiddlyWiki?

    While I just explained why I’m dropping some of the usages for org-mode, it’s still very powerful for what I do need it: projects and notes.

    One of the thoughts that crossed my mind on a walk today was to convert my wiki into a collection of org files. This makes sense because I write my notes in org-mode anyway before I convert them into Markdown and then paste them into TiddlyWiki. At the same time, GitLab can read org files just fine, complete with images.

    TiddlyWiki has a lot of functions built into it, but I might do fine without them, especially with Denote introducing dynamic blocks. Dynamic blocks are essentially meta notes, a key feature that allows one to build a wiki from their notes, as it introduces a hierarchy of links.

    If I can make this work, the friction in my current workflow (write in org-mode, convert to markdown, edit, paste into TiddlyWiki, push changes to gitlab) will be minimized (write in org-mode, push changes into gitlab, edit after the fact) and will allow me to write more notes, more often. This sounds good.

    Less org-mode, more Outlook? Why!?

    It was one of our regular Wednesday date nights. Nat and I decided to meet in one of our favorite local spots instead of ordering in. Knowing Nat finishes work at 6:30, I calculated it would take me about 20 minutes to walk over, meeting at around 7 PM. When it was time to go, I showered, put on clothes and… realized Nat was already there. I was half an hour late instead of 10 minutes early as planned.

    Nat leaves work at 6:00, not 6:30. He gets home at 6:30. My brain did one of its famous “brain farts” where it convinced me, beyond any shadow of a doubt, that Nat had /always finished work at 6:30 for the last five years or so. I was so convinced that I even argued with Nat, saying he must have left work early.

    Being the awesome person he is, Nat didn’t take it too hard. After all, living with me means dealing with these issues more often than not. It’s just something that happens now and then. Me, on the other hand? I had enough.

    I was never good with dates and times; call it ADHD, call it scatter-brain, call it age, call it whatever. Many people who read this would probably think I should use a calendar. You’re right, most people! I should! The only problem with this is org-mode. Let me explain.

    My life is organized in Emacs org-mode. Everything I do, big and small, is written down inside Emacs. It’s my personal database, with search capabilities, dates and hours, TODO lists, and an agenda. I love org-mode, and I’ve said many times it’s the one thing that made me able to organize my life, or I would be a complete mess made of incidents like the one I described above.

    Emacs is awesome and all, but there is one thing it doesn’t do. It doesn’t sync with my work calendar.

    Now, Before all of you Emacs champs (the rest of you can skip ahead) jump with suggestions about the various packages available to do just that: I tried those a couple of times. They don’t work for multiple reasons, and my workplace locks down some of Microsoft 365 abilities for a good reason. So sit back down, please (I know someone is going to leave a comment anyway. Go ahead you, get it out of your system.)

    On with the story.

    While contemplating my choices, I realized there’s another big area where I stopped using org-mode: my journal. I started writing analog about two months ago, leaving my digital journal in Emacs behind. I’m enjoying it, and I already have my next blank notebook waiting for me when I’m done with my current one.

    Another thing that has changed since I started using org-mode is my work style. COVID introduced the option of working remotely, and the change in my role enhanced that. My daily work computer is a Mac, not a Windows PC, which is less distracting and works with many Linux applications, Emacs included. I no longer have many time-sensitive, urgent, small tasks, as I often manage larger projects with a long-term commitment. However, my work routine in Emacs hasn’t changed in years.

    Here’s an example of my current workflow. Whenever there’s a meeting scheduled, I’d go into Emacs and call up a capture function, which will ask me for the title of the meeting and the time it’s scheduled for. It will create a sub-header for my notes, complete with bullet points. Handy, but as I mentioned, I can’t sync between Outlook and Emacs. Every week, I need to look at my work calendar in Outlook, manually add meetings for the upcoming week, and keep them in sync. If a meeting is canceled, I need to remove it in Emacs; if a new one pops up or the time changes, I will have to adjust it. And these days, I have more meetings than ever before.

    Then there’s the problem I told you about at the beginning. org-mode’s built-in agenda doesn’t help with my visually-needy brain. The agenda is a wall of text with timestamps and numbers. Since I need to manually enter times and dates, I type the information into org-mode as I remember it. The problem is right there: “as I remember it.” I must have corrected dates and times in Emacs a hundred times. So, I decided to no longer update org-mode with events and meetings.

    I’m not fond of Outlook or Google Calendar, but I’ve been forced to use them for years. My partners, friends, and family all have a Google account, which means they see what’s coming up in real-time and can call me out on erroneous times my brain comes up with. The calendars are color-coded and reflect the same visual interface that - very importantly - I also see on my phone in real-time.

    While I’m telling you about Outlook and calendars, let me throw something else in: Reminders. I’ve used org-mode for those, and when I’m away from the computer, I use Orgzly on my Android to sync quick notes to my agenda. Since I switched to my iPhone, syncing with Emacs stopped (There’s another technical reason why I can’t sync Emacs notes with my iPhone, which I won’t get into here). When I want to capture a quick idea, the best way is to take out the phone and dictate my thoughts or perhaps record a short voice memo. If it’s a quick thing, like remembering to take the laundry out, all I have to do is ask Siri to remind me. If it’s something more complicated, like brainstorming this post, I would rewrite it as a project, completed with sub-tasks, into org-mode using the short memo as an introduction/outline.

    On my Mac, I now have a widget for my Outlook agenda, which integrates my work and personal calendars. Below is a widget for my reminders from my “Oh Snap!” list, which reflects things I want to see in front of me. This list is meant only for quick reminders, while I have a “planning” list of reminders for events further in the future.

    I’m still working with org-mode for anything project-related. It keeps me focused and organized at what it does best for me: breaking down big projects into doable tasks and keeping notes organized, private, and stored for the long term. This is an adjustment, and I will probably go back and forth a couple of times, but I’m pretty sure the days of my weekly files are numbered, as I don’t have use for those anymore.

    Emacs and OSM (Open Street Maps) are a natural match, so it just makes sense they work very well together out of the box.

    Built-in search function, zooming in and out, and creating org-mode links with a single keystroke to locations. Amazing. If you’re an Emacs user, grab it now!

    GNU ELPA - osm elpa.gnu.org

    Reader: elpa.gnu.org

    Important factors for journaling

    I’ve been keeping a journal on and off since I was 16 or so, but it’s only in 2018 that I started being more structured about it, thanks to Emacs and org-mode. This morning, I thought about some of the reasons this journal is the most effective one for me. Here’s a list, more or less in order of importance:

    • It is mine (saved locally):

    If you have a written journal (a physical notebook), you got this covered. However, if you rely on the cloud, be it iCloud or Dropbox or what have you to be able to write. If you don’t have a file or a physical piece of paper on your hard drive or your shelf, it’s not truly yours - you’re renting out a service. In the case of a personal journal, this is a hard pass for me. In my case, all my files are local and can be read without Emacs since org-mode files are essentially just text.

    • It’s easy to write down thoughts quickly:

    I always have a computer around, and if I don’t, I can use my phone to open the journal file and add to it. On my iPhone, this is a bit more tricky, so I save a quick note and then copy-paste to my journal file if I really have to. Otherwise, it’s a simple matter of 5 keystrokes, and I’m there.

    • It’s Private:

    A journal is private. This is another reason why I won’t have it stored on any cloud, be it iCloud, Google Drive, OneDrive, Dropbox, or whatever have you. I don’t trust anyone else to stay out of my journal because they won’t - be it the temptation to dig for profiling and ads or “think of the kids” policies. I do have a backup for my journal, a local one, and a remote one on the cloud, which gets encrypted on my computer before it’s stored away in Backblaze.

    • Pictures and drawings:

    This is something org-mode is actually not great at, but it works. Pictures are powerful. Memories in a flash, they also store metadata for precise location and time. Perfect for those times when you visit a location and want a quick reference to where it was and what you did. This is one area I do use the phone for and often: I can later extract map coordinates if I want to or write an address. The filename itself tells me the exact time. Pictures that go to my journal are not kept in the cloud anymore - again, I don’t trust Google or Apple with those for long storage. For my journal, it’s good enough to resize them to about 30% of their original size and compress them as a JPG, which really saves room. This is different than preserving good photos in raw forms and processing them later for printing.

    • Internal links:

    That’s probably the latest “essential” requirement I have for my journal, which works well in org-mode thanks to super-links at the moment. On paper, I used to write down page numbers and write in parenthesis something like “see p 128” as a comment. The entry that I point at also gets a link to the one I’m linking from - so they are linked to each other. In org-mode, I use these links to refer to my tasks and projects, which live outside of the journal. That way I can reflect on something I did in my journal and jump directly to the event to see the task itself.

    • Easy to read:

    Probably the second reason (the first reason is that typing is faster than writing) why I keep a journal in a text file on my computer: my handwriting gets worse as I keep writing until I can no longer read it in the future. I’m also prone to spelling mistakes, which makes things harder to decipher and makes me think I have some form of undiagnosed dyslexia. A good spell-checker is a must. Org-mode also breaks down my entries automatically to years, months, weeks, days, and then events in those days, which makes things easier.

    My movie watching habit in org-mode

    Not too long ago, I organized my routines on Emacs with new habits. I’m particularly satisfied with my “watch a good movie” habit:

    This chart might look confusing, but it’s simple once you get used to it.

    Each colored rectangle represents a day. The exclamation mark represents the current day, and an Asterisk represents the last time the habit was completed. The green is the “good range” of the habit in days, which means I have that many days to complete the habit. For example, the head buzz habit above the movie one has today and tomorrow (one more green rectangle) to complete. A day after that is yellow, indicating the last "good day" to do so. After that, the red rectangles indicate days behind on completing the habit.

    Once I mark a habit complete, the colored rectangles disappear from my agenda until I'm in range (green) again. The blue rectangle represents the days before this happens. For both the head buzz and movie habit, I have two days (two blue rectangles) after I complete the habit before I should do it again.

    So, for the movie-watching habit, today is the first day to watch a movie, after I watched one two days ago. If I don’t have time, I still have about a week ahead of me (in the green).

    In addition, I also started to log what movies I watched and when:

    As you can see, Emacs keeps a log of when I complete each habit. I then add a note with the movie name (C-c C-z) in the logbook drawer.

    This is another fine example of why I love using Emacs org-mode to organize my life.

    Installing Emacs from source

    Thursday evening I felt smart and decided to clear some space in my boot partition on my Linux Mint computer with apt autopurge. What this does is to clear the old kernels and clear space along with any libraries apt figures we don’t need.

    The issue with this is that apt didn’t know I needed certain libraries that came with Emacs. That’s because I didn’t install Emacs with apt, but built it directly from source - to get a later version. The next day, Emacs didn’t launch and complain some essential library was missing.

    The solution was to follow my instructions and install Emacs from source, but here I encountered a catch-22: the instructions were in org-mode inside Emacs, which wouldn’t launch.

    Instead of taking out my laptop or switching to the Mac, I decided to deal with it sleep deprived, which is something that happens to me often. This, in turn, led to more frustration as I forgot the steps. Eventually, I gave up and went to sleep (which was the smartest thing I had done up to that point).

    The next day I looked for help in Emacs IRC. The folks there helped me enough to fix the issue. Now that I have my notes again, I’m putting those here in my blog (as well as on my wiki), so I always have it handy for myself and for you, if you happen to be that sort of geek.

    Here are my original instructions based on xahlee’s blog with some additional notes to help.

    One last thing regarding Emacs chat on IRC: When going there using the web interface, use the UI to connect to the Emacs channel. Typing “Emacs” directly will open a new Emacs channel with you as the only person in there.

    The Process:

    1. Download the gz file from the GNU at savannah.gnu.org/projects/emacs.
    2. Untar using your file manager or tar -xvf path/to/file
    3. In the Mint menu, look for Software Sources, under Optional Sources turn on Source code repositories.
    4. Install essential build tools in the terminal: sudo apt-get install build-essential
    5. Get the dependencies using alt: sudo apt-get build-dep emacs

    You can now build emacs:

    1. cd to Emacs download dir, run ./configure
    2. run make
    3. now run sudo make install
    4. launch Emacs from terminal

    Of TiddlyWiki, Emacs, And Digital Gardens

    For the last couple of weeks, I’ve been brainstorming the idea of converting this website into a fork of a wiki, particularly, TiddlyWiki. I went full circle from using the tool to builing a static website, back to the original, single-file java script supported version. Here are some of my thoughts.

    I brought up digital gardens before, and again when I was re-tagging my posts recently. In short, case in point: instead of having the above links leading readers to find these static discussions which are concealed with dates in the past, the discussion would be dynamic, something I keep adding to as I keep developing the idea.

    To continue with this example: on this blog, I would keep discussing digital gardens until it becomes a tag and group all my posts about “digital gardens” together. You’d see a list of posts, organized by date, and you could go in and choose to read pieces based on my progress in time. This is one way to do things and it works quite well if to judge from blogs around the web.

    The “digital garden” idea is to have one place, one “post” that is ever-developing, broken down into sub-topics. Certain ideas will get developed, and other abandoned in favor of others. Instead of seeing progress divided into chunks of dates, we see the progress of the idea in chunks of subtopics.

    OK. Time to get this off my chest. I don’t like the name “digital garden.”

    On the web, folks consider digital gardens anything from a dateless blog to documentations to roam and zettelkasten. I understand the metaphor of being a digital “gardener” as someone who grows ideas and articles, but I prefer to think of it as a form of emphasizing topic organization over date organization. To me, since before I created this blog, this is called a wiki.

    The problem with wikis is that they’re technical documents. Or so I thought. Wikis are named after encyclopedias, which are all about facts. But wikis are just a form of content presentation. They can be as personal as any other personal website can be, just as blogs, which are web logs, can be as technical as a changlog or as personal as an online diary.

    Before I disappeared into org-mode and Emacs and left all other text editors in the dust, I enjoyed using one such wiki: TiddlyWiki. What sets Tiddlywiki’s apart besides the funny name is that it’s fully self-contained: a single HTML file (at the humble size of about 3 MB when you download it first) which contains everything, text and media, by design. It is a polished tool, a more utilitarian one than eye candy, with all of its settings built into its nested articles, which are called tiddlers. You can go into its style sheets and color pallets, which are tiddlers as well, and change whatever you’d like to make it looks and behave however you’d like.

    After moving to write in org-mode however, I didn’t need TiddlyWiki anymore. Emacs offers a much superior writing experience, combined with org-mode, an excellent organizational system. To look into TiddlyWiki again I first had to find a way to work from within org-mode, and I couldn’t find a way to do so. Without much motivation, I gave up quickly and went back to org-mode. It took the spark of going “digital garden” again to explore this a bit more in depth.

    One of the first things I learned, on mastodon of course, was that TiddlyWiki now comes on Node.js. Node.js allows you to run JavaScript applications (which TiddlyWiki is based on) outside of the browser using a local server. This also means the individual tiddlers do not have to be nested inside the original HTML file; instead, every tiddler is stored as a file.

    OK fine, so I have my tiddlers in tid files, what’s the big deal? Well, now we have individual files with essentially text (in TiddlyWiki markup, called wikitext.) See where this is going?

    we can now use Emacs to write and edit tiddlers using wikitext. But it gets better. As it goes with everything you learn, now I was able to ask the right questions. Looking for a way to export from org-mode to wikitext within Emacs, I found ox-tiddly on melpa, which converts org syntax to wikitext. I can now write my TiddlyWiki articles from org-mode. But it gets better even better.

    through node.js functions, I also learned that you can convert TiddlyWiki into a static website. A few simple commands which can be made to a single script will convert all those tid files, the tiddlers which are the articles, to HTML files. TiddlyWiki can become a static website, which can be run off GitHub or Gitlab. I can even push changes through Netify, it seems. Essentially the same workflow I’m using for my current static site.

    But… as I continued learning about these options, I also realized the one downside of publishing content this way, and it’s a big one: no JavaScript. This means the core TiddlyWiki functions, the same ones that make it so good, won’t work. There isn’t even an option to navigate through the different tiddlers since the navbar is completely built on JavaScript.

    There is a way to export JavaScript along with the style sheets and the tiddelrs, but then I’d still need a way to activate it. With all of this it occurred to me that it doesn’t make sense to break down TiddlyWiki if I want to use it for a website; it’s easier and more functional to keep it as is, a single snappy HTML file that contains everything. This is also how other TiddlyWiki websites are built, including the official tiddlywiki.com. So, while there is a slight benefit to working on individual tiddlers locally, I will need to bring everything back together before I build and push the site.

    At this point, it’s simpler to just copy-paste the wikitext from the temporary buffer ox-tiddly gives me and paste it into the editor. Another benefit of this method is seeing the content as I paste it live, with TiddlyWiki’s built-in editor preview mode. Images and different styles that are invisible through org-mode are easier to fix this way.

    I’m not happy to write outside of Emacs org-mode1, but I do want to at least give TiddlyWiki a try. I believe the way it will present information, along with its customization, will be the next big step for this site.

    Footnotes

    1: I discussed similar issues with writing content out of Emacs not too long ago, and the workarounds I’ve come up with. While I managed to stop using Word for the most part for now (and thankfully so), the big issue is that using Emacs is a one-way street: I can use it to publish content to other platforms (in the case TiddlyWiki), but once there, it’s hard to get whatever edits I make there back in Emacs. I wish I could keep all my work in Emacs, but that’s not realistic.

    Capturing doctor visits & Sickdays in org-mode

    At work, we need to fill out a timesheet every month. For those of you who are not familiar with the concept, this is usually a spreadsheet with one column for each month and cells for each day. You fill in the code (V for vacation, S for a sick day, etc.) for the spots you took off from work. There might be a few more variations of these, but this is the general idea.

    To me, timesheets are a pain in the rear. I need to check your calendar (or agenda in my case) to see when I took the off days, then I need to mark them down on the spreadsheet, and then I need to export them to a PDF to sign the thing and send it to my supervisor. I’m horrible at keeping track of these things because they don’t fit my workflow: a vacation or a doctor visit gets marked down on the agenda as an event with a location, unique to its settings. This makes it difficult to go back and catch those when it’s time to do the above routine.

    I had been considering using tags for a while, but I usually only use them for people on the agenda when a task or event involves them. I could have used a category, but it seems silly to have a whole category for one thing just because it’s hard to find on the agenda. Then an idea hit me when I was watching the Emacs Conference, when I noticed a few of the presenters using tables: a table!

    Of course! Not only can I mark down the exact day for a sick day I took, but I can also fill in if it was half a day or a full day, which is another thing I need to mark on the sheet. It took some time to figure out how to use org-capture for a line in a table, but the results were well worth it. Here, take a look:

    a table in org-mode displaying dates, days of the week, journal entries, and links, with some text obscured.

    Looks great, doesn’t it? Not only do I have a nice, organized place to mark down these days, but I can also link to the event itself on the agenda (right now it says journal, I should change that). I can even go into the table and add separators for months and make it clearer. If only Emacs could also fill the Excel sheet I need to fill and sign for me…

    Here’s the code that makes this work:

        ("js" "Sickdays" table-line (file+olp "~/Archive/routines.org" "Personal" "Sickdays") "| %u | %^{(H)alf/(F)ull} | %? |")
    

    table-line is the magic word that tells org-mode to populate the next available line in the table, so it doesn’t matter what’s before it. I can add and remove things as I please. And then the lines just work as is, using org-mode’s powerful table format.

    Submenus in org-mode capture

    In my last post, I discussed how I (finally) found out that I can use entire org files as capture templates. This is a basic feature that works out of the box, but the org-mode manual doesn’t give it enough exposure in my opinion. Turns out it wasn’t just me either.

    As I expanded my checklists and learned more “trivial” org-capture features, I discovered additional useful things but ran out of time to write about them. It’s now time to get back to the basics of org-capture again for some helpful tips.

    When you build your org-mode templates, it’s possible to create sub-menus for better organization. Another way to explain it is to think of “categories” in your capture.

    Says the manual:

    Keys

    The keys that selects the template, as a string, characters only, for example โ€˜“a”โ€™, for a template to be selected with a single key, or โ€˜“bt”โ€™ for selection with two keys. When using several keys, keys using the same prefix key must be sequential in the list and preceded by a 2-element entry explaining the prefix key, for example.

    The bold part was another part that I had to read several times to understand. I knew there’s something different because two letters are used, but my capture template failed to work the first couple of times. I figured it out, and here it is:

         (setq org-capture-templates
          (quote (
                  ("s" "Manual Laptop Setups")
                  ("sd" "Staff Dell Laptops" entry 
                  (file+headline "/mnt/veracrypt1/Archive/OhSnap!.org" "Staff Dells") 
                  (file "/mnt/veracrypt1/Work/setup-dells.org"))
                  ("sa" "Staff Apple Laptops" entry 
                  (file+headline "/mnt/veracrypt1/Archive/OhSnap!.org" "Staff MacBooks") 
                  (file "/mnt/veracrypt1/Work/setup-macs.org"))
                  ("sm" "SLS-Mac" entry
                  (file+headline "/mnt/veracrypt1/Archive/OhSnap!.org" "SLS-Mac")
                  (file "/mnt/veracrypt1/Work/setup-SLS-Mac.org"))
                  ("sw" "SLS-Windows" entry
                  (file+headline "/mnt/veracrypt1/Archive/OhSnap!.org" "SLS-Windows")
                  (file "/mnt/veracrypt1/Work/setup-SLS-Mac.org"))
    ;; more code below - the above is incomplete
    

    Let’s take it piece by piece from the top. Keep in mind, this is not the entire capture section, just the relevant part. If you copy-paste it into your Emacs init, it will fail with an error.

    First, as soon as I start the capture templates, it seems as if I am starting to create another one inside the first one. That’s what the manual means. In my opinion, it stumbles on its own words. I feel like an example would go a long way. What I did was basically create a sub-menu for “Manual Laptop Setups.”

    The result is that when I call org-capture, I get the following:

        Select a capture template
        ===========================
        
        [s]... Manual Laptop Setups...
        [i] INC (my incident template)
        [e] Event (my event and journal template)
    

    I have more templates going down, but I want you to look at the very first one. That [s] with the three dots after it indicates pressing s will take me to a sub-menu of the capture template, which looks like this:

        Select a capture template
        ===========================
        
        s [d] Staff Dell Laptops
        s [a] Staff Apple Laptops
        s [m] SLS-Mac
        s [w] SLS-Windows
    

    You can see from how the menu looks that all of these items start with an s, but this time without the brackets. The brackets indicate what you can press now after you’ve already pressed s to get into the sub-menu you’re currently in. That is, d for Dell checklist, a for Apple checklist, and so on.

    Each one of these sub-templates is a checklist based on an org file, as I explained in the previous post. The templates are all org files (like setup-SLS-Mac.org, for example, the third template), which are nothing but checklists like I pointed out in the previous post.

    This way, I can have an entire “category” of capture templates, with S for setup, without having a long list with letters that won’t seem related.

    Org-mode in files

    Note: Before I dive into the how, I want to tell you a story about why I needed checklists, and how, for a long time, I wasn’t aware that org-mode capture templates can be called from individual files, complete with their headers, tags, checklists… everything. You might find this useful if you’re starting out with Emacs, or if you are a veteran Emacs user who wants to understand some of the hurdles non-programmer Emacs “newbs” might go through.

    If you want to jump ahead to the good stuff, it’s under the “How this works” header below.

    First, I want to answer why use a whole file as an org-mode capture template. To understand that, I need to explain some of the work I do as a help desk person in a large organization.

    Among other things, my work includes prepping desktop and laptop computers. For the most part, this is done from an image, and all software not included is installed remotely via our SMA. However, there are still many cases where the automation fails or does not apply and hands-on deployment is needed. Some scenarios include:

    • BYOD devices, which need to be evaluated and prepared for our environment.
    • MacBooks, which we can’t automate yet.
    • Replacements of existing computers, which should also come with a snort checklist, reminding me to change the inventory, and re-add the hostname to AD down the line, because it is taken (by the existing computer) when I start the process.

    These scenarios are complex but similar in one area: they beg me to use checklists. We’re a big company, and often I find that a good checklist is half the job.

    Communication with clients, managers, purchasing staff, as well as documenting everything, is also a part of the checklist. The difference between a job that was done with a checklist and one that was done without is so obvious that my checklists have been adopted throughout the team, and I was asked several times to guide others (especially newcomers) because of my “methods”. I find this humorous because if you know me, you’d know I’ve always been far from organized. It’s all org-mode, to which I’m very thankful (note from future me, about six years later: I owe this organization my promotions at work. Little did I know back then that these checklists would go so far!).

    As you can imagine, these checklists get quite long and complex, containing parent items and their children.

    In the past, I’ve had a long checklist “template” in a header in the setups.org file, which I used to copy-paste into new projects. The idea of using a file as a template for org-mode capture occurred to me in the past, but because I’ve never seen an example in the wild and didn’t find a clear reference to it in the manual, I dismissed it as wishful thinking.

    When I asked about using org files as templates on Reddit I didn’t get answers. I believe that’s because I didn’t understand exactly what to ask, since I didn’t know what I was looking for. After all, if I had a more concrete idea, I’d probably read this in the Org manual for what it was:

    template

    The template for creating the capture item. If you leave this empty, an appropriate default template will be used. Otherwise this is a string with escape codes, which will be replaced depending on time and context of the capture call. The string with escapes may be loaded from a template file, using the special syntax โ€˜(file “template filename”)โ€™. See below for more details.

    This little paragraph of text can be found about half a page down in the manual. I read the capture part of the manual probably 20 times or more at this point, and I still feel I wouldn’t know I can use a file as a template just from reading it. But why?

    There’s no clear statement that says you can load a capture from a file; rather, it says “the string with escapes may be loaded from a file…”. To me, this meant I could include my template’s syntax in a separate file instead of specifying it in my init file. I had the following template:

          ("j" "Journal" entry (file+datetree "~/Documents/Work/Setups.org")
        "**** %<%H:%M> about %a \n%?" :tree-type week)
    

    ** And I thought this bit of lisp could go into a file. OK, but what’s the point of that?

    So, if for some reason I wouldn’t want the above code in my init file, I could copy-paste it into a dedicated file. This didn’t seem useful for me, after all, I wanted all my code in one place where I can break it down with explanations in org-mode, so I didn’t bother with it.

    Further, the manual says “see below for more details,” and there aren’t any. There are only details about what is referred to as “string with escapes.” Nothing really tells me I can have my whole template, a huge checklist with headers and tags, in another file.

    So I just struggled for a while, trying to figure out how to fit my a checklist in a single string, as shown above, such as [ ] checklist item one /n [ ] checklist item two /n and so forth, which of course didn’t work well (how would I tell org-capture to indent items so create children items under a parent item this way?)

    At some point, I saw an example of someone using a checklist that was inside a different file. stumbled me: for the first time, I realized what I should look for. I managed to find a couple of questions related to org-mode in emacs.stackexchange.com that were not directly related to my issue, but had the following lines in the code (I cut out the paths as they do not matter here)

    ("j" "Journal" entry (file+datetree "...")
    (file "..."))
    

    And then, I found a presentation by Jonathan E. Magen. Of particular interest was slide 6. Right there, in front of me, the title was “Template stored in file,” and below it, a very simple example of org-capture lips that tells org-mode to read the template’s content from a file. It was as it is in the manual, but this time, the slide was very specific, telling me “this is how you tell org mode to go to a file and grab the capture template from there.” Someone finally pointed a finger at it for me. So, this was true. Org-mode can read templates from other org files.

    I wrote the code as I understood it from the examples I found and added (file "~/Documents/Personal/journal-tmpl.org") to the code above instead of that “string with escapes”, and got an error: org-capture: Capture template โ€˜jโ€™: Template is not a valid Org entry or tree.

    I saw this error in the past. I got this far before. Now, through the eyes of someone who knows this should work, this error looked different. Org-mode, I knew, (or Emacs for that matter) should open any file if I tell it to, even if an MP4 or a JPEG file. I would see gibberish on my screen, yes, but it would open. That made me realize that if I see this error, it means the capture template should work, and what I wrote does indeed tell it to open the template from a file, but something in the template file was specifically wrong.

    Suddenly, this error became an encouragement that I am headed in the right direction. The error was now telling me, “Hey, I want to do this for you, but your file is messed up, sorry.” Knowing this, I turned back to the community, this time asking the right question: What is wrong with my org file?

    How this works

    As it turns out, my regular org file started with certain options like #+TITLE: and #+TODO: with several headers already nested inside of it: org-mode capture was looking for the capture syntax, and instead found options it didn’t know what to do with. If I simplified the file and removed all the additional options, it worked.

    Here’s a complete example of one of my org-mode capture template files (for example, mac-checklist.org). Notice how the very first thing is the header itself. It must be the first thing in org-capture syntax. Then the second line specifies what the template does, just like it did in my init. Finally, the checklist itself:

        * Setup Proccess [0%] 
        %^{Ticket}p %^{ID}p %^{Computer}p
        - [ ] Rename (SLS-ID-MAC)
        - [ ] Check OS Updates
        - [ ] Encryption
        - [ ] A/V
          - [ ] Install
          - [ ] Manage (overwrite XML file)
        - [ ] SMA
        - [ ] Restart 
        - [ ] WiFi
        - [ ] VPN 
        - [ ] Another App
          - [ ] Install
          - [ ] Test
          - [ ] Test w/ VPN
        - [ ] Asset Registration
    

    The header has a percentage that changes as I fill in the checklist items. This allows me to see how close I am to being done straight from the agenda view. The second line tells org-capture to prompt me for properties for the ticket number, ID number of the person, and the computer name. Then I have a blank list ahead of me, which I can fill up according to whatever is already done.

    This particular list is summoned by a very similar line to the one I have above regarding my journal. I just have a different file specified (say mac-checklist.org instead of journal-tmpl.org).

    I am now working with four checklists, which I’m tweaking to perfection, summoned directly from org-capture.

    Because I was encouraged to work with different checklists from one menu (org-capture), it meant I needed to look for a way to have “submenus” inside org-capture. In other words, if I want to capture a checklist, I should choose something like c in org-mode capture, and it would then take me to another menu asking me which of the four checklists I have to use.

    Once again, I learned this is possible, and I went down a different rabit whole understanding org-mode capture menus to the point of re-inventing my workflow. This is too much to include in one post, so I hope to specify on that soon (note from the future: I did). For now, the big lesson I learned is this:

    If you think something is possible, it probably is. One way or another, it is. And for those of you who used org-mode for years, especially from a programming background, I hope this post serves to show that some of us struggle not with the code, but with a lack of good, clear examples. We need a story, a scenario, a reason to explore. (another note from the future, after using Emacs for almost 8 years: this is probably our job - the bloggers. To tell a story and not just explain how we do something, but why.)

    Evolvement Of Video Journal & Org

    Over time, my journal videos (I call these j-vids, or jvids for short) got smaller. This is because I got used to use org-mode to record my thoughts. I discussed these a couple of times before.

    My tasks rarely contain sub-tasks anymore. This is odd because sub-tasking was one of the reasons that initially got me into org-mode. Over time, I found that I rather leave notes where I left off and what needs to be done instead of using Keywords (TODO) for tasks in org-mode1.

    The notes I take are usually brief (one paragraph with 3 to 5 lines) and are time-stamped with the most recent note at the top. This lets me know where I stopped a task and why with a quick glance. I also use such notes to indicate general mundane errands, like buying groceries. In such cases, I can also include a checklist.

    The org-mode journal is a different story. This is where I let myself “spill the beans”. I’ve been on a long break from using a journal because typing it felt slow and I wanted a quicker way to record my thoughts - so I started recording myself in jvids.

    But recording myself was inconvenient. I had to take a break from my workflow, record a video, name it, compress it, and save it. It required that I’ll find a quiet corner - nearly impossible to do during my day - to record for a few minutes. So out of necessity, I started to include more notes. Eventually, I felt they become too long and too personal. I needed a separation. Going back to my journal felt natural.

    Now I find that typing is just slow enough to make me process what I’m thinking. I can edit what I’m trying to say, which means I can rethink of a better way to describe it. To stop myself from going on and on, I journal on specific events, not an entire day. My capture template copies the link of the event from the agenda and makes it the title, then takes me to the under it to start typing about it.

    Yesterday, I noticed something interesting: with time, my rambling on videos was reduced from going on an on for an hour plus or so (and multiple videos) to shorter segments. Here’s a visual:

    Auto-generated description: A list of video files with their details is displayed, highlighting changes in size and frequency over time.

    I reached the conclusion that my written journal is just better at keeping track of my experiences. Since I re-created the way I save my achieve files now, it also means the links from the journal to the events is never broken: I just have to make sure to refile an event from my “oh snap” thought-dump folder into the current week’s org file, and I’m good2.

    I still record a short “weekly summary” on weekends, and now I find that I’m actually looking forward to it. These are now 10-20 minutes long videos in which I briefly go through my agenda and logged events and explain what happened while my memories of this week are still fresh. I then give the week a โ€œtheme,โ€ like “agenda and conclusion” if I can.

    This work sas a way for me to remember what happened far in the future if I want to reflect on my experiences but not look for something specific, or if I’m not sure what it is. It’s also a good way to reflect on the major events of the week after I had a weekend to slow down and process.


    1 Note from 2024-09-26: today I live by subtasks and such Keywords in org-mode; they are a critical part of my organization

    2 Note from 2024-09-26: today, I’m back to using a hand-written journal for summaries of personal reflections and emotions, while the more technical notes about the task are included there. Instructions for the future are kept in a separate notes folder, where I use Prot’s Denote to write them in a step-by-step format with visual aids as needed in org-mode.

โ† Newer Posts Older Posts โ†’