Giter Club home page Giter Club logo

citar-denote's Introduction

https://melpa.org/packages/citar-denote-badge.svg https://stable.melpa.org/packages/citar-denote-badge.svg

Citar-Denote is a minor-mode integrating the Emacs Citar and Denote packages to enable create managing bibliographic notes and citations.

For more information read the Citar-Denote Manual in this repository with C-h R (info-display-manual) and select citar-denote.

Change Log

Version 2.2.1

  • citar-denote-template has additional options:
    • nil: No template
    • t: Ask or a template
    • string: Name of the default template for literature notes
  • Updated manual

Version 2.2

  • citar-denote-subdir has additional options:
    • nil: No subdirectory
    • t: Ask for subdirectory
    • string : When using any string, save in a subdirectory with that name under denote-directory
  • Modified behaviour of citar-denote-signature. Users can choose between manually adding a signature or using citation key without prompting.

Version 2.1.2

  • Removed lighter string to not clobber the mode line
  • Bug fixed when using non-standard citar-denote-keyword

Version 2.1.1

  • Updated the manual
  • Minor code updates

Version 2.1

  • Included Texinfo manual.
  • Bug fixes in regex to find citations.
  • New function: citar-denote-no-bibliography lists all citations that do not appear in the global bibliography in the *Messages* buffer.
  • Updated function documentation.

Version 2.02

  • Improved function docstrings
  • Updated example config

Version 2.0.1

  • Updated minor mode definition
  • Updated readme.org and minimum-config.el to define order or installation

Version 2.0

  • Commenced Change Log.
  • Updated all functions for full compatibility with Denote 2.2
  • Added minimum-config.el to provide minimal configuration example.
  • Added citar-denote-signature variable to add signatures for new bibliographic notes. When entering an empty string as signature, the citation key is used as signature.
  • The citar-denote-template variable defines whether a not template is used.
  • Added citar-denote-nocite function to open Citar completion menu with all bibliographic entries neither cited nor referenced in any Denote file. This negates the need for citar-denote-reference-nocite because notes can be created from within the Citar menu.
  • Existing reference removed from Citar completion menu when adding a new reference to a note.
  • Fixed a bug in citar-denote-add-citekey and citar-denote-remove-citekey when using multiple file types.
  • Removed false positives from citar-denote--extract-citations.
  • Behaviour of citar-denote-use-bib-keywords changed. When not-nil, don’t prompt for keywords and only use those in the bibliography.
  • The citar-denote-keyword (“bib”) is removed from the keyword completion menu to avoid confusion.
  • Resolved bug for when citar-denote-keyword is nil.
  • citar-denote-link-reference check that file is a Denote file and fixed linking bug.
  • Added citar-denote--select-file-using-title to select a Denote filename using their title in the completion menu.
  • When only one candidate available in citar-denote-find-citation, skip the section menu.

Version 1.8

  • Fixing bugs and improve package documentation.
  • Marked private functions with double dash
  • Updated citar-denote-citekey-regex to detect citations with multiple entries
  • Updated Citar-Denote manual in Emacs Writing Studio.

Version 1.7

  • Code refactoring and pretty-printing
  • Updated function documentation
  • Bug fix to citar-denote-remove-citekey
  • Package documentation update
  • Code refactoring
  • Added citar-denote-link-reference to insert a Denote link to an existing bibliographic note.
  • Added citar-denote-find-citation to find a citation in your Denote files.

citar-denote's People

Contributors

goofansu avatar grtcdr avatar jloow avatar nobiot avatar pprevos avatar protesilaos avatar swflint avatar troyfigiel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

citar-denote's Issues

Create a denote note including the citekey and bib keyword in one step.

I'm trying to improve my usage of citar in a denote note-taking workflow. This packages seems like it could provide all the necessary elements but I'm not understanding how to create a regular denote file with the additional citekey included in the front matter. Is this supposed to be done in a two step process?

  • create a regular denote note.
  • use the citar-denote-add-citekey command.

If that where the case, could you provide some programmatic examples in the documentation of how to make use of the citar-denote template?. This would seem really useful for programmatically creating notes with the proper citekeys.

Possibility of multiple "bibliographic notes" per file

