all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "N. Jackson" <nljlistbox2@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-agenda: Use `window-max-chars-per-line' instead of `window-width'
Date: Thu, 21 Apr 2022 03:16:11 -0400	[thread overview]
Message-ID: <87a6cekitg.fsf@moondust.localdomain> (raw)
In-Reply-To: <87wnfj3t4x.fsf@localhost> (Ihor Radchenko's message of "Thu, 21 Apr 2022 13:25:18 +0800")


At 13:25 +0800 on Thursday 2022-04-21, Ihor Radchenko wrote:
>
> Attaching the patch.

Great. I tested the patch (with Org mode version 9.5.3) and that
fixes the problem for the block separator wrapping.

However, the problem with the tags wrapping in Agenda (instead of
being right aligned) remains.

Thank you and best regards,
N.


> From 5de3de87872ddae994f5b68eba74d915d5f73201 Mon Sep 17 00:00:00 2001
> Message-Id: <5de3de87872ddae994f5b68eba74d915d5f73201.1650518543.git.yantar92@gmail.com>
> From: Ihor Radchenko <yantar92@gmail.com>
> Date: Thu, 21 Apr 2022 13:18:39 +0800
> Subject: [PATCH] org-agenda: Use `window-max-chars-per-line' instead of
>  `window-width'
>
> * lisp/org-agenda.el (org-agenda-prepare):
> (org-todo-list):
> (org-agenda-show-new-time): Calculate the maximum number of chars
> fitting into window via `window-max-chars-per-line' instead of
> `window-with'.  The latter can return larger number when fringes are
> disabled [1].
>
> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19395
>
> Reported in https://orgmode.org/list/87czhdqi9p.fsf_-_@moondust.localdomain
> ---
>  lisp/org-agenda.el | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index a09b53563..9ddee81ee 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -3925,7 +3925,7 @@ (defun org-agenda-prepare (&optional name)
>  	      (insert "\n"
>  		      (if (stringp org-agenda-block-separator)
>  			  org-agenda-block-separator
> -			(make-string (window-width) org-agenda-block-separator))
> +			(make-string (window-max-chars-per-line) org-agenda-block-separator))
>  		      "\n"))
>  	    (narrow-to-region (point) (point-max)))
>  	(setq org-done-keywords-for-agenda nil)
> @@ -4944,7 +4944,7 @@ (defun org-todo-list (&optional arg)
>  	    (let ((n 0))
>                (dolist (k kwds)
>                  (let ((s (format "(%d)%s" (cl-incf n) k)))
> -                  (when (> (+ (current-column) (string-width s) 1) (window-width))
> +                  (when (> (+ (current-column) (string-width s) 1) (window-max-chars-per-line))
>                      (insert "\n                     "))
>                    (insert " " s))))
>  	    (insert "\n"))
> @@ -10301,10 +10301,7 @@ (defun org-agenda-show-new-time (marker stamp &optional prefix)
>  				  (line-end-position)
>  				  '(display nil))
>  	  (org-move-to-column
> -           (- (if (fboundp 'window-font-width)
> -                  (/ (window-width nil t) (window-font-width))
> -                ;; Fall back to pre-9.3.3 behavior on Emacs <25.
> -                (window-width))
> +           (- (window-max-chars-per-line)
>                (length stamp))
>             t)
>            (add-text-properties


  reply	other threads:[~2022-04-21  7:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 13:10 [BUG] Off-by-one error in width of Agenda window? [9.5.2 (release_9.5.2-25-gaf6f12 @ /data/installs/snapshots/emacs-28.1/lisp/org/)] N. Jackson
2022-04-18 13:39 ` Ihor Radchenko
2022-04-18 19:06   ` N. Jackson
2022-04-19  3:16     ` Ihor Radchenko
2022-04-19 14:06       ` [BUG] Off-by-one error in width of Agenda window? N. Jackson
2022-04-20  4:01         ` Ihor Radchenko
2022-04-20 10:07           ` N. Jackson
2022-04-21  5:25             ` [PATCH] org-agenda: Use `window-max-chars-per-line' instead of `window-width' Ihor Radchenko
2022-04-21  7:16               ` N. Jackson [this message]
2022-04-21  7:56                 ` N. Jackson
2022-04-22  5:58                   ` [PATCH v2] org-agenda: Use `window-max-chars-per-line' to calculate max text width Ihor Radchenko
2022-04-22  8:42                     ` N. Jackson
2022-04-22  9:27                       ` Ihor Radchenko
2022-04-22 15:46                         ` N. Jackson
2022-04-24  7:04                           ` Ihor Radchenko
2022-04-24 11:55                             ` Thank you " N. Jackson
2022-04-18 14:30 ` [BUG] Off-by-one error in width of Agenda window? [9.5.2 (release_9.5.2-25-gaf6f12 @ /data/installs/snapshots/emacs-28.1/lisp/org/)] Tory S. Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6cekitg.fsf@moondust.localdomain \
    --to=nljlistbox2@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.