branch: elpa/tablist commit d65235db22c53d73d3bd95cba79d4cb5898ca451 Author: Andreas Politz <poli...@hochschule-trier.de> Commit: Andreas Politz <poli...@hochschule-trier.de>
Fixed a bug regarding tablist columns. * lisp/tablist.el (tablist-current-column): Compute the current column in a more sane and hopefully correct way. Extended documentation. --- tablist.el | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tablist.el b/tablist.el index a76a4dc..447ff48 100644 --- a/tablist.el +++ b/tablist.el @@ -1145,21 +1145,17 @@ Optional REVERT-P means, revert the display afterwards." prop)) (defun tablist-current-column () - "Return the column number at point." - (let ((columns - (tablist-column-offsets)) - (index 0)) - (when (eq 0 (car columns)) - (cl-incf index)) - (while (and columns - (<= (car columns) - (current-column))) - (cl-incf index) - (setq columns (cdr columns))) - (if (> index 0) - (1- index) - (if columns - 0)))) + "Return the column number at point. + +Returns nil, if point is before the first column." + (let ((column + (1- (cl-position + (current-column) + (append (tablist-column-offsets) + (list most-positive-fixnum)) + :test (lambda (column offset) (> offset column)))))) + (when (>= column 0) + column))) (defun tablist-column-offsets () "Return a list of column positions.