From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.devel Subject: Re: Why (substring "abc" 0 4) does not return "abc" instead of an error? Date: Mon, 16 Jul 2012 22:20:47 +0200 Organization: Informatimago Message-ID: <871ukbtq3k.fsf@kuiper.lan.informatimago.com> References: <87fw8smxag.fsf@gnu.org> <877gu4mv85.fsf@gnu.org> <871ukcmb47.fsf@gnu.org> <87hat7bqmh.fsf@gnu.org> <874np7h9ms.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1342470315 15401 80.91.229.3 (16 Jul 2012 20:25:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2012 20:25:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 22:25:15 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sqrr1-0000Sv-A2 for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2012 22:25:15 +0200 Original-Received: from localhost ([::1]:40410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqrr0-0004Lr-ER for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2012 16:25:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqrqx-0004Lb-Bd for emacs-devel@gnu.org; Mon, 16 Jul 2012 16:25:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sqrqt-0004RA-T8 for emacs-devel@gnu.org; Mon, 16 Jul 2012 16:25:11 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:53922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqrqt-0004Qg-Lp for emacs-devel@gnu.org; Mon, 16 Jul 2012 16:25:07 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Sqrqs-0000NK-Py for emacs-devel@gnu.org; Mon, 16 Jul 2012 22:25:06 +0200 Original-Received: from 81.202.16.46.dyn.user.ono.com ([81.202.16.46]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jul 2012 22:25:06 +0200 Original-Received: from pjb by 81.202.16.46.dyn.user.ono.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jul 2012 22:25:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 19 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 81.202.16.46.dyn.user.ono.com Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:NzljZGFiZTJmMzliMGVjNGU3OTRmMGIzNTZiMDZlMTMxODA1MDQxMQ== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151692 Archived-At: Lars Magne Ingebrigtsen writes: > Tassilo Horn writes: > >> I'm not even able to come up with some concrete use-case where I'd >> like to have the suggested behavior. > > It's a very common use case for me. I know that a string can't be > longer than X for some particular use, so I have to say > > (insert (if (> (length string) 4) > (substring string 0 4) > string)) (insert (substring string 0 (min 4 (length string)))) -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}.