7
votes

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.

4
Re-ordering the entry by putting the :LOGBOOK: after the :PROPERTIES: drawer (or vice versa) solved the issue for me. Thanks for passing on the advice! By the way, you could temporarily set org-habit-show-all-today to t for showing the consistency graphs of all habits on today's agenda to check for your three-monthly item.schmuu

4 Answers

3
votes

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.

1
votes
0
votes

Maybe you have turned them off somehow? Does pressing 'K' in the agenda help?

0
votes

I've had the same problem after upgrading org-mode from version 8.2.10 to 9.1.9 (because of this bug).

Here is what an entry was looked like (org-version = 8.2.10) :

** TODO Sleep in time                                 
   SCHEDULED: <2019-09-07 sam. 23:00 +1d>
   - State "DONE"       from "TODO"       [2019-09-07 sam. 02:54]
   - State "DONE"       from "TODO"       [2019-09-06 ven. 02:09]
   - State "DONE"       from "TODO"       [2019-09-05 jeu. 00:29]
   :PROPERTIES:
   :STYLE: habit
   :LAST_REPEAT: [2019-09-07 sam. 02:54]
   :END:

... and what i've done so that the graph show up again (org-version = 9.1.9) :

** TODO Sleep in time                                 
   SCHEDULED: <2019-09-07 sam. 23:00 +1d>
   :PROPERTIES:
   :STYLE: habit
   :LAST_REPEAT: [2019-09-07 sam. 02:54]
   :END:
   - State "DONE"       from "TODO"       [2019-09-07 sam. 02:54]
   - State "DONE"       from "TODO"       [2019-09-06 ven. 02:09]
   - State "DONE"       from "TODO"       [2019-09-05 jeu. 00:29]

As it's showed, I've swapped up the PROPERTIES drawer and the "log" list.

EDIT:

I just realised that this solution is exactly the same as @schmuu suggested (I don't use LOGBOOK drawer). I got the same conclusion by creating a repeating entry and marked it as done in the agenda view. The "log" item list had appeared after the PROPERTIES drawer.