From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 CJUfNF9uYmLdEQEAbAwnHQ (envelope-from ) for ; Fri, 22 Apr 2022 10:59:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aCYaNF9uYmJgYAEAauVa8A (envelope-from ) for ; Fri, 22 Apr 2022 10:59:11 +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 481D0B851 for ; Fri, 22 Apr 2022 10:59:11 +0200 (CEST) Received: from localhost ([::1]:55498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhp8A-0005bL-1Q for larch@yhetil.org; Fri, 22 Apr 2022 04:59:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhosW-00073E-0c for emacs-orgmode@gnu.org; Fri, 22 Apr 2022 04:43:00 -0400 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]:46967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhosT-00074m-A5 for emacs-orgmode@gnu.org; Fri, 22 Apr 2022 04:42:58 -0400 Received: by mail-qt1-x831.google.com with SMTP id f22so5023183qtp.13 for ; Fri, 22 Apr 2022 01:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=KEWnFaeGFDtk6cgmGaz1C4CIZnyn49UMX+GRUzhXU9w=; b=PKM45+duH9+hC82IX5s+z+nswLZLL4DiE0+5P3xiB3eULKvaRpRkB1sHSzyDvlXcah 4Sbqvkd+esZtTDCXYuunn28B5mh+BcLjTxAFoOYpSDbXtZDBjMR/BmryQrmycUsdZKWn d/8rWOXag5x/onhlt1arz4T9HrJ14yY0Uvnat4Y97o+6RYTHZ2vDB1tcYQ6QlwYCjQIP 3RflYuUkWpNLAYMe0sDoMJYvxsB2ntUz0a0WarU2K+40fajWng6wuZJ5I8q+mibONVXr 6KAWHpmeX0EvpbeoHLXwjzVLolq837dgS3CaEOCFl+AULeNP7T9BInyOK7Ca1y3N/1YV ZCGA== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=KEWnFaeGFDtk6cgmGaz1C4CIZnyn49UMX+GRUzhXU9w=; b=Bj85eplHitF7D8rQaSlvchdpAKjS0WeG9p9Fvgz3ba3sfebav0UGh+zW14kgf76VN+ 286LzVl97q3MCouOhFdG6tYIOjwvcsDxIPTToNeFeaybvlQES7xd6WcvjH2SGG5/cGp6 r+kI6LesKnZ4Llve0Krgh8gkB6ff5urWLj8eQjFUEhK8xvxvdYBHKzPvBStIMLtBsTFD k4aSL/xjnhWCLR4M9hrbXlZzduUu0sUoaOgb1NxIU5HwztJokmz+UhLl2eP+0B0i5/fF QO1iEwy2z0X7ZvPZN8NeMPRnK2qpdhJZFsoudaOIPQ8J3k+uE2idojesHZ/uYgfi1fLK h2kg== X-Gm-Message-State: AOAM532lgkaBLQNWHuWNV1CiLNOXcbvQ0nPvF+PWLk9T2key3c7NGq4J nCO642zBgobd2VoH4rQ5fUC+daIc5ts= X-Google-Smtp-Source: ABdhPJx+gulecYUHmQErp11QTjNEV/RX+BGbDBkjzJQg4YNLqg0e63ev0YQyOLkKDy+5nz9IenheEA== X-Received: by 2002:a05:622a:311:b0:2e1:c5eb:f52f with SMTP id q17-20020a05622a031100b002e1c5ebf52fmr2362645qtw.468.1650616975757; Fri, 22 Apr 2022 01:42:55 -0700 (PDT) Received: from moondust.localdomain.nodomain.none (bras-base-toroon474qw-grc-79-174-92-60-96.dsl.bell.ca. [174.92.60.96]) by smtp.gmail.com with ESMTPSA id p3-20020a05620a15e300b0069e5b556f75sm638517qkm.5.2022.04.22.01.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 01:42:55 -0700 (PDT) From: "N. Jackson" To: Ihor Radchenko Subject: Re: [PATCH v2] org-agenda: Use `window-max-chars-per-line' to calculate max text width 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> <875yn1u0at.fsf@localhost> Date: Fri, 22 Apr 2022 04:42:54 -0400 In-Reply-To: <875yn1u0at.fsf@localhost> (Ihor Radchenko's message of "Fri, 22 Apr 2022 13:58:18 +0800") Message-ID: <87czh9ecfl.fsf@moondust.localdomain> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::831; envelope-from=nljlistbox2@gmail.com; helo=mail-qt1-x831.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=1650617951; 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=KEWnFaeGFDtk6cgmGaz1C4CIZnyn49UMX+GRUzhXU9w=; b=K1BttZt/rjqeyfX3FNJWCU0fAcWYK4GP6bgm6AXE/z8B6+/4Ip9Ck1Wzwik/dpdUiki7d/ +0FjNB5LP1HlrWJWmCPgOWXig1IJJmagh3dTQ7zgURvZiDU53Sv8Ib9T/LsNPmH0AkuQrf bd7pzyvBxnYl2gq32uqzkDlpUmzsdjps70hKCckHGuk7dH6gKoAMV9lhWhzfq/QkTTXAfr +u1+TdncIOsTrIKxClUMZ9Q9aP4vqLE8piRBH/BsNJgjZP4R20Mh4rTaoUkUOygBTHh1ur ps/TGYSP7k2GjvddtLZP0Gl2VIS5xgNUeNEHA2BllyaCNKGNcrASkmhzZIRtWw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650617951; a=rsa-sha256; cv=none; b=De6WBQNK2jGrd8/6lsP/9gfWlIzvSQ8FtY5tUwDEKFzx2twm4TIqYy8Oqkl+c/qw0J4RoI 8KYIApsJUTMhVQhsn26+lwDBF6zJU3QhkoV0Mk+IPrOLAK69Qivq5oNQHi27Zxlzp8m9Q1 +P8ChFo6+FUkq55uGYuR851CepVcblPLASTGF0P3f0jE6S6vtRzJZ0FHnSkXcxju7knvBh xvWCBzny+3Stsqo2AdmTjSSE10T05WnDPPQvmXv0GTzhsy+Zjzr1mXUfbkYUPOgHFP+FX8 qMmKlBrxi4jsrQqBz8nI1Bu3d1Q5jNJ7C8oFfnh+IQD2J0NeNrN5dZHMaR//Kg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PKM45+du; 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: -4.03 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PKM45+du; 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: 481D0B851 X-Spam-Score: -4.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: SEmafMJxVEz8 At 13:58 +0800 on Friday 2022-04-22, Ihor Radchenko wrote: > > Attaching the updated patch. > @@ -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) The fboundp version guard on window-font-width was added to Org recently: commit 94837fc6b5ca204962f3ed992e30cd998d66a9fe Author: Kyle Meyer Date: Sat May 1 15:48:11 2021 -0400 agenda: Fix org-agenda-show-new-time on Emacs 24 * lisp/org-agenda.el (org-agenda-show-new-time): Add fallback for when window-font-width isn't available. efbf96389 (org-agenda.el: Fix display of agenda new time, 2020-02-02) reworked the column calculation to use window-font-width, but that function isn't available until Emacs 25, and it's definition can't be easily ported to org-compat. Instead just use the old logic, which had been in place since v8.2.6, when window-font-width isn't available. Reported-by: Ihor Radchenko Link: https://orgmode.org/list/87y2d2mqik.fsf@localhost If Org needs to support versions of Emacs before 25.1 then I assume you need the same guard on every instance of window-max-chars-per-line -- because window-max-chars-per-line was added to Emacs at the same time as window-font-width: commit 4a50af936e24b5f71df4079beb6dde82ed1955c2 Author: Titus von der Malsburg Date: Sat Mar 21 12:31:29 2015 +0200 Add new functions for computing default font dimensions lisp/window.el (window-font-width, window-font-height) (window-max-chars-per-line): New functions. lisp/simple.el (default-font-height): Doc fix. (default-font-width): New function. etc/NEWS: Mention `default-font-width', `window-font-height', `window-font-width', and `window-max-chars-per-line'. [These functions were new in Emacs 25.1: $ cat etc/NEWS.25 | grep -C 5 window-max-chars-per-line *** New functions 'window-font-height' and 'window-font-width' return the height and average width of characters in a specified face and window. If FACE is remapped (see 'face-remapping-alist'), the function returns the information for the remapped face. *** A new function 'window-max-chars-per-line' returns the maximal number of characters that can be displayed on one line. If a face and/or window are provided, these values are used for the calculation. This function is different from 'window-body-width' in that it accounts for (i) continuation glyphs, (ii) the size of the font, and (iii) the specified window. ] Perhaps this calls for a new wrapper function in Org, an org--window-max-chars-per-line that wraps window-max-chars-per-line in an fboundp and falls back to window-width -- rather than clutter up the code with the fboundp guard. Regards, N.