[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: todo-did.el complete rewrite
From: |
Emanuel Berg |
Subject: |
Re: todo-did.el complete rewrite |
Date: |
Wed, 27 Mar 2019 01:37:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Stefan Monnier wrote:
>> (defun todo-show-file () [...]
>
> Have you considered using todo-mode or
> org-mode for the buffer into which you add
> those entries?
No, as wasn't aware of them (or, I was aware of
org-mode in general, but not that it had a todo
list). Anyway that function is no good. I have
made some changes:
;; This file: http://user.it.uu.se/~embe8573/emacs-init/todo-did.el
;;
;; Updated: 27-03-2019 01:34
;;
;; zsh companion:
;;
;; set the TODO_FILE env in: ~/.zshenv
;; 'todo' command:
;; ~/.zsh/todo
;; http://user.it.uu.se/~embe8573/conf/.zsh/todo
(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) ; NOWARN
(error "Set the env var %s first"
todo-env-var) )))
(with-current-buffer todo-buffer
(revert-buffer t t)) ; IGNORE-AUTO NOCONFIRM
todo-buffer) )
(defun todo-sort-and-save ()
(sort-lines nil ; not REVERSE
(point-min) (point-max))
(save-buffer) )
(defun todo (what)
(interactive "sdo what: ")
(let ((todo-buffer (todo-get-buffer)))
(with-current-buffer todo-buffer
(goto-char (point-max))
(insert what)
(todo-sort-and-save)
)))
(defun todo-show-file ()
(interactive)
(let ((todo-buffer (todo-get-buffer)))
(switch-to-buffer todo-buffer)
(todo-sort-and-save)
))
--
underground experts united
http://user.it.uu.se/~embe8573
- [OFF TOPIC] Re: license and where to safely store all code (was: Re: todo-did.el complete rewrite), (continued)
- Re: todo-did.el complete rewrite, Stefan Monnier, 2019/03/25
- Re: todo-did.el complete rewrite, Stefan Monnier, 2019/03/26
- Re: todo-did.el complete rewrite,
Emanuel Berg <=
- Re: todo-did.el complete rewrite, Amin Bandali, 2019/03/26
- Re: what I should do, and the "Emacs News Ezine", Amin Bandali, 2019/03/27
- Re: what I should do, and the "Emacs News Ezine", Van L, 2019/03/27
- Re: what I should do, and the "Emacs News Ezine", Amin Bandali, 2019/03/28
- Re: what I should do, and the "Emacs News Ezine", Emanuel Berg, 2019/03/29
- Re: what I should do, and the "Emacs News Ezine", Sacha Chua, 2019/03/29