GNU bug report logs - #57712
29.0.50; bibtex.el: Should `bibtex-parse-entry' handle curly braces inside fields?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Ihor Radchenko <yantar92@HIDDEN>; dated Sat, 10 Sep 2022 04:33:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 14 Sep 2022 17:02:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 14 13:02:46 2022
Received: from localhost ([127.0.0.1]:55948 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oYVmg-00065z-EY
	for submit <at> debbugs.gnu.org; Wed, 14 Sep 2022 13:02:46 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42088)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <winkler@HIDDEN>) id 1oYVme-00065c-2C
 for 57712 <at> debbugs.gnu.org; Wed, 14 Sep 2022 13:02:45 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48232)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oYVmL-0004cS-QG; Wed, 14 Sep 2022 13:02:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=Ejw0yhfu7ClTdyhuL32jJM6JMsjJrCeAM+B5nmIiVJU=; b=HdsDpWtOtLskbwGQxeb+
 +KXDqQZ49ttLslACJhxFVX06AFe5CGhl5x9/cJLCldalOJYuqLnqucboBi+MnOYkn1VtttvJo8fG5
 YVmaBh9Tl2S8ygC02mpjTeb+XVSwFAY1VUG/jupUbWTKWhqZl6qhXbCjV1golJEZa5Tn8+buX0G2E
 w9OLWwZhW4xigYGb5IVNyj9ZK5F45bHKkVP9IJQ61Y8gXPDH4VfnlaqRTj8BiIBjxKMHU+qayCgcG
 uenubzSZmv7KaCTq6YQTbuXfWUgF4hhJ2HWpyp3my8SbWO1EmQaGu8mMRJGtCkKXY/4qC6BA1SPew
 kRl0pv9gwq7PFA==;
Received: from [2600:1700:5650:f790::42] (port=40262 helo=regnitz)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oYVmK-0002xA-Qi; Wed, 14 Sep 2022 13:02:25 -0400
From: Roland Winkler <winkler@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN> <871qsi5wcf.fsf@HIDDEN>
 <87bkrlw4ml.fsf@localhost> <8735cw3dnm.fsf@HIDDEN>
 <87pmg0t31x.fsf@localhost> <874jxbzzk4.fsf@HIDDEN>
 <87zgf2yai6.fsf@localhost>
Date: Wed, 14 Sep 2022 12:02:24 -0500
In-Reply-To: <87zgf2yai6.fsf@localhost> (Ihor Radchenko's message of "Wed, 14
 Sep 2022 10:07:13 +0800")
Message-ID: <87v8ppvqhr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Wed, Sep 14 2022, Ihor Radchenko wrote:
> I am looking at this differently. Similar to BibTeX fields, text in the
> fields is a subject of a specific format. That format is _not_ exactly
> the same with TeX (e.g. see
> https://tex.stackexchange.com/questions/26338/how-to-code-%C3%9F-german-sharp-s-in-bibtex)

No, the problem discussed there exists exactly the same way within any
LaTeX document.  I deal with this frequently, both in the context of
LaTeX and in the context of BibTeX.  The content of BibTeX fields must
always be valid from LaTeX's perspective that will digest them.

(BibTeX never checks itself whether the user made an error from
LaTeX's perspective.  BibTeX generates bbl files that are then processed
by LaTeX.  LaTeX will choke over malformed BibTeX fields the same way it
will choke over invalid constructs in any LaTeX document.)

> I expect bibtex.el to handle all the peculiarities of BibTeX format, so
> that external packages do not need to perform extra parsing.

There are only two issues beyond the oddities of LaTeX itself

- BibTeX string constants

- BibTeX crossref'ed entries when a field is absent in an entry because
  it is present in a "parent" entry.

(There is also the odd behavior that standard BibTeX style files want to
downcase the content of the BibTeX "title" field, and this can be
suppressed by putting curly braces around the characters.  But the way
this works is that these braces are preserved in the bbl file generated
by BibTeX, and LaTeX will simply ignore them.  The braces do not violate
the rule that the content of BibTeX fields must always be valid from
LaTeX's perspective.)

> If you dislike modifying bibtex-parse-entry, bibtex-parse-field-text
> looks like a reasonable place to handle field text parsing.

Both BibTeX string constants and BibTeX crossref'ed entries are handled
by bibtex-text-in-field.  (As we discussed previously, expanding string
constants requires bibtex-expand-strings to be non-nil.)

Then bibtex-text-in-field always returns valid LaTeX code (provided the
user did not make any LaTeX mistakes in her fields, see above).

As I said before: if this doesn't fit your needs for org mode, I suggest
you develop a LaTeX parser that can process LaTeX code according to your
needs.  Then you can feed it with any valid LaTeX code including the
return values of bibtex-text-in-field.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 14 Sep 2022 02:06:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 13 22:06:29 2022
Received: from localhost ([127.0.0.1]:53225 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oYHnJ-00023U-4H
	for submit <at> debbugs.gnu.org; Tue, 13 Sep 2022 22:06:29 -0400
Received: from mail-pj1-f46.google.com ([209.85.216.46]:51155)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oYHnH-00023G-9A
 for 57712 <at> debbugs.gnu.org; Tue, 13 Sep 2022 22:06:27 -0400
Received: by mail-pj1-f46.google.com with SMTP id fv3so13105360pjb.0
 for <57712 <at> debbugs.gnu.org>; Tue, 13 Sep 2022 19:06:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date;
 bh=WOR4CeylSfDpcpl4kS0UV3avn+ocAD2vSsB9RqKgIfs=;
 b=EH1PSjR7zP6Oms+pEGKHw2JkuRl2ny7PI+Rf6njq1G4hrfCjBy/5LaccPSmnslCVBn
 dcjbkK8HMepSsN7q3tARWhkJLoibloFZxHRl8DadHAQe4CxekSIxVYSacDlj5x/0jRq8
 gDg1MzJ7OJgEBUH91dTZ53EGT12ML4wv78Il9nFlVZj1saOR1mm9DFtrQF++EYldBtcc
 G4CC+HEj8nN+NIdq2BSW9wYZvrlGLQpD6A+cE4q8800hLW8wZ6r1u1EMavxV9KIZ4Ayk
 Bo1nLzGTjl1uFVIeffmq/yKnVV6bDeSVUim3FcrgEYxCGOj2Sce33ussIpOelW+iTHAi
 DPbw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date;
 bh=WOR4CeylSfDpcpl4kS0UV3avn+ocAD2vSsB9RqKgIfs=;
 b=yq0z0yoqaKqtC1Gm1ES4UgO3XbQNjYwY2bRA8lqaXOtw2tuK5mFpn2FcGicNOxnxzk
 EEg2fHTg3L2HWXCBwCfpCWI8dLHEK5yrjzpvQs6ZxhggTgwt+RjitvLGsxAK9JHz2CYH
 021IZzliU0s/DFZvuQ/yqOJk6kqgIlRCbEhog3XWdRAcOdqxKjJgdDttO/XQcjADk9Og
 4pxuJMtSxw/du1jiGsOiuCU9Nr+SEM8TO1TaAQOK4ls3ZIefY1TFUR//6K9KILXWEUKK
 vBqH947CPZTEOl1hzFolrQtEjHEc3Wy0UBp9iEDPdOMM1tm+JQnmZ8GGuZnM3Q9G5I0e
 TjBQ==
X-Gm-Message-State: ACgBeo2ZK5/1jYUxvNHdqM6Fad1mSAWVGtR7LImzYNiBnP+/Z46lg4WT
 fulwBWt7tZFFk/fXKaicKyI=
X-Google-Smtp-Source: AA6agR7KcSKOtetvBuVSeKcZ3VejbfHOYNpU8GyP9PUMJkA1iBubA0OUq3MhQSlwzYdfgkUETqXatQ==
X-Received: by 2002:a17:903:2445:b0:178:38ee:70f with SMTP id
 l5-20020a170903244500b0017838ee070fmr10542858pls.164.1663121181254; 
 Tue, 13 Sep 2022 19:06:21 -0700 (PDT)
Received: from localhost ([2409:8970:a81:48f7:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 t8-20020a1709027fc800b001783a917b9asm4677105plb.127.2022.09.13.19.06.19
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 13 Sep 2022 19:06:20 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Roland Winkler <winkler@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
In-Reply-To: <874jxbzzk4.fsf@HIDDEN>
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN> <871qsi5wcf.fsf@HIDDEN>
 <87bkrlw4ml.fsf@localhost> <8735cw3dnm.fsf@HIDDEN>
 <87pmg0t31x.fsf@localhost> <874jxbzzk4.fsf@HIDDEN>
Date: Wed, 14 Sep 2022 10:07:13 +0800
Message-ID: <87zgf2yai6.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Roland Winkler <winkler@HIDDEN> writes:

>> will return
>>
>> '("Introduction " (mathmode "$3^5$") " to Mark=C8=AFv Chain " (braces
>> "{MOnte}") "Carlo" (latex "\LaTeX"))
>>
>> that is
>> 1. Escaped symbols are replaced by their unicode
>> 2. Braces are indicated by (braces "string")
>> 3. LaTeX math is indicated by (mathmode "math string")
>> 4. LaTeX commands are indicated by (latex "command")
>> 5. @strings are replaced appropriately
>
> I believe this is much beyond BibTeX mode and yet more beyond
> bibtex-parse-entry.  It is mostly about parsing LaTeX while BibTeX plays
> only a marginal role (adding support for @string's will be cheap once you
> get the rest of this parser working).  Then, you also need to deal with
> the question: what do you want to do with a return value you illustrated
> above?  From what I vaguely understood, your real goal is to convert
> this into something human-readable.

> This is a fairly substantial project.  I am not sure whether it would be
> worth the effort.  And I would not want to bury such a pretty complex
> machinery in a new optional arg of a function that is intended to do
> something very different.

I am looking at this differently. Similar to BibTeX fields, text in the
fields is a subject of a specific format. That format is _not_ exactly
the same with TeX (e.g. see
https://tex.stackexchange.com/questions/26338/how-to-code-%C3%9F-german-sha=
rp-s-in-bibtex)

I expect bibtex.el to handle all the peculiarities of BibTeX format, so
that external packages do not need to perform extra parsing.

If you dislike modifying bibtex-parse-entry, bibtex-parse-field-text
looks like a reasonable place to handle field text parsing.

--=20
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 13 Sep 2022 04:08:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 13 00:08:36 2022
Received: from localhost ([127.0.0.1]:48516 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXxDv-0001Pn-RE
	for submit <at> debbugs.gnu.org; Tue, 13 Sep 2022 00:08:36 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57162)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <winkler@HIDDEN>) id 1oXxDu-0001PU-BH
 for 57712 <at> debbugs.gnu.org; Tue, 13 Sep 2022 00:08:34 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47374)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oXxDp-0005Fl-45; Tue, 13 Sep 2022 00:08:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=aWTW2giW1Sztmzp1Um5vurheXz2KyrIy/xt6uD/V9jk=; b=gl78UP5op5VifLGq4f/m
 1v5l54drdyob+OWXopqm6aR6BE2JXnCn2GBe0LUI5LtRI0onIEshBH8rkw9kEQuT1uJA74T7ENoVU
 uaq+Wt4OaGr9SnyEe/7+8npFXPKWUIuirE3GXq2hXC0uKDLGCoSZPA+d7bgvLUqZmdxQROUEZF76x
 3SDoFoRyQhBllV8nEBiW7mWywT6ep/V0STQllH2JuHtAFYG75J3t8KAluhEdETUCH1q4QlkTB1DXx
 0WJIv0p9YhZ4WuVWlQjVGQKsP9moFg/bPRNAofwJv7AOH2ECB7BJUOWuc/B3/0OG/sa/j6iKPExAp
 CgLqmtdZfjFG/Q==;
Received: from [2600:1700:5650:f790::42] (port=54208 helo=regnitz)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oXxDo-0007Kf-Mp; Tue, 13 Sep 2022 00:08:28 -0400
From: Roland Winkler <winkler@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN> <871qsi5wcf.fsf@HIDDEN>
 <87bkrlw4ml.fsf@localhost> <8735cw3dnm.fsf@HIDDEN>
 <87pmg0t31x.fsf@localhost>
Date: Mon, 12 Sep 2022 23:08:27 -0500
In-Reply-To: <87pmg0t31x.fsf@localhost> (Ihor Radchenko's message of "Tue, 13
 Sep 2022 10:34:50 +0800")
Message-ID: <874jxbzzk4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Tue, Sep 13 2022, Ihor Radchenko wrote:
>   title =3D {{Introduction $3^5$ to Mark\.{o}v Chain {MOnte} Carlo
> \LaTeX}},
>
> (bibtex-parse-entry '(symbols braces mathmode latex strings))
>
> will return
>
> '("Introduction " (mathmode "$3^5$") " to Mark=C8=AFv Chain " (braces
> "{MOnte}") "Carlo" (latex "\LaTeX"))
>
> that is
> 1. Escaped symbols are replaced by their unicode
> 2. Braces are indicated by (braces "string")
> 3. LaTeX math is indicated by (mathmode "math string")
> 4. LaTeX commands are indicated by (latex "command")
> 5. @strings are replaced appropriately

I believe this is much beyond BibTeX mode and yet more beyond
bibtex-parse-entry.  It is mostly about parsing LaTeX while BibTeX plays
only a marginal role (adding support for @string's will be cheap once you
get the rest of this parser working).  Then, you also need to deal with
the question: what do you want to do with a return value you illustrated
above?  From what I vaguely understood, your real goal is to convert
this into something human-readable.

This is a fairly substantial project.  I am not sure whether it would be
worth the effort.  And I would not want to bury such a pretty complex
machinery in a new optional arg of a function that is intended to do
something very different.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 13 Sep 2022 02:34:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 22:34:09 2022
Received: from localhost ([127.0.0.1]:48438 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXvkX-00038s-AL
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 22:34:09 -0400
Received: from mail-pj1-f45.google.com ([209.85.216.45]:35777)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXvkS-00037m-Hr
 for 57712 <at> debbugs.gnu.org; Mon, 12 Sep 2022 22:34:07 -0400
Received: by mail-pj1-f45.google.com with SMTP id
 m10-20020a17090a730a00b001fa986fd8eeso14222805pjk.0
 for <57712 <at> debbugs.gnu.org>; Mon, 12 Sep 2022 19:34:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date;
 bh=QJ+Kw706UoavJg61hMfHiEmZSJSgEIfB+X+Nic5UPpo=;
 b=PTLYaGXcjtWQmxneijVYZZEOlNmuBv+MgTiWGueoj+oDXCFbgx74Ntag4jGfieAqmw
 ziBvmCnFyYo8NwuosjgEblC8/1D5lZCKJoGY17tJ7YkrI5LdVSROU11OtKkPytd3+3L4
 GdEMLoyoVNXF9MxNWAuRMuoT8g9Sl7B8oKIaIK2oq9kMJvxM9CL8O5ETg1ugV+m6XIXy
 xizeowU/dLwY0pT2fJa5c8yeyOkM3X0csf1BcWG7iUAGbCORl2a7jdkfikYj+aNpTIsU
 6bzb1IZG6iMB0a0CbCpq9KX+YdPV3D9HEYLjhwTYeXMUo6hwRUnnvsdBow1PNZzObCN9
 Aiuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date;
 bh=QJ+Kw706UoavJg61hMfHiEmZSJSgEIfB+X+Nic5UPpo=;
 b=F4sm51V7M3CGfvDmSpX+6pXM5ddXSeNgBmgShfEOPiLMzlZerbnKgxECrBojrzmS/N
 rxGFw23sPZTdf2YNfa3iSdqgVQjC82U+thRvJ5I6c1Qg8mBufSF1lD3VIChHBE2uShcX
 wDmRvLEfy9QdpFzKGhgOrrM26TWFNKS4tXWD2mu3fSdH8tA87EBvc3Q0qky8NYvAOLOQ
 H6DTzzXqb3KsJ0n4zXXbtNESY1Ih8oStYXD5sesXMWFv1WThH8RikW+jZoR8XFXomIOt
 aOGT+kLrYRUFNCbE/sWQpx1ek2SzG4Bq/BQ4HRaRfXBs4CqcB80sA9t9GO5HAYhlMbC8
 s7tw==
X-Gm-Message-State: ACgBeo1ma8FQ5zHEuLsi2ilSl/KzplKYH4CCseyhn/EBUwTo/YL2PR1I
 ckYHg3gfLxoGb7zBURHVSHA=
X-Google-Smtp-Source: AA6agR5iSKiDBLOPERpfzcSDTPKSO36XufFnKHseujX1bovSHkxji4CwH2TCrWRZCrhrUDHdvbqhDA==
X-Received: by 2002:a17:902:c245:b0:178:3912:f1f7 with SMTP id
 5-20020a170902c24500b001783912f1f7mr5954772plg.75.1663036438592; 
 Mon, 12 Sep 2022 19:33:58 -0700 (PDT)
Received: from localhost ([2409:8970:a81:48f7:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 u17-20020a170903125100b001780e4e6b65sm6695830plh.114.2022.09.12.19.33.56
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 12 Sep 2022 19:33:58 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Roland Winkler <winkler@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
In-Reply-To: <8735cw3dnm.fsf@HIDDEN>
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN> <871qsi5wcf.fsf@HIDDEN>
 <87bkrlw4ml.fsf@localhost> <8735cw3dnm.fsf@HIDDEN>
Date: Tue, 13 Sep 2022 10:34:50 +0800
Message-ID: <87pmg0t31x.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Roland Winkler <winkler@HIDDEN> writes:

> On Mon, Sep 12 2022, Ihor Radchenko wrote:
>> To clarify, I do not expect bibtex-parse-entry to strip the braces. What
>> I'd like to see is _parsing_ braces (say, as sexp) and other special
>> BibTeX syntax. At least, as long as appropriate option is passed to
>> bibtex-parse-entry.
>
> Can you give some examples of what you believe bibtex-parse-entry should
> do if it had an optional arg CONTENT?  What should it return instead of
> what it returns without such an arg?

Consider the following title:

  title           =3D {{Introduction $3^5$ to Mark\.{o}v Chain {MOnte} Carl=
o \LaTeX}},

(bibtex-parse-entry '(symbols braces mathmode latex strings))

will return

'("Introduction " (mathmode "$3^5$") " to Mark=C8=AFv Chain " (braces "{MOn=
te}") "Carlo" (latex "\LaTeX"))

that is
1. Escaped symbols are replaced by their unicode
2. Braces are indicated by (braces "string")
3. LaTeX math is indicated by (mathmode "math string")
4. LaTeX commands are indicated by (latex "command")
5. @strings are replaced appropriately

>> bibtex-summary approach might be an option, although it is clearly an
>> abuse and begs for future bugs.
>
> My point is: the meaning of CONTENT may largely depend on what the
> caller of bibtex-parse-entry wants to achieve.  What appears perfectly
> reasonable from your perspective may be meaningless from another
> perspective.  That's why the autokey machinery comes with lots of
> options in terms of user variables, plus the option of letting the user
> ignore all of this and define her own function (both for automatically
> generating a key and for generating a summary for an entry). -- It's not
> a perfect solution.  But it has worked well for many years.
>
> A single arg CONTENT (trying to guess "do what I mean") cannot cover all
> this in a satisfactory way.

It can, if it is something like a plist. Note that I do not insist that
CONTENT value must be the only way to control the function behaviour.
Using let-bound variables is another valid option. But all the affecting
variables should be documented in the docstring then.

--=20
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 12 Sep 2022 13:50:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 09:50:32 2022
Received: from localhost ([127.0.0.1]:44681 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXjpY-0007Oq-63
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 09:50:32 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42554)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <winkler@HIDDEN>) id 1oXjpW-0007OX-2F
 for 57712 <at> debbugs.gnu.org; Mon, 12 Sep 2022 09:50:30 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:35664)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oXjpP-0003Rx-Vj; Mon, 12 Sep 2022 09:50:24 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=mBr1WQgl4AAkWHaCDLVUFpE0A49GumwmrU7R3ctxJCs=; b=LK5nMRa49TLhofaJzRGw
 kMeyS+vJcPdBCiuM1Go3c0PxVhJ7dSUfip7NDm/fJivwpjdM8IL1HrIcPlghSdewP250zMSjuqsYS
 512cSVet/rytZ1QwLyGDmhdxizdZExl855h25K2sDp0pItagORAbY0Yw1VUrKoC73FuxzlxP2YCVb
 h1CyqxcdWzTdS+ztbd1S4fKpbVApba0us/ZmpCLrW9MI3am0GQSUd2U/hSNf+/I1NtkdBLXYy+fN7
 epXt6X1mFKNELKHw1W6HFl0KuJBDfLawB1P9gmtlb6N3O2MgRQ1GqPHwXDUIsPYPvTvNx6YJY11Or
 PFYZAagNKtJV7Q==;
Received: from [2600:1700:5650:f790::42] (port=60096 helo=regnitz)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oXjpP-00057o-Cc; Mon, 12 Sep 2022 09:50:23 -0400
From: Roland Winkler <winkler@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN> <871qsi5wcf.fsf@HIDDEN>
 <87bkrlw4ml.fsf@localhost>
Date: Mon, 12 Sep 2022 08:50:21 -0500
In-Reply-To: <87bkrlw4ml.fsf@localhost> (Ihor Radchenko's message of "Mon, 12
 Sep 2022 13:20:18 +0800")
Message-ID: <8735cw3dnm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Mon, Sep 12 2022, Ihor Radchenko wrote:
> To clarify, I do not expect bibtex-parse-entry to strip the braces. What
> I'd like to see is _parsing_ braces (say, as sexp) and other special
> BibTeX syntax. At least, as long as appropriate option is passed to
> bibtex-parse-entry.

Can you give some examples of what you believe bibtex-parse-entry should
do if it had an optional arg CONTENT?  What should it return instead of
what it returns without such an arg?

> bibtex-summary approach might be an option, although it is clearly an
> abuse and begs for future bugs.

My point is: the meaning of CONTENT may largely depend on what the
caller of bibtex-parse-entry wants to achieve.  What appears perfectly
reasonable from your perspective may be meaningless from another
perspective.  That's why the autokey machinery comes with lots of
options in terms of user variables, plus the option of letting the user
ignore all of this and define her own function (both for automatically
generating a key and for generating a summary for an entry). -- It's not
a perfect solution.  But it has worked well for many years.

A single arg CONTENT (trying to guess "do what I mean") cannot cover all
this in a satisfactory way.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 12 Sep 2022 05:19:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 01:19:38 2022
Received: from localhost ([127.0.0.1]:43852 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXbr5-0003Xm-9w
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:19:38 -0400
Received: from mail-pl1-f173.google.com ([209.85.214.173]:47052)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXbr0-0003XX-Md
 for 57712 <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:19:34 -0400
Received: by mail-pl1-f173.google.com with SMTP id jm11so7484869plb.13
 for <57712 <at> debbugs.gnu.org>; Sun, 11 Sep 2022 22:19:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=jxdJHjLvdyFA1VTaDgyWCC6VwD4HH60WGV5ziRqyxXc=;
 b=o7xqfepoIr3u4EBPMQRlAkvWpfvotKPIy5uws9A1ARdHVO8t/fyetcmc4GhpRwsVxH
 arWNer/tc6xcTZ07CCo4eTYBO6iuJ6HAUuCA8Nr5cth6ynPqUxGVuypxq9aeEOC10Avh
 m7aYvLsm8iLJ2/VPvvW8zXQNMqfv2+eVLW+cYmtt6fFlzmJNFYzyMZuILQYSrpu1cbUT
 DfbamO96k6bmaiWkCrL2jMLlfmypsCn6J50jIWGXBxMPSx3nDAtE7COOWEUeyO61pkNd
 WlMvpIGEHADtk8rvesn1QP9sj+R/0qcebB2GROpLiudisR0lCtL4NTIFlGzkcQPGXRH8
 kyUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=jxdJHjLvdyFA1VTaDgyWCC6VwD4HH60WGV5ziRqyxXc=;
 b=dejwClyJ0tV0vhbDluP6MFywaR+BTIDNs7kBuMQPgmmk0tvFthslAh9RsqrfQhjEju
 kMPHpn6hitJs6VIqe+DfWXwVMSrYhqogyicHaSf1jxkiOrJwHZ10TGQUxAq4dJARVez6
 D1JeiQVyqXSY6cjAWW3GT1N4dQ7n4McJ5ElhGAgE/mGR5LQ33zVy+5VfQ5jQrVGSKUPA
 7KwmEoluznDsq1uEuqpnvrBH1bzhTn/C1DmutABP9sDU2A/2+6sjCdkhssd17a1jppSB
 RTcT/C8x1V2KiFBAoEEShRsbxq6kDn+zZElg5FCeVoqyRsp73hQeIktvP9DhMKJ/1eCn
 FKtg==
X-Gm-Message-State: ACgBeo25Nr6A9qtLhe/U+RYsdxN4a9J0L+jAiNyG5FWU1k98Y98yUtP4
 JmXcMkcwV8Sm0N7dvXNvZ14=
X-Google-Smtp-Source: AA6agR75/LTI1cSAFgGWcUbXc8YUSOK+YPSRMojY0H4O5GHSD5GwhX5PFzTKpoDftrfua8yHNKrnSw==
X-Received: by 2002:a17:90b:2743:b0:200:9be5:d492 with SMTP id
 qi3-20020a17090b274300b002009be5d492mr22046172pjb.237.1662959964742; 
 Sun, 11 Sep 2022 22:19:24 -0700 (PDT)
Received: from localhost ([2409:8a70:2bc:c850:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 c200-20020a621cd1000000b00541469775fesm4008990pfc.138.2022.09.11.22.19.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 11 Sep 2022 22:19:24 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Roland Winkler <winkler@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
In-Reply-To: <871qsi5wcf.fsf@HIDDEN>
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN> <871qsi5wcf.fsf@HIDDEN>
Date: Mon, 12 Sep 2022 13:20:18 +0800
Message-ID: <87bkrlw4ml.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Roland Winkler <winkler@HIDDEN> writes:

> On Sat, Sep 10 2022, Roland Winkler wrote:
>> I must be missing something.
>
> I looked at the original org bug report that triggered the present
> report.  I guess that now I understand what the OP is concerned about.
> I believe that bibtex-parse-entry is not the right place to try to fix
> this.  The problem is to define what an optional arg CONTENT should do.

To clarify, I do not expect bibtex-parse-entry to strip the braces. What
I'd like to see is _parsing_ braces (say, as sexp) and other special
BibTeX syntax. At least, as long as appropriate option is passed to
bibtex-parse-entry.

What to do with the braces is another question and has nothing to do
with bibtex.el. It is to be decided by Org.

> I do not know what the "basic org cite export processor" mentioned by
> the OP is doing in detail.  But it reminds me of bibtex-summary which is
> the default value of bibtex-summary-function.  This function generates a
> "human-readable" summary of a BibTeX entry.  It uses the autokey
> machinery of bibtex-mode that was originally developed for generating
> keys for new BibTeX entries.  But this machinery can easily be "misused"
> for things like bibtex-summary.  The point is that it offers rather many
> options to customize what such a summary should look like.  Say, an
> entry has 20 authors.  Do you want to display three or four authors?  Do
> you want to just put dots after the third author or "et al."?  Should the
> author(s) come first or should the title come first?  Should the year
> appear before or after the title?  (Essentially, you can go through all
> the questions relevant for BibTeX style files; but the autokey machinery
> comes with the power of emacs :-)
>
> So I suggest that the  "basic org cite export processor" could use
> something similar to bibtex-summary.  But this should just be the
> default value of something similar to bibtex-summary-function so that
> users can customize this more easily.
>
> (Letting users define their personal bibtex-summary function is probably
> easier than trying to define some user variables that can control this.
> There are just too many possibilities how one might want to customize
> things.  My personal bibtex-summary function does a couple things that
> nobody else might like, but they are important for me.)

bibtex-summary approach might be an option, although it is clearly an
abuse and begs for future bugs.

However, there are at least several issues with, say,
`bibtex-autokey-get-title':
1. Its docstring does not clarify which variables affect the return
   value and does not even mention that the actual title contents is
   transformed in any way.
