Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Say I want to replace all the new lines in my emacs buffer with the character k (wait for the -1, read the rest! :) ). I know I can type M-x replace-string RET C-q C-j RET k. It works fine.

My problem is that the new line character, i.e. ^J is not displayed in the replace query, I just get a new line in the query string. Instead if I try to type C-q C-<another_char> I get ^<another_char>.

As I said, it works fine, but it is annoying, because it is not compact and not easily readable. Is this the default behavior in emacs? Does anybody know how to change it?

share|improve this question

migrated from stackoverflow.com Jul 24 '11 at 10:08

This question came from our site for professional and enthusiast programmers.

1  
It's certainly the default behaviour. –  phils Jul 23 '11 at 18:36
    
It should show the ^J after you accept the search string, right? At least, mine looks like: Replace string ^J with: so you'll at least see it afterward. –  Nicholas Riley Jul 23 '11 at 21:06
    
true, I see it afterwards, but I would like to have it while I write. –  stefano Jul 23 '11 at 21:18

1 Answer 1

I don't think Emacs's behavior can be changed in the way you want. Have you thought about using regexp-replace instead? That way you could see your new lines as \n.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.