mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-25 06:17:34 +00:00
* calendar/todos.el: Fix tabular alignment in Todos Categories mode.
(todos-adjusted-category-label-length): New function. (todos-padded-string): Use it.
This commit is contained in:
parent
c4bf3e3daa
commit
b58fa72f2a
2 changed files with 22 additions and 5 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2013-01-08 Stephen Berman <stephen.berman@gmx.net>
|
||||
|
||||
* calendar/todos.el: Fix tabular alignment in Todos Categories mode.
|
||||
(todos-adjusted-category-label-length): New function.
|
||||
(todos-padded-string): Use it.
|
||||
|
||||
2013-01-08 Stephen Berman <stephen.berman@gmx.net>
|
||||
|
||||
* calendar/todos.el (todos-move-item): Allow moving done items to
|
||||
|
|
|
|||
|
|
@ -2141,15 +2141,26 @@ in Todos Filter Items mode."
|
|||
(dolist (c categories longest)
|
||||
(setq longest (max longest (length c))))))
|
||||
|
||||
(defun todos-adjusted-category-label-length ()
|
||||
"Return adjusted length of category label button.
|
||||
The adjustment ensures proper tabular alignment in Todos
|
||||
Categories mode."
|
||||
(let* ((categories (mapcar 'car todos-categories))
|
||||
(longest (todos-longest-category-name-length categories))
|
||||
(catlablen (length todos-categories-category-label))
|
||||
(lc-diff (- longest catlablen)))
|
||||
(if (and (natnump lc-diff)
|
||||
(eq (logand lc-diff 1) 1)) ; oddp from cl.el
|
||||
(1+ longest)
|
||||
(max longest catlablen))))
|
||||
|
||||
(defun todos-padded-string (str)
|
||||
"Return string STR padded with spaces.
|
||||
"Return category name or label string STR padded with spaces.
|
||||
The placement of the padding is determined by the value of user
|
||||
option `todos-categories-align'."
|
||||
(let* ((categories (mapcar 'car todos-categories))
|
||||
(len (max (todos-longest-category-name-length categories)
|
||||
(length todos-categories-category-label)))
|
||||
(let* ((len (todos-adjusted-category-label-length))
|
||||
(strlen (length str))
|
||||
(strlen-odd (eq (logand strlen 1) 1)) ; oddp from cl.el
|
||||
(strlen-odd (eq (logand strlen 1) 1))
|
||||
(padding (max 0 (/ (- len strlen) 2)))
|
||||
(padding-left (cond ((eq todos-categories-align 'left) 0)
|
||||
((eq todos-categories-align 'center) padding)
|
||||
|
|
|
|||
Loading…
Reference in a new issue