;;; cpp.el --- highlight or hide text according to cpp conditionals
-;; Copyright (C) 1994, 1995 Free Software Foundation
+;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005
+;; Free Software Foundation
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Keywords: c, faces, tools
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;; Todo:
;; Should parse "#if" and "#elif" expressions and merge the faces
-;; somehow.
+;; somehow.
;; Somehow it is sometimes possible to make changes near a read only
;; area which you can't undo. Their are other strange effects in that
:type 'face
:group 'cpp)
-(defcustom cpp-face-type 'light
+(defcustom cpp-face-type 'light
"*Indicate what background face type you prefer.
Can be either light or dark for color screens, mono for monochrome
screens, and none if you don't use a window system and don't have
0. The name of the macro (a string).
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."
+3. t, nil, or `both' depending on what text may be edited."
:type '(repeat (list string face face
(choice (const t)
(const nil)
'("light gray" "light blue" "light cyan" "light yellow" "light pink"
"pale green" "beige" "orange" "magenta" "violet" "medium purple"
"turquoise")
- "Background colours useful with dark foreground colors."
+ "Background colors useful with dark foreground colors."
:type '(repeat string)
:group 'cpp)
'("dim gray" "blue" "cyan" "yellow" "red"
"dark green" "brown" "dark orange" "dark khaki" "dark violet" "purple"
"dark turquoise")
- "Background colours useful with light foreground colors."
+ "Background colors useful with light foreground colors."
:type '(repeat string)
:group 'cpp)
(cond ((eq cpp-unknown-face 'invisible)
(cpp-make-overlay-hidden overlay))
((eq cpp-unknown-face 'default))
- (t
+ (t
(overlay-put overlay 'face cpp-unknown-face)))
(if cpp-unknown-writable
()
(defun cpp-make-overlay-hidden (overlay)
;; Make overlay hidden and intangible.
(overlay-put overlay 'invisible 'cpp)
- (overlay-put overlay 'intangible t)
- ;; Unfortunately `intangible' is not implemented for overlays yet,
- ;; so we make is read-only instead.
(overlay-put overlay 'modification-hooks '(cpp-signal-read-only))
(overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only)))
(defun cpp-edit-mode ()
"Major mode for editing the criteria for highlighting cpp conditionals.
-Click on objects to change them.
+Click on objects to change them.
You can also use the keyboard accelerators indicated like this: [K]ey."
(kill-all-local-variables)
(buffer-disable-undo)
(eq write 'both))
(setq cpp-edit-list (delq entry cpp-edit-list)
entry nil))
-
+
(if (> (length symbol) 39)
(insert (substring symbol 0 39) ": ")
(insert (format "%39s: " symbol)))
(interactive
(let ((symbol (cpp-choose-symbol)))
(list symbol
- (cpp-choose-face "False face"
+ (cpp-choose-face "False face"
(nth 2 (assoc symbol cpp-edit-list))))))
(setcar (nthcdr 2 (cpp-edit-list-entry-get-or-create symbol)) face)
(cpp-edit-reset))
;; Choose a symbol if called from keyboard, otherwise use the one clicked on.
(if cpp-button-event
cpp-callback-data
- (completing-read "Symbol: " (mapcar 'list cpp-edit-symbols) nil t)))
+ (completing-read "Symbol: " cpp-edit-symbols nil t)))
(defun cpp-choose-branch ()
;; Choose a branch, either nil, t, or both.
(provide 'cpp)
+;;; arch-tag: fb7d433d-745d-495a-96f0-86908ab63f74
;;; cpp.el ends here