For the English part of the blog, see Content AND Presentation.

2017-09-18 How to hide repeating entries from the Org agenda

For today, I only have a short tip I learned from the Org-mode mailing list recently. If you have a repeating task in your agenda, say every other day, and you show the agenda for, say, the next 15 days, it is quite annoying to see that task displayed for seven or eight days. You can now say
(setq org-agenda-show-future-repeats nil)
in your init file and see only one instance of this task. If you set it to 'next instead, you’ll see one more instance (which can be quite handy, I imagine). Cool!

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryOrgMode

Comments on this page

2017-09-11 My email capturing workflow

I’m constantly fiddling with my email workflow. Those of you who are not professional procrastinators like me will probably never understand where the difficulty of answering a short email with a one-two sentence response may be a problem requiring a few days; those who are will probably nod their heads with the “been there, done that” gesture. And I guess many people will sympathize with me about the (sometimes quite important) emails lost forever down the “unread” list.

Of course, this shouldn’t happen, and therefore people are constantly devising various schemes to alleviate this problem. Probably the most famous one is “Inbox zero”, which I may decide to use at some point in the future.

Until recently, I had a Beeminder goal of spending [some time] on email every day. This turned out to work only partially; some emails still fell through the cracks. A few days ago, I came up with a (hopefully) better scheme: I set up another Beeminder goal, essentially boiling down to the commitment of having my (kind of) inbox empty at least once every four days. And “inbox kind of empty” means in this context: no unread messages for the last week.

See what I did here? This should work, no? Only that there is one more problem. What about an email which requires some action (and which must not be forgotten about), but this action cannot objectively be done now (for instance, it depends on a piece of information I am yet about to receive)?

What I decided to do is to flag that email and create an Org-mode to-do task (using the capture mechanism, of course).

But flagging an email in mu4e requires a few keystrokes. I don’t like that, so after a while of edebugging I came up with this.

(defun mu4e-flag-message-at-point-now ()
  "Flag the message at point immediately."
  (let ((msg (mu4e-message-at-point)))
	(funcall (plist-get (cdr (assq 'flag mu4e-marks)) :action) (plist-get msg :docid) msg nil)))

And to bind all this together, I now have this in my setup:

(defun make-this-message-into-an-org-todo-item ()
  "Flag this message as important and capture it in Org-mode."
  (org-capture nil "t"))

The "t" corresponds to a “to-do” capture template:

(setq org-capture-templates
	 (file+headline "~/" "TODOs") ; replace ~/ with your path
	 "* TODO %?\n  %i\n  %a")
	;; more templates here...

And the last piece of the puzzle is a keystroke for the above command in one of my hydras.

Obviously, this creates a potential loophole in my system, if I procrastinate on Org-mode to-do tasks. If this becomes a problem, though, it is simple enough to solve (or so I hope at least). The main accomplishment here is that I can stop treating my inbox as a to-do list (which doesn’t work for so many reasons). Anyway, we’ll see how it works.

Do you have anything similar? How do you ensure you don’t miss important emails? Share your wisdom in the comments!

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryOrgMode

Comments on this page

2017-09-04 LaTeX-mark-environments

Some time ago, I wrote about a simple snippet to compile only the current Beamer frame in AUCTeX. A few days ago, I’ve been asked how to compile two consecutive environments.

Of course, the tricky part is to mark them – while LaTeX-mark-environment accepts an argument, its meaning is “how far up in the environment tree do we go”. But Emacs being Emacs, it’s not too difficult to code what we want.

(defun LaTeX-mark-environments (count)
  "Mark the current and COUNT-1 following LaTeX environments."
  (interactive "p")
  (let ((beg (point))
	(n count))
	(while (> n 0)
	  (if (not (looking-at "[ \t\n]*\\\\begin{[a-zA-Z*]+}"))
	  (setq n 0)
	(setq n (- n 1))
	(goto-char (match-end 0))
	(goto-char beg)))

The code should be pretty much self-explanatory. Also, it is fairy simplistic and I am quite sure you can trip it somehow. (Also, negative arguments don’t work.) The assumption here is that the only thing between environments is whitespace, comments “break the chain” of environments.

Marking consecutive environments in LaTeX turns out to be trickier than e.g. marking consecutive defuns in Lisp (which is a topic deserving another post in the future), because LaTeX syntax is so free-form: not everything is enclosed in an environment. Also, unlike in the case of Lisp, we don’t have functions for moving around LaTeX syntactic elements (an issue I plan to address some day).

An interesting point may be that at first, instead of putting [ \t\n]* into the regex, I wanted to (skip-syntax-forward " ") (i.e., skip whitespace). That was a bad idea, and one of the reasons was that newline does not have syntax class “whitespace”; its class is (at least in AUCTeX) is “endcomment”. Who would guess? But when I saw that skip-syntax-forward (which see) does not go past newlines, I put the point at one and pressed C-u C-x =. In a second I knew what the syntax class of newline was. This is one of the coolest things about Emacs – you can ask it about its state, and get answers in no time.

And really, my point here is not that I can write a sophisticated, bullet-proof, interactive Emacs command in twenty minutes. Frankly, I can’t. The point is that you can write such a quick-and-dirty function doing its job well enough very quickly, save yourself tedious typing, and feel good about making your favorite tool do exactly what you want.

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryTeX, CategoryLaTeX

Comments on this page