Karl Voit <devn...@karl-voit.at> writes:

>> It might be helpful if you posted a censored version of your large Org
>> files somewhere.  There's a function by Nicolas that replaces all the
>> characters with "x", and there's also a function that replaces words
>> with random words of the same length (that one takes a while to run).
> Nicolas, can you provide an URL for this? Sounds interesting.

I have it saved, here you go:

#+BEGIN_SRC elisp
  (defun scramble-contents ()
    (let ((tree (org-element-parse-buffer)))
      (org-element-map tree '(code comment comment-block example-block 
                                   keyword link node-property plain-text 
        (lambda (obj)
          (cl-case (org-element-type obj)
            ((code comment comment-block example-block fixed-width keyword
                   node-property verbatim)
             (let ((value (org-element-property :value obj)))
                obj :value (replace-regexp-in-string "[[:alnum:]]" "x" value))))
             (unless (string= (org-element-property :type obj) "radio")
               (org-element-put-property obj :raw-link "http://orgmode.org";)))
              obj (replace-regexp-in-string "[[:alnum:]]" "x" obj)))))
        nil nil nil t)
      (let ((buffer (get-buffer-create "*Scrambled text*")))
        (with-current-buffer buffer
          (insert (org-element-interpret-data tree))
          (goto-char (point-min)))
        (switch-to-buffer buffer))))

The other one can be found here:


> I executed following code below (without changing the prefixes yet
> for testing purposes) which resulted in my usual Agenda but no
> additional buffer showing any results. M-x elp-results is also
> empty.
> What did I do the wrong way?
> (defmacro elp-profile (times &rest body)
>   "Call this macro from an Org source block and you'll get a results block 
>    showing which 20 functions were called the most times, how long they 
>    took to run, etc. Set prefixes to a list of strings matching the prefixes 
>    of the functions you want to instrument.

Did you read the docstring?  ;)  It's intended to be run from an Org
source block with Babel.  Sorry, I should have emphasized that.  You can
rip out the lines that mess with the window and buffer if you just want
to run it directly and leave the results buffer open.

Reply via email to