emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* doi proxy , a test patch
@ 2012-05-23 11:54 Fabrice Pardo
  2012-05-23 12:27 ` Jambunathan K
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Pardo @ 2012-05-23 11:54 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

Hi,

My institution library permits direct access to abstracts
with pdf contents if we access to article through an address like 
http://dx.doi.org.my.instituti.on/... instead of http://dx.doi.org/...

In the attached patch, I have defined a new variable org-doi-proxy
which can be customized by the user.


[-- Attachment #2: org.el.diff --]
[-- Type: text/x-patch, Size: 773 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 05f5375..c5d17a9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1838,6 +1838,10 @@ For more examples, see the system specific constants
 			(string :tag "Command")
 			(sexp :tag "Lisp form")))))
 
+(defcustom org-doi-proxy "http://dx.doi.org/"
+  "The doi proxy"
+  :group 'org-link-follow
+  :type 'string)
 
 
 (defgroup org-refile nil
@@ -9714,7 +9718,7 @@ application the system uses for this file type."
 					 path))))
 
 	 ((string= type "doi")
-	  (browse-url (concat "http://dx.doi.org/" (if (org-string-match-p "[[:nonascii:] ]" path)
+	  (browse-url (concat org-doi-proxy (if (org-string-match-p "[[:nonascii:] ]" path)
 						       (org-link-escape
 							path org-link-escape-chars-browser)
 						     path))))

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

* Re: doi proxy , a test patch
  2012-05-23 11:54 doi proxy , a test patch Fabrice Pardo
@ 2012-05-23 12:27 ` Jambunathan K
  2012-05-23 13:04   ` Christian Moe
  0 siblings, 1 reply; 8+ messages in thread
From: Jambunathan K @ 2012-05-23 12:27 UTC (permalink / raw)
  To: Fabrice Pardo; +Cc: emacs-orgmode


Is there a way one can avoid the defcustom and achieve the same effect
using link abbreviations? I don't know.

  (info "(org) Link abbreviations")


Fabrice Pardo <fabrice.pardo@lpn.cnrs.fr> writes:

> Hi,
>
> My institution library permits direct access to abstracts
> with pdf contents if we access to article through an address like
> http://dx.doi.org.my.instituti.on/... instead of http://dx.doi.org/...
>
> In the attached patch, I have defined a new variable org-doi-proxy
> which can be customized by the user.
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 05f5375..c5d17a9 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -1838,6 +1838,10 @@ For more examples, see the system specific constants
>  			(string :tag "Command")
>  			(sexp :tag "Lisp form")))))
>  
> +(defcustom org-doi-proxy "http://dx.doi.org/"
> +  "The doi proxy"
> +  :group 'org-link-follow
> +  :type 'string)
>  
>  
>  (defgroup org-refile nil
> @@ -9714,7 +9718,7 @@ application the system uses for this file type."
>  					 path))))
>  
>  	 ((string= type "doi")
> -	  (browse-url (concat "http://dx.doi.org/" (if (org-string-match-p "[[:nonascii:] ]" path)
> +	  (browse-url (concat org-doi-proxy (if (org-string-match-p "[[:nonascii:] ]" path)
>  						       (org-link-escape
>  							path org-link-escape-chars-browser)
>  						     path))))
>

-- 

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

* Re: doi proxy , a test patch
  2012-05-23 12:27 ` Jambunathan K
@ 2012-05-23 13:04   ` Christian Moe
  2012-05-23 15:12     ` Fabrice Pardo
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Moe @ 2012-05-23 13:04 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode, Fabrice Pardo

I think so.

I find DOI links simplify life a great deal in any case:

