help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read syntax for regular exps


From: B. T. Raven
Subject: read syntax for regular exps
Date: Thu, 02 Jan 2014 15:21:10 -0600
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

Hello:

I want to put the following manual procedures into a function so I can
modify a bunch of files more conveniently but I am unable to get the
elisp right.  (_ is literal space char)

C-M-% _+ RET _  RET       ;; collapse all instances of multiple spaces
to one

C-M-%  _+$ RET RET       ;; remove all spaces on otherwise blank lines

C-M-% _+\([;!?:]\) RET \1 RET  ;; remove spaces before sem, bang, quest,
colon

C-M-% \(^C-qC-j\)+ RET \1 RET  ;; collapse multiple blank lines into one

I assume that I need something like this wrapped in a lambda??

(interactive "r")
or just
(interactive)
if I don't use regions,

and then

(goto-char start)
(replace-regexp " +" " ")

four times, mutatis mutandis.

I am having special trouble with the \ paren parts of strings. Is there
example code of this anywhere? The elisp manual seems a little too
difficult for me.



Thanks,

Ed


reply via email to

[Prev in Thread] Current Thread [Next in Thread]