From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 i7KfCvm0A2TtMwAAbAwnHQ (envelope-from ) for ; Sat, 04 Mar 2023 22:15:37 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id a648Cvm0A2TFRQAA9RJhRA (envelope-from ) for ; Sat, 04 Mar 2023 22:15:37 +0100 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 B30741EEC1 for ; Sat, 4 Mar 2023 22:15:36 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=K58HIfEy; 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"; dmarc=pass (policy=quarantine) header.from=me.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677964537; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=iuDv+37fQ3V2PyVnahkqm4qGFFAZOczfvy+AAhWsxXc=; b=XNPKYZDue857ldXb0oTi20jXI2h/ZR6jVJsI88kx0IDEkfQLd+FMWqyrAosqCkqRLFNNDJ Npo8PtpWaQU3hQmnh2SfCfdRgy0fMzopPXN6DQBPy4etCrkKzrqVdoLSZFnhM/2i2SHMjE eHG0im59N9YFQGeaitYpxFybPXKRoRgVwiPLsUmyJOy54VpcRA1ckSB2epVAHYW0DSqsFC F2PjT92HE649YQ33rtXkXhNp7jv8gHaLtbaRQFf3wpxFNeakMO8NHKsnHQuGAcDhu3fbER 6UKBbU+qXuXHHIFEqzDi1DyC/TOBo0hM0V1/Rjrh/xeU6A1OSB2y2EcvSBZqSQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=K58HIfEy; 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"; dmarc=pass (policy=quarantine) header.from=me.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677964537; a=rsa-sha256; cv=none; b=nH48lWpfk3Oo+01km28riCU/aUlIw12xxFCDoRPY5pkgCQ8pBZ8WMOi40W6e2WB7/ayA5K M1S9g+Uvo5ZqrgUVa7KAsA1BfUCumE/rdYzl32Z2G46EWuwBuF/1TLH78Nc7uKS9EaqalH Rtg5ZQEp2Xe9BEkL7Wg6wF1b2imrRSdZzaS/nD00xvurZA/ttZxCVduemnKq0J/AxZOdYM Ks8zek2ZPhVXw/kA6bE2dhVSdl/VoY2t5DihvRxd5MO11V3eL047id1V42WtbfLZt9S9rX +dL2LWBbJUrtONL+7XgCNYbiOADyBuoPA+wrUiDg4z5m4kQ5N2BoTP3lnD3nrA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYZDM-0004Ai-9U; Sat, 04 Mar 2023 16:14:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYZDJ-0004AY-15 for emacs-orgmode@gnu.org; Sat, 04 Mar 2023 16:14:45 -0500 Received: from mr85p00im-zteg06021901.me.com ([17.58.23.194]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYZDH-0002UM-2d for emacs-orgmode@gnu.org; Sat, 04 Mar 2023 16:14:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1677964480; bh=iuDv+37fQ3V2PyVnahkqm4qGFFAZOczfvy+AAhWsxXc=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=K58HIfEyk+uOy02SDE6/A16M3ZkrcwdkMPkBBsvdT8XCB5uVwFOyC7TsyKO784zf2 0X6k80jYN6D8/oAwASa7Jxv6LyxEd/QpNY9W9ULmcJXwD1zENPuQH4de1cK14s+eNE Q/czElYxaXrOzM8CKC/UhdNPsZGxv4p7K+J1WfMH/17o6OWvB9k2MST8NzpFxnpHO4 qhu5lixrSc6sVUjg/xj1T43DAI3R6jq8QNBtu0LkcKFHWs/UAPgaZH7a+A8DtO0sYa 6JCuOntcVRGM857QPNomGINmy1zs9MAb++T3W8mZETnyPnAyb0/wgxHeb0D0h1SpS6 f+xiwSO6BZSFA== Received: from Rudolfs-MacBook-Air.local (mr38p00im-dlb-asmtp-mailmevip.me.com [17.57.152.18]) by mr85p00im-zteg06021901.me.com (Postfix) with ESMTPSA id 4C68C740808; Sat, 4 Mar 2023 21:14:39 +0000 (UTC) From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= To: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: [PATCH] org-clock: Add a trailing space to the mode line string In-Reply-To: References: <20230302141443.7842-1-salutis@me.com> <87r0u54ygh.fsf@localhost> Date: Sat, 04 Mar 2023 22:14:35 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Proofpoint-ORIG-GUID: G6SXHQAAdK165LlU-sgmysVKp_XLKYET X-Proofpoint-GUID: G6SXHQAAdK165LlU-sgmysVKp_XLKYET X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.572,17.0.605.474.0000000_definitions?= =?UTF-8?Q?=3D2022-01-14=5F01:2022-01-14=5F01,2020-02-14=5F11,2020-01-23?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2303040185 Received-SPF: pass client-ip=17.58.23.194; envelope-from=salutis@me.com; helo=mr85p00im-zteg06021901.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: X-Migadu-Spam-Score: -7.90 X-Spam-Score: -7.90 X-Migadu-Scanner: scn0.migadu.com X-Migadu-Queue-Id: B30741EEC1 List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: Rios87GzFVE8 --=-=-= Content-Type: text/plain Max Nikulin writes: > nitpick > > [...] > >> To make a hyperlink to Info documentation, [...] That is a good nitpick, thank you! Fixed in the attached patch (along with indentation). Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-clock-Add-a-trailing-space-to-the-mode-line-stri.patch >From 60c86cf1991e5437084b3efb28f0866c5a50ca6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Thu, 2 Mar 2023 15:06:19 +0100 Subject: [PATCH] org-clock: Add a trailing space to the mode line string * lisp/org-clock.el (org-clock-get-clock-string): End the mode line element in a space, instead of beginning with space, to make it play well with other mode line strings, which typically end a space. For reference, see the mode line string of the Display Time mode. --- lisp/org-clock.el | 4 ++-- testing/lisp/test-org-clock.el | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index d46458536..a300df8ff 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -728,9 +728,9 @@ If not, show simply the clocked time like 01:50." 'org-mode-line-clock-overrun 'org-mode-line-clock))) (effort-str (org-duration-from-minutes effort-in-minutes))) - (format (propertize " [%s/%s] (%s)" 'face 'org-mode-line-clock) + (format (propertize "[%s/%s] (%s) " 'face 'org-mode-line-clock) work-done-str effort-str org-clock-heading)) - (format (propertize " [%s] (%s)" 'face 'org-mode-line-clock) + (format (propertize "[%s] (%s) " 'face 'org-mode-line-clock) (org-duration-from-minutes clocked-time) org-clock-heading)))) diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el index f732e471a..239634cb9 100644 --- a/testing/lisp/test-org-clock.el +++ b/testing/lisp/test-org-clock.el @@ -1276,5 +1276,40 @@ CLOCK: [2012-03-29 Thu 16:00]--[2012-03-29 Thu 17:00] => 1:00" (test-org-clock-clocktable-contents (format ":hidefiles t :scope (lambda () (list %S))" the-file)))))))) +;;; Mode line + +(ert-deftest test-org-clock/mode-line () + "Test mode line string ends in a space. + +\"Elements that are added to [the mode line] should normally end +in a space (to ensure that consecutive 'global-mode-string' +elements display properly)\" per the Info node `(elisp)Mode Line +Variables'." + ;; Test the variant without effort. + (should + (equal + " [0:00] (Heading) " + (org-test-with-temp-text + "* Heading" + (org-clock-in) + (prog1 (concat " " + (org-clock-get-clock-string) + " ") + (org-clock-out))))) + ;; Test the variant with effort. + (should + (equal + " [0:00/1:00] (Heading) " + (org-test-with-temp-text + "* Heading +:PROPERTIES: +:EFFORT: 1h +:END:" + (org-clock-in) + (prog1 (concat " " + (org-clock-get-clock-string) + " ") + (org-clock-out)))))) + (provide 'test-org-clock) ;;; test-org-clock.el end here -- 2.39.2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "Be especially critical of any statement following the word 'obviously.'" -- Anna Pell Wheeler, 1883-1966 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--