Basically, is there an easy way to have two or more references/bibliographic entries use the same note file?

The practical use case for me is when I have the same work but from different translators. I'd like to have my notes for each translation in the same file.

Using specific directory for citar notes

Hi,

thanks for this code, I've been using and though it wanted to place citar notes in a specific directory (usually a subdirectory of denote-directory). I think this migh be useful, so you can define, say, a denote-citar-directory to be nil or a directory and pass it to the denote command:

(denote
     ;; Replace underscores in citation key
     (replace-regexp-in-string "_" "-" key)
     (denote-citar--keywords-prompt)
     nil
     denote-directory)

I'm providing a patch though it might not be the proper way to implement this (limited elisp knowledge here).

https://gist.github.com/gnava/b33eadb51e71abd9114904c04e7bbb72

best,

guille

Obsolete symbols, some further integration

I ran into some problems after starting to use this package yesterday: when creating new notes, the reference wasn't inserted. I was able to determine that this due to two obsolete symbols in the function denote-citar-file--create-note (see https://protesilaos.com/emacs/denote-changelog).

I rewrote the function slightly to get it working again:

(defun denote-citar-file--create-note (key &optional entry)
  "Create a bibliography note through Citar."
  (let ((denote-file-type nil)) ; make sure it is Org
    (denote
     ;; Replace underscores in citation key
     (replace-regexp-in-string "_" "-" key)
     (denote-citar--keywords-prompt))
    ;; This sort of works now. It's not pretty, but hey.
    ;; denote-last-buffer was obsolete.
    ;; denote-retrieve--id-front-matter-key-regexp was obsolete.
    (with-current-buffer (current-buffer)
      (save-excursion
	(goto-char (point-min))
	(re-search-forward "^[^#]")
	(search-backward "#")
	(goto-char (point-at-eol))
        (newline)
        (insert (format "#+reference:  %s" key))))))

I'm quite bad with regex, so there's probably a nicer way of doing this. From what I can tell, though, this works.

Since I was already at it, I decided to see if I could get the integration with e.g. citar-open to work. I think I managed to get a basic implementation working; perhaps it's useful for future work.

Much of this work is writing our own citar-files--get-notes function (my function is largely based on citar-file--directory-files, which citar-files--get-notes relies on). The new function looks like this:

