[emacs-berlin] Magic magit
tils at tils.net
Thu Oct 1 23:21:16 UTC 2015
Rasmus <rasmus at gmx.us> writes:
> -1. You should use org-capture. It's designed for exactly this. Except
> the "move from inbox to org" which I don't understand.
Yes, I suppose I should have looked into org-capture more thoroughly
before. One thing that I don't see how it would be possible with
org-capture is to have a function pre-guess what would be the best
target file and suggest that, so that I only have to press enter to
accept the guess in most cases, but still have the possibility to change
If I understand correctly, the org-capture approach would be either to
create a capture template for each possible target org file - with that
there would be no pre-guessing - or create a single capture template
that uses a custom function to select the target file. With this, it
wouldn't be possible to change the suggested guess though. Maybe this is
not a big deal anyway and I should just use that approach, I'll think
> 0. What's wrong with (insert "* TODO " link " :mail:") ? You could get
> the relative level with (org-outline-level).
Nothing wrong with insert, I just thought it would be good practice to
use org specific functions when doing things inside org-mode.
> 1. Tags are non-trivial. First, if the tag column is set, it should be
> respected (depending on org-auto-align-tags, of course). If you care,
> you check this with org-complex-heading-regexp. For your script this
> is probably sufficient,
> (when org-auto-align-tags (org-align-tags-here org-tags-column))
this also doesn't indent it properly. It seems to be related to
inserting a link - with normal text inserted it works. This reproduces
(with-current-buffer (find-file-noselect "/tmp/test.org")
(insert "* TODO " "[[file:~/.emacs.d/notmuch-stuff.el][This is a test]]")
(when org-auto-align-tags (org-align-tags-here org-tags-column))))
> For a complete example see e.g. org-remove-indentation (in org ≥ 8.3)
>> (org-set-tags nil t)
> (insert "\n") ?
Right, (org-return) is over the top. Maybe even (newline) ?
> I haven't tested this since I don't have notmuch (and lazy), but if you
> like `cl-lib' maybe you can extend on this:
> (let ((subject (notmuch-show-get-subject))
> (from (notmuch-show-get-from))
> (to (notmuch-show-get-to))
> (cc (notmuch-show-get-cc))
> ;; Should be a defcustom...
> (types '(("@emacs-berlin\\.org" "~/org/emacs.org" to cc)
> ("@railsgirlsberlin\\.de" "~/org/railsgirls.org" to cc from))))
> (cl-some (lambda (entry) (cl-some (lambda (field)
> (if (string-match-p (car entry) field)
> (cadr entry))
> (cl-remove-if-not 'identity (cddr entry)))))
I'll try to wrap my head around it later.
Thanks for the input!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 472 bytes
Desc: not available
More information about the emacs-berlin