help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Org mode rant


From: Emanuel Berg
Subject: Re: Org mode rant
Date: Sat, 01 May 2021 07:10:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Bastien wrote:

> I write a blog entry about to-do lists that you might find
> useful, as it is not directly connected to Org:
>
> https://bzg.fr/en/on-using-to-do-lists-efficiently/

You can include mine if you'd like to, it isn't connected to
Org directly or indirectly - I yank it last.

There are some things that can be improved but they were
actually never put on the TODO list so it is not like they are
tasks that I never did or anything...

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/todo-did.el
;;;   https://dataswamp.org/~incal/emacs-init/todo-did.el

(defun todo-get-buffer ()
  (let*((todo-env-var "TODO_FILE")
        (todo-file     (getenv todo-env-var))
        (todo-buffer   (if todo-file (find-file-noselect todo-file t)
                         (error "Set the env var %s first" todo-env-var) )))
  todo-buffer) )

(defun todo-sort-and-save ()
  (sort-lines nil (point-min) (point-max)) ; not REVERSE
  (whitespace-cleanup)
  (save-buffer) )

(defun todo-insert-entry (what buffer)
  (with-current-buffer buffer
    (goto-char (point-max))
    (insert "\n" what)
    (todo-sort-and-save) ))

(defun todo (what)
  (interactive "sdo what: ")
  (let ((todo-buffer (todo-get-buffer)))
    (todo-insert-entry what todo-buffer) ))

(defun todo-show-file ()
  (interactive)
  (let ((todo-buffer (todo-get-buffer)))
    (with-current-buffer todo-buffer
      (when (buffer-modified-p todo-buffer)
        (todo-sort-and-save) )
      (switch-to-buffer todo-buffer) )))

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]