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,gmane.emacs.devel Subject: todo-did.el complete rewrite Date: Mon, 25 Mar 2019 06:12:22 +0100 Message-ID: <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="133044"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cc: emacs-devel@gnu.org To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 25 06:12:50 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 1h8Hui-000YUB-Tu for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Mar 2019 06:12:49 +0100 Original-Received: from localhost ([127.0.0.1]:36576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Huh-0004b8-Ti for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Mar 2019 01:12:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8HuS-0004at-Ib for help-gnu-emacs@gnu.org; Mon, 25 Mar 2019 01:12:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8HuR-0005c9-EB for help-gnu-emacs@gnu.org; Mon, 25 Mar 2019 01:12:32 -0400 Original-Received: from [195.159.176.226] (port=40986 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8HuR-0005U9-5n for help-gnu-emacs@gnu.org; Mon, 25 Mar 2019 01:12:31 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1h8HuO-000YCb-Pn for help-gnu-emacs@gnu.org; Mon, 25 Mar 2019 06:12:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Followup-To: gmane.emacs.help,gmane.emacs.devel Mail-Copies-To: never Cancel-Lock: sha1:JNh6OmDYPXNcT3lo5YVyqGChIDY= 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:119733 gmane.emacs.devel:234698 Archived-At: Emacs/shell (here, zsh) interface to a TODO buffer. Very useful and fast. (`todo-show-file' ought to be bound to a key, e.g. I have it `C-j t'.) In the shell it is just $ todo sleep more, take less amphetamine (Note the lack of apostrophes/quotes!) The next time you do `C-j t' (or whatever you have it) it'll be there - sorted, and saved. Same if you do M-x todo RET fix all the bugs in todo-did.el RET Ain't it cool stuff? :) Please comment! The last couple of days I have posted tons of code (of various degrees of advancedness, this is probably the most advanced) - the last couple of days I have posted tons of code and not received a single comment :( Very disappointing is my honest sensation. PS. Check the date if you use the URL! Might get a cached version otherwise. DS. Aaanyway... ;; This file: http://user.it.uu.se/~embe8573/emacs-init/todo-did.el ;; ;; Updated: 25-03-2019 05:53 ;; ;; 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)) ) (if todo-file (or (get-file-buffer todo-file) (find-file-noselect todo-file) ) (error "Set the env var %s first" todo-env-var) ))) (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))) (set-buffer todo-buffer) ;; this if if the file doesn't exist ;; but the env is set correctly (save-buffer) ;; this is if the file ;; has changed from the shell (revert-buffer t t) ; IGNORE-AUTO NOCONFIRM (todo-sort-and-save) (switch-to-buffer todo-buffer) )) -- underground experts united http://user.it.uu.se/~embe8573