unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Merciadri Luca <Luca.Merciadri@student.ulg.ac.be>
To: help-gnu-emacs@gnu.org
Subject: Re: Adding `#' at each new line with text until the end of the file
Date: Mon, 17 May 2010 22:11:33 +0200	[thread overview]
Message-ID: <878w7is2yy.fsf@merciadriluca-station.MERCIADRILUCA> (raw)
In-Reply-To: 87bpcel6zj.fsf@kuiper.lan.informatimago.com

-----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 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkvxovUACgkQM0LLzLt8Mhy/UwCfZVeNrnTF0Ygl0XwS54iTVvEa
qRwAn1oBeyo6ORYEJ1D/YZ2zVu6uCvyZ
=0fJA
-----END PGP SIGNATURE-----


  reply	other threads:[~2010-05-17 20:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 16:05 Adding `#' at each new line with text until the end of the file Merciadri Luca
2010-05-17 18:26 ` Pascal J. Bourguignon
2010-05-17 20:11   ` Merciadri Luca [this message]
     [not found]     ` <87zkzyjkcb.fsf@kuiper.lan.informatimago.com>
2010-05-18 10:09       ` Merciadri Luca
2010-05-18 12:06         ` Pascal J. Bourguignon
2010-05-18 16:47           ` Merciadri Luca
2010-05-18 20:27             ` Pascal J. Bourguignon
2010-05-19 16:08               ` Merciadri Luca
2010-05-20 13:18                 ` Pascal J. Bourguignon
2010-05-20 18:09                   ` Merciadri Luca
2010-05-20 19:05                 ` Andreas Politz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w7is2yy.fsf@merciadriluca-station.MERCIADRILUCA \
    --to=luca.merciadri@student.ulg.ac.be \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).