Update org-mode version.

This commit is contained in:
Tom Alexander 2023-08-25 02:55:01 -04:00
parent 77348b560c
commit 16a107eebb
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 88 additions and 32 deletions

View File

@ -75,9 +75,6 @@ fn is_expect_fail(name: &str) -> Option<&str> {
"autogen_greater_element_drawer_drawer_with_headline_inside" => Some("Apparently lines with :end: become their own paragraph. This odd behavior needs to be investigated more."), "autogen_greater_element_drawer_drawer_with_headline_inside" => Some("Apparently lines with :end: become their own paragraph. This odd behavior needs to be investigated more."),
"autogen_element_container_priority_footnote_definition_dynamic_block" => Some("Apparently broken begin lines become their own paragraph."), "autogen_element_container_priority_footnote_definition_dynamic_block" => Some("Apparently broken begin lines become their own paragraph."),
"autogen_lesser_element_paragraphs_paragraph_with_backslash_line_breaks" => Some("The text we're getting out of the parse tree is already processed to remove line breaks, so our comparison needs to take that into account."), "autogen_lesser_element_paragraphs_paragraph_with_backslash_line_breaks" => Some("The text we're getting out of the parse tree is already processed to remove line breaks, so our comparison needs to take that into account."),
"autogen_greater_element_plain_list_trailing_whitespace_ownership_test_case_1" => Some("Seeing odd behavior about whitespace ownership."), // https://list.orgmode.org/9372527e-3852-419e-936a-7b4dd38cc847@app.fastmail.com/
"autogen_greater_element_plain_list_trailing_whitespace_ownership_test_case_3" => Some("Seeing odd behavior about whitespace ownership."), // https://list.orgmode.org/9372527e-3852-419e-936a-7b4dd38cc847@app.fastmail.com/
"autogen_greater_element_plain_list_trailing_whitespace_ownership_test_case_4" => Some("Seeing odd behavior about whitespace ownership."), // https://list.orgmode.org/9372527e-3852-419e-936a-7b4dd38cc847@app.fastmail.com/
_ => None, _ => None,
} }
} }

View File

@ -14,7 +14,7 @@ RUN make DESTDIR="/root/dist" install
FROM build AS build-org-mode FROM build AS build-org-mode
ARG ORG_VERSION=299193bf091a63474fc8036bd31de51800a2555a ARG ORG_VERSION=7bdec435ff5d86220d13c431e799c5ed44a57da1
COPY --from=build-emacs /root/dist/ / COPY --from=build-emacs /root/dist/ /
RUN mkdir /root/dist RUN mkdir /root/dist
# Savannah does not allow fetching specific revisions, so we're going to have to put unnecessary load on their server by cloning main and then checking out the revision we want. # Savannah does not allow fetching specific revisions, so we're going to have to put unnecessary load on their server by cloning main and then checking out the revision we want.

View File

@ -42,6 +42,39 @@ pub fn assert_bounds<'s, S: Source<'s>>(
emacs: &'s Token<'s>, emacs: &'s Token<'s>,
rust: &'s S, rust: &'s S,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
let standard_properties = get_standard_properties(emacs)?;
let (begin, end) = (
standard_properties
.begin
.ok_or("Token should have a begin.")?,
standard_properties
.end
.ok_or("Token should have a begin.")?,
);
let (rust_begin, rust_end) = get_offsets(source, rust);
if (rust_begin + 1) != begin || (rust_end + 1) != end {
Err(format!("Rust bounds ({rust_begin}, {rust_end}) do not match emacs bounds ({emacs_begin}, {emacs_end})", rust_begin = rust_begin + 1, rust_end = rust_end + 1, emacs_begin=begin, emacs_end=end))?;
}
Ok(())
}
struct StandardProperties {
begin: Option<usize>,
#[allow(dead_code)]
post_affiliated: Option<usize>,
#[allow(dead_code)]
contents_begin: Option<usize>,
#[allow(dead_code)]
contents_end: Option<usize>,
end: Option<usize>,
#[allow(dead_code)]
post_blank: Option<usize>,
}
fn get_standard_properties<'s>(
emacs: &'s Token<'s>,
) -> Result<StandardProperties, Box<dyn std::error::Error>> {
let children = emacs.as_list()?; let children = emacs.as_list()?;
let attributes_child = children let attributes_child = children
.iter() .iter()
@ -49,34 +82,60 @@ pub fn assert_bounds<'s, S: Source<'s>>(
.ok_or("Should have an attributes child.")?; .ok_or("Should have an attributes child.")?;
let attributes_map = attributes_child.as_map()?; let attributes_map = attributes_child.as_map()?;
let standard_properties = attributes_map.get(":standard-properties"); let standard_properties = attributes_map.get(":standard-properties");
let (begin, end) = if standard_properties.is_some() { Ok(if standard_properties.is_some() {
let std_props = standard_properties let mut std_props = standard_properties
.expect("if statement proves its Some") .expect("if statement proves its Some")
.as_vector()?; .as_vector()?
let begin = std_props .into_iter();
.get(0) let begin = maybe_token_to_usize(std_props.next())?;
.ok_or("Missing first element in standard properties")? let post_affiliated = maybe_token_to_usize(std_props.next())?;
.as_atom()?; let contents_begin = maybe_token_to_usize(std_props.next())?;
let end = std_props let contents_end = maybe_token_to_usize(std_props.next())?;
.get(1) let end = maybe_token_to_usize(std_props.next())?;
.ok_or("Missing first element in standard properties")? let post_blank = maybe_token_to_usize(std_props.next())?;
.as_atom()?; StandardProperties {
(begin, end) begin,
post_affiliated,
contents_begin,
contents_end,
end,
post_blank,
}
} else { } else {
let begin = attributes_map let begin = maybe_token_to_usize(attributes_map.get(":begin").map(|token| *token))?;
.get(":begin") let end = maybe_token_to_usize(attributes_map.get(":end").map(|token| *token))?;
.ok_or("Missing :begin attribute.")? let contents_begin =
.as_atom()?; maybe_token_to_usize(attributes_map.get(":contents-begin").map(|token| *token))?;
let end = attributes_map let contents_end =
.get(":end") maybe_token_to_usize(attributes_map.get(":contents-end").map(|token| *token))?;
.ok_or("Missing :end attribute.")? let post_blank =
.as_atom()?; maybe_token_to_usize(attributes_map.get(":post-blank").map(|token| *token))?;
(begin, end) let post_affiliated =
}; maybe_token_to_usize(attributes_map.get(":post-affiliated").map(|token| *token))?;
let (rust_begin, rust_end) = get_offsets(source, rust); StandardProperties {
if (rust_begin + 1).to_string() != begin || (rust_end + 1).to_string() != end { begin,
Err(format!("Rust bounds ({rust_begin}, {rust_end}) do not match emacs bounds ({emacs_begin}, {emacs_end})", rust_begin = rust_begin + 1, rust_end = rust_end + 1, emacs_begin=begin, emacs_end=end))?; post_affiliated,
} contents_begin,
contents_end,
Ok(()) end,
post_blank,
}
})
}
fn maybe_token_to_usize(
token: Option<&Token<'_>>,
) -> Result<Option<usize>, Box<dyn std::error::Error>> {
Ok(token
.map(|token| token.as_atom())
.map_or(Ok(None), |r| r.map(Some))?
.map(|val| {
if val == "nil" {
None
} else {
Some(val.parse::<usize>())
}
})
.flatten() // Outer option is whether or not the param exists, inner option is whether or not it is nil
.map_or(Ok(None), |r| r.map(Some))?)
} }