[SOLVED] (was: how to randomize (scample) regions in a an org buffer)

2021-10-06 Thread Uwe Brauer
>>> "UB" == Uwe Brauer  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)))




smime.p7s
Description: S/MIME cryptographic signature


how to randomize (scample) regions in a an org buffer

2021-10-06 Thread Uwe Brauer


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