Skip to content

Commit bf28564

Browse files
author
Jason Duncan
committed
Readability/using more of subr-x.
1 parent b9b6acb commit bf28564

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

TODO.org

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
** TODO 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.
22
** DONE "delimiater" -> "delimiter"
33
** DONE 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)?
4-
** TODO Could the first conditional in format-table-remove-noise be written either as:
4+
** DONE Could the first conditional in format-table-remove-noise be written either as:
55

66
#+BEGIN_SRC emacs-lisp
77
(unless (or (string-equal "" cur-line)
@@ -17,6 +17,9 @@
1717
(push cur-line ret))
1818
#+END_SRC
1919

20+
*** NOTE The version using `and' is slightly more concise, but I believe the compromise I made between the two suggestions to be more readable.
21+
*** 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.
22+
2023
** TODO Could the last conditional in format-table-remove-noise be written with (when ret ...) instead of (if (not ret) nil ...)?
2124
** TODO Rather than
2225

format-table.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@
9898
(regexp (if (not row-count-format) nil (format row-count-format "[[:digit:]]+")))
9999
ret)
100100
(dolist (cur-line (reverse lines) ret)
101-
(if (not (or (string-equal "" cur-line)
102-
(if (not regexp) nil (string-match regexp cur-line))))
103-
(push cur-line ret)))
101+
(unless (or (string-empty-p cur-line)
102+
(and regexp (string-match regexp cur-line)))
103+
(push cur-line ret)))
104104
(if (not ret) nil
105105
(setq ret (if (plist-get input-mode :top-border-fn) (-slice ret 1) ret))
106106
(if (plist-get input-mode :top-border-fn)

0 commit comments

Comments
 (0)