emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Feature Request. org-bibtex-tags-are-keywords inherit tags
@ 2014-04-04 10:43 Leonard Randall
  2014-04-04 11:31 ` Leonard Randall
  0 siblings, 1 reply; 9+ messages in thread
From: Leonard Randall @ 2014-04-04 10:43 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,
Right now when you run org-bibtex with org-bibtex-tags-are-keywords set to
true, only the tags assigned directly to the headline are converted. So for
instance if run org bibtex on a file set up like this.
* Authority  :auth:
** Kant's Views on authority :Kant:
:properties:
(bibliography info here)
:end:
This behavior is controlled by the function org-bibtex-headline in
org-bibtex.el. I can change the behavior on my machine by changing
`org-get-local-tags-at' to `org-get-tags-at' in

[-- Attachment #2: Type: text/html, Size: 1127 bytes --]

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-04 10:43 Feature Request. org-bibtex-tags-are-keywords inherit tags Leonard Randall
@ 2014-04-04 11:31 ` Leonard Randall
  2014-04-17 14:25   ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Leonard Randall @ 2014-04-04 11:31 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,
I apologize, for the last short post. The keybinding for new headline in
org-mode sends an email in gmail. Let us try this again.

Right now when you run org-bibtex with org-bibtex-tags-are-keywords
set to true, only the tags assigned directly to the headline are
converted. So, for instance, if I run org bibtex on a file set up like
this.
#+---------------------EXAMPLE--------------------------------------------
* Journal articles on Authortity                                    :auth:
** Kant's Mature View of Legal Authority                            :Kant:
:PROPERTIES:
(bib info here)
:END:
#+-----------------------END-EXAMPLE--------------------------------------

The .bib file that is exported only inherits the second tag `:Kant:'
Having tag inheritance would be very useful for organizing large
bibliographies. This would give people the convenience of managing and
organizing the files in org-mode, but still allow them to use some of
the convenient features of gui based bibtex browsers. It would also
allow people to share their bibliographies, along with their tags with
colleagues who have not yet been converted to using org-mode.

This relevant behavior is controlled by the function
org-bibtex-headline in org-bibtex.el. I can change the behavior on
my machine by changing `org-get-local-tags-at' to `org-get-tags-at'
in my local version of org-bibtex.el. This of course does not fix
the bug I mentioned last week. (Bug: Error with org-bibtex export with tags
when using custom
bibtypes<http://thread.gmane.org/gmane.emacs.orgmode/84198/focus=84215>
)However the cases where the original
org-bibtex works this function works as well. Of course not everyone
would want this on all of the time. However it seems like it would not be
too hard to make a variable such as `org-bibtex-tags-are-keywords-inherit'
and modify `org-bibtex-headline' so that you can toggle tag inheritance.
Unfortunately, my knowledge of lisp is particularly rudimentary so I can't
offer to do it myself.
Let me know what you think
Thanks so much,
Leonard



On Fri, Apr 4, 2014 at 11:43 AM, Leonard Randall <
leonard.a.randall@gmail.com> wrote:

> Hi,
> Right now when you run org-bibtex with org-bibtex-tags-are-keywords set to
> true, only the tags assigned directly to the headline are converted. So for
> instance if run org bibtex on a file set up like this.
> * Authority  :auth:
> ** Kant's Views on authority :Kant:
> :properties:
> (bibliography info here)
> :end:
> This behavior is controlled by the function org-bibtex-headline in
> org-bibtex.el. I can change the behavior on my machine by changing
> `org-get-local-tags-at' to `org-get-tags-at' in
>

[-- Attachment #2: Type: text/html, Size: 8503 bytes --]

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-04 11:31 ` Leonard Randall
@ 2014-04-17 14:25   ` Bastien
       [not found]     ` <CAMRQoAnD9W7DpuXp5ELsN2fTBPJ2URS3p3+=ERZxM_ESduXtmQ@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-04-17 14:25 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hi Leonard,

Leonard Randall <leonard.a.randall@gmail.com> writes:

> Unfortunately, my knowledge of lisp is particularly rudimentary so I
> can't offer to do it myself.

I think you certainly underestimate yourself and can start hacking :)

1. install Git on your machine
2. ~$ git clone git://orgmode.org/org-mode.git
3. ~$ cd org-mode/
4. Edit lisp/org-bibtex.el
5. Use C-x C-e at the end of the edited functions and check it works

When you're done, simple C-x v = in the edited buffer, C-x o to go to
that buffer, then save it and send it to us.

Otherwise let's wait someone with a better understanding than mine
can hack it together.  But I'm sure you can give us something that
will be useful enough.

Best,

-- 
 Bastien

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
       [not found]     ` <CAMRQoAnD9W7DpuXp5ELsN2fTBPJ2URS3p3+=ERZxM_ESduXtmQ@mail.gmail.com>
@ 2014-04-18  9:02       ` Leonard Randall
  2014-04-18 11:14         ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Leonard Randall @ 2014-04-18  9:02 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1594 bytes --]

I
​
t was indeed easier than I had thought. I tested the modified function on
my reading list file and it works as expected under most conditions (It
plays well with other variables etc.). The only exception was the
previously mentioned issue with nonstandard bibtex types. If I have time
this weekend, I will try to look into this problem. (I think it might be
time to break down and actually learn lisp.)

Attached is the requested diff. In addition to adding the new variable
`org-bibtex-tags-inherit' and editing the function `org-bibtex-headline', I
modified a couple of customize doc strings to reflect the change. I also
edited one doc string that seemed to refer to an old variable that is no
longer in use.


On 17 April 2014 15:25, Bastien <bzg@gnu.org> wrote:

> Hi Leonard,
>
> Leonard Randall <leonard.a.randall@gmail.com> writes:
>
> > Unfortunately, my knowledge of lisp is particularly rudimentary so I
> > can't offer to do it myself.
>
> I think you certainly underestimate yourself and can start hacking :)
>
> 1. install Git on your machine
> 2. ~$ git clone git://orgmode.org/org-mode.git
> 3. ~$ cd org-mode/
> 4. Edit lisp/org-bibtex.el
> 5. Use C-x C-e at the end of the edited functions and check it works
>
> When you're done, simple C-x v = in the edited buffer, C-x o to go to
> that buffer, then save it and send it to us.
>
> Otherwise let's wait someone with a better understanding than mine
> can hack it together.  But I'm sure you can give us something that
> will be useful enough.
>
> Best,
>
> --
>  Bastien
>

[-- Attachment #1.2: Type: text/html, Size: 2696 bytes --]

[-- Attachment #2: org-bibtexpatch.diff --]
[-- Type: text/plain, Size: 1995 bytes --]

diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index ed645e5..848d0e4 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -270,20 +270,31 @@ with underscores, and characters that are not permitted in org
 tags will be removed.
 
 If t, local tags in an org entry will be exported as a
-comma-separated string of keywords when exported to bibtex.  Tags
-defined in `org-bibtex-tags' or `org-bibtex-no-export-tags' will
-not be exported."
+comma-separated string of keywords when exported to bibtex. If
+`org-bibtex-inherit-tags' is t, inherited tags will also be
+exported as keywords. Tags defined in `org-bibtex-tags' or
+`org-bibtex-no-export-tags' will not be exported."
   :group 'org-bibtex
   :version "24.1"
   :type 'boolean)
 
 (defcustom org-bibtex-no-export-tags nil
   "List of tag(s) that should not be converted to keywords.
-This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t."
+This variable is relevant only if `org-bibtex-tags-are-keywords' is t."
   :group 'org-bibtex
   :version "24.1"
   :type '(repeat :tag "Tag" (string)))
 
+(defcustom org-bibtex-inherit-tags nil
+  "This variable controlls whether inherited tags are included
+when converting org tags to bibtex keywords. It is relevant only
+if `org-bibtex-tags-are-keywords' is t. Tag inheritence itself is
+controlled by `org-use-tag-inheritence' and
+`org-exclude-tags-from-inheritence'"
+  :group 'org-bibtex
+  :version "24.1"
+  :type 'boolean)
+
 (defcustom org-bibtex-type-property-name "btype"
   "Property in which to store bibtex entry type (e.g., article)."
   :group 'org-bibtex
@@ -332,7 +343,9 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t."
 					  (append org-bibtex-tags
 						  org-bibtex-no-export-tags))
 			    tag))
-			(org-get-local-tags-at))))))
+			(if org-bibtex-inherit-tags
+			    (org-get-tags-at)
+			  (org-get-local-tags-at)))))))
     (when type
       (let ((entry (format
 		    "@%s{%s,\n%s\n}\n" type id

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-18  9:02       ` Leonard Randall
@ 2014-04-18 11:14         ` Bastien
  2014-04-18 13:44           ` Leonard Randall
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-04-18 11:14 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hi Leonard,

thanks for starting this!  A few stylistic comments inline.

Leonard Randall <leonard.a.randall@gmail.com> writes:

> diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
> index ed645e5..848d0e4 100644
> --- a/lisp/org-bibtex.el
> +++ b/lisp/org-bibtex.el
> @@ -270,20 +270,31 @@ with underscores, and characters that are not permitted in org
>  tags will be removed.
>  
>  If t, local tags in an org entry will be exported as a
> -comma-separated string of keywords when exported to bibtex.  Tags
> -defined in `org-bibtex-tags' or `org-bibtex-no-export-tags' will
> -not be exported."
> +comma-separated string of keywords when exported to bibtex. If

Make sure to end sentences with two spaces.

>  (defcustom org-bibtex-no-export-tags nil
>    "List of tag(s) that should not be converted to keywords.
> -This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t."
> +This variable is relevant only if `org-bibtex-tags-are-keywords' is t."
>    :group 'org-bibtex
>    :version "24.1"
>    :type '(repeat :tag "Tag" (string)))

I fixed this docstring from the maint branch, you may need to pull
again and rewrite your changes.

> +(defcustom org-bibtex-inherit-tags nil
> +  "This variable controlls whether inherited tags are included

The first line of the docstring should be a sentence.

> +when converting org tags to bibtex keywords. It is relevant only
> +if `org-bibtex-tags-are-keywords' is t. Tag inheritence itself is
> +controlled by `org-use-tag-inheritence' and
> +`org-exclude-tags-from-inheritence'"

There is a missing fullstop at the end, and missing double-space
between sentences.

> +  :group 'org-bibtex
> +  :version "24.1"
> +  :type 'boolean)

Use 

  :version "25.1"
  :package-version '(Org . "8.3")

here, so that users will know the option is new in Org 8.3 (the next
version that will be released from the master branc) and in Emacs 25.1
(the next Emacs stable version that will contain 8.3.)

Otherwise, the patch looks good.  Please resubmit it from a fresh pull
with the modifications I suggested.

Thanks in advance!

-- 
 Bastien

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-18 11:14         ` Bastien
@ 2014-04-18 13:44           ` Leonard Randall
  2014-04-18 14:47             ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Leonard Randall @ 2014-04-18 13:44 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2364 bytes --]

Hi Bastien,
Thanks for the feedback. I have attached the modified patch.
All best,
Leonard


On 18 April 2014 12:14, Bastien <bzg@gnu.org> wrote:

> Hi Leonard,
>
> thanks for starting this!  A few stylistic comments inline.
>
> Leonard Randall <leonard.a.randall@gmail.com> writes:
>
> > diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
> > index ed645e5..848d0e4 100644
> > --- a/lisp/org-bibtex.el
> > +++ b/lisp/org-bibtex.el
> > @@ -270,20 +270,31 @@ with underscores, and characters that are not
> permitted in org
> >  tags will be removed.
> >
> >  If t, local tags in an org entry will be exported as a
> > -comma-separated string of keywords when exported to bibtex.  Tags
> > -defined in `org-bibtex-tags' or `org-bibtex-no-export-tags' will
> > -not be exported."
> > +comma-separated string of keywords when exported to bibtex. If
>
> Make sure to end sentences with two spaces.
>
> >  (defcustom org-bibtex-no-export-tags nil
> >    "List of tag(s) that should not be converted to keywords.
> > -This variable is relevant only if `org-bibtex-export-tags-as-keywords'
> is t."
> > +This variable is relevant only if `org-bibtex-tags-are-keywords' is t."
> >    :group 'org-bibtex
> >    :version "24.1"
> >    :type '(repeat :tag "Tag" (string)))
>
> I fixed this docstring from the maint branch, you may need to pull
> again and rewrite your changes.
>
> > +(defcustom org-bibtex-inherit-tags nil
> > +  "This variable controlls whether inherited tags are included
>
> The first line of the docstring should be a sentence.
>
> > +when converting org tags to bibtex keywords. It is relevant only
> > +if `org-bibtex-tags-are-keywords' is t. Tag inheritence itself is
> > +controlled by `org-use-tag-inheritence' and
> > +`org-exclude-tags-from-inheritence'"
>
> There is a missing fullstop at the end, and missing double-space
> between sentences.
>
> > +  :group 'org-bibtex
> > +  :version "24.1"
> > +  :type 'boolean)
>
> Use
>
>   :version "25.1"
>   :package-version '(Org . "8.3")
>
> here, so that users will know the option is new in Org 8.3 (the next
> version that will be released from the master branc) and in Emacs 25.1
> (the next Emacs stable version that will contain 8.3.)
>
> Otherwise, the patch looks good.  Please resubmit it from a fresh pull
> with the modifications I suggested.
>
> Thanks in advance!
>
> --
>  Bastien
>

[-- Attachment #1.2: Type: text/html, Size: 3236 bytes --]

[-- Attachment #2: org-bibtexpatch2.diff --]
[-- Type: text/plain, Size: 1804 bytes --]

diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index cdb12b7..516f2cf 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -270,9 +270,10 @@ with underscores, and characters that are not permitted in org
 tags will be removed.
 
 If t, local tags in an org entry will be exported as a
-comma-separated string of keywords when exported to bibtex.  Tags
-defined in `org-bibtex-tags' or `org-bibtex-no-export-tags' will
-not be exported."
+comma-separated string of keywords when exported to bibtex.  If
+`org-bibtex-inherit-tags' is t, inherited tags will also be
+exported as keywords.  Tags defined in `org-bibtex-tags' or
+`org-bibtex-no-export-tags' will not be exported."
   :group 'org-bibtex
   :version "24.1"
   :type 'boolean)
@@ -284,6 +285,17 @@ This variable is relevant only if `org-bibtex-tags-are-keywords' is t."
   :version "24.1"
   :type '(repeat :tag "Tag" (string)))
 
+(defcustom org-bibtex-inherit-tags nil
+  "Controls whether inherited tags are converted to bibtex keywords.
+It is relevant only if `org-bibtex-tags-are-keywords' is t.  Tag 
+inheritence itself is controlled by `org-use-tag-inheritence' and
+`org-exclude-tags-from-inheritence'."
+  :group 'org-bibtex
+  :version "25.1"
+  :package-version '(Org . "8.3")
+  :type 'boolean)
+
+
 (defcustom org-bibtex-type-property-name "btype"
   "Property in which to store bibtex entry type (e.g., article)."
   :group 'org-bibtex
@@ -332,7 +344,9 @@ This variable is relevant only if `org-bibtex-tags-are-keywords' is t."
 					  (append org-bibtex-tags
 						  org-bibtex-no-export-tags))
 			    tag))
-			(org-get-local-tags-at))))))
+			(if org-bibtex-inherit-tags
+			    (org-get-tags-at)
+			  (org-get-local-tags-at)))))))
     (when type
       (let ((entry (format
 		    "@%s{%s,\n%s\n}\n" type id

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-18 13:44           ` Leonard Randall
@ 2014-04-18 14:47             ` Bastien
  2014-04-19 13:34               ` Leonard Randall
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-04-18 14:47 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hi Leonard,

Leonard Randall <leonard.a.randall@gmail.com> writes:

> Thanks for the feedback. I have attached the modified patch.

Applied, thanks.

Have a look at the ChangeLog I added in the commit message.
If you plan to add other change, please sign the FSF agreement:

http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Best,

-- 
 Bastien

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-18 14:47             ` Bastien
@ 2014-04-19 13:34               ` Leonard Randall
  2014-04-19 14:41                 ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Leonard Randall @ 2014-04-19 13:34 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

Hi Bastien,
Thanks for applying this and for being so diligent in keeping org great. I
have requested the fsf agreement and will sign it when it comes. One
additional minor issue I noticed is that in the docstring for the function
`org-bibtex', it reads, `org-bibtex-export-headline' where it should read
`org-bibtex-headline'.

I have also figured out that bug I mentioned. More on that in a minute.

Thanks,
Leonard


On 18 April 2014 15:47, Bastien <bzg@gnu.org> wrote:

> Hi Leonard,
>
> Leonard Randall <leonard.a.randall@gmail.com> writes:
>
> > Thanks for the feedback. I have attached the modified patch.
>
> Applied, thanks.
>
> Have a look at the ChangeLog I added in the commit message.
> If you plan to add other change, please sign the FSF agreement:
>
> http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt
>
> Best,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1559 bytes --]

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

* Re: Feature Request. org-bibtex-tags-are-keywords inherit tags
  2014-04-19 13:34               ` Leonard Randall
@ 2014-04-19 14:41                 ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2014-04-19 14:41 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hi Leonard,

Leonard Randall <leonard.a.randall@gmail.com> writes:

> Thanks for applying this and for being so diligent in keeping org
> great. I have requested the fsf agreement and will sign it when it
> comes. One additional minor issue I noticed is that in the docstring
> for the function `org-bibtex', it reads, `org-bibtex-export-headline'
> where it should read `org-bibtex-headline'.

Fixed, thanks.

-- 
 Bastien

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

end of thread, other threads:[~2014-04-19 14:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04 10:43 Feature Request. org-bibtex-tags-are-keywords inherit tags Leonard Randall
2014-04-04 11:31 ` Leonard Randall
2014-04-17 14:25   ` Bastien
     [not found]     ` <CAMRQoAnD9W7DpuXp5ELsN2fTBPJ2URS3p3+=ERZxM_ESduXtmQ@mail.gmail.com>
2014-04-18  9:02       ` Leonard Randall
2014-04-18 11:14         ` Bastien
2014-04-18 13:44           ` Leonard Randall
2014-04-18 14:47             ` Bastien
2014-04-19 13:34               ` Leonard Randall
2014-04-19 14:41                 ` 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).