From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0CFPAAdEYmIMGQEAbAwnHQ (envelope-from ) for ; Fri, 22 Apr 2022 07:58:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id qP5OAAdEYmJ6ZAEA9RJhRA (envelope-from ) for ; Fri, 22 Apr 2022 07:58:31 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 94C427E11 for ; Fri, 22 Apr 2022 07:58:30 +0200 (CEST) Received: from localhost ([::1]:37238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhmJJ-0008Ll-Pt for larch@yhetil.org; Fri, 22 Apr 2022 01:58:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhmIM-0008Ku-GU for emacs-orgmode@gnu.org; Fri, 22 Apr 2022 01:57:30 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:33592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhmIK-0007vx-Ly for emacs-orgmode@gnu.org; Fri, 22 Apr 2022 01:57:30 -0400 Received: by mail-pl1-x636.google.com with SMTP id c23so8642608plo.0 for ; Thu, 21 Apr 2022 22:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=V1zL0kHCv9eEzgnOPt463r1tiT8IPcjV4qWJ/GYDCt0=; b=StBobIItVaDiCDl/ya0Yt1BAMSQDIWm31Dv8hJapZyR+7+YdQ+lgguhSClHpLz/EuL vi8eJWqBKds4oYBmclD2zy3sc07ltNfFTV/SQ/Ulo0zRVQVC9HlHC+0S80DBIDdXxiPL yObSB18qdx6Y/YyakchwfJZU62dDWCnun1KOWuauTdTUJLuWj+hIaulLY0mNAwl27AqC /iyEduoL+rtxjo+wY49LtgYbEBkyv1EpkJBAxLMiwVwG0eS4q4MJwztY9vLeCuXM/KLx MrtYolba4SkvtOIrRAdEZ+SCVdw9RyRHFIN9pZvW8NIgkVG2/8vqK5LBOY4qbf/qYrAb wziQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=V1zL0kHCv9eEzgnOPt463r1tiT8IPcjV4qWJ/GYDCt0=; b=oPtZ11xlaAKsnyfFXvNKMajkuvUyXwE5n9rrP2WJbksrrxT9LCl18n48xvqzaJyyHP sIePkc2hqrdn7YB/S1wO//vIUTS/IbR4mg+SgHCih0b3P+kdCg6D6XocC3AYgRntZ/Cd 1jjLyHGO9TvdqCa/co1YVfs2wuAMah7nLI0DD8+NmReZtqM1LNjUYCOj0C+bglb9r1uS Z4lYSbPSnRpJTlVFgc15yWV4CuJACfG9fiKk6jmOI9k3VjOFi8YygBx4G1804i+kxuN/ C2TI+Tl+gbfOf2fbiTR0XCByAuA6E5IaVRd16fuYDHKKeggATtCBK2LrMB4oAr4bD7UE /rcQ== X-Gm-Message-State: AOAM530Q5lSZnPmJIOyoUSMAXORgxTrfVmJVIm+HTRi0yT61kPzG1vbx JabQ+ghG5fDmi+CPS0jhEIg= X-Google-Smtp-Source: ABdhPJwlp5OfEyVs3bhgfTyJVrUre6jPNumf9GSGz3aYBRSfYLcvATGT91RZDvX/Z/+SEeDM21VGaw== X-Received: by 2002:a17:902:f64d:b0:14f:fb63:f1a with SMTP id m13-20020a170902f64d00b0014ffb630f1amr2954035plg.159.1650607046859; Thu, 21 Apr 2022 22:57:26 -0700 (PDT) Received: from localhost ([103.125.234.62]) by smtp.gmail.com with ESMTPSA id c139-20020a624e91000000b005060cdff4ffsm1051158pfb.129.2022.04.21.22.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 22:57:26 -0700 (PDT) From: Ihor Radchenko To: "N. Jackson" Subject: [PATCH v2] org-agenda: Use `window-max-chars-per-line' to calculate max text width In-Reply-To: <875yn2vphr.fsf@moondust.localdomain> References: <874k2qwn92.fsf@moondust.localdomain> <87ee1ubje8.fsf@localhost> <87o80yqkhi.fsf@moondust.localdomain> <874k2ppxth.fsf@localhost> <87czhdqi9p.fsf_-_@moondust.localdomain> <87o80wz9le.fsf@localhost> <87ee1sjcf9.fsf@moondust.localdomain> <87wnfj3t4x.fsf@localhost> <87a6cekitg.fsf@moondust.localdomain> <875yn2vphr.fsf@moondust.localdomain> Date: Fri, 22 Apr 2022 13:58:18 +0800 Message-ID: <875yn1u0at.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=yantar92@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650607110; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=V1zL0kHCv9eEzgnOPt463r1tiT8IPcjV4qWJ/GYDCt0=; b=EBnJJKjyoqaY4FdGF2ADyVCDSwyFAahsMrZ/npIu9vCJeBYC6PEF49SlZHo7becz2sBLgy OJPc78jPBJWquTXjIbJ72pdSCFnGNab00b2ZL+d1j19d62ofa9GKGpCK9RlVyoGYPFeEop 1/Ug+RuA0v97aVEdv31EDqnMxSx1l3zcidXdxHcvxQdQAoLyvBTcZnNC0eQ3JUZRJKyOPU M0mNFBuBUVujVGt4YaW2S0vdOGOHIALf/gwOUoq8LPorHOTP1G91Den5gasotOm3mCumbi vQ24Et1NePVId+IJFY2I4LEoLOzmgfgbX04beVdNc8S8e1cgPF6TRa6jBhRAiA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650607110; a=rsa-sha256; cv=none; b=IiInPPEMS1jULbWIgfU89dmjg8N1P30sLnQDdc5VPJO4ujtGmBLn66eICumwVyE0TXbHB1 nXDT91CF/FuV2/e91aUfmN2S1NRZn7T+Zgg44eiDi5aWxsYNu+YVaQw6g34wxDvKbhVEKE Z0+GjKW4r7sVB2Ir2Y3AwLKdv2RHrK7layXCusWr2zkRG+aurSJhbyUhevRaB/UdUzJMpV dOKeu9uZJZvS4VDKMLVFBovnd4/TgmaMwPGfuc9cZC7bFl6enWCU+n6ge9E5KXoDQqqBu1 PKeYRlCcKfOZbUBhgCbSFYrfTiE2JErJmxK4NZa1ZrDDGMFQ2hfuEay0xMB/Og== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=StBobIIt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.53 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=StBobIIt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 94C427E11 X-Spam-Score: -3.53 X-Migadu-Scanner: scn1.migadu.com X-TUID: XIl8Cj9uYTP5 --=-=-= Content-Type: text/plain "N. Jackson" writes: > (- (window-text-width)) > ^^^^^^^^^^^^^^^^^ > > Changing window-text-width to window-max-chars-per-line fixes the > problem here and seems like the right thing to do. Sounds reasonable. Attaching the updated patch. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-agenda-Use-window-max-chars-per-line-to-calculat.patch >From 5251305db6032a4a10f337fe13c519cee6d0fb94 Mon Sep 17 00:00:00 2001 Message-Id: <5251305db6032a4a10f337fe13c519cee6d0fb94.1650606943.git.yantar92@gmail.com> From: Ihor Radchenko Date: Thu, 21 Apr 2022 13:18:39 +0800 Subject: [PATCH] org-agenda: Use `window-max-chars-per-line' to calculate max text width * lisp/org-agenda.el (org-agenda-prepare): (org-todo-list): (org-agenda-align-tags): (org-agenda-show-new-time): Calculate the maximum number of chars fitting into window via `window-max-chars-per-line' instead of `window-with' or `window-text-with'. The latter functions 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 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a09b53563..0f656a6ad 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")) @@ -10032,8 +10032,8 @@ (defun org-agenda-align-tags (&optional line) current line." (let ((inhibit-read-only t) (org-agenda-tags-column (if (eq 'auto org-agenda-tags-column) - (- (window-text-width)) - org-agenda-tags-column)) + (- (window-max-chars-per-line)) + org-agenda-tags-column)) (end (and line (line-end-position))) l c) (save-excursion @@ -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 -- 2.35.1 --=-=-=--