2. It simply strips the curly braces.
   `bibtex-autokey-titleword-case-convert' is applied regardless of the
   braces.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 12 Sep 2022 05:05:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 01:05:55 2022
Received: from localhost ([127.0.0.1]:43846 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXbdq-00035n-Kq
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:05:54 -0400
Received: from mail-pj1-f49.google.com ([209.85.216.49]:42777)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXbdn-00035X-9a
 for 57712 <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:05:53 -0400
Received: by mail-pj1-f49.google.com with SMTP id
 q62-20020a17090a17c400b00202a3497516so4713536pja.1
 for <57712 <at> debbugs.gnu.org>; Sun, 11 Sep 2022 22:05:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=rUvNcNqy48jjf5LUjIx3NjE/E29uZyl9185Ht56bvfc=;
 b=B+eMBSs7uxRWRtaLNgW7P5r9P7HTuiTWzM4CFV/NUxx1WG1/ibx9joXKG4lrxdVCey
 ZwcTiAaNw4Y0J68HPXK9BYiZSl3aBePUMzQrM5MJc6nJ1mNBLDKy1BRP8DkORo37pUKC
 AEhG77ibahYPAIOPYSgaC8qJfH2I1odFCxrM/wodBKX4reJ5oNNGGtmfLG3e5dSLGv5H
 ELKS4HL7Gr9UnbqV+S12FidtZ9R+gW35fR4oDnaGrfc97zDeHFPsch2y8WfZsRN0bfpU
 QunSVJqFeGSs858ck9osUTcdvKuv4gEMTud1kOvY5LVQlC5v38k1IpBCegRyyX9Xqg9y
 b8Ug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=rUvNcNqy48jjf5LUjIx3NjE/E29uZyl9185Ht56bvfc=;
 b=llzA6UHF8j+PU+97+RsIcZ4Qq4umK+qLzOXdDo5Co/m4F5oszBrNCRMQO5zW7d9U7c
 h1aATyyH0ihIT7XY+HqMjCA5nBKkdTWTFCxW9D8X+dOMIP03K8ValnHqtPH4jXal0PUX
 X4IIHpS9oFl2llGkgbOsNT3Xn+QK6yVqt5/57AnaxXC1qUGWHFUSUMmIbZESA2P2QZ0n
 qZRUVG5Uaxb564/FZLNoZSvCtlSbIDQPnjBsE7xHfuOBPEswJDDFmDkMbK1IXzitYw3e
 nC3HljlK7K2zJx3+Br5RT5xsCSMuSjMeBioEb1lPwv2TE9y+vWouMT1BCYFPX3oZuRVC
 0leQ==
X-Gm-Message-State: ACgBeo30WFUKdhAuwzlfO/Dv37I2Y+6A95JnPFaWBe5pNWGWgZNTOG/a
 qay4Sgl9wmqqo8VTXSog42c=
X-Google-Smtp-Source: AA6agR7VssJ9vVeWIR1myilwpI9zHi4QcmJBgJpnDGgG7BesWUrwRkWzwq5PE616kg6GpGOeJ/eXTw==
X-Received: by 2002:a17:90b:1b4c:b0:202:c05f:6e7b with SMTP id
 nv12-20020a17090b1b4c00b00202c05f6e7bmr6281396pjb.200.1662959145277; 
 Sun, 11 Sep 2022 22:05:45 -0700 (PDT)
Received: from localhost ([2409:8a70:2bc:c850:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 o13-20020a17090a4b4d00b001fd76f7a0d1sm4145517pjl.54.2022.09.11.22.05.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 11 Sep 2022 22:05:44 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Roland Winkler <winkler@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
In-Reply-To: <87zgf75i32.fsf@HIDDEN>
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN>
Date: Mon, 12 Sep 2022 13:06:37 +0800
Message-ID: <87edwhw59e.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Roland Winkler <winkler@HIDDEN> writes:

> M-: (bibtex-parse-entries)

Note that bibtex.el does not have such function.

> Certainly, stripping off the braces would turn valid LaTeX code into
> gibberish.

Note the BibTeX braces, escapes, special symbols, a subset of LaTeX
commands, and LaTeX math inside BibTeX entries are a part of BibTeX
syntax (http://www.bibtex.org/SpecialSymbols/). I expect bibtex.el to
understand that syntax and parse it, so that the user of bibtex.el does
not need to implement extra parsing on top.

I understand that the BibTeX syntax is fully compatible with LaTeX and
for the purposes of LaTeX processing, there is no need to parse the
BibTeX entry contents. However, BibTeX may be used outside LaTeX. Then,
it is reasonable to expect the parsing to be done inside bibtex.el.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 11 Sep 2022 05:11:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 11 01:11:38 2022
Received: from localhost ([127.0.0.1]:40614 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXFFq-0008Fs-4s
	for submit <at> debbugs.gnu.org; Sun, 11 Sep 2022 01:11:38 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43400)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <winkler@HIDDEN>) id 1oXFFn-0008EF-Dc
 for 57712 <at> debbugs.gnu.org; Sun, 11 Sep 2022 01:11:37 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52402)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oXFFh-0003wD-TI; Sun, 11 Sep 2022 01:11:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=9N2H1eKECub5YJy+lNccfCTx2OTPQKHFIomQpaV/L+Y=; b=jG6UQHNWNqROSrwYJ0ds
 EIA7mPHCeoBy0NUBb93pYm5lxHMjH9BPoEB+BfJ2h4Pv3Z75ZDidZMhHQHYbNviQD/wkeT9CWRVft
 Cl4v75WZ2BdG4YBzypIoNN//v1HKGIMnoFQlUevqQHFpA0GZe6jIjCBRQZrZr2FierYyfknEhIF/z
 xlaAz+m1eJ2frDmammxH21U6gvIdxLlwk+ABXTePAypjqGCd0KxiY/kNDWsLvFSnv7nLegReCCjjr
 a5Zt1LR59Sxddnte6yKSItoOgzNwcBD+itGI6Q1mWonNDZqsYpi4CoQDKhxTcwV5NHVGFMkWZeblI
 4Hilx4DhGxRNVQ==;
Received: from [2600:1700:5650:f790::42] (port=57556 helo=regnitz)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oXFFh-0005Nu-Ea; Sun, 11 Sep 2022 01:11:29 -0400
From: Roland Winkler <winkler@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
 <87zgf75i32.fsf@HIDDEN>
Date: Sun, 11 Sep 2022 00:11:28 -0500
In-Reply-To: <87zgf75i32.fsf@HIDDEN> (Roland Winkler's message of "Sat, 10
 Sep 2022 11:07:13 -0500")
Message-ID: <871qsi5wcf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Ihor Radchenko <yantar92@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Sat, Sep 10 2022, Roland Winkler wrote:
> I must be missing something.

I looked at the original org bug report that triggered the present
report.  I guess that now I understand what the OP is concerned about.
I believe that bibtex-parse-entry is not the right place to try to fix
this.  The problem is to define what an optional arg CONTENT should do.

I do not know what the "basic org cite export processor" mentioned by
the OP is doing in detail.  But it reminds me of bibtex-summary which is
the default value of bibtex-summary-function.  This function generates a
"human-readable" summary of a BibTeX entry.  It uses the autokey
machinery of bibtex-mode that was originally developed for generating
keys for new BibTeX entries.  But this machinery can easily be "misused"
for things like bibtex-summary.  The point is that it offers rather many
options to customize what such a summary should look like.  Say, an
entry has 20 authors.  Do you want to display three or four authors?  Do
you want to just put dots after the third author or "et al."?  Should the
author(s) come first or should the title come first?  Should the year
appear before or after the title?  (Essentially, you can go through all
the questions relevant for BibTeX style files; but the autokey machinery
comes with the power of emacs :-)

So I suggest that the  "basic org cite export processor" could use
something similar to bibtex-summary.  But this should just be the
default value of something similar to bibtex-summary-function so that
users can customize this more easily.

(Letting users define their personal bibtex-summary function is probably
easier than trying to define some user variables that can control this.
There are just too many possibilities how one might want to customize
things.  My personal bibtex-summary function does a couple things that
nobody else might like, but they are important for me.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 10 Sep 2022 16:07:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 12:07:23 2022
Received: from localhost ([127.0.0.1]:40245 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oX30t-0003tB-Kp
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 12:07:23 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53004)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <winkler@HIDDEN>) id 1oX30r-0003sy-AU
 for 57712 <at> debbugs.gnu.org; Sat, 10 Sep 2022 12:07:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:56310)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oX30l-0003NP-KY; Sat, 10 Sep 2022 12:07:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=qEkdQ17hAZT0kZlzjqneKt7+A5Uk7h6AVXVIm0KbXoc=; b=mZEUsJpAIthll8h1SOSG
 eF3VIXdg4kHxbAM+pQarhx9VcSDhqTS1af/bG6mT+2i5wUgqCWdEwJhV4y0ILqeHW6108wqH5tTlc
 B5EIu08P+5C19ZvpciqGYxzguJueEa6fRCYphquhEiqqpp/WpUJdWsKU6BRXxEMYTlv1h6IgHt/FS
 RtgLlWcGkSN1RbFb2U1yXpJnwCmUgUJP+H6Uv1KmBRyE+is7lp+Q6kXjOjT066JYyejKvJl/xxA4J
 ezQ0miOb45OC7/WWXwi44HQa+2+1Za5Q/0fZ+CNrP1wukv1synEZRrAZG7OLF0k0y7Aje/iWjg7wd
 Ncry8c0dl0zNhg==;
Received: from [2600:1700:5650:f790::42] (port=51000 helo=regnitz)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1oX30l-0001pf-Bg; Sat, 10 Sep 2022 12:07:15 -0400
From: Roland Winkler <winkler@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
References: <87k06b26iu.fsf@localhost> <87r10jrgf4.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 11:07:13 -0500
In-Reply-To: <87r10jrgf4.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sat,
 10 Sep 2022 06:39:59 +0200")
Message-ID: <87zgf75i32.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Ihor Radchenko <yantar92@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> It would be useful if bibtex-parse-entry could process the escapes when,
> say, its first optional argument CONTENT is set to 'parse.

I must be missing something.  With `emacs -q' (28.1) and the proposed
test case bibtex-parse-entry honors all braces.  Same with any other
entries I tested.  Try

