aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2013-01-07 00:29:54 +0100
committerStephen Berman2013-01-07 00:29:54 +0100
commit3a898abefd967d00573ec4ddb19c26db1ff9c1f6 (patch)
tree8ba2e777af7f4e316ac42e813cc1ed4e70c8dd56
parenta1a7d89e1a808bf3aaedb23fc0b556712a949854 (diff)
downloademacs-3a898abefd967d00573ec4ddb19c26db1ff9c1f6.tar.gz
emacs-3a898abefd967d00573ec4ddb19c26db1ff9c1f6.zip
* calendar/todos.el: Display numerical priority string of top
priority items in category in a distinctive face. (todos-prefix-string): Make doc string more precise. (todos-top-priority): New defface. (todos-done, todos-done-sep): Use more compact face definition \(taken from font-lock.el). (todos-comment): Give a complete face definition, instead of inheriting from todos-done. (todos-font-lock-keywords): Use todos-comment-face for todos-comment-string-matcher. (todos-prefix-overlays): Use todos-top-priority as the face property of top priority items; don't condition reapplying item prefix overlay on whether the string changed, since that prevents updating display after changing number of top priorities. (todos-set-top-priorities): Call todos-prefix-overlays to update display.
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/calendar/todos.el157
2 files changed, 103 insertions, 73 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5ac573dc06b..9ca318515e9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12013-01-06 Stephen Berman <stephen.berman@gmx.net>
2
3 * calendar/todos.el: Display numerical priority string of top
4 priority items in category in a distinctive face.
5 (todos-prefix-string): Make doc string more precise.
6 (todos-top-priority): New defface.
7 (todos-done, todos-done-sep): Use more compact face definition
8 \(taken from font-lock.el).
9 (todos-comment): Give a complete face definition, instead of
10 inheriting from todos-done.
11 (todos-font-lock-keywords): Use todos-comment-face for
12 todos-comment-string-matcher.
13 (todos-prefix-overlays): Use todos-top-priority as the face
14 property of top priority items; don't condition reapplying item
15 prefix overlay on whether the string changed, since that prevents
16 updating display after changing number of top priorities.
17 (todos-set-top-priorities): Call todos-prefix-overlays to update
18 display.
19
12013-01-04 Stephen Berman <Stephen.Berman@rub.de> 202013-01-04 Stephen Berman <Stephen.Berman@rub.de>
2 21
3 * calendar/todos.el (todos-reset-global-current-todos-file) 22 * calendar/todos.el (todos-reset-global-current-todos-file)
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el
index f1876db459c..b956e7807ae 100644
--- a/lisp/calendar/todos.el
+++ b/lisp/calendar/todos.el
@@ -614,7 +614,31 @@ categories display according to priority."
614 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine")) 614 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
615 (((class color) (min-colors 8)) (:foreground "magenta")) 615 (((class color) (min-colors 8)) (:foreground "magenta"))
616 (t (:weight bold :underline t))) 616 (t (:weight bold :underline t)))
617 "Face for Todos prefix string." 617 "Face for Todos prefix or numerical priority string."
618 :group 'todos-faces)
619
620(defface todos-top-priority
621 ;; '((t :inherit font-lock-comment-face))
622 '((((class grayscale) (background light))
623 :foreground "DimGray" :weight bold :slant italic)
624 (((class grayscale) (background dark))
625 :foreground "LightGray" :weight bold :slant italic)
626 (((class color) (min-colors 88) (background light))
627 :foreground "Firebrick" :weight bold)
628 (((class color) (min-colors 88) (background dark))
629 :foreground "chocolate1" :weight bold)
630 (((class color) (min-colors 16) (background light))
631 :foreground "red" :weight bold)
632 (((class color) (min-colors 16) (background dark))
633 :foreground "red1" :weight bold)
634 (((class color) (min-colors 8) (background light))
635 :foreground "red" :weight bold)
636 (((class color) (min-colors 8) (background dark))
637 :foreground "yellow" :weight bold)
638 (t :weight bold :slant italic))
639 "Face for top priority Todos item numerical priority string.
640The item's priority number string has this face if the number is
641less than or equal the category's top priority setting."
618 :group 'todos-faces) 642 :group 'todos-faces)
619 643
620(defface todos-mark 644(defface todos-mark
@@ -738,77 +762,51 @@ categories display according to priority."
738 762
739(defface todos-done 763(defface todos-done
740 ;; '((t :inherit font-lock-comment-face)) 764 ;; '((t :inherit font-lock-comment-face))
741 '((((class grayscale) 765 '((((class grayscale) (background light))
742 (background light)) 766 :foreground "DimGray" :weight bold :slant italic)
743 (:slant italic :weight bold :foreground "DimGray")) 767 (((class grayscale) (background dark))
744 (((class grayscale) 768 :foreground "LightGray" :weight bold :slant italic)
745 (background dark)) 769 (((class color) (min-colors 88) (background light))
746 (:slant italic :weight bold :foreground "LightGray")) 770 :foreground "Firebrick")
747 (((class color) 771 (((class color) (min-colors 88) (background dark))
748 (min-colors 88) 772 :foreground "chocolate1")
749 (background light)) 773 (((class color) (min-colors 16) (background light))
750 (:foreground "Firebrick")) 774 :foreground "red")
751 (((class color) 775 (((class color) (min-colors 16) (background dark))
752 (min-colors 88) 776 :foreground "red1")
753 (background dark)) 777 (((class color) (min-colors 8) (background light))
754 (:foreground "chocolate1")) 778 :foreground "red")
755 (((class color) 779 (((class color) (min-colors 8) (background dark))
756 (min-colors 16) 780 :foreground "yellow")
757 (background light)) 781 (t :weight bold :slant italic))
758 (:foreground "red"))
759 (((class color)
760 (min-colors 16)
761 (background dark))
762 (:foreground "red1"))
763 (((class color)
764 (min-colors 8)
765 (background light))
766 (:foreground "red"))
767 (((class color)
768 (min-colors 8)
769 (background dark))
770 (:foreground "yellow"))
771 (t
772 (:slant italic :weight bold)))
773 "Face for done Todos item header string." 782 "Face for done Todos item header string."
774 :group 'todos-faces) 783 :group 'todos-faces)
775(defvar todos-done-face 'todos-done) 784(defvar todos-done-face 'todos-done)
776 785
777(defface todos-comment 786(defface todos-comment
778 '((t :inherit todos-done)) 787 ;; '((t :inherit font-lock-keyword-face))
788 '((((class grayscale) (background light)) :foreground "LightGray" :weight bold)
789 (((class grayscale) (background dark)) :foreground "DimGray" :weight bold)
790 (((class color) (min-colors 88) (background light)) :foreground "Purple")
791 (((class color) (min-colors 88) (background dark)) :foreground "Cyan1")
792 (((class color) (min-colors 16) (background light)) :foreground "Purple")
793 (((class color) (min-colors 16) (background dark)) :foreground "Cyan")
794 (((class color) (min-colors 8)) :foreground "cyan" :weight bold)
795 (t :weight bold))
779 "Face for comments appended to done Todos items." 796 "Face for comments appended to done Todos items."
780 :group 'todos-faces) 797 :group 'todos-faces)
781(defvar todos-comment-face 'todos-comment) 798(defvar todos-comment-face 'todos-comment)
782 799
783(defface todos-done-sep 800(defface todos-done-sep
784 ;; '((t :inherit font-lock-type-face)) 801 ;; '((t :inherit font-lock-type-face))
785 '((((class grayscale) 802 '((((class grayscale) (background light)) :foreground "Gray90" :weight bold)
786 (background light)) 803 (((class grayscale) (background dark)) :foreground "DimGray" :weight bold)
787 (:weight bold :foreground "Gray90")) 804 (((class color) (min-colors 88) (background light)) :foreground "ForestGreen")
788 (((class grayscale) 805 (((class color) (min-colors 88) (background dark)) :foreground "PaleGreen")
789 (background dark)) 806 (((class color) (min-colors 16) (background light)) :foreground "ForestGreen")
790 (:weight bold :foreground "DimGray")) 807 (((class color) (min-colors 16) (background dark)) :foreground "PaleGreen")
791 (((class color) 808 (((class color) (min-colors 8)) :foreground "green")
792 (min-colors 88) 809 (t :weight bold :underline t))
793 (background light))
794 (:foreground "ForestGreen"))
795 (((class color)
796 (min-colors 88)
797 (background dark))
798 (:foreground "PaleGreen"))
799 (((class color)
800 (min-colors 16)
801 (background light))
802 (:foreground "ForestGreen"))
803 (((class color)
804 (min-colors 16)
805 (background dark))
806 (:foreground "PaleGreen"))
807 (((class color)
808 (min-colors 8))
809 (:foreground "green"))
810 (t
811 (:underline t :weight bold)))
812 "Face for separator string bewteen done and not done Todos items." 810 "Face for separator string bewteen done and not done Todos items."
813 :group 'todos-faces) 811 :group 'todos-faces)
814(defvar todos-done-sep-face 'todos-done-sep) 812(defvar todos-done-sep-face 'todos-done-sep)
@@ -904,7 +902,7 @@ mode following todo (not done) items."
904 '(todos-date-string-matcher 1 todos-date-face t) 902 '(todos-date-string-matcher 1 todos-date-face t)
905 '(todos-time-string-matcher 1 todos-time-face t) 903 '(todos-time-string-matcher 1 todos-time-face t)
906 '(todos-done-string-matcher 0 todos-done-face t) 904 '(todos-done-string-matcher 0 todos-done-face t)
907 '(todos-comment-string-matcher 1 todos-done-face t) 905 '(todos-comment-string-matcher 1 todos-comment-face t)
908 ;; '(todos-category-string-matcher 1 todos-done-sep-face t) 906 ;; '(todos-category-string-matcher 1 todos-done-sep-face t)
909 '(todos-category-string-matcher-1 1 todos-done-sep-face t t) 907 '(todos-category-string-matcher-1 1 todos-done-sep-face t t)
910 '(todos-category-string-matcher-2 1 todos-done-sep-face t t) 908 '(todos-category-string-matcher-2 1 todos-done-sep-face t t)
@@ -1535,7 +1533,7 @@ The final element is \"*\", indicating an unspecified month.")
1535 (todos-backward-item) 1533 (todos-backward-item)
1536 (todos-prefix-overlays)) 1534 (todos-prefix-overlays))
1537 1535
1538(defun todos-prefix-overlays () 1536(defun todos-prefix-overlays () ;FIXME: this is a category function
1539 "Put before-string overlay in front of this category's items. 1537 "Put before-string overlay in front of this category's items.
1540The overlay's value is the string `todos-prefix' or with non-nil 1538The overlay's value is the string `todos-prefix' or with non-nil
1541`todos-number-priorities' an integer in the sequence from 1 to 1539`todos-number-priorities' an integer in the sequence from 1 to
@@ -1546,7 +1544,12 @@ of each other."
1546 (not (string-match "^[[:space:]]*$" todos-prefix))) 1544 (not (string-match "^[[:space:]]*$" todos-prefix)))
1547 (let ((prefix (propertize (concat todos-prefix " ") 1545 (let ((prefix (propertize (concat todos-prefix " ")
1548 'face 'todos-prefix-string)) 1546 'face 'todos-prefix-string))
1549 (num 0)) 1547 (num 0)
1548 (cat-tp (or (cdr (assoc-string (todos-current-category)
1549 (nth 2 (assoc-string todos-current-todos-file
1550 todos-priorities-rules))))
1551 todos-show-priorities))
1552 done)
1550 (save-excursion 1553 (save-excursion
1551 (goto-char (point-min)) 1554 (goto-char (point-min))
1552 (while (not (eobp)) 1555 (while (not (eobp))
@@ -1560,9 +1563,13 @@ of each other."
1560 (looking-back (concat "^" 1563 (looking-back (concat "^"
1561 (regexp-quote todos-category-done) 1564 (regexp-quote todos-category-done)
1562 "\n"))) 1565 "\n")))
1563 (setq num 1)) 1566 (setq num 1
1567 done t))
1564 (setq prefix (propertize (concat (number-to-string num) " ") 1568 (setq prefix (propertize (concat (number-to-string num) " ")
1565 'face 'todos-prefix-string))) 1569 'face
1570 (if (and (not done) (<= num cat-tp))
1571 'todos-top-priority ; make defface
1572 'todos-prefix-string))))
1566 (let ((ovs (overlays-in (point) (point))) 1573 (let ((ovs (overlays-in (point) (point)))
1567 marked ov-pref) 1574 marked ov-pref)
1568 (if ovs 1575 (if ovs
@@ -1571,14 +1578,17 @@ of each other."
1571 (if (equal val "*") 1578 (if (equal val "*")
1572 (setq marked t) 1579 (setq marked t)
1573 (setq ov-pref val))))) 1580 (setq ov-pref val)))))
1574 (unless (equal ov-pref prefix) 1581 ;; Omitting this condition doesn't appear to slow
1582 ;; redisplay down, while having it prevents updating
1583 ;; display after changing number of top priorities.
1584 ;; (unless (equal ov-pref prefix)
1575 ;; Why doesn't this work? 1585 ;; Why doesn't this work?
1576 ;; (remove-overlays (point) (point) 'before-string) 1586 ;; (remove-overlays (point) (point) 'before-string)
1577 (remove-overlays (point) (point)) 1587 (remove-overlays (point) (point))
1578 (overlay-put (make-overlay (point) (point)) 1588 (overlay-put (make-overlay (point) (point))
1579 'before-string prefix) 1589 'before-string prefix)
1580 (and marked (overlay-put (make-overlay (point) (point)) 1590 (and marked (overlay-put (make-overlay (point) (point))
1581 'before-string todos-item-mark))))) 1591 'before-string todos-item-mark))));)
1582 (forward-line)))))) 1592 (forward-line))))))
1583 1593
1584;; --------------------------------------------------------------------------- 1594;; ---------------------------------------------------------------------------
@@ -2104,7 +2114,8 @@ set the user customizable option `todos-priorities-rules'."
2104 (list file cur nrule) 2114 (list file cur nrule)
2105 nrule) 2115 nrule)
2106 (delete frule rules))) 2116 (delete frule rules)))
2107 (customize-save-variable 'todos-priorities-rules rules))) 2117 (customize-save-variable 'todos-priorities-rules rules)
2118 (todos-prefix-overlays)))
2108 2119
2109(defun todos-filtered-buffer-name (buffer-type file-list) 2120(defun todos-filtered-buffer-name (buffer-type file-list)
2110 "Rename Todos filtered buffer using BUFFER-TYPE and FILE-LIST. 2121 "Rename Todos filtered buffer using BUFFER-TYPE and FILE-LIST.