From unknown Mon Aug 18 14:19:15 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#1939 <1939@debbugs.gnu.org> To: bug#1939 <1939@debbugs.gnu.org> Subject: Status: suggestion: adding read-line function to elisp Reply-To: bug#1939 <1939@debbugs.gnu.org> Date: Mon, 18 Aug 2025 21:19:15 +0000 retitle 1939 suggestion: adding read-line function to elisp reassign 1939 emacs submitter 1939 xah lee severity 1939 wishlist thanks From xah@xahlee.org Sat Jan 17 10:14:14 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 17 Jan 2009 18:14:15 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: * X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=1.1 required=4.0 tests=FOURLA,IMPRONONCABLE_2 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0HIEBSi000507 for ; Sat, 17 Jan 2009 10:14:12 -0800 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LOFgR-00020Z-4t for bug-gnu-emacs@gnu.org; Sat, 17 Jan 2009 13:14:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LOFgO-0001zz-Gq for bug-gnu-emacs@gnu.org; Sat, 17 Jan 2009 13:14:09 -0500 Received: from [199.232.76.173] (port=58889 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOFgO-0001zw-Bo for bug-gnu-emacs@gnu.org; Sat, 17 Jan 2009 13:14:08 -0500 Received: from mout.perfora.net ([74.208.4.194]:63184) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOFgO-0000Q0-0y for bug-gnu-emacs@gnu.org; Sat, 17 Jan 2009 13:14:08 -0500 Received: from [192.168.1.2] (c-24-6-175-142.hsd1.ca.comcast.net [24.6.175.142]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0MKpCa-1LOFgB08RQ-0007FS; Sat, 17 Jan 2009 13:13:57 -0500 Mime-Version: 1.0 (Apple Message framework v753.1) Content-Transfer-Encoding: quoted-printable Message-Id: <421D26F9-3257-44EE-97B0-A7276A97AD73@xahlee.org> Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed To: bug-gnu-emacs@gnu.org From: xah lee Subject: suggestion: adding read-line function to elisp Date: Sat, 17 Jan 2009 10:13:51 -0800 X-Mailer: Apple Mail (2.753.1) X-Provags-ID: V01U2FsdGVkX18d2wpLm1IWLEJ95u2VrRFVLkIkoztYDgiL9lv twA7QSHcOqeWoLxQ/+v1P/OutgBaP9yQT14wLz0H98bDPrk7+S oehaHOxlgslnL0a9viszg== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. summary: i'd like to have a read-line function in elisp, that will read a =20 given file and return a list of lines. The reason is that in almost all modern scripting langs (php, perl, =20 python, ruby), there's such a function, so that users can get a list =20 of lines of a file in about single line of code. Getting lines as =20 list is a very frequent need. elisp is very suitable for tasks of text processing. So, having such =20 a convenience function seems appropriate. Here's a implementation: (defun read-lines (file) "Return a list of lines in FILE." (with-temp-buffer (insert-file-contents file) (split-string (buffer-substring-no-properties 1 (point-max)) "\n" t) ) ) Thanks. The thought came from a recent newsgroup discussion in comp.lang.lisp http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/=20 761fe827c8c9ea5e/ Here's a short article for some context: =E2=80=A2 A Ruby Illustration of Lisp Problems http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html Xah =E2=88=91 http://xahlee.org/ =E2=98=84= From lekktu@gmail.com Sat Jan 17 21:48:15 2009 Received: (at 1939) by emacsbugs.donarmstrong.com; 18 Jan 2009 05:48:15 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.0 required=4.0 tests=HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.184]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0I5mBbJ029739 for <1939@emacsbugs.donarmstrong.com>; Sat, 17 Jan 2009 21:48:12 -0800 Received: by nf-out-0910.google.com with SMTP id 30so294676nfu.31 for <1939@emacsbugs.donarmstrong.com>; Sat, 17 Jan 2009 21:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wqckOvR6FuAmrKW8Gi6usSAXjL1ViNabIvXNO5bbUiM=; b=RnAfSfPPleXnFfXFqhqV2uZn5L9sDRMLmjylDv/g7BdHkj2p2WeKwDYYnBAJO2fq/q +nOq4HZmdfqZVxXRWT2p0J/zsLHtScUEPy7NHu99jv/rcHnjiTHuhbhxdJHc8SZ935VT FyAcvmCz2Um0sT0XlzfliCgIiO0rlliPoVVys= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=cx3w/cypi14kfmgaZYb1w/bD4PBh5+IdZS4jvi1S9jkAXt7+Yf5E7S06ZE51tHNR/u xaHh57HmUiQ8OGwbs6+ivvqyOpc/j43B3+BMKrYNAecRzMF58SOx6IuFL3+nb2jRSjVl LgxnU0B1ly4YPGsdB7gJ1IGFH+sLtTYnTAb7Q= MIME-Version: 1.0 Received: by 10.210.69.6 with SMTP id r6mr80895eba.83.1232257690542; Sat, 17 Jan 2009 21:48:10 -0800 (PST) In-Reply-To: <421D26F9-3257-44EE-97B0-A7276A97AD73@xahlee.org> References: <421D26F9-3257-44EE-97B0-A7276A97AD73@xahlee.org> Date: Sun, 18 Jan 2009 06:48:10 +0100 Message-ID: Subject: Re: bug#1939: suggestion: adding read-line function to elisp From: Juanma Barranquero To: xah lee Cc: 1939@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Sat, Jan 17, 2009 at 19:13, xah lee wrote: > Getting lines as list is a very frequent need. > > elisp is very suitable for tasks of text processing. So, having such a > convenience function seems appropriate. Getting lines as list is much less frequent in elisp. The reason is that is much more flexible (and faster) to manipulate text in a buffer than as a collection of strings. So in most cases, using `with-temp-buffer' (as in your read-lines function) is the Right Thing To Do. Juanma From rgm@gnu.org Sun Jan 18 12:22:50 2009 Received: (at control) by emacsbugs.donarmstrong.com; 18 Jan 2009 20:22:50 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: ** X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=2.3 required=4.0 tests=MISSING_SUBJECT,NOSUBJECT, VALID_BTS_CONTROL autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0IKMlnA002448 for ; Sun, 18 Jan 2009 12:22:48 -0800 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1LOe92-0007Kz-TZ; Sun, 18 Jan 2009 15:21:20 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18803.36672.857032.427796@fencepost.gnu.org> Date: Sun, 18 Jan 2009 15:21:20 -0500 From: Glenn Morris To: control tags 1702 - moreinfo severity 1933 wishlist severity 1939 wishlist From cyd@stupidchicken.com Sun Jan 18 19:15:20 2009 Received: (at control) by emacsbugs.donarmstrong.com; 19 Jan 2009 03:15:21 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=none autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0J3FIqi011285 for ; Sun, 18 Jan 2009 19:15:19 -0800 Received: by cyd.mit.edu (Postfix, from userid 1000) id 8933557E197; Sun, 18 Jan 2009 22:15:39 -0500 (EST) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 1939 Date: Sun, 18 Jan 2009 22:15:39 -0500 Message-ID: <87d4ekyois.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii close 1939 thanks From unknown Mon Aug 18 14:19:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Mon, 16 Feb 2009 15:24:08 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator