A dog is a dog at leisure. This was my first half of the year, and in order to make a difference I found a lot of task-management tools, such as magic lists, ticking lists (which I still use), etc., but it still didn’t meet my needs. Being an energetic developer, I even had an idea for a time management tool that would meet my own needs, but I brushed it off.

But as a new generation of young people, how can you not have a time management tool? I found Emacs Org Mode through my colleague, leader, and good friend. It was so sweet. Now, I’m going to talk about how I manage my time with Org Mode.

Emacs download and configuration

First, we need to download and install Emacs.

apt install software-properties-common
add-apt-repository ppa:kelleyk/emacs
apt update
apt install emacs26
Copy the code

At this point we can use Emacs to open the.org file to manage our time, like this:

Great, we’ve done the first step. I’m a little lazy and don’t want to use a streaking Emacs, so I went with Spacemacs, so we can configure a good Emacs for us.

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
Copy the code

Once the file has been downloaded, you can run Emacs and initialize it according to the initialization process. When the installation is complete, you can reopen the file.

Next, we will start the teaching of time management.

Move a nest for the mission

We need to break the tasks down to what we want them to look like. For example, my task list is long like this:

We need to divide our work into different modules for management. This is all work-related content. I don’t use Emacs to manage my life. I will be? I wouldn’t, would you? No serious person records their lives on a computer. I chose Emacs because my job is very computer-related, and no one lives near a computer every day.

Develop a workflow

Once we have the tasks mapped out, we need to work out the workflow, a set of processes from TODO to DONE.

Each line can have different states, such as not started, in progress, completed, etc., which can be defined according to their own needs, so how do we define?

We need to open the.spacemacs configuration file in the user directory and add the process configuration and the color, background color style configuration.

;; Set the task flow (this is my configuration)
(setq org-todo-keywords
      '((sequence "Before starting (p! " "In progress (T! " "Blocking (s! " "|" "Completed (D! " "Cancelled (a@/! ")))

;; Setting task styles
(setq org-todo-keyword-faces
   '(("Not started" .   (:foreground "red" :weight bold))
    ("Blocking" .   (:foreground "red" :weight bold))
    ("In progress" .      (:foreground "orange" :weight bold))
    ("Done" .      (:foreground "green" :weight bold))
    ("Cancelled" .     (:background "gray" :foreground "black"))))Copy the code

We can use the shortcut keys Ctrl c + Ctrl T, and then press the corresponding keys to mark the task status, as shown below.

Schedule tasks

Next, we need to schedule the tasks to the specified date, using the shortcut keys Ctrl C + Ctrl S to schedule the corresponding tasks (at the same time, there is also support for loop tasks and other complex time Settings).

You won’t see much by itself, but we need the Org Agenda to go with it.

We need to give it a shortcut and add the file to our schedule (in the.spacemacs configuration) :

;; Set the Org Agenda shortcut key
(global-set-key (kbd "C-c a") 'org-agenda)

;; Add it to your schedule
(setq org-agenda-files (list "~/org-mode/111.org"))
Copy the code

We press Ctrl C + A to open the Agenda. We press A to select the tasks for the current week.

At the same time, we can press D in the corresponding day to enter the situation of the corresponding day.

Task timing

With the Agenda in place, you can manage your time, but if you want to keep track of how much time is spent on each task, you can use Org Clock for time logging.

We move the cursor to the task that we want to record the time, and then press Ctrl C + Ctrl X + Ctrl I to record the start time of the task.

Then, when the task is complete, or when the task needs to be tentative, we can record it with Ctrl C + Ctrl X + Ctrl O.

You can see that the time cost of our task has been recorded, and that the time record can be started and ended multiple times.

Time to report

We have just timestamp the start and end of each task, so we can easily generate a report of the time spent.

We go to the Agenda screen and press V + R to get the time report.

In this way, we can see the report of the time spent on the task. We can also see the task timing of the whole day in the Agenda. We will add the following configuration to the configuration file:

;; The time block inside agenda is displayed in color
;; From: https://emacs-china.org/t/org-agenda/8679/3
(defun ljg/org-agenda-time-grid-spacing ()
  "Set different line spacing w.r.t. time duration."
  (save-excursion
    (let* ((background (alist-get 'background-mode (frame-parameters)))
           (background-dark-p (string= background "dark"(a))colors (list "#1ABC9C" "#2ECC71" "#3498DB" "#9966ff"))
           pos
           duration)
      (nconc colors colors)
      (goto-char (point-min(a))while (setq pos (next-single-property-change (point) 'duration))
        (goto-char pos)
        (when (and (not (equal pos (point-at-eol)))
                   (setq duration (org-get-at-bol 'duration)))
          (let ((line-height (if (< duration 30) 1.0 (+ 0.5 (/ duration 60))))
                (ov (make-overlay (point-at-bol) (1+ (point-at-eol)))))
            (overlay-put ov 'face `(:background ,(car colors)
                                                :foreground
                                                ,(if background-dark-p "black" "white")))
            (setq colors (cdr colors))
            (overlay-put ov 'line-height line-height)
            (overlay-put ov 'line-spacing (1- line-height))))))))

(add-hook 'org-agenda-finalize-hook #'ljg/org-agenda-time-grid-spacing)
Copy the code

This is what the mission log looks like with V + L on Agenda:

The resources

  1. Artifact Org – mode
  2. Orgmode for GTD

Thank you very much for reading, welcome to follow, forward, share and support me.