Re: Proposal: do not align tags in Agenda

2020-10-28 Thread Kyle Meyer
Michaël Cadilhac writes:

> 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.

I see (and sorry for the slow reply).  I've never used habits, but that
does sound good to avoid.  Would you mind 1) wrapping the change below
into a patch (see ) and 2)
providing a minimal example like the one in my last reply so that
reviewers have something to quickly test?

No Wayman, I see that you replied [1] that your patch at
 would allow working
around this issue [2], but do you still think the change below is a good
idea?  Thanks.


  [1] Note that it's detached from this thread because the References
  and In-Reply-To headers weren't preserved.

  [2] Sorry that that patch hasn't gotten any attention yet.

> 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

I haven't applied this to check, but I suspect you'll need some amount
of guarding (e.g. with boundp) to silence the byte-compiler here.

>   (insert (org-add-props
>   (make-string (max 1 (- c (current-column))) ?\s)
>   (plist-put (copy-sequence (text-properties-at (point)))



Re: Proposal: do not align tags in Agenda

2020-10-05 Thread No Wayman
I recently proposed a patch that would allow a workaround for this:

https://orgmode.org/list/87ft8gelpn@gmail.com/

It allows custom placement of the habit consistency graph within the agenda.
There is an accompanying example that places the graph on its own line
under the agenda item.
I've attached an org file with my current workaround which advises
`org-habit-insert-consistency-graphs'.


org-habit-single-line-suggestion.org
Description: Lotus Organizer


Re: Proposal: do not align tags in Agenda

2020-10-04 Thread Michaël Cadilhac
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  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)))


Re: Proposal: do not align tags in Agenda

2020-09-29 Thread Kyle Meyer
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?



Proposal: do not align tags in Agenda

2020-09-24 Thread Michaël Cadilhac
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)))