all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "B. T. Raven" <ecinmn@peoplepc.com>
Subject: Re: replacing endline
Date: Thu, 20 Apr 2006 23:38:10 GMT	[thread overview]
Message-ID: <CXU1g.9456$i41.8374@newsread1.news.atl.earthlink.net> (raw)
In-Reply-To: 87acagux25.fsf@gmail.com


"Fredrik Bulow" <kaliumfredrik@gmail.com> wrote in message
news:87acagux25.fsf@gmail.com...
> >> I don't see why this behavior shouldn't be labeled as a bug.
> >
> >if you label that behavior as a bug, then you have introduced two
> >"bugs", not just one.  the first bug is in your mental model of how
> >emacs should work, and the second, the one labeled as suggested.  if
> >you pre-emptively fix the first bug, perhaps the second bug will, as a
> >result, vanish as well.
> >
> >applying the above thought process to various behaviors, you may
> >be able to find and remove many bugs in the future.  good luck!
> >
> >thi
>
> Thanks for that totally uncalled for insult. Of course, any bug can be
> removed by changing your expectations on how a program should behave
> to the way a program actually behaves. "It's not a bug that something
> crashes, it is suppose to crash, and how do I know that? Well, I tried
> and it crashed!." Usually, if something behaves in an unexpected way I
> think it is a bug unless there is a good reason why the current
> behaviour makes more sense than what I expected. I was kind of hoping
> that someone would give me the good reason why there should be two
> different behaviours.
>
> So once again, what is the good reason that (query-replace "\n" "#")
> behave differenty than calling the same function with its keybinding
> and providing it interactively with the same arguments?
>
> /Fredrik

This is one of those wonderful instances where both you and Thi are right.
It is difficult for those far up on the mountainside to see what things
look like down here in the valley. Try playing around with  C-q C-j and
just C-j in *scratch* and in a text-mode buffer.
In
(query-replace "\n" "*")
the "/n" works the same way as it does in
 printf ("Hello World!\n");
It is one of two arguments of type string to the query-replace function
If you put the lines below into *scratch* and then evaluate the form, it
will find the invisible newlines rather than the characters ", \, n, "
M-% will only find those literal characters unless you input a newline as
C-q C-j. Press the n key instead of the space bar to inhibit replacement
with "*". After you play around with this for a while you will agree with
Thi, sort of, which is good enough.


(query-replace "\n" "*")




\n
"\n"
'("\n")

p.s. Remember M-x top-level and C-x n w. It's easy to get lost while
fooling around with C-j in an interactive lisp buffer. Its behaviour
depends on whether or not there are matched parentheses above the point
where it is invoked. I am pretty sure that C-q C-j is a synonym for the
Enter-Return key just about anywhere except inside interactive functions
like M-% and C-M-% where it produces an actual newline in the minibuffer..

("
")

Ed.

  parent reply	other threads:[~2006-04-20 23:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20  0:18 replacing endline sarah.dzion
2006-04-20  1:15 ` Katsumi Yamaoka
2006-04-20  1:17 ` Ye Wenbin
2006-04-20  1:22 ` Fredrik Bulow
2006-04-20  1:44 ` Fredrik Bulow
2006-04-20  1:56 ` Fredrik Bulow
2006-04-20  6:32   ` Thien-Thi Nguyen
2006-04-20 14:43     ` Fredrik Bulow
2006-04-20 16:11       ` Lennart Borgman
2006-04-20 18:16       ` Eli Zaretskii
     [not found]       ` <mailman.650.1145549499.9609.help-gnu-emacs@gnu.org>
2006-04-20 19:25         ` Harald Hanche-Olsen
2006-04-20 22:19           ` Lennart Borgman
2006-04-21  7:38             ` Eli Zaretskii
     [not found]           ` <mailman.671.1145571606.9609.help-gnu-emacs@gnu.org>
2006-04-21  6:52             ` Harald Hanche-Olsen
2006-04-21  0:53         ` Thien-Thi Nguyen
2006-04-20 23:38       ` B. T. Raven [this message]
2006-04-20 10:21   ` Peter Dyballa
2006-04-20 18:54 ` kgold

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

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

  git send-email \
    --in-reply-to='CXU1g.9456$i41.8374@newsread1.news.atl.earthlink.net' \
    --to=ecinmn@peoplepc.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.