Content AND Presentation

(Note to English-speaking readers: the links entitled Komentarze na tej stronie lead to comment pages.)

2015-10-03 Annoying Org-mode buffers

In the spirit of my previous post, let me share something I did just today. If I launch Org-mode agenda, it loads all agenda files (which in my case is quite a lot). If they are already opened in an Emacs session, that doesn’t do any harm; but if not, they are then all at the front of the buffer list, which I don’t like: I prefer to land where I was when I press q in agenda. Here’s a very simple function to remedy this.

(defun bury-org-buffers ()
  "Bury all Org-mode buffers."
  (mapcar (lambda (buffer)
	    (with-current-buffer buffer
	      (when (eq major-mode 'org-mode)

It is clear what and how it does. One problem is whether it is a good idea to put it into org-agenda-finalize-hook. I first did it, and then resigned. As I mentioned, the only situation this is really needed is when I start the agenda for the first time. (And if this is the first thing I do after starting Emacs, the fact that all agenda buffers are at the front of the buffer list doesn’t do any harm at all anyway, so the only moment it matters is if I launch the agenda for the first time some time after launching Emacs.)

All these considerations mean that what I really need is not a function to bury Org-mode buffers, but to load them at Emacs startup. Since I don’t restart Emacs very often (and I configured my window manager to start it right after I log in), long startup time doesn’t bother me at all.

After some time looking around in org-agenda.el, I finally found the solution. Now I just have

(org-agenda-prepare-buffers (org-agenda-files))

in my init.el.

As a final note, It might be worth mentioning that org-agenda visits agenda files using find-file-noselect. This is not exactly optimal. For instance, if one of the agenda files has unsafe file-local variables, Emacs asks the user what to do. What’s even worse, the same applies to non-agenda files which nevertheless contain one of the recent clocks. (In fact, for that it’s enough to load any Org-mode file.) Since those files might be in VC, and they might be edited by other people, and other people might be malicious, this seems to be sane behavior. Personally, I don’t mind Emacs asking me such a question on startup, but YMMV.

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryOrgMode

Comments on this page

2015-09-26 A few org-agenda hacks

Like many Emacs users these days, I heavily depend on Org-mode. One particular feature I use a lot (in fact, more and more) is the agenda. However, in the default setup, it was not the best experience for me.

For starters, I found out that instead of plain C-c a a (to get my agenda for the next few days), I always pressed C-c a a o (to display the agenda in a sole window). Only recently it struck me that it doesn’t make any sense, and decided to automate this behavior. Basically, this boiled down to finding the right knob to turn:

(add-hook 'org-agenda-finalize-hook (lambda () (delete-other-windows)))

Of course, I also set up some more “standard” agenda features.

Since I want my agenda to warn me about any dangers lurking on the horizon, like my wife’s birthday (just kidding: this one I do remember, together with our wedding anniversary;-)), the default org-agenda-span of one week was not enough for me.

(setq org-agenda-span 14)

Then, starting the agenda on Monday (the default setting for org-agenda-start-on-weekday) is nonsensical: I have no idea why I could want the agenda to start on any day but today, and even if I decided to have it started at the beginning of the week, Monday does not make sense, either.

(setq org-agenda-start-on-weekday nil)

Also, I sometimes have events with a precise hour (as opposed to the date alone) in the agenda, and I found the time-grid feature rather distracting – so I turned it off.

(setq org-agenda-use-time-grid nil)

Finally, since the lines in the agenda are sometimes quite wide (especially with tags), I decided I needed a visual aid telling me which line I’m in. That was easy, however:

(add-hook 'org-agenda-finalize-hook (lambda () (hl-line-mode)))

And this is pretty much it. (Not really, I have some setup related to the global TODO list, but this will wait for another post.) Even though all that is in the manual, I hope that this rundown of my agenda setup might be helpful for someone.

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryOrgMode

Comments on this page

2015-09-19 Theory of hyperconvex spaces – a beginner's guide

I am proud to announce that a book I have written is out. The book is entitled Theory of hyperconvex metric spaces: a beginner’s guide. Hyperconvex spaces are a very interesting (though a bit abstract) topic between mathematical analysis and topology. They have remarkable properties; the book is mainly devoted to their connections with fixed point theory.

The book is published by the Juliusz P. Schauder Center for Nonlinear Studies in the series Lecture Notes in Nonlinear Analysis.

CategoryEnglish, CategoryBlog, CategoryMath

Comments on this page


(Więcej means More in Polish; click it to see older entries.)

CategoryEnglish, CategoryBlog