Compare plain list item bullets.

This commit is contained in:
Tom Alexander
2023-09-29 17:28:50 -04:00
parent 13697df7ea
commit 967e74c147
4 changed files with 53 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
use super::elisp_fact::GetElispFact;
use super::sexp::Token;
use crate::compare::sexp::unquote;
use crate::types::GetStandardProperties;
use crate::types::StandardProperties;
@@ -202,3 +203,17 @@ pub(crate) fn get_property_unquoted_atom<'s, 'x>(
.map(Token::as_atom)
.map_or(Ok(None), |r| r.map(Some))?)
}
/// Get a named property containing an quoted string from the emacs token.
///
/// Returns None if key is not found.
pub(crate) fn get_property_quoted_string<'s, 'x>(
emacs: &'s Token<'s>,
key: &'x str,
) -> Result<Option<String>, Box<dyn std::error::Error>> {
Ok(get_property(emacs, key)?
.map(Token::as_atom)
.map_or(Ok(None), |r| r.map(Some))?
.map(unquote)
.map_or(Ok(None), |r| r.map(Some))?)
}