Git Product home page Git Product logo

Comments (38)

tmalsburg avatar tmalsburg commented on June 5, 2024 1

I added this feature in 5d028b9. I did not merge the branch because the commit history was fairly messy. Thanks everyone for your input.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

I considered storing all notes in one file when I first wrote helm-bibtex. The reason why I decided against it is that in my experience Emacs can be really slow with bigger org files. So I thought that the one-file solution may not be scaleable.

Are there any true benefits of having all notes in one file or is this just a matter of personal preference?

If a one-file solution were to be added, I think we would simply recycle the variable helm-bibtex-notes-path. If it points to a directory, make one file per publication. If it points to an org-file, store the notes in that file. For that file, I would probably prefer to have a structure like the following:

* DoeEtAl2013
Here are my notes on Jon Doe's recent paper: ...

where DoeEtAl2013 is the BibTeX key. While this is perhaps less human-readable, it has the benefit that it avoids the property drawer, which seem to slow down Emacs a lot. (I believe org-contacts is so unbearably slow because it heavily relies on properties.)

I'm just thinking aloud here. I'm not planning to work on this and I may not even accept a pull-request. At the moment, it seems to me that the one-file approach is neither better nor worse than the approach using multiple files and I don't see why we need two solutions for storing notes.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

The reason for using one file would be to extend the flexibility of helm-bibtex. People have different approaches. Some work better than others. Personally, I've always used one file and never had problems with speed, even when having to retrieve from drawers.

Some of the benefits of using one file is to be able to (1) export all or some of the notes to html, pdf etc.; (2) search with helm-swoop or occur/org-occur; (3) sort and move notes to different subtree categories. Another advantage is that the note heading and metadata are added automatically using the information provided in the bib file, which avoids having to name files in a separate directory.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Ok, convinced, and I may actually switch to the one-file approach when the code is ready. I will probably introduce a customization variable that allows users to define their own template for notes. Something like the following could be used to implement your proposal.