(defun denote-citar--get-notes (&optional keys)
   (let ((files (make-hash-table :test 'equal))
	;; For now, we only support one extension.
	(org-files-regexp ".*\.org$")
	(marker1 nil)
	(marker2 nil)
	(dirs citar-notes-paths))
    (prog1 files
      (dolist (dir dirs)
	(when (file-directory-p dir)
	  (dolist (file (directory-files dir t ".*\.org$"))
	    ;; There certainly is a more elegant way of doing this
	    (with-current-buffer (get-buffer (find-file-noselect file))
	      (save-excursion
		;; Not sure if this is needed
		(goto-char (point-min))
		;; This should put us at the beginnig of the reference
		;; name. If this search fails, we are not dealing with
		;; a notes file for a reference.
		(when (search-forward "#+reference: " nil t)
		  ;; Here we select the reference name
		  (forward-to-word 1)
		  (setq marker1 (point))
		  (end-of-line)
		  (setq marker2 (point))
		  (if keys
		      (dolist (key keys)
			(when (string= key
				       (buffer-substring-no-properties marker1 marker2))
			  (push file (gethash key files))))
		    (let ((key (buffer-substring-no-properties marker1 marker2)))
		      (push file (gethash key files))))))))))
      ;; Reverse file lists because push adds elements to the front
      (maphash (lambda (key filelist)
                 (puthash key (nreverse filelist) files))
	       files))))

(Note that this implementation takes into consideration citar-notes-path.)

We also need a new citar-file--has-notes. Our version will look more or less the same only, for some reason, I couldn't use let and instead had to use setq:

(defun denote-citar--has-notes ()
  (setq notes (denote-citar--get-notes))
    (unless (hash-table-empty-p notes)
      (lambda (citekey) (and (gethash citekey notes) t))))

Then we simply register a new note source with our new functions:

(citar-register-notes-source
 'denote-citar-source (list :name "Denote Notes"
			    :category 'file
			    :items 'denote-citar--get-notes
			    :hasitems 'denote-citar--has-notes
			    :open 'find-file
                            :create 'denote-citar-file--create-note))
(setq citar-notes-source 'denote-citar-source)

I haven't tested this extensively, but it seems to work so far.

Include subdirectory?

I put my notes for denote in various subdirectories. It would be nice to add this as an option for citar-denote. You could do something like this for citar-denote-create-note

(defun citar-denote-create-note (key &optional _entry)
  "Create a bibliography note for `KEY' with properties `ENTRY'.
The file type for the note to be created is determined by user
option `denote-file-type'."
  (let ((denote-file-type citar-denote-file-type))
    (denote
     (read-string "Title: " (citar-get-value "title" key))
     (citar-denote-keywords-prompt))
    (citar-denote-add-reference key denote-file-type)
    (when denote-subdir (denote-subdirectory-prompt))))

I'm not sure if other functions would also need to be changed for note retrieval, etc.

Running citar-create-note doesn't add a "#+reference"

I'm in the process of rig-jigging my (academic) workflow, and am cleaning up my emacs.d configuration.

That's seen me adopt vertico (1.1), denote (1.2.0), and citar (20230227.2247). The citar-denote package (20230211.528) looks like it should be just the thing I need to join citar and denote.

I've installed it thus:

(use-package citar-denote
:after citar denote
:config
(citar-denote-mode)
(setq citar-open-always-create-notes t))

Alas ... there's a wee problem, when I create a new note (citar-create-note) a new buffer is created that with the right frontmatter (a title, date, filetags, and identifier), but without a reference.

E.g., a buffer called "20230305T155127--organizational-strategy-structure-and-process__bib_strategy.org" is created; this looks correct to me and has the following content.

#+title: Organizational Strategy, Structure, and Process
#+date: [2023-03-05 Sun 15:51]
#+filetags: :bib:strategy:
#+identifier: 20230305T155127

But I would expect to see a reference like "#+reference: miles_organizational_1978"

There is an error message that says, "citar-denote-add-reference: Buffer is not a Denote file".

Looking at the mode-line, it says Org citar-denote Ind Fly/en, which is exactly what it says when I open any other denote file.

I'm a little lost now ... any ideas

double "#+title" in notes created throught the citar interface

Hi,
Thanks for your work on this, it's really great and I use it daily :)
I have this strange bug, the source of which I can't figure out:

image

This only happens with notes I create hrough citar (either citar-create-note, or throught citar-open, and then the "create denote" action).

Thanks for your assistance.

Notes linked using `citar-denote-add-citekey` are not visitable

Using the following citar-denote configuration

(add-directory-to-load-path "citar-denote")
(require 'citar-denote)
(setopt citar-denote-keyword "literature"
        citar-denote-subdir "literature"
        citar-denote-template t)
(citar-denote-mode)
(diminish 'citar-denote-mode)

Existing notes that were linked using citar-denote-add-citekey are not detected as existing. Have I missed some piece of configuration?

reference key as target-finder?

Was playing a bit with your package and denote, and noticed something that sometimes comes up in the org-roam world.

The reference property citekey: you may want to consider an embark "target-finder" (or similar for hydra/transient) for that, so that users can act on it at point.

If you conclude yes, you may want to consider a syntax with already-existing finder: @key?

Which actually raises another issue: by default, you don't put the properties in an org property drawer, so this function doesn't work with that change.

https://github.com/emacs-citar/citar/blob/d183ec20c407983c4ae22089ec481f1a6f5cbe69/citar-org.el#L312

I think you want to wrap them in :properties: and :end:?

Reference key in Signature

Hi! I was thinking about an option of adding the reference key as the denote signature. This way, one could have the reference in the filename while still retaining the option of using descriptive titles like author-year etc.

Having the reference in the filename might also possibly make the lookup for reference notes easier, I suspect, but I don't know how that is solved currently.

What do you think? I could try do this myself and make a PR.

Miss candidate with citar-denote-find-citation

For example, this is a note content.

#+title: test
#+date: [2023-03-22 Wed 11:43]
#+filetags: :bib:
#+identifier: 20230322T114151

This is a test[cite:@taerweluc2013].


If there is a dot at the end of citation, when I use citar-denote-find-citation to find denote files related to citation taerweluc2013, it do not exist in the completion minibuffer.

If I delete the dot, then use citar-denote-find-citation, the candidate appeared.

image

with dot at the end of citation.

image

without dot.

Above picture shows, one reference disappeared. Any char at the end of citation will cause this problem.

Add additional information from bibliographic entry into note, with pre-defined formatting?

It seems like citar-denote already has all the functionality to read an entry in a bibliography,
and write its data to a note in denote, e.g. the citation key in the note or the authors/years/title as the note's filename.
This is awesome, but right now it seems like this functionality can only be utilized in a very narrow way.
It would be great to use this functionality a bit more flexibly.

What a lot of people do with similar note-taking apps, is to create notes for an entry in their bibliography,
such that basic pre-definable information about the bibliographic entry is written into the note automatically.
For example, I choose an entry just like I do right now with citar-denote, and citar-denote creates a note,
just as it already does. But in addition to writing the citation key in the front matter, I'd like it to write something
like

author: NAME
date: DATE
publisher: PUBLISHER 
isbn: ISBN
pages: PAGES
arXiv: ARXIV

underneath or in the denote front matter (don't know if denote limits what can go in the FM),
where the uppercase variables are read from the bibliography, and the exact information to be displayed
is configurable via the citar-denote package. I hope it's clear what I'm asking.

Meaningful use cases:

  • Adding the ISBN or arXiv identified makes rediscovery future-proof. Opposite to citation keys, it's not going to change or break. Even if citar-denote or denote itself should go away in the future, a literature note can be uniquely identified with a simple grep for its ISBN.

  • One might want to create a note for every author one's reading in one's note-taking app (here denote), and link to them, such that visiting the author's note and displaying backlinks informs one about all previous times someone has read something by them. Having the author there takes away manual work.

Author (year) as title

Hi,

is it possible to change the title of the note? In my field, we tend to talk about papers as "author (year)", with the consequence that we rarely know the titles of papers. However, citar-denote uses the title of the paper as the title of the note, and as far as I can tell there's no way to change this.

I think it would be really nice to have the option of customizing this. Can this be done? If not, are there any plans to add it?

add an easy way to insert a link to the note of a given reference?

Hi,
I appreciate the work you've put into this, and I think it's great.
I think it would be really useful to be able to quickly insert a link to the note attached to a given reference.
I imagine using the same interface as citar-denote-open-note, but inserting a denote link instead.

Feature request: Add support for citations in the backlinks buffer ?

Hi, I would like to discuss the addition of a new feature which I think would have its place in citar-denote (but might also require modification in denote?). I mostly use org-mode in my notes and am very fond of org-cite.

Imagine that I have a paper/reference that I cite in different notes (let's call them a.org, b.org, c.org). When I am in the note for this paper, I want to produce a backlinks buffer showing files that cite the paper (a.org, b.org, c.org) as well as the files linking directly to the current note (the default behaviour). Unfortunately, the backlinks are only registered for denote-type links but not citations.

I wrote the following function as a proof-of-concept of the functionality for org-cite :

(defun citar-denote-cite-backlinks ()
  "Construct a buffer of all the notes (in .org format) that cite
the current reference. This function must be called from a denote 
note.

TODO: add support for other citations provided by citar (latex,
markdown) ?
"
  (interactive)
   (let* ((file (buffer-file-name))
	  (key (citar-denote-retrieve-reference-key-value file 'org)))
     (if key
	 (xref--show-xrefs
	  (xref-matches-in-files (format "cite:@%s" key) (denote-directory-text-only-files))
	  nil)
       ;; check if current file is a reference note, add reference if needed and
       ;; rerun command
       (when (yes-or-no-p "Current buffer does not reference a bibliography item. Select a reference ?")
	 (citar-denote-add-citekey)
	 (citar-denote-cite-backlinks)))))

How can we extend the behaviour of denote-link-backlinks from within citar-denote to include the results of the above function ? Is it even possible in the current version of denote ?

I was unsure whether I should ask this question on the denote mailing list, but I feel that this is better suited for citar-denote.

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.