aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Francoise2005-12-14 11:21:24 +0000
committerRomain Francoise2005-12-14 11:21:24 +0000
commit28aa81489da5e780d3b811e17a5508af4e1d2728 (patch)
tree6f845f331753abe624864b69e4b1fdff99f38789
parente8171d36a31b88d9840a4bf36d6c7e5cbabaac60 (diff)
downloademacs-28aa81489da5e780d3b811e17a5508af4e1d2728.tar.gz
emacs-28aa81489da5e780d3b811e17a5508af4e1d2728.zip
(font-lock-keywords-alist): Rename `append' to `how'.
(font-lock-add-keywords, font-lock-update-removed-keyword-alist): (font-lock-remove-keywords): Likewise.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/font-lock.el42
2 files changed, 27 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 84ecda11885..b9db971e623 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12005-12-14 Romain Francoise <romain@orebokech.com>
2
3 * font-lock.el (font-lock-keywords-alist): Rename `append' to `how'.
4 (font-lock-add-keywords, font-lock-update-removed-keyword-alist):
5 (font-lock-remove-keywords): Likewise.
6
12005-12-14 Juri Linkov <juri@jurta.org> 72005-12-14 Juri Linkov <juri@jurta.org>
2 8
3 * log-view.el (log-view-diff): Doc fix. 9 * log-view.el (log-view-diff): Doc fix.
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 0b786ac71ce..f6b334832d0 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -463,13 +463,13 @@ optimized.")
463(defvar font-lock-keywords-alist nil 463(defvar font-lock-keywords-alist nil
464 "Alist of additional `font-lock-keywords' elements for major modes. 464 "Alist of additional `font-lock-keywords' elements for major modes.
465 465
466Each element has the form (MODE KEYWORDS . APPEND). 466Each element has the form (MODE KEYWORDS . HOW).
467`font-lock-set-defaults' adds the elements in the list KEYWORDS to 467`font-lock-set-defaults' adds the elements in the list KEYWORDS to
468`font-lock-keywords' when Font Lock is turned on in major mode MODE. 468`font-lock-keywords' when Font Lock is turned on in major mode MODE.
469 469
470If APPEND is nil, KEYWORDS are added at the beginning of 470If HOW is nil, KEYWORDS are added at the beginning of
471`font-lock-keywords'. If it is `set', they are used to replace the 471`font-lock-keywords'. If it is `set', they are used to replace the
472value of `font-lock-keywords'. If APPEND is any other non-nil value, 472value of `font-lock-keywords'. If HOW is any other non-nil value,
473they are added at the end. 473they are added at the end.
474 474
475This is normally set via `font-lock-add-keywords' and 475This is normally set via `font-lock-add-keywords' and
@@ -650,15 +650,15 @@ Major/minor modes can set this variable if they know which option applies.")
650 (font-lock-unfontify-buffer) 650 (font-lock-unfontify-buffer)
651 (font-lock-turn-off-thing-lock))) 651 (font-lock-turn-off-thing-lock)))
652 652
653(defun font-lock-add-keywords (mode keywords &optional append) 653(defun font-lock-add-keywords (mode keywords &optional how)
654 "Add highlighting KEYWORDS for MODE. 654 "Add highlighting KEYWORDS for MODE.
655 655
656MODE should be a symbol, the major mode command name, such as `c-mode' 656MODE should be a symbol, the major mode command name, such as `c-mode'
657or nil. If nil, highlighting keywords are added for the current buffer. 657or nil. If nil, highlighting keywords are added for the current buffer.
658KEYWORDS should be a list; see the variable `font-lock-keywords'. 658KEYWORDS should be a list; see the variable `font-lock-keywords'.
659By default they are added at the beginning of the current highlighting list. 659By default they are added at the beginning of the current highlighting list.
660If optional argument APPEND is `set', they are used to replace the current 660If optional argument HOW is `set', they are used to replace the current
661highlighting list. If APPEND is any other non-nil value, they are added at the 661highlighting list. If HOW is any other non-nil value, they are added at the
662end of the current highlighting list. 662end of the current highlighting list.
663 663
664For example: 664For example:
@@ -691,17 +691,17 @@ Note that some modes have specialized support for additional patterns, e.g.,
691see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', 691see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
692`objc-font-lock-extra-types' and `java-font-lock-extra-types'." 692`objc-font-lock-extra-types' and `java-font-lock-extra-types'."
693 (cond (mode 693 (cond (mode
694 ;; If MODE is non-nil, add the KEYWORDS and APPEND spec to 694 ;; If MODE is non-nil, add the KEYWORDS and HOW spec to
695 ;; `font-lock-keywords-alist' so `font-lock-set-defaults' uses them. 695 ;; `font-lock-keywords-alist' so `font-lock-set-defaults' uses them.
696 (let ((spec (cons keywords append)) cell) 696 (let ((spec (cons keywords how)) cell)
697 (if (setq cell (assq mode font-lock-keywords-alist)) 697 (if (setq cell (assq mode font-lock-keywords-alist))
698 (if (eq append 'set) 698 (if (eq how 'set)
699 (setcdr cell (list spec)) 699 (setcdr cell (list spec))
700 (setcdr cell (append (cdr cell) (list spec)))) 700 (setcdr cell (append (cdr cell) (list spec))))
701 (push (list mode spec) font-lock-keywords-alist))) 701 (push (list mode spec) font-lock-keywords-alist)))
702 ;; Make sure that `font-lock-removed-keywords-alist' does not 702 ;; Make sure that `font-lock-removed-keywords-alist' does not
703 ;; contain the new keywords. 703 ;; contain the new keywords.
704 (font-lock-update-removed-keyword-alist mode keywords append)) 704 (font-lock-update-removed-keyword-alist mode keywords how))
705 (t 705 (t
706 ;; Otherwise set or add the keywords now. 706 ;; Otherwise set or add the keywords now.
707 ;; This is a no-op if it has been done already in this buffer 707 ;; This is a no-op if it has been done already in this buffer
@@ -712,13 +712,13 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
712 (if was-compiled 712 (if was-compiled
713 (setq font-lock-keywords (cadr font-lock-keywords))) 713 (setq font-lock-keywords (cadr font-lock-keywords)))
714 ;; Now modify or replace them. 714 ;; Now modify or replace them.
715 (if (eq append 'set) 715 (if (eq how 'set)
716 (setq font-lock-keywords keywords) 716 (setq font-lock-keywords keywords)
717 (font-lock-remove-keywords nil keywords) ;to avoid duplicates 717 (font-lock-remove-keywords nil keywords) ;to avoid duplicates
718 (let ((old (if (eq (car-safe font-lock-keywords) t) 718 (let ((old (if (eq (car-safe font-lock-keywords) t)
719 (cdr font-lock-keywords) 719 (cdr font-lock-keywords)
720 font-lock-keywords))) 720 font-lock-keywords)))
721 (setq font-lock-keywords (if append 721 (setq font-lock-keywords (if how
722 (append old keywords) 722 (append old keywords)
723 (append keywords old))))) 723 (append keywords old)))))
724 ;; If the keywords were compiled before, compile them again. 724 ;; If the keywords were compiled before, compile them again.
@@ -726,7 +726,7 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
726 (set (make-local-variable 'font-lock-keywords) 726 (set (make-local-variable 'font-lock-keywords)
727 (font-lock-compile-keywords font-lock-keywords t))))))) 727 (font-lock-compile-keywords font-lock-keywords t)))))))
728 728
729(defun font-lock-update-removed-keyword-alist (mode keywords append) 729(defun font-lock-update-removed-keyword-alist (mode keywords how)
730 "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE." 730 "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE."
731 ;; When font-lock is enabled first all keywords in the list 731 ;; When font-lock is enabled first all keywords in the list
732 ;; `font-lock-keywords-alist' are added, then all keywords in the 732 ;; `font-lock-keywords-alist' are added, then all keywords in the
@@ -736,7 +736,7 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
736 ;; will not take effect. 736 ;; will not take effect.
737 (let ((cell (assq mode font-lock-removed-keywords-alist))) 737 (let ((cell (assq mode font-lock-removed-keywords-alist)))
738 (if cell 738 (if cell
739 (if (eq append 'set) 739 (if (eq how 'set)
740 ;; A new set of keywords is defined. Forget all about 740 ;; A new set of keywords is defined. Forget all about
741 ;; our old keywords that should be removed. 741 ;; our old keywords that should be removed.
742 (setq font-lock-removed-keywords-alist 742 (setq font-lock-removed-keywords-alist
@@ -786,14 +786,14 @@ happens, so the major mode can be corrected."
786 ;; If MODE is non-nil, remove the KEYWORD from 786 ;; If MODE is non-nil, remove the KEYWORD from
787 ;; `font-lock-keywords-alist'. 787 ;; `font-lock-keywords-alist'.
788 (when top-cell 788 (when top-cell
789 (dolist (keyword-list-append-pair (cdr top-cell)) 789 (dolist (keyword-list-how-pair (cdr top-cell))
790 ;; `keywords-list-append-pair' is a cons with a list of 790 ;; `keywords-list-how-pair' is a cons with a list of
791 ;; keywords in the car top-cell and the original append 791 ;; keywords in the car top-cell and the original how
792 ;; argument in the cdr top-cell. 792 ;; argument in the cdr top-cell.
793 (setcar keyword-list-append-pair 793 (setcar keyword-list-how-pair
794 (delete keyword (car keyword-list-append-pair)))) 794 (delete keyword (car keyword-list-how-pair))))
795 ;; Remove keyword list/append pair when the keyword list 795 ;; Remove keyword list/how pair when the keyword list
796 ;; is empty and append doesn't specify `set'. (If it 796 ;; is empty and how doesn't specify `set'. (If it
797 ;; should be deleted then previously deleted keywords 797 ;; should be deleted then previously deleted keywords
798 ;; would appear again.) 798 ;; would appear again.)
799 (let ((cell top-cell)) 799 (let ((cell top-cell))