Minor cleanup.

This commit is contained in:
Tom Alexander 2023-09-30 00:16:19 -04:00
parent 846a8b3729
commit 6ed35f4674
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -28,8 +28,7 @@ pub fn run_anonymous_compare_with_settings<P: AsRef<str>>(
// TODO: This is a work-around to pretend that dos line endings do not exist. It would be better to handle the difference in line endings.
let org_contents = org_contents.as_ref().replace("\r\n", "\n");
let org_contents = org_contents.as_str();
eprintln!("Using emacs version: {}", get_emacs_version()?.trim());
eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim());
print_versions()?;
let rust_parsed = parse_with_settings(org_contents, global_settings)?;
let org_sexp = emacs_parse_anonymous_org_document(org_contents, global_settings)?;
let (_remaining, parsed_sexp) = sexp(org_sexp.as_str()).map_err(|e| e.to_string())?;
@ -54,8 +53,7 @@ pub fn run_compare_on_file_with_settings<P: AsRef<Path>>(
global_settings: &GlobalSettings,
) -> Result<(), Box<dyn std::error::Error>> {
let org_path = org_path.as_ref();
eprintln!("Using emacs version: {}", get_emacs_version()?.trim());
eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim());
print_versions()?;
let parent_directory = org_path
.parent()
.ok_or("Should be contained inside a directory.")?;
@ -89,3 +87,9 @@ pub fn run_compare_on_file_with_settings<P: AsRef<Path>>(
Ok(())
}
fn print_versions() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Using emacs version: {}", get_emacs_version()?.trim());
eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim());
Ok(())
}