Hello Kyle,

Thanks very much for your feedback.  As these are changes I made
months ago, I forgot the … finer details—I basically got my narrative
completely wrong, my apologies.

My problem wasn't at all, as you point out, that the tag would erase the entry.

It has to do with habits: The habit graph overwrites anything else.  I
like having org-agenda-tags-column to a low value (wide screen), but
tags are crucial to my workflow, so them being overwritten is
problematic.

My previous patch is completely overkill for that purpose (it's even
misguided since it does stem from a misunderstanding of tags
alignment).  Here's a simpler patch.  It may be a matter of taste,
though.

Cheers,
M.


On Tue, Sep 29, 2020 at 10:36 PM Kyle Meyer <k...@kyleam.com> wrote:
>
> Michaël Cadilhac writes:
>
> > Hello all,
> >
> > I have a wide screen, which makes right edge alignment of tags in the
> > agenda inconvenient (they're hard to match with the main entry).
> > Setting org-agenda-tags-column to a specific column overwrites part of
> > the entry, which is not optimal.  I'd simply want the tag to be put
> > _after_ the entry.
>
> Hmm, I don't think it's supposed to overwrite part of the entry.  I
> haven't been able to trigger that on my end.  Here's the setup I tried
> with an otherwise vanilla configuration:
>
>     (setq org-agenda-files (list "/tmp/scratch.org"))
>     (setq org-agenda-tags-column 25)
>
> where /tmp/scratch.org looks like this
>
>     * TODO foo bar baz                                                      
> :one:
>     * TODO b                                                                
> :two:
>
> When I run org-todo-list, the longer top entry isn't overwritten:
>
>     Global list of TODO items of type: ALL
>     Press ‘N r’ (e.g. ‘0 r’) to search again: (0)[ALL] (1)TODO (2)DONE
>       scratch:    TODO foo bar baz :one:
>       scratch:    TODO b     :two:
>
> What am I missing?
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e4a334dbd..a80123853 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9080,6 +9080,10 @@ current line."
 	(goto-char (match-beginning 1))
 	(delete-region (save-excursion (skip-chars-backward " \t") (point))
 		       (point))
+	(when (get-text-property (point) 'org-habit-p)
+	  (setq c (max c (+ 1 org-habit-graph-column
+			    org-habit-preceding-days
+			    org-habit-following-days))))
 	(insert (org-add-props
 		    (make-string (max 1 (- c (current-column))) ?\s)
 		    (plist-put (copy-sequence (text-properties-at (point)))

Reply via email to