all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <moasenwood@zoho.eu>
To: help-gnu-emacs@gnu.org
Cc: emacs-devel@gnu.org
Subject: todo-did.el complete rewrite
Date: Mon, 25 Mar 2019 06:12:22 +0100	[thread overview]
Message-ID: <865zs7bkqx.fsf@zoho.eu> (raw)

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




             reply	other threads:[~2019-03-25  5:12 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25  5:12 Emanuel Berg [this message]
2019-03-25  6:57 ` todo-did.el complete rewrite Van L
2019-03-25 18:25   ` license and where to safely store all code (was: Re: todo-did.el complete rewrite) Emanuel Berg
2019-03-25 18:50     ` [OFF TOPIC] " Emanuel Berg
2019-03-25 20:04 ` todo-did.el complete rewrite Ralph Seichter
2019-03-26  0:07   ` where to put files (was: Re: todo-did.el complete rewrite) Emanuel Berg
2019-03-26  0:53     ` where to put files Ralph Seichter
2019-03-26  2:48       ` Emanuel Berg
2019-03-26 17:15       ` Robert Thorpe
2019-03-26  8:36     ` Van L
2019-03-25 20:45 ` todo-did.el complete rewrite Stefan Monnier
2019-03-25 23:41   ` Emanuel Berg
2019-03-26 17:35 ` Stefan Monnier
2019-03-27  0:37   ` Emanuel Berg
2019-03-27  1:42 ` Amin Bandali
2019-03-27 13:12   ` what I should do, and the "Emacs News Ezine" (was: Re: todo-did.el complete rewrite) Emanuel Berg
2019-03-27 13:40     ` what I should do, and the "Emacs News Ezine" Michael Albinus
2019-03-29  9:16       ` Marcin Borkowski
2019-03-29 12:49         ` Óscar Fuentes
2019-04-01 22:07       ` Emanuel Berg
2019-03-27 14:40     ` Amin Bandali
2019-03-28  0:05       ` Van L
2019-03-29  1:38         ` Amin Bandali
2019-03-29  6:27           ` Emanuel Berg
2019-04-27 14:58             ` Van L
2019-04-27 21:09               ` Emanuel Berg
2019-03-29  5:27       ` Sacha Chua
2019-03-29 14:44         ` Drew Adams
2019-04-01 22:11           ` Emanuel Berg
2019-04-26  7:04             ` Van L
2019-04-26  7:39               ` Emanuel Berg
2019-04-27 13:07                 ` Van L
2019-04-27 21:07                   ` Emanuel Berg
2019-04-26  7:47               ` tomas
2019-04-27 21:10                 ` Emanuel Berg
2019-04-29  3:32                   ` Van L
2019-04-04  4:18           ` Xavier Maillard
2019-04-04  3:31         ` Emanuel Berg
2019-04-17  0:39           ` Sacha Chua
2019-04-17  1:53             ` Emanuel Berg
2019-04-17 11:02               ` Van L
2019-04-17 19:07                 ` Emanuel Berg
2019-04-01 13:07       ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865zs7bkqx.fsf@zoho.eu \
    --to=moasenwood@zoho.eu \
    --cc=emacs-devel@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.