(setq org-link-abbrev-alist
        '(("doi" . "http://dx.doi.org/")))

e.g. doi:10.1016/j.jphysparis.2011.09.011

(Simply replace "dx.doi.org" with any privileged access point your 
institution might have)

Yours,
Christian

On 5/23/12 2:27 PM, Jambunathan K wrote:
>
> Is there a way one can avoid the defcustom and achieve the same effect
> using link abbreviations? I don't know.
>
>    (info "(org) Link abbreviations")
>
>
> Fabrice Pardo<fabrice.pardo@lpn.cnrs.fr>  writes:
>
>> Hi,
>>
>> My institution library permits direct access to abstracts
>> with pdf contents if we access to article through an address like
>> http://dx.doi.org.my.instituti.on/... instead of http://dx.doi.org/...
>>
>> In the attached patch, I have defined a new variable org-doi-proxy
>> which can be customized by the user.
>>
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 05f5375..c5d17a9 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -1838,6 +1838,10 @@ For more examples, see the system specific constants
>>   			(string :tag "Command")
>>   			(sexp :tag "Lisp form")))))
>>
>> +(defcustom org-doi-proxy "http://dx.doi.org/"
>> +  "The doi proxy"
>> +  :group 'org-link-follow
>> +  :type 'string)
>>
>>
>>   (defgroup org-refile nil
>> @@ -9714,7 +9718,7 @@ application the system uses for this file type."
>>   					 path))))
>>
>>   	 ((string= type "doi")
>> -	  (browse-url (concat "http://dx.doi.org/" (if (org-string-match-p "[[:nonascii:] ]" path)
>> +	  (browse-url (concat org-doi-proxy (if (org-string-match-p "[[:nonascii:] ]" path)
>>   						       (org-link-escape
>>   							path org-link-escape-chars-browser)
>>   						     path))))
>>
>

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

* Re: doi proxy , a test patch
  2012-05-23 13:04   ` Christian Moe
@ 2012-05-23 15:12     ` Fabrice Pardo
  2012-05-23 16:05       ` Christian Moe
  2012-05-23 16:39       ` Jambunathan K
  0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Pardo @ 2012-05-23 15:12 UTC (permalink / raw)
  To: emacs-orgmode

Does it really achieve the same effect ?
Don't you need to use double square bracket
eg [[doi:10.1016/j.jphysparis.2011.09.011]]
instead of doi:10.1016/j.jphysparis.2011.09.011 ?

If I'm wrong please correct me, I'm a newbie.

My proposal is to customize the already defined doi External link,
which was hardcoded in org-open-at-point function.


On 12-05-23 03:04 PM, Christian Moe wrote:
> I think so.
>
> I find DOI links simplify life a great deal in any case:
>
> (setq org-link-abbrev-alist
> '(("doi" . "http://dx.doi.org/")))
>
> e.g. doi:10.1016/j.jphysparis.2011.09.011
>
> (Simply replace "dx.doi.org" with any privileged access point your
> institution might have)
>
> Yours,
> Christian
>
> On 5/23/12 2:27 PM, Jambunathan K wrote:
>>
>> Is there a way one can avoid the defcustom and achieve the same effect
>> using link abbreviations? I don't know.
>>
>> (info "(org) Link abbreviations")
>>
>>
>> Fabrice Pardo<fabrice.pardo@lpn.cnrs.fr> writes:
>>
>>> Hi,
>>>
>>> My institution library permits direct access to abstracts
>>> with pdf contents if we access to article through an address like
>>> http://dx.doi.org.my.instituti.on/... instead of http://dx.doi.org/...
>>>
>>> In the attached patch, I have defined a new variable org-doi-proxy
>>> which can be customized by the user.
>>>
>>> diff --git a/lisp/org.el b/lisp/org.el
>>> index 05f5375..c5d17a9 100644
>>> --- a/lisp/org.el
>>> +++ b/lisp/org.el
>>> @@ -1838,6 +1838,10 @@ For more examples, see the system specific
>>> constants
>>> (string :tag "Command")
>>> (sexp :tag "Lisp form")))))
>>>
>>> +(defcustom org-doi-proxy "http://dx.doi.org/"
>>> + "The doi proxy"
>>> + :group 'org-link-follow
>>> + :type 'string)
>>>
>>>
>>> (defgroup org-refile nil
>>> @@ -9714,7 +9718,7 @@ application the system uses for this file type."
>>> path))))
>>>
>>> ((string= type "doi")
>>> - (browse-url (concat "http://dx.doi.org/" (if (org-string-match-p
>>> "[[:nonascii:] ]" path)
>>> + (browse-url (concat org-doi-proxy (if (org-string-match-p
>>> "[[:nonascii:] ]" path)
>>> (org-link-escape
>>> path org-link-escape-chars-browser)
>>> path))))
>>>
>>
>

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

* Re: doi proxy , a test patch
  2012-05-23 15:12     ` Fabrice Pardo
@ 2012-05-23 16:05       ` Christian Moe
  2012-05-23 16:39       ` Jambunathan K
  1 sibling, 0 replies; 8+ messages in thread
From: Christian Moe @ 2012-05-23 16:05 UTC (permalink / raw)
  To: Fabrice Pardo; +Cc: emacs-orgmode

Uhhh... no, it doesn't. Sorry about the noise!

(I've had that customization for a long time, and don't think I 
noticed that a hardcoded doi link type was introduced, so I didn't 
even test before posting.)

Yours,
Christian

On 5/23/12 5:12 PM, Fabrice Pardo wrote:
> Does it really achieve the same effect ?
> Don't you need to use double square bracket
> eg [[doi:10.1016/j.jphysparis.2011.09.011]]
> instead of doi:10.1016/j.jphysparis.2011.09.011 ?
>
> If I'm wrong please correct me, I'm a newbie.
>
> My proposal is to customize the already defined doi External link,
> which was hardcoded in org-open-at-point function.
>
>
> On 12-05-23 03:04 PM, Christian Moe wrote:
>> I think so.
>>
>> I find DOI links simplify life a great deal in any case:
>>
>> (setq org-link-abbrev-alist
>> '(("doi" . "http://dx.doi.org/")))
>>
>> e.g. doi:10.1016/j.jphysparis.2011.09.011
>>
>> (Simply replace "dx.doi.org" with any privileged access point your
>> institution might have)
>>
>> Yours,
>> Christian
>>
>> On 5/23/12 2:27 PM, Jambunathan K wrote:
>>>
>>> Is there a way one can avoid the defcustom and achieve the same effect
>>> using link abbreviations? I don't know.
>>>
>>> (info "(org) Link abbreviations")
>>>
>>>
>>> Fabrice Pardo<fabrice.pardo@lpn.cnrs.fr> writes:
>>>
>>>> Hi,
>>>>
>>>> My institution library permits direct access to abstracts
>>>> with pdf contents if we access to article through an address like
>>>> http://dx.doi.org.my.instituti.on/... instead of
>>>> http://dx.doi.org/...
>>>>
>>>> In the attached patch, I have defined a new variable org-doi-proxy
>>>> which can be customized by the user.
>>>>
>>>> diff --git a/lisp/org.el b/lisp/org.el
>>>> index 05f5375..c5d17a9 100644
>>>> --- a/lisp/org.el
>>>> +++ b/lisp/org.el
>>>> @@ -1838,6 +1838,10 @@ For more examples, see the system specific
>>>> constants
>>>> (string :tag "Command")
>>>> (sexp :tag "Lisp form")))))
>>>>
>>>> +(defcustom org-doi-proxy "http://dx.doi.org/"
>>>> + "The doi proxy"
>>>> + :group 'org-link-follow
>>>> + :type 'string)
>>>>
>>>>
>>>> (defgroup org-refile nil
>>>> @@ -9714,7 +9718,7 @@ application the system uses for this file
>>>> type."
>>>> path))))
>>>>
>>>> ((string= type "doi")
>>>> - (browse-url (concat "http://dx.doi.org/" (if (org-string-match-p
>>>> "[[:nonascii:] ]" path)
>>>> + (browse-url (concat org-doi-proxy (if (org-string-match-p
>>>> "[[:nonascii:] ]" path)
>>>> (org-link-escape
>>>> path org-link-escape-chars-browser)
>>>> path))))
>>>>
>>>
>>
>
>
>

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

* Re: doi proxy , a test patch
  2012-05-23 15:12     ` Fabrice Pardo
  2012-05-23 16:05       ` Christian Moe
@ 2012-05-23 16:39       ` Jambunathan K
  2012-05-24  8:50         ` Fabrice Pardo
  1 sibling, 1 reply; 8+ messages in thread
From: Jambunathan K @ 2012-05-23 16:39 UTC (permalink / raw)
  To: Fabrice Pardo; +Cc: emacs-orgmode


I know nothing about doi services.  From what you say, the proxy servers
are not inter-changeable.

For the sake of argument -

Can a given Org document contain links to two different doi proxies?  In
that case will a defcustom help.

Fabrice Pardo <fabrice.pardo@lpn.cnrs.fr> writes:

> Does it really achieve the same effect ?
> Don't you need to use double square bracket
> eg [[doi:10.1016/j.jphysparis.2011.09.011]]
> instead of doi:10.1016/j.jphysparis.2011.09.011 ?
>
> If I'm wrong please correct me, I'm a newbie.
>
> My proposal is to customize the already defined doi External link,
> which was hardcoded in org-open-at-point function.
>
>
> On 12-05-23 03:04 PM, Christian Moe wrote:
>> I think so.
>>
>> I find DOI links simplify life a great deal in any case:
>>
>> (setq org-link-abbrev-alist
>> '(("doi" . "http://dx.doi.org/")))
>>
>> e.g. doi:10.1016/j.jphysparis.2011.09.011
>>
>> (Simply replace "dx.doi.org" with any privileged access point your
>> institution might have)
>>
>> Yours,
>> Christian
>>
>> On 5/23/12 2:27 PM, Jambunathan K wrote:
>>>
>>> Is there a way one can avoid the defcustom and achieve the same effect
>>> using link abbreviations? I don't know.
>>>
>>> (info "(org) Link abbreviations")
>>>
>>>
>>> Fabrice Pardo<fabrice.pardo@lpn.cnrs.fr> writes:
>>>
>>>> Hi,
>>>>
>>>> My institution library permits direct access to abstracts
>>>> with pdf contents if we access to article through an address like
>>>> http://dx.doi.org.my.instituti.on/... instead of http://dx.doi.org/...
>>>>
>>>> In the attached patch, I have defined a new variable org-doi-proxy
>>>> which can be customized by the user.
>>>>
>>>> diff --git a/lisp/org.el b/lisp/org.el
>>>> index 05f5375..c5d17a9 100644
>>>> --- a/lisp/org.el
>>>> +++ b/lisp/org.el
>>>> @@ -1838,6 +1838,10 @@ For more examples, see the system specific
>>>> constants
>>>> (string :tag "Command")
>>>> (sexp :tag "Lisp form")))))
>>>>
>>>> +(defcustom org-doi-proxy "http://dx.doi.org/"
>>>> + "The doi proxy"
>>>> + :group 'org-link-follow
>>>> + :type 'string)
>>>>
>>>>
>>>> (defgroup org-refile nil
>>>> @@ -9714,7 +9718,7 @@ application the system uses for this file type."
>>>> path))))
>>>>
>>>> ((string= type "doi")
>>>> - (browse-url (concat "http://dx.doi.org/" (if (org-string-match-p
>>>> "[[:nonascii:] ]" path)
>>>> + (browse-url (concat org-doi-proxy (if (org-string-match-p
>>>> "[[:nonascii:] ]" path)
>>>> (org-link-escape
>>>> path org-link-escape-chars-browser)
>>>> path))))
>>>>
>>>
>>
>
>
>

-- 

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

* Re: doi proxy , a test patch
  2012-05-23 16:39       ` Jambunathan K
@ 2012-05-24  8:50         ` Fabrice Pardo
  2012-07-05 17:36           ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Pardo @ 2012-05-24  8:50 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Jambunathan K

On 12-05-23 06:39 PM, Jambunathan K wrote:
> Can a given Org document contain links to two different doi proxies?  In
> that case will a defcustom help.

No, my doi server is an enhancement or the official http://dx.doi.org/

Hence it would be a goog thing to redirect all the org-mode external 
links to a customizable address, and to replace the hard-coded string
"http://dx.doi.org/" in org-open-at-point by a variable.

Regards

-- 
Fabrice

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

* Re: doi proxy , a test patch
  2012-05-24  8:50         ` Fabrice Pardo
@ 2012-07-05 17:36           ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-07-05 17:36 UTC (permalink / raw)
  To: Fabrice Pardo; +Cc: emacs-orgmode, Jambunathan K

Hi Fabrice,

Fabrice Pardo <fabrice.pardo@lpn.cnrs.fr> writes:

> On 12-05-23 06:39 PM, Jambunathan K wrote:
>> Can a given Org document contain links to two different doi proxies?  In
>> that case will a defcustom help.
>
> No, my doi server is an enhancement or the official http://dx.doi.org/
>
> Hence it would be a goog thing to redirect all the org-mode external links
> to a customizable address, and to replace the hard-coded string
> "http://dx.doi.org/" in org-open-at-point by a variable.

There is now `org-doi-server-url'.

Thanks,

-- 
 Bastien

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

end of thread, other threads:[~2012-07-05 17:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-23 11:54 doi proxy , a test patch Fabrice Pardo
2012-05-23 12:27 ` Jambunathan K
2012-05-23 13:04   ` Christian Moe
2012-05-23 15:12     ` Fabrice Pardo
2012-05-23 16:05       ` Christian Moe
2012-05-23 16:39       ` Jambunathan K
2012-05-24  8:50         ` Fabrice Pardo
2012-07-05 17:36           ` Bastien

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).