From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master 9480169 1/2: Change the string-limit parameter semantics Date: Tue, 22 Dec 2020 09:57:26 -0500 Message-ID: References: <20201222055934.22358.13749@vcs0.savannah.gnu.org> <20201222055936.BC7DD20B72@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33430"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 22 15:58:47 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krj7e-0008c0-Po for ged-emacs-devel@m.gmane-mx.org; Tue, 22 Dec 2020 15:58:46 +0100 Original-Received: from localhost ([::1]:35740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krj7d-0006bd-R2 for ged-emacs-devel@m.gmane-mx.org; Tue, 22 Dec 2020 09:58:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krj6U-0005x7-Bs for emacs-devel@gnu.org; Tue, 22 Dec 2020 09:57:34 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krj6Q-0000ug-7H for emacs-devel@gnu.org; Tue, 22 Dec 2020 09:57:33 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id BCFEA4404FF; Tue, 22 Dec 2020 09:57:28 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 73989440280; Tue, 22 Dec 2020 09:57:27 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1608649047; bh=iKArHgg0aQdkZj1pf/aW5EVPw/L+gcLErtTIb5ACsJM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=YNIr3H+Snk8bPlcGeZb2I0dDpClKN0EF734mZ8XByGVLWy3gmJy9ckpvoFrIEFSWO by6yMNcRwgb8YmVMcn/pWY4hBVpLsi67d+YRntZV29xygE6N6qt8hkvuy9vJFl2aEq BtzzEEwMyLWdwX/4ErfbH28ntVMbG/tAbDm7xGAN10xT56UKD9fWbXq7x1xCmlPUVI /JmSvKQF9TyXMs9ZRtg4UWq8GzCV5UTdZOVGjnmDWOOKYENXZOpufl8eRFCo0tmIN9 ZC44B7Hxsghz51bnL8QXKXh3DyB0EfIVJ5cdUDh1mPKpNdK7SAwPndqb0Jv1WwaVp6 zB3SPh1sE7tag== Original-Received: from alfajor (69-165-136-52.dsl.teksavvy.com [69.165.136.52]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 28E97120473; Tue, 22 Dec 2020 09:57:27 -0500 (EST) In-Reply-To: <20201222055936.BC7DD20B72@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Tue, 22 Dec 2020 00:59:36 -0500 (EST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261491 Archived-At: > +@defun string-limit string length &optional end > +If @var{string} is shorter than @var{length}, @var{string} is returned > +as is. Otherwise, return a substring of @var{string} consisting of > +the first @var{length} characters. If the optional @var{end} > +parameter is given, return a string of the @var{length} last > +characters instead. > @end defun In my experience it's very rare to need to limit a string to a particular *length*. Instead you usually want to limit it to a particular *width*. So I'd strongly recommend you mention `truncate-string-to-width` as an alternative. Stefan