From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Replace all tab characters in buffer with newline Date: Wed, 15 Jan 2014 23:30:18 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389854154 20130 80.91.229.3 (16 Jan 2014 06:35:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Jan 2014 06:35:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 16 07:36:00 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W3gYU-0007fk-0v for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jan 2014 07:35:54 +0100 Original-Received: from localhost ([::1]:58734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3gYT-0007K0-Jw for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jan 2014 01:35:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3gTb-0005qN-Dm for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 01:30:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3gTU-0007HD-4d for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 01:30:51 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:54426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3gTT-0007H9-U0 for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 01:30:44 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W3gTH-0001id-Gp for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 07:30:31 +0100 Original-Received: from 70-59-41-30.hlrn.qwest.net ([70.59.41.30]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jan 2014 07:30:31 +0100 Original-Received: from kevin.d.rodgers by 70-59-41-30.hlrn.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jan 2014 07:30:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 76 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 70-59-41-30.hlrn.qwest.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95427 Archived-At: On 1/15/14 9:51 AM, Angus Comber wrote: > Hi I found a way to do this: > > c-m-% then C-Q replace with: C-Q C-J > > C-j is the key thing that works. > > Reason is that C-J means a newline and if you just press enter that is interpretted by emacs as the end of the command. (Or anyway is interpretted differently). [Please don't top-post.] For a precise explanation of that interpretation: 1. C-h f read-event Note that evaluating (read-event "Event: ") in the *scratch* buffer and then hitting the Enter key returns [return] i.e. a vector with 1 element which is a symbol. 2. C-h f read-key Note that evaluating (read-key "Key: ") in the *scratch* buffer and then hitting the key returns 13, which is the ASCII code for Control-M: (format "%c" 13) returns "^M" i.e. a string with 1 character which is Control-M. 3. See the "Named ASCII Chars" node in the Emacs manual. 4. See the "Function Keys" and "Translation Keymaps" nodes in the Emacs Lisp manual. 5. C-h v local-function-key-map You can get C-q to behave as you expected with this: (defadvice quoted-insert (around translate-enter-to-newline activate) (let ((local-function-key-map (copy-keymap local-function-key-map))) (define-key local-function-key-map [return] [?\C-j]) ad-do-it)) > On Wednesday, 15 January 2014 16:41:08 UTC, Angus Comber wrote: >> I have eg: >> >> text1text2text3 >> text4text5text6 >> >> I want to transform into: >> >> text1 >> text2 >> text3 >> text4 >> text5 >> text6 >> >> Using c-m-% I tried this: >> >> c-m=% Used C-Q for quorted then entered tab key on keyboard >> >> For replacement I used C-Q (quoted) then entered key >> >> But then I end up with: >> >> text1^Mtext2^Mtext3 >> text4^Mtext5^Mtext6 >> >> How should I have done it? >> >> Platform is Windows by the way. -- Kevin Rodgers Denver, Colorado, USA