unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Adding tab characters
@ 2008-03-13 17:08 Kerry.Thurber
  2008-03-13 17:26 ` Brendan Halpin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kerry.Thurber @ 2008-03-13 17:08 UTC (permalink / raw)
  To: help-gnu-emacs

Hello everyone,

I'm missing something obvious I think.  I want to create a tab
delimited file using emacs.  I can do it fine with a keyboard macro,
but I need to make something permanent that others can use.

(defun CreateTabDelimitedFile()
  "Convert JED logs into something Scott can use"
  (interactive)
  (beginning-of-buffer)
  (replace-string ";" "\009")  ;tried many other variants
)

In place of "\009" I tried ^I, ^Tab, an actual tab, "[tab]" and
everything else I could imagine.  Nothing seems to work.  Is there a
way to replace a string with a tab character?  Is there a way to
replace a string with another string *plus* a tab character?

Any help is appreciated.

Thanks,
Kerry



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding tab characters
  2008-03-13 17:08 Adding tab characters Kerry.Thurber
@ 2008-03-13 17:26 ` Brendan Halpin
  2008-03-13 17:52   ` Kerry.Thurber
  2008-03-13 19:30 ` Joel J. Adamson
  2008-03-15  6:53 ` Kevin Rodgers
  2 siblings, 1 reply; 5+ messages in thread
From: Brendan Halpin @ 2008-03-13 17:26 UTC (permalink / raw)
  To: help-gnu-emacs

Kerry.Thurber@gmail.com writes:

> Hello everyone,
>
> I'm missing something obvious I think.  I want to create a tab
> delimited file using emacs.  I can do it fine with a keyboard macro,
> but I need to make something permanent that others can use.
>
> (defun CreateTabDelimitedFile()
>   "Convert JED logs into something Scott can use"
>   (interactive)
>   (beginning-of-buffer)
>   (replace-string ";" "\009")  ;tried many other variants
> )
>
> In place of "\009" I tried ^I, ^Tab, an actual tab, "[tab]" and
> everything else I could imagine.  Nothing seems to work.  Is there a
> way to replace a string with a tab character?  Is there a way to
> replace a string with another string *plus* a tab character?

An actual tab should work, but you need to enter it as C-Q TAB as Emacs
may enter spaces instead (or indent). However try:

 (replace-string ";" "\t")

\t stands for a literal tab. 

Brendan
-- 
Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:brendan.halpin@ul.ie  http://www.ul.ie/sociology/brendan.halpin.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding tab characters
  2008-03-13 17:26 ` Brendan Halpin
@ 2008-03-13 17:52   ` Kerry.Thurber
  0 siblings, 0 replies; 5+ messages in thread
From: Kerry.Thurber @ 2008-03-13 17:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 13, 10:26 am, Brendan Halpin <brendan.hal...@ul.ie> wrote:
> Kerry.Thur...@gmail.com writes:
> > Hello everyone,
>
> > I'm missing something obvious I think.  I want to create a tab
> > delimited file using emacs.  I can do it fine with a keyboard macro,
> > but I need to make something permanent that others can use.
>
> > (defun CreateTabDelimitedFile()
> >   "Convert JED logs into something Scott can use"
> >   (interactive)
> >   (beginning-of-buffer)
> >   (replace-string ";" "\009")  ;tried many other variants
> > )
>
> > In place of "\009" I tried ^I, ^Tab, an actual tab, "[tab]" and
> > everything else I could imagine.  Nothing seems to work.  Is there a
> > way to replace a string with a tab character?  Is there a way to
> > replace a string with another string *plus* a tab character?
>
> An actual tab should work, but you need to enter it as C-Q TAB as Emacs
> may enter spaces instead (or indent). However try:
>
>  (replace-string ";" "\t")
>
> \t stands for a literal tab.
>
> Brendan
> --
> Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
> Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
> mailto:brendan.hal...@ul.ie  http://www.ul.ie/sociology/brendan.halpin.html

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding tab characters
  2008-03-13 17:08 Adding tab characters Kerry.Thurber
  2008-03-13 17:26 ` Brendan Halpin
@ 2008-03-13 19:30 ` Joel J. Adamson
  2008-03-15  6:53 ` Kevin Rodgers
  2 siblings, 0 replies; 5+ messages in thread
From: Joel J. Adamson @ 2008-03-13 19:30 UTC (permalink / raw)
  To: Kerry.Thurber; +Cc: help-gnu-emacs

Kerry.Thurber@gmail.com writes:

> Hello everyone,
>
> I'm missing something obvious I think.  I want to create a tab
> delimited file using emacs.  I can do it fine with a keyboard macro,
> but I need to make something permanent that others can use.
>
> (defun CreateTabDelimitedFile()
>   "Convert JED logs into something Scott can use"
>   (interactive)
>   (beginning-of-buffer)
>   (replace-string ";" "\009")  ;tried many other variants
> )

A couple notes on style: Lisp code usually separates words with hyphens
kinda-like-this, as in spicy-food-p.  CamelCase is generally avoided, 
AndWouldYouWantToTypeThat?  Also, it's easier to look at if the trailing
parentheses are all on one line)).

> In place of "\009" I tried ^I, ^Tab, an actual tab, "[tab]" and
> everything else I could imagine.

Can you imagine "\t"?

(info "(elisp) Basic Char Syntax")

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109
Public key: http://pgp.mit.edu

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding tab characters
  2008-03-13 17:08 Adding tab characters Kerry.Thurber
  2008-03-13 17:26 ` Brendan Halpin
  2008-03-13 19:30 ` Joel J. Adamson
@ 2008-03-15  6:53 ` Kevin Rodgers
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2008-03-15  6:53 UTC (permalink / raw)
  To: help-gnu-emacs

Kerry.Thurber@gmail.com wrote:
> Hello everyone,
> 
> I'm missing something obvious I think.  I want to create a tab
> delimited file using emacs.  I can do it fine with a keyboard macro,
> but I need to make something permanent that others can use.
> 
> (defun CreateTabDelimitedFile()
>   "Convert JED logs into something Scott can use"
>   (interactive)
>   (beginning-of-buffer)
>   (replace-string ";" "\009")  ;tried many other variants
> )
> 
> In place of "\009" I tried ^I, ^Tab, an actual tab, "[tab]" and
> everything else I could imagine.  Nothing seems to work.  Is there a
> way to replace a string with a tab character?  Is there a way to
> replace a string with another string *plus* a tab character?

The "\NNN" syntax is octal, so "\009" is interpreted as "\00" (NUL) 
followed by "9" (the digit).

"\011" is the octal syntax.  "\u0009" is the hexadecimal syntax.

"\^I" and "\C-i" (and "\C-I") are the control character syntaxes.


-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-15  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 17:08 Adding tab characters Kerry.Thurber
2008-03-13 17:26 ` Brendan Halpin
2008-03-13 17:52   ` Kerry.Thurber
2008-03-13 19:30 ` Joel J. Adamson
2008-03-15  6:53 ` Kevin Rodgers

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).