From: Uwe Brauer <oub@mat.ucm.es>
To: help-gnu-emacs@gnu.org
Subject: [SOLVED] (was: how to randomize (scample) regions in a an (org) buffer)
Date: Wed, 06 Oct 2021 18:35:26 +0200 [thread overview]
Message-ID: <87tuhu9kmp.fsf@mat.ucm.es> (raw)
In-Reply-To: 877deqb14o.fsf@mat.ucm.es
[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]
>>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:
> Hi
> I need to replace private information in my org files, but only region wide.
> I found
> https://www.reddit.com/r/emacs/comments/6pc0ts/sanitize_buffer_by_replacing_words_with_random/
> Where two such functions are discussed, one is even for org files,
> however only buffer wide and the code looks rather complicated to me.
Actually it was quite easy as in
(defun randomise-region ()
"Like `ap/replace-words-randomly', but only replace inside region if it is active.
If the region is not active, replace from point to the end of the
buffer. The region is never considered active outside
`transient-mark-mode'. "
(interactive)
(if (or (and (boundp 'zmacs-region-active-p) zmacs-region-active-p)
(and (boundp 'transient-mark-mode) transient-mark-mode mark-active))
(save-restriction
(save-excursion
(narrow-to-region (point) (mark))
(goto-char (point-min))
(ap/replace-words-randomly)))
(ap/replace-words-randomly)))
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
next prev parent reply other threads:[~2021-10-06 16:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 15:53 how to randomize (scample) regions in a an (org) buffer Uwe Brauer
2021-10-06 16:35 ` Uwe Brauer [this message]
2021-10-06 19:59 ` [SOLVED] (was: how to randomize (scample) regions in a an (org) buffer) Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-06 20:24 ` [SOLVED] Uwe Brauer
2021-10-06 20:58 ` [SOLVED] Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-07 7:05 ` [SOLVED] Uwe Brauer
2021-10-07 8:15 ` [SOLVED] Emanuel Berg via Users list for the GNU Emacs text editor
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=87tuhu9kmp.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--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).