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

@@ -19,6 +19,9 @@ use super::object_parser::standard_set_object;
use super::util::confine_context;
use super::OrgSource;
use crate::context::bind_context;
use crate::context::constants::ORG_ELEMENT_DUAL_KEYWORDS;
use crate::context::constants::ORG_ELEMENT_KEYWORD_TRANSLATION_ALIST;
use crate::context::constants::ORG_ELEMENT_PARSED_KEYWORDS;
use crate::context::Context;
use crate::context::ContextElement;
use crate::context::GlobalSettings;
@@ -156,7 +159,7 @@ fn translate_name<'g, 's>(global_settings: &'g GlobalSettings<'g, 's>, name: &'s
.split_once('[')
.map(|(before, _after)| before)
.unwrap_or(name);
for (src, dst) in global_settings.element_keyword_translation_alist {
for (src, dst) in ORG_ELEMENT_KEYWORD_TRANSLATION_ALIST {
if name_until_optval.eq_ignore_ascii_case(src) {
return dst.to_lowercase();
}
@@ -179,12 +182,10 @@ fn identify_keyword_type<'g, 's>(
.into_iter()
.any(|candidate| name.eq_ignore_ascii_case(candidate))
|| name.to_lowercase().starts_with("attr_");
let is_parsed = global_settings
.element_parsed_keywords
let is_parsed = ORG_ELEMENT_PARSED_KEYWORDS
.iter()
.any(|candidate| name.eq_ignore_ascii_case(candidate));
let can_have_optval = global_settings
.element_dual_keywords
let can_have_optval = ORG_ELEMENT_DUAL_KEYWORDS
.iter()
.any(|candidate| name.eq_ignore_ascii_case(candidate));
match (is_multiple, is_parsed, can_have_optval) {