Skip to content

Commit

Permalink
Merge remote-tracking branch 'org-noter/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
petermao committed Sep 6, 2023
2 parents ec09eac + 9d42ebc commit c90909c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
9 changes: 9 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<path-to-org-noter>"
:ensure t
:demand t)
#+end_src

*** straight.el
In plain ~straight.el~ syntax
#+begin_src elisp
Expand Down
9 changes: 5 additions & 4 deletions org-noter-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion org-noter.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
44 changes: 27 additions & 17 deletions tests/Notes.org
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down

0 comments on commit c90909c

Please sign in to comment.