* how to randomize (scample) regions in a an org buffer
@ 2021-10-06 15:52 Uwe Brauer
2021-10-06 16:37 ` [SOLVED] (was: how to randomize (scample) regions in a an org buffer) Uwe Brauer
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Brauer @ 2021-10-06 15:52 UTC (permalink / raw)
To: emacs-orgmode
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.
Anybody knows about such a function?
Thanks
Uwe Brauer
^ permalink raw reply [flat|nested] 2+ messages in thread
* [SOLVED] (was: how to randomize (scample) regions in a an org buffer)
2021-10-06 15:52 how to randomize (scample) regions in a an org buffer Uwe Brauer
@ 2021-10-06 16:37 ` Uwe Brauer
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Brauer @ 2021-10-06 16:37 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1068 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.
No it was actually quite simple:
(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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-06 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-06 15:52 how to randomize (scample) regions in a an org buffer Uwe Brauer
2021-10-06 16:37 ` [SOLVED] (was: how to randomize (scample) regions in a an org buffer) Uwe Brauer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).