Comments (10)
Sounds interesting. It would make things easier if tags were stored in the BibTeX file, e.g., in the field for keywords or a new field. This way it would be trivial to implement the search part of your proposal (except perhaps for the hierarchy bit; not sure if I understand what you mean there). Editing tags should also be easy to implement. Generating an index would probably better be handled by a separate tool. That could be implemented using bib2bib, bibtex2html, and some shell-script glue. I use a similar setup to generate the sections of my publication page.
from helm-bibtex.
Is it safe to add another field or could it affect other tools that process bibtex files?
If it's safe an option would be to use the keywords
field as content tags and then another field (tags
) for the read/unread/favourite tags.
Could the latter be displayed as a separate column in the results?
from helm-bibtex.
It's safe to add fields and many bibliography managers do it for their own internal purposes. I agree that we should not pollute the keywords field with tags. Customization of columns is desirable and not too difficult to implement. However, it's not too high up on my list of priorities. I'm happy to accept pull requests, though. Mu4e has customizable columns and perhaps it would make sense to copy the way they define the columns.
from helm-bibtex.
OK. I'll send a pull request when I get to it :)
from helm-bibtex.
I started working on this by introducing a tags field in my bibliography. Now I have data for testing. I think we should break this down in several separate feature additions (and pull requests):
- Add the ability to configure which fields are used for searching. Other people may already have a field for tags and we don't want to force them to use the name "tags". Of course configurable search fields are useful for independent reasons as well.
- Configurable columns for display of search results (probably mu4e style).
- Configure tags field and add the possibility to edit tags.
Not sure, whether the last point is needed. I think I would prefer to just edit the BibTeX entry using the "show extry" action (which should perhaps be renamed to "edit entry").
from helm-bibtex.
I added code to address 1 (2ddea19). Now you can add this to your configuration to extend the fields that are used for searching by the field tags:
(setq helm-bibtex-additional-search-fields '(tags))
However, tags are not displayed and there is no special UI for editing them. Not sure whether I will add code for the latter because my approach is to edit BibTeX directly.
from helm-bibtex.
Nice! I experimented a bit to see what tags I would find useful and I came to the following conclusion:
- Use the
tags
field to mark items which are read/in progress/to read - Use an additional field
cites
to mark interesting references of this paper. This way I can use a simple script like this to print a graph of my reading list straight from the bib file
As you say, I found that editing the bib file directly is the way to go. With that in mind, I thought it would be nice to have some functions that jump directly to tags
or cites
fields (when present). The patch is here but needs merging with your latest commit.
from helm-bibtex.
Hi Paul, your cites field is a cool idea but I suppose you are the only user of that field and I don't want to add non-standard functionallity that is used by only one user. Similarly, tags is a non-standard field that is perhaps only used by you and me. Having said that, it might make sense at some point to add infrastucture that allows users to introduce custom fields and edit actions for these fields without having to mess with the code. Since the main feature that you requested (seraching for tags) was added, I'll close this issue for now.
from helm-bibtex.
Thanks for adding tags! I wrote a function to tag multiple entries, if someone has use for it. Requires org-ref.
;;** Add tags interactively to bibtex entry in .bib file, also sorting fields
(defun bibtex-completion-tag-entry (keys)
"Tag multiple bibtex entries in .bib file."
(interactive)
;; Using a modified version of org-ref-sort-bibtex-entry.
;; Input tag
(setq enteredTag (read-string "Enter tag:"))
(dolist (tempKey keys) ;; to enable tagging of multiple entries
;; "Show the selected entry in the BibTeX file."
(catch 'break
(dolist (bib-file (bibtex-completion-normalize-bibliography 'main))
(let ((key tempKey)
(buf (bibtex-completion-buffer-visiting bib-file)))
(find-file bib-file)
(widen)
(if (eq major-mode 'org-mode)
(let* ((prop (if (boundp 'org-bibtex-key-property)
org-bibtex-key-property
"CUSTOM_ID"))
(match (org-find-property prop key)))
(when match
(goto-char match)
(org-show-entry)
(throw 'break t)))
(goto-char (point-min))
(when (re-search-forward
(concat "^@\\(" parsebib--bibtex-identifier
"\\)[[:space:]]*[\(\{][[:space:]]*"
(regexp-quote key) "[[:space:]]*,") nil t)
(throw 'break t)))
(unless buf
(kill-buffer)))))
;; retrieve entry as list
(bibtex-beginning-of-entry)
(let* (
(entry (bibtex-parse-entry))
(entry-fields)
(other-fields)
(addTag enteredTag)
(oldTags (cdr (assoc "tags" entry))) ;; to keep existing tags
(type (cdr (assoc "=type=" entry)))
(key (cdr (assoc "=key=" entry)))
(field-order (cdr (assoc (if type (downcase type))
org-ref-bibtex-sort-order))))
;; if tags are not nil keep old tags and add the new one
(if (cdr (assoc "tags" entry))
(setcdr (assoc "tags" entry)
(s-concat (replace-regexp-in-string "}" ", " (format "%s" oldTags)) addTag "}"))
)
;; if tags are nil, add the new tag, then santize
(if
(cdr (assoc "tags" entry)) nil (push (list "tags" addTag) entry);; create tag if nil
;; sanitize, changing parenteses to curly braces
(setcdr (assoc "tags" entry) (s-concat (replace-regexp-in-string ")" "}" (format "%s" (cdr (assoc "tags" entry))))))
(setcdr (assoc "tags" entry) (s-concat (replace-regexp-in-string "(" "{" (format "%s" (cdr (assoc "tags" entry))))))
)
;; these are the fields we want to order that are in this entry
(setq entry-fields (mapcar (lambda (x) (car x)) entry))
;; we do not want to reenter these fields
(setq entry-fields (remove "=key=" entry-fields))
(setq entry-fields (remove "=type=" entry-fields))
;;these are the other fields in the entry, and we sort them alphabetically.
(setq other-fields
(sort (-remove (lambda(x) (member x field-order)) entry-fields)
'string<))
(bibtex-kill-entry)
(insert
(concat "@" type "{" key ",\n"
(mapconcat
(lambda (field)
(when (member field entry-fields)
(format "%s = %s,"
field
(cdr (assoc field entry)))))
field-order "\n")
;; now add the other fields
(mapconcat
(lambda (field)
(cl-loop for (f . v) in entry concat
(when (string= f field)
(format "%s = %s,\n" f v))))
(-uniq other-fields) "\n")
"\n}\n\n"))
(bibtex-find-entry key)
(bibtex-fill-entry)
(bibtex-clean-entry))
)
)
from helm-bibtex.
Thanks for sharing this. When I have some time I will consider adding this as a standard feature.
from helm-bibtex.
Related Issues (20)
- Prenote and Postnote options for citations in org-mode HOT 4
- Symbol’s function definition is void: org-cite-register-processor HOT 7
- bibtex-completion-format-citation-org-cite gives wrong format HOT 2
- org-ref-helm-bibtex-insert-citation results in wrong type argument HOT 3
- helm-bibtex-candidates-formatter not applied (?) HOT 11
- Invalid image type 'svg' HOT 3
- Symbol’s value as variable is void: browse-url-mosaic-program HOT 4
- Inquiry about Automatic Updating of BibTeX Files from Online Databases in Helm-Bibtex. HOT 1
- Set the variable bibtex-completion-bibliography used by helm-bibtex to the dynamical generated bib files list corresponding to the current master tex file. HOT 14
- Trigger bibliography completion list in-situ in TeX source document when typing `\cite{}` command.
- Inquiry about citation commands supported by helm-bibtex package. HOT 11
- The problem related to `(require 'helm-config)` and `(require 'helm-bibtex)`. HOT 9
- What's the mode hook defined in `helm-bibtex` to conditionally activate it when AUCTeX's `LaTeX-mode` is called? HOT 4
- Allow additional functions for format entry HOT 1
- Bug?: Abstract may be invalid if final character is `}` HOT 4
- Feature request: Integration with Zotra HOT 5
- Clarify documentation for `org-bibtex` bibliography. HOT 3
- helm-bibtex-follow doesn't fail properly for non-existent keys HOT 7
- Unicode Support HOT 3
- helm-bibtex fails to create window with (wrong-type-argument window-live-p nil) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helm-bibtex.