rudolfochrist / interleave

Emacs minor mode to interleave notes and text books

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

additional property for page offset?

gyps opened this issue · comments

commented

Hi,
since interleave seems to allow a really smooth workflow, when annotating PDFs in emacs, I'm thinking about using it to annotate theses, something I regularly need to do. Since page 1 of a thesis usually is at page 8 to 20 of the PDF it would be great if one could set a property defining this offset. In interleave--create-new-note when the headline for the note is created, this property's value could then just be added to the page variable in (insert (format "Notes for page %d" page)). The behavior of interleave would not be changed, only headings would reflect the actual page numbers.

What do you think about that?

Cheers,
Alex

Hi,

Sounds great. I would definitively merge in a PR for this (hint, hint :))

commented

OK, I gave it a try.
Please excuse this maybe naive approach but the last time I did serious Lisp programming was nearly 20 years ago (last century anyways).

I introduced a constant a variable an a function:

 (defconst interleave--preamble-prop "interleave_preamble_length"
  "The pdf offset string.")
(defvar interleave-preamble-length 0
  "PDF page offset")
(defun interleave--notes-heading (page) 
  (format "Notes for page %d (%d)" (- page interleave-preamble-length) page ))

in interleave-mode I added

	    (if (org-entry-get nil interleave--preamble-prop)
		(setq interleave-preamble-length (string-to-number 
						  (org-entry-get nil interleave--preamble-prop))))

right at the beginning in the (progn ...

In interleave--create-new-note I changed the (insert ... statement to:

 (insert (interleave--notes-heading page))

I'm not sure if this will work in every situation (in particular with multiple files) but so far it works for me.

Would you mind creating a real pull request for this? In this form, your contribution is kind of hard to review and impossible to merge. Also, with a real Pull Request ™ the tests would be run against your changes and catch any regressions.

Thank you very much for your contribution and caring.

commented

If I understand correctly I need to push a new branch to github to create that pull request. Unfortunately I don't seem to be allowed to push to interleave. Correct?
Cheers,
Alex


git push origin page-offset
Username for 'https://github.com': gyps 
Password for 'https://gyps@github.com': 
remote: Permission to rudolfochrist/interleave.git denied to gyps.
fatal: unable to access 'https://github.com/rudolfochrist/interleave.git/': The requested URL returned error: 403

Yes, correct. You're not allowed to push to the interleave repository (yet? 😉). Basically you have to fork the repository, push a branch with your changes to your fork and then you can create a pull request for that.

The Github help describes this kind of workflow very well: https://help.github.com/categories/collaborating-with-issues-and-pull-requests/ and https://help.github.com/articles/creating-a-pull-request-from-a-fork/

Regards,
Sebastian