diff --git a/README.org b/README.org index 96d27e6..2427c1d 100644 --- a/README.org +++ b/README.org @@ -44,6 +44,15 @@ (require 'org-noter) #+end_src +*** vanilla Emacs after version 29.1, which includes use-package + +#+begin_src elisp +(use-package org-noter + :load-path "" + :ensure t + :demand t) +#+end_src + *** straight.el In plain ~straight.el~ syntax #+begin_src elisp diff --git a/org-noter-core.el b/org-noter-core.el index 50dec06..cb71e16 100644 --- a/org-noter-core.el +++ b/org-noter-core.el @@ -1130,10 +1130,11 @@ FORCE-NEW-REF is not used by PDF, NOV, or DJVU format files." (org-noter--with-valid-session (org-noter--doc-location-change-handler))) (defsubst org-noter--doc-file-property (headline) - (let ((doc-prop (or (org-element-property (intern (concat ":" org-noter-property-doc-file)) headline) - (org-entry-get nil org-noter-property-doc-file t)))) - (or (run-hook-with-args-until-success 'org-noter-parse-document-property-hook doc-prop) - doc-prop))) + (when (derived-mode-p 'org-mode) + (let ((doc-prop (or (org-element-property (intern (concat ":" org-noter-property-doc-file)) headline) + (org-entry-get nil org-noter-property-doc-file t)))) + (or (run-hook-with-args-until-success 'org-noter-parse-document-property-hook doc-prop) + doc-prop)))) (defun org-noter--check-location-property (arg) (let ((property (if (stringp arg) arg diff --git a/org-noter.el b/org-noter.el index 6e15d4c..4695287 100644 --- a/org-noter.el +++ b/org-noter.el @@ -47,7 +47,7 @@ (declare-function org-entry-put "org") (declare-function org-with-wide-buffer "org-macs") -(add-to-list 'load-path (concat (file-name-directory load-file-name) "modules/")) +(add-to-list 'load-path (concat (file-name-directory load-file-name) "modules")) (when (or (memq 'doc-view-mode org-noter-supported-modes) (memq 'pdf-view-mode org-noter-supported-modes)) (require 'org-noter-pdf)) diff --git a/tests/Notes.org b/tests/Notes.org index 1726838..575e850 100644 --- a/tests/Notes.org +++ b/tests/Notes.org @@ -221,7 +221,7 @@ direction. An easy calculation shows that the absolute value of the spin must be org-babel is slow on subsequent runs after B9, but direct execution with C-x C-e does not suffer the same performance degradation. - + **** summary of results (PM) 56a45e0: 4.45s (17x10) slower 2nd time in org babel, but consistent w/ C-xC-e (PM) 7d94dc2: 3.279694, 9.246695 (2 note-steps x 1 repeats) @@ -233,7 +233,7 @@ direction. An easy calculation shows that the absolute value of the spin must be **** raw results (PM) 56a45e0: 4.45s (17x10) slower 2nd time in org babel, but consistent w/ C-xC-e (PM) cd3c86c: 22.911387 (7 x 1) 2nd - (PM) cd3c86c: 4.101886, (7 x 24) 1st + (PM) cd3c86c: 4.101886, (7 x 24) 1st (PM) 7d94dc2: 3.279694, 9.246695 (2 note-steps x 1 repeats) (D1) a494169: 9.266794 (2 note-steps x 1 repeats) (M2) b30cbaa: 11.612586, 32.265847 (7 note-steps x 1 repeat) @@ -403,17 +403,17 @@ i * MobyDick :PROPERTIES: :NOTER_DOCUMENT: MobyDick.pdf - :NOTER_PAGE: 171 + :NOTER_PAGE: 1 :END: ** Skeleton To time this code, you need the measure-time macro. - #+begin_src elisp + #+begin_src elisp :results none ;; http://lists.gnu.org/archive/html/help-gnu-emacs/2008-06/msg00087.html (defmacro measure-time (&rest body) "Measure the time it takes to evaluate BODY." `(let ((time (current-time))) ,@body - (message "%.06f" (float-time (time-since time))))) + (float-time (time-since time)))) (defmacro measure-time-sexp (&rest body) "Measure the time it takes to evaluate BODY. @@ -424,25 +424,35 @@ i (message "%.06f" (float-time (time-since time))) retval)) #+end_src + *** Title page :PROPERTIES: :NOTER_PAGE: 1 :END: - #+begin_src elisp - (let (ii jj - (note-steps 138) - (repeats 1)) - (measure-time - (other-window 1) - (dotimes (jj repeats) - (dotimes (ii note-steps) (org-noter-sync-next-page-or-chapter)) - (dotimes (ii note-steps) (org-noter-sync-prev-page-or-chapter))) - (other-window -1))) - #+end_src + #+begin_src elisp :results raw + (let ((note-steps 138) + (repeats 1) + ii jj et) + (other-window -1) + (profiler-start 'cpu) + (setq et (measure-time + (dotimes (jj repeats) + (dotimes (ii note-steps) (org-noter-sync-next-page-or-chapter)) + (dotimes (ii note-steps) (org-noter-sync-prev-page-or-chapter))))) + (profiler-stop) + (profiler-report) + (profiler-report-write-profile (format "%s/speed-test-Emacs%s-Org%s-%.6f" + speed-test-results-dir + emacs-version (org-git-version) et)) + (quit-window) + (other-window -1) + (format "%.2f s; Emacs %s; Org %s" et emacs-version (org-git-version))) + #+end_src #+RESULTS: - : 10.116560 + 17.37 s; Emacs 29.1; Org release_9.4.6 + 32.99 s; Emacs 29.1; Org release_9.6.7-476-g4d63e5 *** ETYMOLOGY :PROPERTIES: