Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org-mode habit consistency graph not displaying

Tags:

emacs

org-mode

org-version 8.3.4 (elpa package, 20160530) emacs 24.4.1 (Debian package, Installed: 24.4+1-4.1~bpo70+1)

When I started using org-mode from elpa, the habit consistency graph stopped showing. I was using a version of org-mode that comes with debian before, with emacs 23 and the graph showed.

I'm a beginner in emacs lisp, but anyway I tried stepping through the org-agenda-list function and found the org-agenda-finalize function where the org habit graph is supposed to be inserted via the org-habit-insert-consistency-graphs function. But it skips over that function, probably because this expression returns false:

(next-single-property-change (point-min) 'org-habit-p))

At this point, I don't know what to do to make habits show. This is the first time I've looked at org-mode code, I don't know what the above test is for.

Help, please?

UPDATE: 2016-06-25. I upgraded the org-mode package to elpa, 20160620 (still org-version 8.3.4). Still have the same behaviour. I am getting the package from elpa.gnu.org.

UPDATE 2: 2016-07-02: I did try pressing K (for org-habit-toggle-habits). It didn't change the contents of the buffer visibly. I also tried refreshing the buffer after typing K. And repeating the experiment, in case the K put emacs in the wrong mode the first time.

UPDATE 3: 2016-07-08: on the emacs-orgmode mailing list, I got advice to ensure that the structure of the entries with habits is:

  • headline
  • SCHEDULED
  • PROPERTIES
  • everything else

by using this function org-repair-property-drawers from this site: http://orgmode.org/Changes.html

but that broke my weekly agenda display and also, once I fixed the entries, didn't make the habits work. Probably my entries were in worse shape than the function anticipated. But this method worked for Josiah who sent the advice. Including it here in case it helps someone else.

UPDATE 4: 2016-07-09: thanks Phil for the suggestion to make a minimal example of the problem. With the following .org file and no other, I see the problem:

** TODO daily customer meeting                             :SUPPORT:CUSTOMER:
   :SCHEDULED: <2016-07-06 Wed 10:30 .+1d>
   :PROPERTIES:
   :LAST_REPEAT: [2016-07-05 Tue 12:00]
   :STYLE: habit
   :END:
   :LOGBOOK:
   - State "DONE"       from "TODO"       [2016-07-05 Tue 12:00]
   - State "DONE"       from "TODO"       [2016-06-30 Thu 16:34]
   - State "DONE"       from "TODO"       [2016-06-29 Wed 20:02]
   - State "DONE"       from "TODO"       [2016-06-28 Tue 10:53]
   - State "DONE"       from "TODO"       [2016-06-27 Mon 10:50]
   - State "DONE"       from "TODO"       [2016-06-23 Thu 12:11]
   - State "CANCELLED"  from "TODO"       [2016-06-21 Tue 13:43] \\
     No meeting today, cancelled by Mmmm.
   :END:

I'm using the minimal.emacs suggested in the link, namely:

(add-to-list 'load-path (expand-file-name "/home/bjb/.emacs.d/elpa/org-20160620"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . org-mode))
(setq org-agenda-files '("/home/bjb/.emacs.d/test/test.org"))
(require 'org-install)
(require 'org-habit)

;(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
;(global-set-key "\C-cb" 'org-iswitchb)

And showing the agenda with C-c a a.

I had added the leading colon to the SCHEDULED line... when I remove it, the graph shows up. However, I had added it (a while ago) because I was trying to solve other problems, which I don't remember what they were.

I will play with this, and see if I can get all my org files to load fully with habit-consistency-graphs. Thanks ... will report back with results.

Must note that when I looked at this particular item (which is a short version of an actual habit in my org-files) there were two PROPERTY drawers, one before LOGBOOK with just the LAST-REPEAT property, and one after LOGBOOK with the habit property. I merged the two property drawers to show you the failure, as I believe the PROPERTY drawer is supposed to be in one piece before the LOGBOOK drawer. So I have some maintenance to do on my org-files. I had tried to merge them into one piece in each habit before, but then agenda weekly view broke badly and I put it back the way it was. Will have to try harder.

UPDATE 5 2016-07-09: I had put in the leading colon before SCHEDULED: because I wanted to see when the 3-monthly items fell in the future ... I wanted to see them as scheduled items. That worked but when I upgraded org-mode the consistency graph went away. When I took off the leading colon on all the habits, the daily habits showed up, and I have confidence that the three-monthly items will show up when they fall on "today". But I won't get any notice of having to pay the interest ... it will just appear on the day it must be paid. Well that is for me to figure out.

Thanks everyone for considering and answering my question.

like image 814
Brenda J. Butler Avatar asked Jun 25 '16 18:06

Brenda J. Butler


People also ask

How do I enable ORG habits?

To use Org habits, customize org-modules and enable the habit module. To set something as a habit, use C-c C-x p ( org-set-property ) to set the STYLE property to habit . For more information, you should definitely check out the Org manual's section on habits. Yay Emacs and the people who contribute to it!

What can you do with Org mode?

Org mode is routinely used to build and manage complex workflows. It does this using an elegantly simple syntax that scales from basic markup to full LaTeX typesetting and from plain text notes to literate programs. Everything you need to get started is demonstrated in the example.


2 Answers

I had a similar problem today, and it turns out that somehow the habit module was turned off (but the recurrent tasks still stays in the agenda so I didn't make the connection). When I re-enable the module (M-x customize variable org-modules then tick on habit), the consistency graph displays as normal in the agenda's view.

like image 145
amuyena Avatar answered Sep 27 '22 19:09

amuyena


This won't solve your issue but might help a bit:

http://orgmode.org/worg/org-faq.html#minimal-emacs

like image 38
Phil Hudson Avatar answered Sep 27 '22 19:09

Phil Hudson