M-: (bibtex-parse-entries)

Certainly, stripping off the braces would turn valid LaTeX code into
gibberish.

There is also bibtex-autokey-get-field that comes with an optional arg
CHANGE-LIST which is most often bibtex-autokey-transcriptions.  This
massages the field values in all kinds of ways.  But it serves an
entirely different purpose.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at 57712 <at> debbugs.gnu.org:


Received: (at 57712) by debbugs.gnu.org; 10 Sep 2022 04:40:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 00:40:09 2022
Received: from localhost ([127.0.0.1]:36100 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWsHp-0001Uf-Lv
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:40:09 -0400
Received: from quimby.gnus.org ([95.216.78.240]:53722)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oWsHn-0001UQ-KT
 for 57712 <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:40:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=/uFwO+4XYElNdBgNNSIrr6A/5UJolzdrMarK0j809xA=; b=EapwFQiuy7eeaooaiZroxd7Qtz
 o89oLnGDJXoVgAsRS/Chw+Q+K+wIQpwi/mEFNWOkeg//oW967ce/zyy3zqHmNbRrhhZpXpWzFkpc/
 UryloTJehzxIgfiaz9QC91+90hIxnKw5LGdcSK7mhMVGIBxz4jxHkJ170rw2kPiwR/Is=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oWsHf-0006JQ-JG; Sat, 10 Sep 2022 06:40:01 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry'
 handle curly braces inside fields?
In-Reply-To: <87k06b26iu.fsf@localhost> (Ihor Radchenko's message of "Sat, 10
 Sep 2022 12:32:57 +0800")
References: <87k06b26iu.fsf@localhost>
X-Now-Playing: Peter Gabriel's _Peter Gabriel 3_: "Start"
Date: Sat, 10 Sep 2022 06:39:59 +0200
Message-ID: <87r10jrgf4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Ihor Radchenko <yantar92@HIDDEN> writes: > It would be
 useful if bibtex-parse-entry could process the escapes when, > say, its first
 optional argument CONTENT is set to 'parse. > > Would it be possible? 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57712
Cc: 57712 <at> debbugs.gnu.org, Roland Winkler <winkler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> It would be useful if bibtex-parse-entry could process the escapes when,
> say, its first optional argument CONTENT is set to 'parse.
>
> Would it be possible?

Perhaps Roland has some comments; added to the CCs.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Sep 2022 04:32:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 00:32:14 2022
Received: from localhost ([127.0.0.1]:36081 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWsAA-0001Hg-Ih
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:32:14 -0400
Received: from lists.gnu.org ([209.51.188.17]:48334)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWsA3-0001HU-Rl
 for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:32:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47196)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oWsA3-0005ID-JS
 for bug-gnu-emacs@HIDDEN; Sat, 10 Sep 2022 00:32:07 -0400
Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:41955)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oWsA1-0005od-MV
 for bug-gnu-emacs@HIDDEN; Sat, 10 Sep 2022 00:32:07 -0400
Received: by mail-pj1-x102b.google.com with SMTP id
 q15-20020a17090a304f00b002002ac83485so3413643pjl.0
 for <bug-gnu-emacs@HIDDEN>; Fri, 09 Sep 2022 21:32:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date; bh=no36hY3B19NHj904o4zYnW0tDN9sl6GfvGBsljC9rGk=;
 b=P2Jf5U07ebF/y1G1tSmBQFuYNZVcC6NaePylOV1OhVz51rw2DrbipNrp2plBL0TV/T
 WkfHfH+1ZFTfpPaT2MMgv0QC8HV9yYJPuemLyCEUAy6fOYDEXzQ4y4RglSmQbMy+39zZ
 Y8vPQgN1rtm4yot4REjV3jlrSqaM1SxAwMK8HsJ/tK1KyRhnV8HmyDB2zd9vbGfwKhgV
 wLqgJOoZmTuU7yszzM3fx3dSixuif16kXHuPbF02NjvOywYtYMqlc1CMQLM7NjvSzm+6
 q5uel75+pK6/ccQMHxyf3nep5FXIrz7sCazKl+20JLh7bTQdzlhs6ENHwC4vsY7Ik4B5
 xfVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date;
 bh=no36hY3B19NHj904o4zYnW0tDN9sl6GfvGBsljC9rGk=;
 b=OohoPkcQEOM6VwXTXYreljJRo10bHtBHyvUKNDPFcoSsXLHLLWVYrO0PVTP5zq2m3r
 yIzIK/YUacqiB1rP/THS161/9QJED0xl9+7A+8cxjZ1wEwsgUJ3Or6PloKoQ/CcM+r9X
 a7VOcVAqKY1RR08n8620nXiDbHAeTbPfOHkMSh2lWjomznikPSLJD5VrJjZf44Uyv8Ra
 1x1h3NKcYyE5zipbRCGYoiM1KavRNxEq0SqHs7Q9wRryi5/sn6w3ROSz1ZcE+WsdLOVQ
 0o0J5rNuKx9U0j/AtiT7pDsqYT1PdFQHEUWrMJRr9JRQ7k9myOJ8Y3W8Hzr/o8r9Vsh0
 nLNQ==
X-Gm-Message-State: ACgBeo0Js2DPUPRYn6EwZj8cFDdRFlUg5lFGpv3RStr+8xjQyGlUTnwY
 tYuwmsCU3vTiEGEQND4iGMAApat4zVg=
X-Google-Smtp-Source: AA6agR7/rTWviiu78jHZHyn+hEg1S3aUPZ6QVYyaMtrWQ0OIeSBVWoPruSSih6pi8J+gwbWXVpqTbg==
X-Received: by 2002:a17:90a:a003:b0:200:7642:a6e5 with SMTP id
 q3-20020a17090aa00300b002007642a6e5mr12777481pjp.10.1662784323731; 
 Fri, 09 Sep 2022 21:32:03 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 e11-20020a17090301cb00b00172a670607asm783782plh.300.2022.09.09.21.32.02
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 21:32:03 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; bibtex.el: Should `bibtex-parse-entry' handle curly braces
 inside fields?
Date: Sat, 10 Sep 2022 12:32:57 +0800
Message-ID: <87k06b26iu.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::102b;
 envelope-from=yantar92@HIDDEN; helo=mail-pj1-x102b.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Hello,

Org mode is relying upon bibtex.el to parse BibTeX bibliographies.

Recently, we have got a bug report where curly braces are used inside
title field:

https://orgmode.org/list/CAF+0kSg8O3RQBG1wXoHjMEHwnGFz0gaDkTTSGv+ZaOt4d4myCA@HIDDEN

@InCollection{Geyer2011,
  author          = {Geyer, Charles J},
  title           = {{Introduction to Markov Chain Monte Carlo}},
                     ^                                        ^
  year            = 2011,
  booktitle       = {{Handbook of Markov Chain Monte Carlo}},
  editor          = {Brooks, Steve and Gelman, Andrew and Jones, Galin and Meng,
		  Xiao-Li},
  publisher       = {CRC press},
  pages           = 45,
}

The curly braces inside fields are a part of BibTeX specification:
http://www.bibtex.org/SpecialSymbols/

Yet, bibtex-parse-entry simply ignores all the curly braces inside the
field and returns the field as is:

(("=type=" . "InCollection")
... ("title" . "{Introduction to Mark\\.{o}v Chain Monte Carlo}") ...)

The same goes for the \.{o} special symbol.

It would be useful if bibtex-parse-entry could process the escapes when,
say, its first optional argument CONTENT is set to 'parse.

Would it be possible?

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Acknowledgement sent to Ihor Radchenko <yantar92@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#57712; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 14 Sep 2022 17:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.