Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 1.66 KB

File metadata and controls

37 lines (28 loc) · 1.66 KB

Some docstrings are quite long which lets you pass package-lint and makes for good enough M-x apropos output, but they wrap poorly in M-x help.

“delimiater” -> “delimiter”

Since you’re using Emacs 25 you can use the string-trim functions (could format-table-trim-row be rewritten as just (string-trim row begin-row end-row)?

NOTE the answer is no, this causes a regression. The optional trim-left and trim-right arugments were not added to string-trim until emacs 26.

Could the first conditional in format-table-remove-noise be written either as:

(unless (or (string-equal "" cur-line)
            (and regexp (string-match regexp cur-line)))
  (push cur-line ret))

or, even more aggressively (perhaps even using string-blank-p instead of string-empty-p?):

(and (not (string-empty-p cur-line))
     (not (and regexp (string-match regexp cur-line)))
     (push cur-line ret))

NOTE The version using `and’ is slightly more concise, but I believe the compromise I made between the two suggestions to be more readable.

NOTE2 I’m wary of going all the way to string-blank-p as I wouldn’t want to break potential compatibility with a table format which uses whitespace in a way I hadn’t thought of.

Could the last conditional in format-table-remove-noise be written with (when ret …) instead of (if (not ret) nil …)?

Rather than

(let* ((lines (split-string str "[

]+"))...)

which incidentally contains two newlines, why not:

(let* ((lines (split-string str "[\n]+")) ...)