Commits


mailcap: reset string parser state for cmd handling When interpolating a mailcap command, make sure we reset the state of the string parser each time, otherwise the intended command is never interpolated. This would mean that previous commands would get run with old files, or worse still, segfault.


add --with-default-opener; use to open(1) on mac and xdg-open elsewhere


code: add wrappers for common failure cases Certain calls to well-known functions sometimes result in similar error handling across the code base. Sometimes there's a need to centralise the failure case. Achieve this for common wrappers to often-used functions. The transformation is achieved via coccinelle, commited with this patch. Note that coccinelle can be told to ignore code blocks with comment delimiters. This transformation applies just to telescope's code, and not any of the bundled depdencies in telescope (libgrapheme).


mailcap: change the default to run xdg-open in the background


mailcap: improve flag handling Extra information present on a mailcap line can extend to almost anything. It cannot be assumed that flags such as "copiousoutput" or "needsterminal" will be the first set of flags after the command field. For now, treat everything after the "command" part of a mailcap entry as potential fields, and still scan for "copiousoutput" and "needsterminal".


mailcap: fix str_trim_whitespace return the pointer advanced past the leading blanks too.


mailcap: ignore comments too


mailcap: extract the FILE parsing routine and export it so that we can write tests for this module.


mailcap: whitespace nits


mailcap: add parser for external command handling This introduces a (limited) subset of mailcap handling, as defined in RFC 1524. This makes it possible for telescope to run commands on different mime types as defined in a mailcap file, but defaults to a default mime type of using xdg-open if no match is found, or no mailcap file defined.