This has been on my to-investigate list for months, and I finally got around to it.
Problem
^c-c-t (my todo capture template) takes 10 seconds or so, no matter what the template
elp-instrument-package org
(elp-instrument-package(quote org))
Profile
Function name Call count Elapsed Time Average Time
org-capture 1 7.4114240000 7.4114240000
org-capture-fill-template 1 6.6733817000 6.6733817000
org-get-x-clipboard 4 6.6563808 1.6640952
org-get-x-clipboard-compat 4 6.6563808 1.6640952
org-capture-select-template 1 0.7310417999 0.7310417999
org-mks 1 0.7310417999 0.7310417999
org-mode 1 0.0130008 0.0130008
org-install-agenda-files-menu 1 0.0060004000 0.0060004000
org-set-regexps-and-options 1 0.0060003000 0.0060003000
Basically, org-get-x-clipboard is almost all of the time.
(Verified by nulling out org-gert-x-clipboard.)
Suboptimal: I was not asking for any template substitutions. But org-capture-fill-template calculates every variable, whether needed or not
(defun org-capture-fill-template (&optional template initial annotation)
"Fill a template and return the filled template as a string.
The template may still contain \"%?\" for cursor positioning."
(setq template (or template (org-capture-get :template)))
(when (stringp initial)
(setq initial (org-no-properties initial))
(remove-text-properties 0 (length initial) '(read-only t) initial))
(let* ((buffer (org-capture-get :buffer))
(file (buffer-file-name (or (buffer-base-buffer buffer) buffer)))
(ct (org-capture-get :default-time))
(dct (decode-time ct))
(ct1
(if (< (nth 2 dct) org-extend-today-until)
(encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))
ct))
(plist-p (if org-store-link-plist t nil))
(v-c (and (> (length kill-ring) 0) (current-kill 0)))
(v-x (or (org-get-x-clipboard 'PRIMARY)
(org-get-x-clipboard 'CLIPBOARD)
(org-get-x-clipboard 'SECONDARY)))
(v-t (format-time-string (car org-time-stamp-formats) ct))
(v-T (format-time-string (cdr org-time-stamp-formats) ct))
(v-u (concat "[" (substring v-t 1 -1) "]"))
(v-U (concat "[" (substring v-T 1 -1) "]"))
However, although I think that I am not using a template, I get
Clipboard pasted as level 1 subtree
Workaround
Making org-get-x-clipboard empty
makes capture very fast - 0.036 seconds as reportted by elp
Configuration
GNU Emacs 24.3.1org-mode 7.8./03
CYGWIN_NT-6.1-WOW64 glew-tablet 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin
No comments:
Post a Comment