unofficial mirror of emacs-orgmode@gnu.org
 help / color / mirror / Atom feed
* Re: Proposal: do not align tags in Agenda
@ 2020-10-05 16:59 No Wayman
  0 siblings, 0 replies; 5+ messages in thread
From: No Wayman @ 2020-10-05 16:59 UTC (permalink / raw)
  To: michael; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 398 bytes --]

I recently proposed a patch that would allow a workaround for this:

https://orgmode.org/list/87ft8gelpn.fsf@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'.

[-- Attachment #1.2: Type: text/html, Size: 592 bytes --]

[-- Attachment #2: org-habit-single-line-suggestion.org --]
[-- Type: application/vnd.lotus-organizer, Size: 1849 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Proposal: do not align tags in Agenda
  2020-10-04 16:03   ` Michaël Cadilhac
@ 2020-10-29  2:21     ` Kyle Meyer
  0 siblings, 0 replies; 5+ messages in thread
From: Kyle Meyer @ 2020-10-29  2:21 UTC (permalink / raw)
  To: Michaël Cadilhac; +Cc: Org-Mode mailing list, No Wayman

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 <https://orgmode.org/worg/org-contribute.html>) 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
<https://orgmode.org/list/87ft8gelpn.fsf@gmail.com/> 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)))


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Proposal: do not align tags in Agenda
  2020-09-30  3:36 ` Kyle Meyer
@ 2020-10-04 16:03   ` Michaël Cadilhac
  2020-10-29  2:21     ` Kyle Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Michaël Cadilhac @ 2020-10-04 16:03 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Org-Mode mailing list

[-- Attachment #1: Type: text/plain, Size: 1987 bytes --]

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 <kyle@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?

[-- Attachment #2: agenda-tags-habit.patch --]
[-- Type: text/x-patch, Size: 608 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Proposal: do not align tags in Agenda
  2020-09-24 16:16 Michaël Cadilhac
@ 2020-09-30  3:36 ` Kyle Meyer
  2020-10-04 16:03   ` Michaël Cadilhac
  0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2020-09-30  3:36 UTC (permalink / raw)
  To: Michaël Cadilhac; +Cc: Org-Mode mailing list

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?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Proposal: do not align tags in Agenda
@ 2020-09-24 16:16 Michaël Cadilhac
  2020-09-30  3:36 ` Kyle Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Michaël Cadilhac @ 2020-09-24 16:16 UTC (permalink / raw)
  To: Org-Mode mailing list

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

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.

[-- Attachment #2: do-not-align.diff --]
[-- Type: text/x-patch, Size: 1380 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-29  2:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 16:59 Proposal: do not align tags in Agenda No Wayman
  -- strict thread matches above, loose matches on Subject: below --
2020-09-24 16:16 Michaël Cadilhac
2020-09-30  3:36 ` Kyle Meyer
2020-10-04 16:03   ` Michaël Cadilhac
2020-10-29  2:21     ` Kyle Meyer

unofficial mirror of emacs-orgmode@gnu.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git