From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Merciadri Luca Newsgroups: gmane.emacs.help Subject: Re: Adding `#' at each new line with text until the end of the file Date: Mon, 17 May 2010 22:11:33 +0200 Organization: ULg Message-ID: <878w7is2yy.fsf@merciadriluca-station.MERCIADRILUCA> References: <87k4r24iq3.fsf@merciadriluca-station.MERCIADRILUCA> <87bpcel6zj.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291832095 13030 80.91.229.12 (8 Dec 2010 18:14:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 18:14:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 08 19:14:51 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQOXQ-0003Mr-ST for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 19:14:49 +0100 Original-Received: from localhost ([127.0.0.1]:58372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQOXQ-0002iu-3n for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 13:14:48 -0500 Original-Path: usenet.stanford.edu!goblin2!goblin.stu.neva.ru!news.net.uni-c.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:nsJXzpRj6WIm1VmPfi1K/cdSA2E= Original-Lines: 48 Original-NNTP-Posting-Host: 62.197.101.67 Original-X-Trace: news.sunsite.dk DXC=ITo?_RihPF^0Sc_VCmP]hZYSB=nbEKnk[fPSZB06Fl List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75772 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 pjb@informatimago.com (Pascal J. Bourguignon) writes: > > So: > (while (< (point) (point-max)) > (when (looking-at ".") > (insert "#")) > (forward-line)) > After extensive testing, == (defun fildi () (find-file "~/Sayings") (goto-char (point-min)) (while (< (point) (point-max)) (when (looking-at ".") (insert "#")) (forward-line)) ) == does not work. When I evaluate it using C-x C-e (in a buffer), it only says `fildi', which does not look very interesting. What am I doing wrong? It finds the file; it goes to the beginning of it; while it has not reached the end of the file, it looks for a line containing a dot (as every saying ends by a dot); while this works, it inserts a "#" and, as the cursor is at the beginning of the line, it inserts a "#" at the beginning of the line. It also goes to the next line. And? - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- When making your choices in life, do not forget to live. (Samuel Johnson) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 iEYEARECAAYFAkvxovUACgkQM0LLzLt8Mhy/UwCfZVeNrnTF0Ygl0XwS54iTVvEa qRwAn1oBeyo6ORYEJ1D/YZ2zVu6uCvyZ =0fJA -----END PGP SIGNATURE-----