Automatic operator formatting mode in Emacs

Emacs has a nice new mode called electric-operator developed by David Spepherd. It helps when you write code by formatting all operators in a predefined way. For example, in R it adds spaces around the operator signs, when you write 1+1, this is automatically converted into 1 + 1.

You can define your own way of formatting for other modes. For gams-mode you add the following to your .emacs file

Read the rest “Automatic operator formatting mode in Emacs”

Note taking with LaTeX for learning

Summarizing a text book is easy in LaTeX, but sometimes I want to learn the summarized text. Reading the summary over and over again is not very efficient, so I came up with the typical solution, where you can hide the main part of the summary and can check your knowledge by asking yourself questions based on keywords in the margin. Here is an example, where I started summarizing the R package data.table:

image

Now I use hide the main text and can ask myself the questions:

  • Express the data.table in SQL-form?
  • How to create a data.table?

Add the following to … Read the rest “Note taking with LaTeX for learning”

Column guide in Emacs

Many professional editors have a column guide. For example, below you see in the Powershell editor a veritcal line at column 80.

image

This marker comes in handy, if you want to print your files. In Emacs I usually check for the column 80 in the status line.

image

However, I usually forget to check, and when I print out stuff or publish, I got line breaks where I don’t want them. Passing the 80th column for comments is not a problem, as a simple Ctrl-q forces Emacs to break the lines nicely and add comment symbols at the beginning.

image

But after … Read the rest “Column guide in Emacs”

Using file templates in Emacs

A good practice in modeling is to place information related to the project your are working on, the subject, the data and your personal information like E-mail address at the top of your file. In Emacs you can define skeleton functions that will prompt for the information and put it in the file. Below is an example for a file with as comment symbol “**: (the $Id: $ is for my version control system, that automatically will add the information on the last commit in this line).

image

Below you see how to make a function using skeleton. As I don’t … Read the rest “Using file templates in Emacs”

Using Org-mode to keep track of your project files

For every project I work on I have a org-file. Every file has the following structure:

  • Tasks
  • Repeat
  • Wait
  • Notes
  • Calls
  • Reading

I use remember-mode to capture tasks, notes and calls. Under the heading “Repeat” are tasks that are repeated on a regularly base. Under “Wait” are reminders for things I wait for (like a reply on an e-mail, an order, a call, etc.). These waits are also captured using org-remember (I have written about that in an earlier post). Under the heading “Reading” I have links to papers I am currently reading (using Bibtex; see an earlier post on … Read the rest “Using Org-mode to keep track of your project files”