aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2013-01-08 22:40:41 +0100
committerStephen Berman2013-01-08 22:40:41 +0100
commitb58fa72f2ad2f2c268a3e6eb8d884fe0f229dfac (patch)
tree3ab8586c05d1a74996d756a36ddce928708ceb37
parentc4bf3e3daad163c81e215a08c141269601f4194e (diff)
downloademacs-b58fa72f2ad2f2c268a3e6eb8d884fe0f229dfac.tar.gz
emacs-b58fa72f2ad2f2c268a3e6eb8d884fe0f229dfac.zip
* calendar/todos.el: Fix tabular alignment in Todos Categories mode.
(todos-adjusted-category-label-length): New function. (todos-padded-string): Use it.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/calendar/todos.el21
2 files changed, 22 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 754e936f2b3..c529800e564 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12013-01-08 Stephen Berman <stephen.berman@gmx.net> 12013-01-08 Stephen Berman <stephen.berman@gmx.net>
2 2
3 * calendar/todos.el: Fix tabular alignment in Todos Categories mode.
4 (todos-adjusted-category-label-length): New function.
5 (todos-padded-string): Use it.
6
72013-01-08 Stephen Berman <stephen.berman@gmx.net>
8
3 * calendar/todos.el (todos-move-item): Allow moving done items to 9 * calendar/todos.el (todos-move-item): Allow moving done items to
4 done section of another category. 10 done section of another category.
5 11
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el
index 0b3a3b57a9b..c5792338930 100644
--- a/lisp/calendar/todos.el
+++ b/lisp/calendar/todos.el
@@ -2141,15 +2141,26 @@ in Todos Filter Items mode."
2141 (dolist (c categories longest) 2141 (dolist (c categories longest)
2142 (setq longest (max longest (length c)))))) 2142 (setq longest (max longest (length c))))))
2143 2143
2144(defun todos-adjusted-category-label-length ()
2145 "Return adjusted length of category label button.
2146The adjustment ensures proper tabular alignment in Todos
2147Categories mode."
2148 (let* ((categories (mapcar 'car todos-categories))
2149 (longest (todos-longest-category-name-length categories))
2150 (catlablen (length todos-categories-category-label))
2151 (lc-diff (- longest catlablen)))
2152 (if (and (natnump lc-diff)
2153 (eq (logand lc-diff 1) 1)) ; oddp from cl.el
2154 (1+ longest)
2155 (max longest catlablen))))
2156
2144(defun todos-padded-string (str) 2157(defun todos-padded-string (str)
2145 "Return string STR padded with spaces. 2158 "Return category name or label string STR padded with spaces.
2146The placement of the padding is determined by the value of user 2159The placement of the padding is determined by the value of user
2147option `todos-categories-align'." 2160option `todos-categories-align'."
2148 (let* ((categories (mapcar 'car todos-categories)) 2161 (let* ((len (todos-adjusted-category-label-length))
2149 (len (max (todos-longest-category-name-length categories)
2150 (length todos-categories-category-label)))
2151 (strlen (length str)) 2162 (strlen (length str))
2152 (strlen-odd (eq (logand strlen 1) 1)) ; oddp from cl.el 2163 (strlen-odd (eq (logand strlen 1) 1))
2153 (padding (max 0 (/ (- len strlen) 2))) 2164 (padding (max 0 (/ (- len strlen) 2)))
2154 (padding-left (cond ((eq todos-categories-align 'left) 0) 2165 (padding-left (cond ((eq todos-categories-align 'left) 0)
2155 ((eq todos-categories-align 'center) padding) 2166 ((eq todos-categories-align 'center) padding)