The variables for keywords are actually constants.

These settings do not need to exist in GlobalSettings because they are actually constants in upstream Org-Mode.
This commit is contained in:
Tom Alexander
2023-10-18 18:22:01 -04:00
parent c58b0e7c35
commit ba72cc1b29
5 changed files with 29 additions and 42 deletions

View File

@@ -22,6 +22,8 @@ use super::util::get_consumed;
use super::util::maybe_consume_trailing_whitespace_if_not_exiting;
use super::util::org_line_ending;
use crate::context::bind_context;
use crate::context::constants::ORG_ELEMENT_AFFILIATED_KEYWORDS;
use crate::context::constants::ORG_ELEMENT_DUAL_KEYWORDS;
use crate::context::RefContext;
use crate::error::CustomError;
use crate::error::Res;
@@ -152,9 +154,9 @@ fn plain_affiliated_key<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
for keyword in context.get_global_settings().element_affiliated_keywords {
for keyword in ORG_ELEMENT_AFFILIATED_KEYWORDS {
let result = map(
tuple((tag_no_case::<_, _, CustomError>(*keyword), peek(tag(":")))),
tuple((tag_no_case::<_, _, CustomError>(keyword), peek(tag(":")))),
|(key, _)| key,
)(input);
if let Ok((remaining, ent)) = result {
@@ -170,9 +172,9 @@ fn dual_affiliated_key<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
for keyword in context.get_global_settings().element_dual_keywords {
for keyword in ORG_ELEMENT_DUAL_KEYWORDS {
let result = recognize(tuple((
tag_no_case::<_, _, CustomError>(*keyword),
tag_no_case::<_, _, CustomError>(keyword),
tag("["),
optval,
tag("]"),