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 ms9.migadu.com with LMTPS id uIWYBgbxR2QdQQAASxT56A (envelope-from ) for ; Tue, 25 Apr 2023 17:25:58 +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 ONGBBgbxR2T2IwAAauVa8A (envelope-from ) for ; Tue, 25 Apr 2023 17:25:58 +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 D4EAF69BC for ; Tue, 25 Apr 2023 17:25:57 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prKXO-0002LW-IW; Tue, 25 Apr 2023 11:25:02 -0400 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 1prKXM-0002L7-PD for emacs-orgmode@gnu.org; Tue, 25 Apr 2023 11:25:00 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prKXL-0001TS-2w for emacs-orgmode@gnu.org; Tue, 25 Apr 2023 11:25:00 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id f7d6d574 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 25 Apr 2023 15:24:56 +0000 (UTC) References: <87ildmuavp.fsf@localhost> <87y1misv5l.fsf@localhost> <877cu24p5b.fsf@localhost> <87v8hks24j.fsf@localhost> User-agent: mu4e 1.9.22; emacs 30.0.50 To: Ihor Radchenko Cc: Axel Kielhorn , emacs-orgmode@gnu.org Subject: Re: [DRAFT PATCH v2] Decouple LANG= and testing (was: Test failure due to LANG) Date: Tue, 25 Apr 2023 23:14:36 +0800 In-reply-to: <87v8hks24j.fsf@localhost> Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz 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, 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: , Reply-to: Ruijie Yu From: Ruijie Yu via "General discussions about Org-mode." 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682436357; a=rsa-sha256; cv=none; b=Xt8VOXu76tVwVJ4xqNngxQ0UfLqDlpmQgZH4bGnM/iAuzaTxogIHth+4b5XNCBBpA4ELHf yWKIgySdRzrQ3mIw8Dgh1EQFMPglayazIz7c8E1Cc/eRez8aQ8jnfsUPKM0+nsCITUuufe mcqfnfH1lfxsxT6w9dtpF8Ow1ypvnWKwTpWpOBZXTFuz4EvDwBvxKDLBL4x/Wd70bNYMo1 FuQ+Z0lUU4cCIJrCg/xFbJvNf3c8wuQAH1JD/VycCKsyRMhYr6k7oMJcAx4lysIpRpgEn0 deEZu+V0kTnSkx410mzjH0eQWSTGtjv65cLRhUYT3zK8Pn0Q+PAEMYQ/hxBZpA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682436357; h=from:from:sender:sender:reply-to: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; bh=uHepOUsGsXb5bnHawvBzlqMxMEmPe8x+r54TLgmkIcU=; b=K/Uka7yslcPwvAi9Cm1yRXyAopC+Cz17B7UhmJME+fBjCueo8goHNmLUFaKAXAnJU6z7yH a2I7tKT+b7EoiV5O9ppvTFQYu5tALt8U+RJcqibRWjLwAI3o+2suH8dx+O+mz/5UEiVifO VYX4zDNMbSYi95WvflXjUutC5KVZHzCWkH0VMLA/+EXUInVZoj8YvFTKzZWcUdNX8ZK7be OM97RzXGi7VOhdJ4ifkf8BBld0HbrUlk/rd92hbDk2XW4PU+vfk6lVpXd2UAvQIlxhrHup CPTAOu5ZufqnFo8+d0Lu9BGtCBys4/bGxY9iAXql50hlJl5qAnQPlPA9xcngIw== X-Migadu-Spam-Score: -2.41 X-Spam-Score: -2.41 X-Migadu-Queue-Id: D4EAF69BC X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-TUID: hbuEYtlzgTT4 Ihor Radchenko writes: >> +(defun org-columns--substring-below-width (string start width) >> + "Similar to `substring', but use `string-width' to check width. > > This is not really similar to `substring' as `substring' has totally > different third argument. Addressed in v6 -- see my update in the other subthread. >> +The returned value is a substring of STRING, starting at START, >> +and is the largest possible substring whose width does not exceed >> +WIDTH." >> + (let ((end (min (+ start width) (length string))) res) >> + (while (and end (>= end start)) >> + (let* ((curr (string-width string start end)) >> + (excess (- curr width))) >> + (if (cl-plusp excess) > > Why not simply (> excess 0)? `cl-plusp' is a bit confusing - we > generally avoid cl-lib functions unless necessary. (I've never seen > `cl-plusp' used frequently) Well, one of the courses I took last year used Common Lisp, where plusp and minusp were largely preferred over (> x 0), hence the habit. I have switched over accordingly in v6. >> (defun org-columns-add-ellipses (string width) >> "Truncate STRING with WIDTH characters, with ellipses." >> (cond >> - ((<= (length string) width) string) >> - ((<= width (length org-columns-ellipses)) >> - (substring org-columns-ellipses 0 width)) >> - (t (concat (substring string 0 (- width (length org-columns-ellipses))) >> - org-columns-ellipses)))) >> + ((<= (string-width string) width) string) >> + ((<= width (string-width org-columns-ellipses)) >> + (org-columns--substring-below-width org-columns-ellipses 0 width)) >> + (t (concat >> + (org-columns--substring-below-width >> + string 0 (- width (length org-columns-ellipses))) >> + org-columns-ellipses)))) > > It will be best to write dedicated tests here that will clearly indicate > issues when some non-standard LANG environment is used. The current > failure is rather difficult to debug. Done -- somewhat. At the time I wrote the tests I misunderstood what you said, so now we have a test on org-columns--truncate-below-width (renamed from org-columns--substring-below-width). I can add a test on org-columns-add-ellipses as well, if you think it is necessary. But probably tomorrow. -- Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.]