Hello everyone,

When habits contain emphasis markers, e.g.

  * TODO Habit 1
  SCHEDULED: <2026-05-12 Tue .+1d>
  :PROPERTIES:
  :STYLE:    habit
  :END:
  * TODO /Habit/ 2
  SCHEDULED: <2026-05-12 Tue .+1d>
  :PROPERTIES:
  :STYLE:    habit
  :END:
  
and the emphasis markers are hidden:

  (setopt org-hide-emphasis-markers t)
  (require 'org-habit)

the habit graph doesn’t start at the correct column in the agenda:

  agenda:     TODO Habit 1     .................
  agenda:     TODO Habit 2   .................

Attached is a simple patch that adds the emphasis marker invisibility
(‘t’) to the ‘buffer-invisibility-spec’ when constructing the habit
graphs.

Thanks,

-- 
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument
From 5f68515c620f6a20438ac389a6c85be10ceaff13 Mon Sep 17 00:00:00 2001
From: "Jacob S. Gordon" <[email protected]>
Date: Tue, 12 May 2026 16:20:00 -0400
Subject: [PATCH v1] ; org-habit: Fix alignment with hidden emphasis markers

* lisp/org-habit.el (org-habit-insert-consistency-graphs): Keep
emphasis markers hidden so that the habit graph starts at the correct
column when 'org-hide-emphasis-markers' is t.
---
 lisp/org-habit.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 8d0108639..379d30799 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -430,7 +430,7 @@ (defun org-habit-build-graph (habit starting current ending)
 (defun org-habit-insert-consistency-graphs (&optional line)
   "Insert consistency graph for any habitual tasks."
   (let ((inhibit-read-only t)
-	(buffer-invisibility-spec '(org-link))
+	(buffer-invisibility-spec '(org-link t))
 	(moment (time-subtract nil (* 3600 org-extend-today-until))))
     (save-excursion
       (goto-char (if line (line-beginning-position) (point-min)))

base-commit: fb9ebffa9fd900bdd68752a16c6dc493d665d336
-- 
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument

Reply via email to