From: Stephen Berman <stephen.berman@gmx.net>
To: Christopher Dimech <dimech@gmx.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Emacs Function to add dashes to leading spaces in a Selected Region
Date: Fri, 30 Oct 2020 01:12:11 +0100 [thread overview]
Message-ID: <87zh44efms.fsf@rub.de> (raw)
In-Reply-To: <trinity-a2a0ae6f-4929-42f7-b830-ed4a0ebe891d-1604014455970@3c-app-mailcom-bs12> (Christopher Dimech's message of "Fri, 30 Oct 2020 00:34:16 +0100")
On Fri, 30 Oct 2020 00:34:16 +0100 Christopher Dimech <dimech@gmx.com> wrote:
> I need an Emacs Function to add dashes to leading spaces in a Selected Region.
> Require help to do this thing.
(defun space-to-dash (beg end)
"Replace spaces by dashes in region."
(interactive "r")
(goto-char beg)
(while (< (point) end)
(when (looking-at "^ +")
(let ((rep (make-string (length (match-string 0)) ?-)))
(replace-match rep)))
(forward-line)))
Steve Berman
next prev parent reply other threads:[~2020-10-30 0:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 23:34 Emacs Function to add dashes to leading spaces in a Selected Region Christopher Dimech
2020-10-30 0:12 ` Stephen Berman [this message]
2020-10-30 2:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-30 3:17 ` Christopher Dimech
2020-10-30 8:00 ` tomas
2020-10-30 14:28 ` Christopher Dimech
2020-10-31 20:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-05 3:15 ` David Masterson
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh44efms.fsf@rub.de \
--to=stephen.berman@gmx.net \
--cc=dimech@gmx.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).