From 791fe1b0ceb656b51fae63f06c2c20e7cdae5886 Mon Sep 17 00:00:00 2001 From: Vladimir Nikishkin Date: Mon, 14 Aug 2023 14:48:24 +0800 Subject: [PATCH 1/7] README.org: add installation instructions with Emacs 29.1 Emacs 29.1 ships use-package. Give example of using it. --- README.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.org b/README.org index aba0060..da17733 100644 --- a/README.org +++ b/README.org @@ -44,6 +44,16 @@ (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 From 7c58225e0faae1f025af1f33337d3a0aa3df7170 Mon Sep 17 00:00:00 2001 From: Vladimir Nikishkin Date: Tue, 15 Aug 2023 10:35:44 +0800 Subject: [PATCH 2/7] Format snipped in readme as suggested. --- README.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.org b/README.org index da17733..c305f8f 100644 --- a/README.org +++ b/README.org @@ -50,8 +50,7 @@ (use-package org-noter :load-path "" :ensure t - :demand t - ) + :demand t) #+end_src *** straight.el From 119fc45f6aa2106771471df8de2d83fcdb038598 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sat, 26 Aug 2023 16:24:42 +0800 Subject: [PATCH 3/7] Remove trailing "/" when expand load-path Some distributions, such as Nixpkgs, use `normal-top-level-add-subdirs-to-load-path' to recursively add sub dirs of load-path entries to load-path. org-note also does this when it is loaded using `add-to-list'. Ideally, this should be a no-op since `add-to-list' does deduplication. However, the entry org-noter adds has a trailing "/", which is not the case for other entries of `load-path'[1]. As a result, the deduplication fails. [1]: See the source code of `normal-top-level-add-to-load-path'. --- org-noter.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) From 868a74cf754f992a2cf27c97344ddf3278e5e821 Mon Sep 17 00:00:00 2001 From: Peter Mao Date: Fri, 1 Sep 2023 19:06:07 -0700 Subject: [PATCH 4/7] update Notes.org for speed-test clean up whitespace change :results to "raw" so results from run-to run are maintained save with `:NOTER_PAGE: 1` so that the file opens ready-to-run --- tests/Notes.org | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/tests/Notes.org b/tests/Notes.org index 1726838..32b8cf5 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))))) + (message "%.2f s; %s; %s" (float-time (time-since time)) (org-version nil t) (version)))) (defmacro measure-time-sexp (&rest body) "Measure the time it takes to evaluate BODY. @@ -424,25 +424,31 @@ 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 (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 #+RESULTS: - : 10.116560 + 11.12 s; Org mode version 9.4.6 (release_9.4.6 @ /home/peterm/emacs/org-mode/lisp/); GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) + of 2022-09-12 + 11.17 s; Org mode version 9.4.6 (release_9.4.6 @ /home/peterm/emacs/org-mode/lisp/); GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) + of 2022-09-12 + 14.61 s; Org mode version 9.4.6 (release_9.4.6 @ /home/peterm/emacs/org-mode/lisp/); GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) + of 2022-09-12 *** ETYMOLOGY :PROPERTIES: From 868f1fae4b824f3c167d1016caeb572280d67c2e Mon Sep 17 00:00:00 2001 From: Peter Mao Date: Sat, 2 Sep 2023 13:42:46 -0700 Subject: [PATCH 5/7] add profiler commands to speed test generate profile report with filename format: "speed-test-Emacs-Org-" --- tests/Notes.org | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/Notes.org b/tests/Notes.org index 32b8cf5..3056807 100644 --- a/tests/Notes.org +++ b/tests/Notes.org @@ -413,7 +413,7 @@ i "Measure the time it takes to evaluate BODY." `(let ((time (current-time))) ,@body - (message "%.2f s; %s; %s" (float-time (time-since time)) (org-version nil t) (version)))) + (float-time (time-since time)))) (defmacro measure-time-sexp (&rest body) "Measure the time it takes to evaluate BODY. @@ -431,24 +431,26 @@ i :END: #+begin_src elisp :results raw - (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))) + (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 "speed-test-Emacs%s-Org%s-%.6f" 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: - 11.12 s; Org mode version 9.4.6 (release_9.4.6 @ /home/peterm/emacs/org-mode/lisp/); GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) - of 2022-09-12 - 11.17 s; Org mode version 9.4.6 (release_9.4.6 @ /home/peterm/emacs/org-mode/lisp/); GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) - of 2022-09-12 - 14.61 s; Org mode version 9.4.6 (release_9.4.6 @ /home/peterm/emacs/org-mode/lisp/); GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) - of 2022-09-12 + 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: From ab05d5e7cb66f82f3b93a2910ab1aa6015433477 Mon Sep 17 00:00:00 2001 From: Peter Mao Date: Sat, 2 Sep 2023 22:36:59 -0700 Subject: [PATCH 6/7] put profiler results in speed-test-results-dir --- tests/Notes.org | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/Notes.org b/tests/Notes.org index 3056807..575e850 100644 --- a/tests/Notes.org +++ b/tests/Notes.org @@ -432,20 +432,22 @@ i #+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 "speed-test-Emacs%s-Org%s-%.6f" emacs-version (org-git-version) et)) - (quit-window) - (other-window -1) - (format "%.2f s; Emacs %s; Org %s" et emacs-version (org-git-version))) + (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: From 561d740cfe8abe822ae7b9cf0d6ea5c0d2783c2c Mon Sep 17 00:00:00 2001 From: Peter Mao Date: Sun, 3 Sep 2023 16:26:36 -0700 Subject: [PATCH 7/7] in --doc-file-property ensure buffer is org-mode or pass --- org-noter-core.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/org-noter-core.el b/org-noter-core.el index 82e736b..c75967c 100644 --- a/org-noter-core.el +++ b/org-noter-core.el @@ -1125,10 +1125,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