From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AGFABN7qYGIg5AAAbAwnHQ (envelope-from ) for ; Thu, 21 Apr 2022 07:25:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cO1xA97qYGLoJgAAG6o9tA (envelope-from ) for ; Thu, 21 Apr 2022 07:25:50 +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 7B2A824C7E for ; Thu, 21 Apr 2022 07:25:49 +0200 (CEST) Received: from localhost ([::1]:59264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhPK8-0004Q9-Eg for larch@yhetil.org; Thu, 21 Apr 2022 01:25:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhPIr-0004Pk-TU for emacs-orgmode@gnu.org; Thu, 21 Apr 2022 01:24:29 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:43992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhPIq-0005bW-3e for emacs-orgmode@gnu.org; Thu, 21 Apr 2022 01:24:29 -0400 Received: by mail-pj1-x102c.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso4131624pjj.2 for ; Wed, 20 Apr 2022 22:24: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=iu245DOvjiB/e6WPA8RAy8tdZqcMSkb55VEXkq+ukQg=; b=RQt5KLJQeuvgeBHICM628yY/jPb4rujAC22QgNF7ut4E51KEMYdVas9hRqsj3e/MTT 5lR3W2HBDOhHv/goc3jCtvPM4W6NKmYhcYQg9ZDwGedLVc3HEou2Ge/vBKi6/8uaZ5Sc uoahXIec4bVzfQPye3bsfGrhTz3Rzx086rOfbEsSFk8SxNyxDhcs6wln4w2GPDIJBksH QoVOm6SB2gvmiduovaLjXGdEI+M+yN5dPzSyCtoK/m3ggzN4mhDc6OzrODdyPUaM6b1w XdJeToo+Eb+/lLQZKY81j3G/WdgUpaee7CXcqqTm3XyG5U/JcdOhqPbqgRVUKqInlUkk mpww== 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=iu245DOvjiB/e6WPA8RAy8tdZqcMSkb55VEXkq+ukQg=; b=GQIiYHH80XB540JtrW3UVfziFydyv++ACp0ahMPoHoMZScCxD+Qthf6vZ5/BwMg5Sp R1T79lMaBl4VVKt16JaKdF1hih8PzsT3caT2o7QpQBv/1IK5kKmcQnLUzPk+In0az9Lq rpQd0hNKvXBEpjb7rNE2pQ7VEnKquEwi84g0dzq8UzaIiQQ+c3rs3EBiq6SdqHVj0yv1 tJNrhHcZyfrlKJLXddevcqKbJUKtQ7DzJinTlVw+eyRmpzH5HCrJaqlHhLOpFi3RWteC p/X3kmBflQsIWOQMbUD8NLiGmnMJ+ttgZEAHA43ejTQZoOOYywGSPAWem/ZC+I8BheNo JXmw== X-Gm-Message-State: AOAM530mOECMeYwJq5UZmFO9znO0a6C0GjZrQ5oWjQ2O4NKFG08ZZSrD crYXUNOOeILOT3vsYZmLoW0= X-Google-Smtp-Source: ABdhPJzaZuKcH9OLtDW7fkj+vUjs4jFUQ7fPbkC7nb2kCJJ2KqMlgKRwTZ2hdEwiFhnASCLKwYA/CA== X-Received: by 2002:a17:902:e804:b0:158:f6fb:76b1 with SMTP id u4-20020a170902e80400b00158f6fb76b1mr19958344plg.21.1650518666232; Wed, 20 Apr 2022 22:24:26 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id j185-20020a62c5c2000000b0050adc3e5f91sm791000pfg.49.2022.04.20.22.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 22:24:25 -0700 (PDT) From: Ihor Radchenko To: "N. Jackson" Subject: [PATCH] org-agenda: Use `window-max-chars-per-line' instead of `window-width' In-Reply-To: <87ee1sjcf9.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> Date: Thu, 21 Apr 2022 13:25:18 +0800 Message-ID: <87wnfj3t4x.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102c.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=1650518749; 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=iu245DOvjiB/e6WPA8RAy8tdZqcMSkb55VEXkq+ukQg=; b=XFpkmXYmq65dHyaKAirYpct7Ry7kFOGFUFxK/q+Gsb8v1qGnNEFNTiU2LLM4ZEiLWnq0rd Odl6k5hn9SbeR8Uujx8caZ0j84eNj45leu7FBC/p2yeqH3g0JJ30Sx+RapMV8lS9XiicDl SSebjyqAcqERXzp9Y6sZzGqHEuuyR80di3GAyYQPnqGzRuyFJ3NYiLeGaNkDzxkJbAfS2Z 6KdMl2QIIQCFBwAik5BwD092DRvD6tdZ+lwic7m/rH3mciRFh2u3mUrZk+NzlI//DIx8Gm bgjcXkH82YOE2v/1WQ+5Y7xpBwbICdKzfzX37tRRcXuOcdaGZF8C38NuYDiLLg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650518749; a=rsa-sha256; cv=none; b=c5P1gbeo+CxeiWD5iEb1P1eM4/aUeDpn3+fqq1H8UhBpBJU/+ddZBl/OEWYJ2EeSO5I/5w YGPykQ7FeTVawvd8cRKMoQok+bj88qHHfbt0s3Dc8yY3TTNxRhUDtfOs4mQsc8C8BaPvsN 5j5+U9ULUKdCPLJpfeEFa8j54WzLgJEU1TS/9i9XEr2V0mlyXuzdoVrwAM4LPnAfOa5Fr8 rK3sqGvUryZjdedT+E2wfS+uHUiTs25kvetN63wSwzYw6ImHDD9Lx2P37I1zmEq6cjU0h9 fnFc5838ZcVUQs/ZD9X2+5QmPdZVID+DZG6c86biQmzCobOExdOCGWPKwCGWMA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RQt5KLJQ; 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.54 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RQt5KLJQ; 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: 7B2A824C7E X-Spam-Score: -3.54 X-Migadu-Scanner: scn1.migadu.com X-TUID: qeTd6LeGrwEc --=-=-= Content-Type: text/plain "N. Jackson" writes: > No, I'm not saying Org shouldn't use window-max-chars-per-line -- > rather the opposite in fact. I'm just saying it maybe needs to be > thought about carefully first. Indeed. There is no point using w-m-c-p-l when we actually need the full window size with fringes. > If it works as advertised it would seem to be the right choice as > long as Emacs bug #19395 exists (which looks like it will be > forever). My reservations about the function are only that its spec > is more ambitious than that of window-width (because it handles > faces) and the added complexity might potentially introduce more > corner cases where it doesn't work. But perhaps that's just the > paranoia of someone who thinks that text editors should restrict > themselves to monospaced fonts! There is at least one workaround in org-agenda trying to account for the face width. w-m-c-p-l should do better than that. Attaching the patch. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-agenda-Use-window-max-chars-per-line-instead-of-.patch >From 5de3de87872ddae994f5b68eba74d915d5f73201 Mon Sep 17 00:00:00 2001 Message-Id: <5de3de87872ddae994f5b68eba74d915d5f73201.1650518543.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' 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 -- 2.35.1 --=-=-=--