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.  The attached patch is what I've been using for the
past month, and it seems to work alright.

Thoughts for/against?

Stay safe,
M.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e4a334dbd..792348e4c 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1912,6 +1912,7 @@ character screen."
   :group 'org-agenda-line-format
   :type '(choice
 	  (const :tag "Automatically align to right edge of window" auto)
+	  (const :tag "Do not align" nil)
 	  (integer :tag "Specific column" -80))
   :package-version '(Org . "9.1")
   :version "26.1")
@@ -9073,13 +9074,20 @@ current line."
 				 (if (memq 'org-tag prop)
 				     prop
 				   (cons 'org-tag prop))))))
-	(setq l (string-width (match-string 1))
-	      c (if (< org-agenda-tags-column 0)
-		    (- (abs org-agenda-tags-column) l)
-		  org-agenda-tags-column))
+	(when org-agenda-tags-column
+	    (setq l (string-width (match-string 1))
+		  c (if (< org-agenda-tags-column 0)
+			(- (abs org-agenda-tags-column) l)
+		      org-agenda-tags-column)))
 	(goto-char (match-beginning 1))
 	(delete-region (save-excursion (skip-chars-backward " \t") (point))
 		       (point))
+	(unless org-agenda-tags-column
+	  (setq c (if (get-text-property (point) 'org-habit-p)
+		      (+ 1 org-habit-graph-column
+			 org-habit-preceding-days
+			 org-habit-following-days)
+		    (current-column))))
 	(insert (org-add-props
 		    (make-string (max 1 (- c (current-column))) ?\s)
 		    (plist-put (copy-sequence (text-properties-at (point)))

Reply via email to