From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: todo-did.el complete rewrite Date: Wed, 27 Mar 2019 01:37:15 +0100 Message-ID: <86imw5tao4.fsf@zoho.eu> References: <865zs7bkqx.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="261471"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 27 01:56:36 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8wrr-0015uD-AE for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Mar 2019 01:56:35 +0100 Original-Received: from localhost ([127.0.0.1]:40095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8wrq-00012V-9J for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Mar 2019 20:56:34 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8wpY-0007e2-0r for help-gnu-emacs@gnu.org; Tue, 26 Mar 2019 20:54:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8wZI-0000lr-Tt for help-gnu-emacs@gnu.org; Tue, 26 Mar 2019 20:37:25 -0400 Original-Received: from [195.159.176.226] (port=37790 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8wZI-0000lN-Lb for help-gnu-emacs@gnu.org; Tue, 26 Mar 2019 20:37:24 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1h8wZE-000mVD-Ne for help-gnu-emacs@gnu.org; Wed, 27 Mar 2019 01:37:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Cancel-Lock: sha1:hlzm2vceSC4MEd3eaLwemq55BKY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119760 Archived-At: 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