unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 2/2] bibtex.el: Add support for DOI URLs.
       [not found] <9b5b428bbf8cbf8590249081f69605cc82d0601b.1370990432.git.ruediger@c-plusplus.de>
@ 2013-06-11 22:41 ` Rüdiger Sonderfeld
  2013-06-13  2:50   ` Roland Winkler
  2013-06-25  9:19   ` [PATCH 2/2] " Roland Winkler
  0 siblings, 2 replies; 4+ messages in thread
From: Rüdiger Sonderfeld @ 2013-06-11 22:41 UTC (permalink / raw)
  To: emacs-devel; +Cc: winkler

Digital object identifier (DOI) are commonly used to provide
persistent citations.  Therefore it seems to be a good idea to provide
default support for them in bibtex.el.

* lisp/textmodes/bibtex.el (bibtex-doi-server-url): New variable.
  (bibtex-generate-url-list): Add support for DOI URLs.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/textmodes/bibtex.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 6280e19..b498da9 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1223,8 +1223,20 @@ (defcustom bibtex-summary-function 'bibtex-summary
   :type '(choice (const :tag "Default" bibtex-summary)
                  (function :tag "Personalized function")))
 
+(defcustom bibtex-doi-server-url (if (boundp 'org-doi-server-url)
+                                     org-doi-server-url
+                                   "http://dx.doi.org/")
+  "The URL of the DOI server."
+  :group 'bibtex
+  :version "24.4"
+  :type 'string)
+
 (defcustom bibtex-generate-url-list
-  '((("url" . ".*:.*")))
+  '((("url" . ".*:.*"))
+    (("doi" . "10\\.[0-9]+/.+")
+     ("doi" ".*"
+      (lambda (text)
+        (concat bibtex-doi-server-url text)))))
   "List of schemes for generating the URL of a BibTeX entry.
 These schemes are used by `bibtex-url'.
 
@@ -1261,6 +1273,7 @@ (defcustom bibtex-generate-url-list
      (\"volume\" \".*\" 0)
      (\"pages\" \"\\`[A-Z]?[0-9]+\" 0)))"
   :group 'bibtex
+  :version "24.4"
   :type '(repeat
           (cons :tag "Scheme"
                 (cons :tag "Matcher" :extra-offset 4
-- 
1.8.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] bibtex.el: Add support for DOI URLs.
  2013-06-11 22:41 ` [PATCH 2/2] bibtex.el: Add support for DOI URLs Rüdiger Sonderfeld
@ 2013-06-13  2:50   ` Roland Winkler
  2013-06-13  4:31     ` [PATCH] " Rüdiger Sonderfeld
  2013-06-25  9:19   ` [PATCH 2/2] " Roland Winkler
  1 sibling, 1 reply; 4+ messages in thread
From: Roland Winkler @ 2013-06-13  2:50 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: emacs-devel

On Wed Jun 12 2013 Rüdiger Sonderfeld wrote:
> +(defcustom bibtex-doi-server-url (if (boundp 'org-doi-server-url)
> +                                     org-doi-server-url
> +                                   "http://dx.doi.org/")
> +  "The URL of the DOI server."
> +  :group 'bibtex
> +  :version "24.4"
> +  :type 'string)
> +
>  (defcustom bibtex-generate-url-list
> -  '((("url" . ".*:.*")))
> +  '((("url" . ".*:.*"))
> +    (("doi" . "10\\.[0-9]+/.+")
> +     ("doi" ".*"
> +      (lambda (text)
> +        (concat bibtex-doi-server-url text)))))

Thanks.  I believe this patch is a bit complicated. It depends on
whether org-mode is loaded before or after bibtex-mode.  But this
can go straight into bibtex-generate-url-list (which the user can
customize if she doesn't like it; but I can only think of more
exotic reasons why this might be necessary).

Roland



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] bibtex.el: Add support for DOI URLs.
  2013-06-13  2:50   ` Roland Winkler
@ 2013-06-13  4:31     ` Rüdiger Sonderfeld
  0 siblings, 0 replies; 4+ messages in thread
From: Rüdiger Sonderfeld @ 2013-06-13  4:31 UTC (permalink / raw)
  To: Roland Winkler; +Cc: emacs-devel

On Thursday 13 June 2013 12:50:39 Roland Winkler wrote:
> Thanks.  I believe this patch is a bit complicated. It depends on
> whether org-mode is loaded before or after bibtex-mode.  But this
> can go straight into bibtex-generate-url-list (which the user can
> customize if she doesn't like it; but I can only think of more
> exotic reasons why this might be necessary).

I simplified the patch according to your suggestion.

-- 8< -------------------------------------------------------------------------- >8 --

Digital object identifier (DOI) are commonly used to provide
persistent citations.  Therefore it seems to be a good idea to provide
default support for them in bibtex.el.

* lisp/textmodes/bibtex.el (bibtex-generate-url-list): Add support for
  DOI URLs.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/textmodes/bibtex.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 6280e19..171f373 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1224,7 +1224,10 @@ (defcustom bibtex-summary-function 'bibtex-summary
                  (function :tag "Personalized function")))
 
 (defcustom bibtex-generate-url-list
-  '((("url" . ".*:.*")))
+  '((("url" . ".*:.*"))
+    (("doi" . "10\\.[0-9]+/.+")
+     "http://dx.doi.org/%s"
+     ("doi" ".*" 0)))
   "List of schemes for generating the URL of a BibTeX entry.
 These schemes are used by `bibtex-url'.
 
@@ -1261,6 +1264,7 @@ (defcustom bibtex-generate-url-list
      (\"volume\" \".*\" 0)
      (\"pages\" \"\\`[A-Z]?[0-9]+\" 0)))"
   :group 'bibtex
+  :version "24.4"
   :type '(repeat
           (cons :tag "Scheme"
                 (cons :tag "Matcher" :extra-offset 4
-- 
1.8.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] bibtex.el: Add support for DOI URLs.
  2013-06-11 22:41 ` [PATCH 2/2] bibtex.el: Add support for DOI URLs Rüdiger Sonderfeld
  2013-06-13  2:50   ` Roland Winkler
@ 2013-06-25  9:19   ` Roland Winkler
  1 sibling, 0 replies; 4+ messages in thread
From: Roland Winkler @ 2013-06-25  9:19 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: emacs-devel

On Wed Jun 12 2013 Rüdiger Sonderfeld wrote:
> Digital object identifier (DOI) are commonly used to provide
> persistent citations. Therefore it seems to be a good idea to
> provide default support for them in bibtex.el.

Thanks, done.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-25  9:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <9b5b428bbf8cbf8590249081f69605cc82d0601b.1370990432.git.ruediger@c-plusplus.de>
2013-06-11 22:41 ` [PATCH 2/2] bibtex.el: Add support for DOI URLs Rüdiger Sonderfeld
2013-06-13  2:50   ` Roland Winkler
2013-06-13  4:31     ` [PATCH] " Rüdiger Sonderfeld
2013-06-25  9:19   ` [PATCH 2/2] " Roland Winkler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).