comparison lisp/progmodes/cpp.el @ 49598:0d8b17d428b5

Trailing whitepace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 13:24:35 +0000
parents 7505ed4a9b60
children 54347668e2e9 d7ddb3e565de
comparison
equal deleted inserted replaced
49597:e88404e8f2cf 49598:0d8b17d428b5
30 ;; This package is inspired by Jim Coplien's delta editor for SCCS. 30 ;; This package is inspired by Jim Coplien's delta editor for SCCS.
31 31
32 ;;; Todo: 32 ;;; Todo:
33 33
34 ;; Should parse "#if" and "#elif" expressions and merge the faces 34 ;; Should parse "#if" and "#elif" expressions and merge the faces
35 ;; somehow. 35 ;; somehow.
36 36
37 ;; Somehow it is sometimes possible to make changes near a read only 37 ;; Somehow it is sometimes possible to make changes near a read only
38 ;; area which you can't undo. Their are other strange effects in that 38 ;; area which you can't undo. Their are other strange effects in that
39 ;; area. 39 ;; area.
40 40
65 (defcustom cpp-unknown-face 'highlight 65 (defcustom cpp-unknown-face 'highlight
66 "*Face used for unknown cpp symbols." 66 "*Face used for unknown cpp symbols."
67 :type 'face 67 :type 'face
68 :group 'cpp) 68 :group 'cpp)
69 69
70 (defcustom cpp-face-type 'light 70 (defcustom cpp-face-type 'light
71 "*Indicate what background face type you prefer. 71 "*Indicate what background face type you prefer.
72 Can be either light or dark for color screens, mono for monochrome 72 Can be either light or dark for color screens, mono for monochrome
73 screens, and none if you don't use a window system and don't have 73 screens, and none if you don't use a window system and don't have
74 a color-capable display." 74 a color-capable display."
75 :options '(light dark mono nil) 75 :options '(light dark mono nil)
366 ;; Create an overlay for an unknown cpp command from START to END. 366 ;; Create an overlay for an unknown cpp command from START to END.
367 (let ((overlay (make-overlay start end))) 367 (let ((overlay (make-overlay start end)))
368 (cond ((eq cpp-unknown-face 'invisible) 368 (cond ((eq cpp-unknown-face 'invisible)
369 (cpp-make-overlay-hidden overlay)) 369 (cpp-make-overlay-hidden overlay))
370 ((eq cpp-unknown-face 'default)) 370 ((eq cpp-unknown-face 'default))
371 (t 371 (t
372 (overlay-put overlay 'face cpp-unknown-face))) 372 (overlay-put overlay 'face cpp-unknown-face)))
373 (if cpp-unknown-writable 373 (if cpp-unknown-writable
374 () 374 ()
375 (overlay-put overlay 'modification-hooks '(cpp-signal-read-only)) 375 (overlay-put overlay 'modification-hooks '(cpp-signal-read-only))
376 (overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only))) 376 (overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only)))
459 ;; Symbols defined in the edit buffer. 459 ;; Symbols defined in the edit buffer.
460 (make-variable-buffer-local 'cpp-edit-symbols) 460 (make-variable-buffer-local 'cpp-edit-symbols)
461 461
462 (defun cpp-edit-mode () 462 (defun cpp-edit-mode ()
463 "Major mode for editing the criteria for highlighting cpp conditionals. 463 "Major mode for editing the criteria for highlighting cpp conditionals.
464 Click on objects to change them. 464 Click on objects to change them.
465 You can also use the keyboard accelerators indicated like this: [K]ey." 465 You can also use the keyboard accelerators indicated like this: [K]ey."
466 (kill-all-local-variables) 466 (kill-all-local-variables)
467 (buffer-disable-undo) 467 (buffer-disable-undo)
468 (auto-save-mode -1) 468 (auto-save-mode -1)
469 (setq buffer-read-only t) 469 (setq buffer-read-only t)
533 (or (null true) (eq true 'default)) 533 (or (null true) (eq true 'default))
534 (or (null false) (eq false 'default)) 534 (or (null false) (eq false 'default))
535 (eq write 'both)) 535 (eq write 'both))
536 (setq cpp-edit-list (delq entry cpp-edit-list) 536 (setq cpp-edit-list (delq entry cpp-edit-list)
537 entry nil)) 537 entry nil))
538 538
539 (if (> (length symbol) 39) 539 (if (> (length symbol) 39)
540 (insert (substring symbol 0 39) ": ") 540 (insert (substring symbol 0 39) ": ")
541 (insert (format "%39s: " symbol))) 541 (insert (format "%39s: " symbol)))
542 542
543 (cpp-make-button (cpp-face-name true) 543 (cpp-make-button (cpp-face-name true)
647 (defun cpp-edit-false (symbol face) 647 (defun cpp-edit-false (symbol face)
648 "Select SYMBOL's false FACE used for highlighting untaken conditionals." 648 "Select SYMBOL's false FACE used for highlighting untaken conditionals."
649 (interactive 649 (interactive
650 (let ((symbol (cpp-choose-symbol))) 650 (let ((symbol (cpp-choose-symbol)))
651 (list symbol 651 (list symbol
652 (cpp-choose-face "False face" 652 (cpp-choose-face "False face"
653 (nth 2 (assoc symbol cpp-edit-list)))))) 653 (nth 2 (assoc symbol cpp-edit-list))))))
654 (setcar (nthcdr 2 (cpp-edit-list-entry-get-or-create symbol)) face) 654 (setcar (nthcdr 2 (cpp-edit-list-entry-get-or-create symbol)) face)
655 (cpp-edit-reset)) 655 (cpp-edit-reset))
656 656
657 (defun cpp-edit-write (symbol branch) 657 (defun cpp-edit-write (symbol branch)