From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adonay Felipe Nogueira Subject: Re: How do you store web pages for reference? Date: Tue, 14 Mar 2017 09:17:19 -0300 Message-ID: <87k27scasw.fsf@openmailbox.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnlOX-0001JT-8D for emacs-orgmode@gnu.org; Tue, 14 Mar 2017 08:17:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnlOS-0003d9-Ki for emacs-orgmode@gnu.org; Tue, 14 Mar 2017 08:17:41 -0400 Received: from lb1.openmailbox.org ([5.79.108.160]:58678 helo=mail.openmailbox.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnlOS-0003ba-CL for emacs-orgmode@gnu.org; Tue, 14 Mar 2017 08:17:36 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Note 1: You might need to load "org-bibtex". Note 2: "org-bibtex" only accepts some properties to be exposed to org-capture, it's not an exact parser like "bibtex" package. As a future suggestion: I would like to suggest "org-bibtex" to be improved so as to take all fields parsed by the "bibtex" package, but I don't know how to do that yet. This would allow non-default BibTeX entries and fields such as the "url" field (which is already supported), and other ones such as "urlaccessdate" (this one is used by ABNTeX) and "note" to be made available transparently through org-capture templates. Note 3: Each time a reference entry is found in a refere file, such entry should be removed from the references list, so as to avoid such reference key being matched twice, even if there is a repeated reference file. This is currently the only control mechanism that exists for this hack. Note 4: As an improvement, I still have to find a way to use an org-capture template without being required to bind such template to a key, as this can conflict with other templates or keys. I'm accepting suggestions for such as long as I can figure out how it exactly works. Note 5: I'm not a programmer, so I'm slow on picking up programming concepts or languages' syntax. Note 6: You must evaluate the first source code block once for the first time the file is openned and everytime you adapt/change/modify the source code block (for both cases: unless you preset the "org-capture-templates" to reflect the same behavior in your overall Emacs setup. For the last case: you must also make sure that there are no old duplicates of such items in "org-capture-templates" otherwise they might cause obsolete results or always raise an error). Note 7: You must evaluate the second source code block (import-references) once before exporting if either the "Reference" headlin= e is empty, if the references inside "References" headline is outdated, and if the overall document contains a broken link (this one will already cause an error that will stop exporting if broken-links #+OPTION is set to nil). Having read the notes above, I do the following: # Begin of Org file #+OPTIONS: d:(not "BibTeX_Importer") :BibTeX_Importer: #+BEGIN_SRC emacs-lisp :results silent (add-to-list 'org-capture-templates '("B" "BibTeX references" item (file+headline reference-parent-file "References") "<<%:key>> %:author. *%:title*. %:year. %:annote. _[[%:url][Source]]_." :immediate-finish t)) #+END_SRC #+NAME: reference-files - /home/adfeno/Publico/Referencias_BibTeX.bib #+NAME: references - Stallman-2015-Free_Software_and_Your_Freedom #+NAME: import-references #+BEGIN_SRC emacs-lisp :var reference-parent-file=3D(buffer-file-name) :var= reference-files=3Dreference-files :var referenced-entries=3Dreferences (dolist (current-reference-file reference-files) (find-file (car current-reference-file)) (let ((reference-file-buffer (buffer-name))) (dolist (current-entry referenced-entries) (set-buffer reference-file-buffer) (when (bibtex-find-entry (car current-entry)) (org-capture nil "B") (setq referenced-entries (delete current-entry referenced-entries)))))) #+END_SRC :END: * References # End of Org file Respectfully, Adonay. --=20 * https://libreplanet.org/wiki/User:Adfeno * Palestrante e consultor sobre software livre (n=C3=A3o confundir com gratis). * "WhatsApp"? Ele n=C3=A3o =C3=A9 livre, por isso n=C3=A3o uso. Iguais a el= e prefiro Ring, ou Tox. Quer outras formas de contato? Adicione o vCard que est=C3=A1 no endere=C3=A7o acima aos teus contatos. * Pretende me enviar arquivos .doc, .ppt, .cdr, ou .mp3? OK, eu aceito, mas n=C3=A3o repasso. Entrego apenas em formatos favor=C3=A1veis = ao software livre. Favor entrar em contato em caso de d=C3=BAvida. * "People said I should accept the world. Bullshit! I don't accept the world." --- Richard Stallman