Compare plain list type in diff.rs.

This commit is contained in:
Tom Alexander
2023-09-29 13:03:01 -04:00
parent a4b1d462c3
commit f820e27b17
3 changed files with 32 additions and 5 deletions

View File

@@ -190,3 +190,15 @@ pub(crate) fn get_property<'s, 'x>(
};
Ok(Some(*prop))
}
/// Get a named property containing an unquoted atom from the emacs token.
///
/// Returns None if key is not found.
pub(crate) fn get_property_unquoted_atom<'s, 'x>(
emacs: &'s Token<'s>,
key: &'x str,
) -> Result<Option<&'s str>, Box<dyn std::error::Error>> {
Ok(get_property(emacs, key)?
.map(Token::as_atom)
.map_or(Ok(None), |r| r.map(Some))?)
}