Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

additional property for page offset? #49

Open
gyps opened this issue Aug 5, 2017 · 5 comments
Open

additional property for page offset? #49

gyps opened this issue Aug 5, 2017 · 5 comments

Comments

@gyps
Copy link

gyps commented Aug 5, 2017

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

@rudolfochrist
Copy link
Owner

Hi,

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

@gyps
Copy link
Author

gyps commented Aug 5, 2017

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.

@rudolfochrist
Copy link
Owner

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.

@gyps
Copy link
Author

gyps commented Aug 6, 2017

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://[email protected]': 
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

@rudolfochrist
Copy link
Owner

rudolfochrist commented Aug 6, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants