emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Slow speed of week and month views


From: Adam Porter
Subject: Re: [O] Slow speed of week and month views
Date: Sun, 06 Aug 2017 05:28:50 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Karl Voit <address@hidden> 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 ()
    (interactive)
    (let ((tree (org-element-parse-buffer)))
      (org-element-map tree '(code comment comment-block example-block 
fixed-width
                                   keyword link node-property plain-text 
verbatim)
        (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)))
               (org-element-put-property
                obj :value (replace-regexp-in-string "[[:alnum:]]" "x" value))))
            (link
             (unless (string= (org-element-property :type obj) "radio")
               (org-element-put-property obj :raw-link "http://orgmode.org";)))
            (plain-text
             (org-element-set-element
              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))))
#+END_SRC

The other one can be found here:

https://gist.github.com/alphapapa/2d141b60ccbe92f1b90000debde2ddd2

> 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

[Prev in Thread] Current Thread [Next in Thread]