X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/034babe1e173ce643c6a419db156916e792c0ebd..c94d5f81aaef23672bf1be040c9388f8fe9f88e5:/lisp/progmodes/cpp.el diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index c615082814..e85c475241 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -1,6 +1,6 @@ ;;; cpp.el --- highlight or hide text according to cpp conditionals -;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005 +;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007 ;; Free Software Foundation ;; Author: Per Abrahamsen @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) +;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -50,6 +50,7 @@ ;;; Customization: (defgroup cpp nil "Highlight or hide text according to cpp conditionals." + :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) :group 'c :prefix "cpp-") @@ -58,14 +59,18 @@ :type 'file :group 'cpp) +(define-widget 'cpp-face 'lazy + "Either a face or the special symbol 'invisible'." + :type '(choice (const invisible) (face))) + (defcustom cpp-known-face 'invisible "*Face used for known cpp symbols." - :type 'face + :type 'cpp-face :group 'cpp) (defcustom cpp-unknown-face 'highlight "*Face used for unknown cpp symbols." - :type 'face + :type 'cpp-face :group 'cpp) (defcustom cpp-face-type 'light @@ -94,10 +99,12 @@ Each entry is a list with the following elements: 1. Face used for text that is `ifdef' the macro. 2. Face used for text that is `ifndef' the macro. 3. t, nil, or `both' depending on what text may be edited." - :type '(repeat (list string face face - (choice (const t) - (const nil) - (const both)))) + :type '(repeat (list (string :tag "Macro") + (cpp-face :tag "True") + (cpp-face :tag "False") + (choice (const :tag "True branch writable" t) + (const :tag "False branch writeable" nil) + (const :tag "Both branches writeable" both)))) :group 'cpp) (defvar cpp-overlay-list nil) @@ -182,7 +189,7 @@ or a cons cell (background-color . COLOR)." '(("default" . default) ("invisible" . invisible)) "Alist of names and faces available even if you don't use a window system." - :type '(repeat (cons string face)) + :type '(repeat (cons string cpp-face)) :group 'cpp) (defvar cpp-face-all-list @@ -519,6 +526,8 @@ You can also use the keyboard accelerators indicated like this: [K]ey." 'cpp-edit-toggle-unknown) (insert (format "\n\n\n%39s: %14s %14s %7s\n\n" "Expression" "[T]rue Face" "[F]alse Face" "[W]rite")) + + (setq symbols (reverse symbols)) (while symbols (let* ((symbol (car symbols)) (entry (assoc symbol cpp-edit-list))