(defcustom
  helm-bibtex-notes-template
  "\n* ${author} (${year}): ${title}\n  :PROPERTIES:\n  :BIBTEX-KEY: ${=key=}\n  :END:\n"
  "Template for new notes."
  :group 'helm-bibtex
  :type 'string)

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Could you please test the version in the new branch note-files? To configure it, all you have to do is to set helm-bibtex-notes-path to a file. The default template (defined in helm-bibtex-notes-template) assumes that this file is an org file but you could also use markdown or whatever you want. If there already is a note for the publication, the cursor jumps to that note (and unfolds the org node if org-mode is on). If there is no note for the file, the template is used to create one at the end of the file.

One issue: when existing notes are searched, the code simply looks for the first occurrence of the BibTeX key in the notes file. If that key is used in the notes of another publication ("This paper reports a failed replication of XYZ", where XYZ is the BibTeX key), you might land there. Not sure how to deal with this.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

I tested and it's working fine, expect the subtrees are not showing. This is what I would expect to see:

** Author (2013) Title

bla bla

*** chapter 1...
*** chapter 2...

This would be my suggestion:

(if (re-search-forward (concat "\\b" key "\\b") nil t)
    (when (eq major-mode 'org-mode)
      (org-show-entry)
      (show-children)
      (outline-previous-visible-heading 1)
      (recenter-top-bottom 0))

I'm not sure I understand your issue. Why would you reuse the key?

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Here's an example:

* Author1 (year1): Title1
  :PROPERTIES:
  :BIBTEX-KEY: Key1
  :END:

As was shown in [[/path/to/pdf/Key2.pdf][Key2]], ...

* Author2 (year2): Title2
  :PROPERTIES:
  :BIBTEX-KEY: Key2
  :END:

The re-search-forward would position the cursor not at the entry for Key2 but in the notes about Key1 where Key2 is referenced.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

In a89bde5, I added something similar to what you suggest: the complete subtree for the publication's notes is made visible and all other trees are hidden.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

I see the problem. Could you exclude the brackets from the search?

from helm-bibtex.

BrianZbr avatar BrianZbr commented on June 5, 2024

Before I saw this issue, I made a hack: http://pastebin.com/r8NuSNKv I will have to give the branch a try.

As for the search problem, why not use ":BIBTEX-KEY: Key2" instead of just "Key2"?

from helm-bibtex.

BrianZbr avatar BrianZbr commented on June 5, 2024

Just made a pull request (my first one ever!) but there is another issue with this branch that I couldn't solve. The ${author} part of the default template does not work for me. I get a message like 'Wrong type argument: sequencep, 3'. The number corresponds to the length of the author's last name. Any ideas how to fix this?

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Thanks for the PR. I'll look at it on the weekend. The reason why I hesitated to make a decision is that, once people start using a certain format, making changes is going to be hard.

from helm-bibtex.

BrianZbr avatar BrianZbr commented on June 5, 2024

I see... Well for now anyway, aside from the ${author} thing, this branch is working very nicely for me and I'm very glad to have this feature!

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Still thinking about the best way to use and detect BibTeX keys in the notes file. What about this solution:

* [[/path/to/pdf][Author (year): Title]]                      :TheBibTeXKey:

I think this is an appropriate use for Org tags and if we search for :TheBibTeXKex: the chance of false positives is reasonably low. (And perhaps Org already has facilities for jumping to a headline with a specific key.) I like this solution better than the one using property drawers which I find incredibly clunky. Opinions?

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

That's a big change. As far as I know, most people are using properties, which doesn't mean that it's any better. I'd be happy to give the tag method a try and see how it goes. Another solution would be to implement both methods, so that if no tags are found, helm-bibtex would look in the properties drawer.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

The code for the property drawers is not yet merged into the official version. So I doubt that most people are using drawers at the moment. However, I understand that it would be inconvenient for you to transition to a solution using tags. If I decide to implement it with tags, I will try to make it easy for you to stick with property drawers. Shouldn't be too difficult.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

Helm-bibtex provides a very nice (and fast) interface for managing bibliographies, but people who use it might use it in conjunction with other tools, or hacking their own solutions for retrieving notes. One could use org-ref to retrieve notes and helm-bibtex to open pdfs, for example, so I think the community would benefit from both options. Which ever way you decide, let us know. I'd be happy to test it.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

I don't use org-ref. Are you saying that org-ref already has support for notes and that it is using property drawers?

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

It does support notes. As far as using properties drawer, I believe so.

from helm-bibtex.

llcc avatar llcc commented on June 5, 2024

Because I saw you guys talking about the org-ref notes properties. I just give a screenshot of one note entry generated by org-ref. Hope it will help you know it.
image

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Thank you, @llcc. I don't understand why they duplicate the information from the BibTeX entries. If something changes (e.g., a paper goes from in press to published online, or from published online to published in print with page numbers etc.) you have to change the BibTeX entry and the notes file. Also, I don't see a BibTeX key (the name Custom_ID suggests that this may not be the BibTeX key but I'm not sure). I don't think this is going to be the default format in helm-bibtex but I will probably implement something that makes it easy to customize the format for people who prefer the org-ref style.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

I'm also not sure why it's duplicated, unless it's able to sync with the bib file, which I doubt. The only information really needed is the bibtex-key under Custom_ID, used to retrieve the notes, and maybe the URL. In any case, the process of viewing notes could be simplified if the most cited, and most recently cited, authors were on top, but that's another subject.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

I updated the note-files branch. There are several changes:

When one big notes file is used:

  • The new default template is simpler than what org-ref uses but it should be compatible because it uses the Custom_ID property to store the key.
  • The list of publications now shows a mark if notes are available for a publication.
  • Finding the correct entry is now robust. The code looks for Custom_ID: key not just for the key.

Multiple notes file (one for each publication):

  • The template for new notes is used to populate new note files. Adresses #46.

Please test and let me know if that works for you. If everything works as expected, I will merge these changes into master. Thank you.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

I get an error

Debugger entered--Lisp error: (void-function outline-hide-sublevels)
  (outline-hide-sublevels 1)
  (progn (outline-hide-sublevels 1))
  (if (eq major-mode (quote org-mode)) (progn (outline-hide-sublevels 1)))

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Thanks for testing! Which version of Emacs are you using? I'm on the development version.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

24.5.1

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

@jagrg It should work now. I was using the new names of some functions in outline.el. See 92fda4c.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

I'm having a few problems. Pressing f9 inserts a new note template at the top of the page, above #+TITLE:. You probably want as the first heading instead, below #+TITLE:. It's also not finding notes and I'm not seeing the notes icon displayed.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Thanks for the feedback. Another user also reported these issues. So far, I haven't been able to reproduce them on my system (apart from inserting at the top, of course). Weird. I'll try with an older version of Emacs.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

In jagrg@6c82d40, I was able to make the notes-file branch work. With helm-bibtex-notes-path set to a single file, I can now open the notes correctly, and if the key is not found, a new heading is created at the end of the document.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Hm, I can't see what your changes were. Can you commit your changes into the current note-files branch (without changes from master) instead of making a new branch?

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

The notes-file branch was too old to merge.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

There were a couple of problems which I hope are resolved in this commit: 282f507

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

Looks good, Titus, except you brought back the problem of templates being inserted on top of the file. I would suggest replacing org-show-subtree with org-show-entry to avoid drawers from being expanded. In any case, I got better results with jagrg@f0b0df8, although the template is being inserted before the last heading. I'm not sure why. Maybe you have a better idea.

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

To be honest, I chose insertion at the top because it didn't work at the bottom. I think I'm hitting a bug in Emacs but don't have the nerve or time to track it down.

Ok, regarding org-show-entry.

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

I also think it's a bug. In any case, my notes branch works well with a single file, so maybe we could try splitting the function with a variable to choose between one or multiple files. This means that when the variable is set to one-file, only the one-file function is called. Just a thought. No pressure!

(defun helm-bibtex-edit-notes ()
  (if (eq helm-bibtex-use-multiple-files t)
      (helm-bibtex-edit-notes-from-multiple-files)
    (helm-bibtex-edit-notes-from-single-file)))

from helm-bibtex.

tmalsburg avatar tmalsburg commented on June 5, 2024

Appending at the end now seems to work reliable. I have a vague sense of what the problem was. Probably an Emacs bug.

The code now uses org-show-subtree but follows up with org-cycle-hide-drawers.

My impression that this feature is now finally complete and working correctly. Any objections against merging into master?

from helm-bibtex.

jagrg avatar jagrg commented on June 5, 2024

You solved the puzzle. Thanks!

from helm-bibtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.