1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-01 11:14:55 +00:00
emacs/lisp/progmodes/cpp.el

828 lines
27 KiB
EmacsLisp
Raw Normal View History

;;; cpp.el --- highlight or hide text according to cpp conditionals
1994-09-14 09:03:27 +00:00
;; Copyright (C) 1994-1995, 2001-2012 Free Software Foundation, Inc.
1994-09-14 09:03:27 +00:00
1997-05-27 21:24:07 +00:00
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
1994-09-14 09:03:27 +00:00
;; Keywords: c, faces, tools
1994-09-14 09:05:48 +00:00
;; This file is part of GNU Emacs.
1994-09-14 09:03:27 +00:00
;; GNU Emacs is free software: you can redistribute it and/or modify
1994-09-14 09:03:27 +00:00
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
1994-09-14 09:05:48 +00:00
;; GNU Emacs is distributed in the hope that it will be useful,
1994-09-14 09:03:27 +00:00
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
1994-09-14 09:05:48 +00:00
1994-09-14 09:03:27 +00:00
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
1994-09-14 09:03:27 +00:00
1994-09-14 09:05:48 +00:00
;;; Commentary:
1994-09-14 09:03:27 +00:00
;; Parse a text for C preprocessor conditionals, and highlight or hide
;; the text inside the conditionals as you wish.
1994-09-14 18:29:11 +00:00
;; This package is inspired by Jim Coplien's delta editor for SCCS.
1994-09-14 09:03:27 +00:00
;;; Todo:
;; Should parse "#if" and "#elif" expressions and merge the faces
2003-02-04 13:24:35 +00:00
;; somehow.
1994-09-14 09:03:27 +00:00
;; 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
;; area.
;; The Edit buffer should -- optionally -- appear in its own frame.
;; Conditionals seem to be rear-sticky. They shouldn't be.
;; Restore window configurations when exiting CPP Edit buffer.
;;; Code:
;;; Customization:
1997-07-27 19:53:27 +00:00
(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
1997-07-27 19:53:27 +00:00
:prefix "cpp-")
(defcustom cpp-config-file (convert-standard-filename ".cpp.el")
"File name to save cpp configuration."
1997-07-27 19:53:27 +00:00
:type 'file
:group 'cpp)
(define-widget 'cpp-face 'lazy
"Either a face or the special symbol 'invisible'."
:type '(choice (const invisible) (face)))
1997-07-27 19:53:27 +00:00
(defcustom cpp-known-face 'invisible
"Face used for known cpp symbols."
:type 'cpp-face
1997-07-27 19:53:27 +00:00
:group 'cpp)
(defcustom cpp-unknown-face 'highlight
"Face used for unknown cpp symbols."
:type 'cpp-face
1997-07-27 19:53:27 +00:00
:group 'cpp)
2003-02-04 13:24:35 +00:00
(defcustom cpp-face-type 'light
"Indicate what background face type you prefer.
1994-09-14 09:03:27 +00:00
Can be either light or dark for color screens, mono for monochrome
2000-07-31 15:36:50 +00:00
screens, and none if you don't use a window system and don't have
a color-capable display."
1997-07-27 19:53:27 +00:00
:options '(light dark mono nil)
:type 'symbol
:group 'cpp)
(defcustom cpp-known-writable t
"Non-nil means you are allowed to modify the known conditionals."
1997-07-27 19:53:27 +00:00
:type 'boolean
:group 'cpp)
(defcustom cpp-unknown-writable t
"Non-nil means you are allowed to modify the unknown conditionals."
1997-07-27 19:53:27 +00:00
:type 'boolean
:group 'cpp)
(defcustom cpp-edit-list nil
"Alist of cpp macros and information about how they should be displayed.
Each entry is a list with the following elements:
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."
:type '(repeat (list (string :tag "Macro")
(cpp-face :tag "True")
(cpp-face :tag "False")
(choice (const :tag "True branch writable" t)
2008-12-03 03:26:23 +00:00
(const :tag "False branch writable" nil)
(const :tag "Both branches writable" both))))
1997-07-27 19:53:27 +00:00
:group 'cpp)
(defvar cpp-overlay-list nil)
;; List of cpp overlays active in the current buffer.
(make-variable-buffer-local 'cpp-overlay-list)
(defvar cpp-callback-data)
(defvar cpp-state-stack)
(defconst cpp-face-type-list
'(("light color background" . light)
("dark color background" . dark)
("monochrome" . mono)
("tty" . none))
"Alist of strings and names of the defined face collections.")
(defconst cpp-writable-list
;; Names used for the writable property.
'(("writable" . t)
("read-only" . nil)))
(defvar cpp-button-event nil)
;; This will be t in the callback for `cpp-make-button'.
(defvar cpp-edit-buffer nil)
;; Real buffer whose cpp display information we are editing.
(make-variable-buffer-local 'cpp-edit-buffer)
(defconst cpp-branch-list
;; Alist of branches.
'(("false" . nil)
("true" . t)
("both" . both)))
1997-07-27 19:53:27 +00:00
(defcustom cpp-face-default-list nil
"Alist of faces you can choose from for cpp conditionals.
Each element has the form (STRING . FACE), where STRING
serves as a name (for `cpp-highlight-buffer' only)
and FACE is either a face (a symbol)
or a cons cell (background-color . COLOR)."
:type '(repeat (cons string (choice face (cons (const background-color) string))))
1997-07-27 19:53:27 +00:00
:group 'cpp)
1997-07-27 19:53:27 +00:00
(defcustom cpp-face-light-name-list
'("light gray" "light blue" "light cyan" "light yellow" "light pink"
"pale green" "beige" "orange" "magenta" "violet" "medium purple"
"turquoise")
"Background colors useful with dark foreground colors."
1997-07-27 19:53:27 +00:00
:type '(repeat string)
:group 'cpp)
1997-07-27 19:53:27 +00:00
(defcustom cpp-face-dark-name-list
'("dim gray" "blue" "cyan" "yellow" "red"
"dark green" "brown" "dark orange" "dark khaki" "dark violet" "purple"
"dark turquoise")
"Background colors useful with light foreground colors."
1997-07-27 19:53:27 +00:00
:type '(repeat string)
:group 'cpp)
(defcustom cpp-face-light-list nil
"Alist of names and faces to be used for light backgrounds."
:type '(repeat (cons string (choice face
(cons (const background-color) string))))
1997-07-27 19:53:27 +00:00
:group 'cpp)
(defcustom cpp-face-dark-list nil
"Alist of names and faces to be used for dark backgrounds."
:type '(repeat (cons string (choice face
(cons (const background-color) string))))
1997-07-27 19:53:27 +00:00
:group 'cpp)
(defcustom cpp-face-mono-list
'(("bold" . bold)
("bold-italic" . bold-italic)
("italic" . italic)
("underline" . underline))
"Alist of names and faces to be used for monochrome screens."
:type '(repeat (cons string face))
:group 'cpp)
(defcustom cpp-face-none-list
'(("default" . default)
("invisible" . invisible))
1997-07-27 19:53:27 +00:00
"Alist of names and faces available even if you don't use a window system."
:type '(repeat (cons string cpp-face))
1997-07-27 19:53:27 +00:00
:group 'cpp)
(defvar cpp-face-all-list
(append cpp-face-light-list
cpp-face-dark-list
cpp-face-mono-list
cpp-face-none-list)
"All faces used for highlighting text inside cpp conditionals.")
1994-09-14 09:03:27 +00:00
;;; Parse Buffer:
(defvar cpp-parse-symbols nil
"List of cpp macros used in the local buffer.")
(make-variable-buffer-local 'cpp-parse-symbols)
(defconst cpp-parse-regexp
;; Regexp matching all tokens needed to find conditionals.
(concat
"'\\|\"\\|/\\*\\|//\\|"
"\\(^[ \t]*#[ \t]*\\(ifdef\\|ifndef\\|if\\|"
"elif\\|else\\|endif\\)\\b\\)"))
;;;###autoload
1994-09-14 18:48:45 +00:00
(defun cpp-highlight-buffer (arg)
"Highlight C code according to preprocessor conditionals.
This command pops up a buffer which you should edit to specify
what kind of highlighting to use, and the criteria for highlighting.
A prefix arg suppresses display of that buffer."
1994-09-14 09:03:27 +00:00
(interactive "P")
(unless (or (eq t buffer-invisibility-spec)
(memq 'cpp buffer-invisibility-spec))
(add-to-invisibility-spec 'cpp))
1994-09-14 09:03:27 +00:00
(setq cpp-parse-symbols nil)
(cpp-parse-reset)
(if (null cpp-edit-list)
(cpp-edit-load))
(let (cpp-state-stack)
1994-09-14 09:03:27 +00:00
(save-excursion
(goto-char (point-min))
(cpp-progress-message "Parsing...")
(while (re-search-forward cpp-parse-regexp nil t)
(cpp-progress-message "Parsing...%d%%"
(/ (* 100 (- (point) (point-min))) (buffer-size)))
(let ((match (buffer-substring (match-beginning 0) (match-end 0))))
(cond ((or (string-equal match "'")
(string-equal match "\""))
(goto-char (match-beginning 0))
(condition-case nil
(forward-sexp)
(error (cpp-parse-error
"Unterminated string or character"))))
((string-equal match "/*")
(or (search-forward "*/" nil t)
(error "Unterminated comment")))
((string-equal match "//")
(skip-chars-forward "^\n\r"))
(t
(end-of-line 1)
(let ((from (match-beginning 1))
(to (1+ (point)))
(type (buffer-substring (match-beginning 2)
(match-end 2)))
(expr (buffer-substring (match-end 1) (point))))
(cond ((string-equal type "ifdef")
(cpp-parse-open t expr from to))
((string-equal type "ifndef")
(cpp-parse-open nil expr from to))
((string-equal type "if")
(cpp-parse-open t expr from to))
((string-equal type "elif")
(let (cpp-known-face cpp-unknown-face)
(cpp-parse-close from to))
(cpp-parse-open t expr from to))
((string-equal type "else")
(or cpp-state-stack
(cpp-parse-error "Top level #else"))
(let ((entry (list (not (nth 0 (car cpp-state-stack)))
(nth 1 (car cpp-state-stack))
1994-09-14 09:03:27 +00:00
from to)))
(cpp-parse-close from to)
(setq cpp-state-stack (cons entry cpp-state-stack))))
1994-09-14 09:03:27 +00:00
((string-equal type "endif")
(cpp-parse-close from to))
(t
(cpp-parse-error "Parser error"))))))))
(message "Parsing...done"))
(if cpp-state-stack
1994-09-14 09:03:27 +00:00
(save-excursion
(goto-char (nth 3 (car cpp-state-stack)))
1994-09-14 09:03:27 +00:00
(cpp-parse-error "Unclosed conditional"))))
(or arg
(null cpp-parse-symbols)
(cpp-parse-edit)))
(defun cpp-parse-open (branch expr begin end)
"Push information about conditional-beginning onto `cpp-state-stack'."
;; Discard comments within this line.
1994-09-14 09:03:27 +00:00
(while (string-match "\\b[ \t]*/\\*.*\\*/[ \t]*\\b" expr)
(setq expr (concat (substring expr 0 (match-beginning 0))
(substring expr (match-end 0)))))
;; If a comment starts on this line and continues past, discard it.
(if (string-match "\\b[ \t]*/\\*" expr)
(setq expr (substring expr 0 (match-beginning 0))))
;; Delete any C++ comment from the line.
1994-09-14 09:03:27 +00:00
(if (string-match "\\b[ \t]*\\(//.*\\)?$" expr)
(setq expr (substring expr 0 (match-beginning 0))))
(while (string-match "[ \t]+" expr)
(setq expr (concat (substring expr 0 (match-beginning 0))
(substring expr (match-end 0)))))
(setq cpp-state-stack (cons (list branch expr begin end) cpp-state-stack))
1994-09-14 09:03:27 +00:00
(or (member expr cpp-parse-symbols)
(setq cpp-parse-symbols
(cons expr cpp-parse-symbols)))
(if (assoc expr cpp-edit-list)
(cpp-make-known-overlay begin end)
(cpp-make-unknown-overlay begin end)))
(defun cpp-parse-close (from to)
;; Pop top of cpp-state-stack and create overlay.
(let ((entry (assoc (nth 1 (car cpp-state-stack)) cpp-edit-list))
(branch (nth 0 (car cpp-state-stack)))
(end (nth 3 (car cpp-state-stack))))
(setq cpp-state-stack (cdr cpp-state-stack))
1994-09-14 09:03:27 +00:00
(if entry
(let ((face (nth (if branch 1 2) entry))
(read-only (eq (not branch) (nth 3 entry)))
(priority (length cpp-state-stack))
1994-09-14 09:03:27 +00:00
(overlay (make-overlay end from)))
(cpp-make-known-overlay from to)
(setq cpp-overlay-list (cons overlay cpp-overlay-list))
(if priority (overlay-put overlay 'priority priority))
(cond ((eq face 'invisible)
(cpp-make-overlay-hidden overlay))
((eq face 'default))
(t
(overlay-put overlay 'face face)))
(if read-only
(cpp-make-overlay-read-only overlay)
(cpp-make-overlay-sticky overlay)))
(cpp-make-unknown-overlay from to))))
(defun cpp-parse-error (error)
;; Error message issued by the cpp parser.
(error "%s at line %d" error (count-lines (point-min) (point))))
1994-09-14 09:03:27 +00:00
(defun cpp-parse-reset ()
"Reset display of cpp conditionals to normal."
(interactive)
(while cpp-overlay-list
(delete-overlay (car cpp-overlay-list))
(setq cpp-overlay-list (cdr cpp-overlay-list))))
;;;###autoload
(defun cpp-parse-edit ()
"Edit display information for cpp conditionals."
(interactive)
(or cpp-parse-symbols
(cpp-highlight-buffer t))
1994-09-14 09:03:27 +00:00
(let ((buffer (current-buffer)))
(pop-to-buffer "*CPP Edit*")
(cpp-edit-mode)
(setq cpp-edit-buffer buffer)
(cpp-edit-reset)))
;;; Overlays:
(defun cpp-make-known-overlay (start end)
;; Create an overlay for a known cpp command from START to END.
(let ((overlay (make-overlay start end)))
(if (eq cpp-known-face 'invisible)
(cpp-make-overlay-hidden overlay)
(or (eq cpp-known-face 'default)
(overlay-put overlay 'face cpp-known-face))
(if cpp-known-writable
()
(overlay-put overlay 'modification-hooks '(cpp-signal-read-only))
(overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only))))
(setq cpp-overlay-list (cons overlay cpp-overlay-list))))
(defun cpp-make-unknown-overlay (start end)
;; Create an overlay for an unknown cpp command from START to END.
(let ((overlay (make-overlay start end)))
(cond ((eq cpp-unknown-face 'invisible)
(cpp-make-overlay-hidden overlay))
((eq cpp-unknown-face 'default))
2003-02-04 13:24:35 +00:00
(t
1994-09-14 09:03:27 +00:00
(overlay-put overlay 'face cpp-unknown-face)))
(if cpp-unknown-writable
()
(overlay-put overlay 'modification-hooks '(cpp-signal-read-only))
(overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only)))
(setq cpp-overlay-list (cons overlay cpp-overlay-list))))
(defun cpp-make-overlay-hidden (overlay)
;; Make overlay hidden and intangible.
(overlay-put overlay 'invisible 'cpp)
(overlay-put overlay 'modification-hooks '(cpp-signal-read-only))
(overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only)))
1994-09-14 09:03:27 +00:00
(defun cpp-make-overlay-read-only (overlay)
;; Make overlay read only.
(overlay-put overlay 'modification-hooks '(cpp-signal-read-only))
(overlay-put overlay 'insert-in-front-hooks '(cpp-signal-read-only))
(overlay-put overlay 'insert-behind-hooks '(cpp-signal-read-only)))
(defun cpp-make-overlay-sticky (overlay)
;; Make OVERLAY grow when you insert text at either end.
(overlay-put overlay 'insert-in-front-hooks '(cpp-grow-overlay))
(overlay-put overlay 'insert-behind-hooks '(cpp-grow-overlay)))
(defun cpp-signal-read-only (overlay after start end &optional _len)
1994-09-14 09:03:27 +00:00
;; Only allow deleting the whole overlay.
;; Trying to change a read-only overlay.
(if (and (not after)
(or (< (overlay-start overlay) start)
(> (overlay-end overlay) end)))
1994-09-14 09:03:27 +00:00
(error "This text is read only")))
(defun cpp-grow-overlay (overlay after start end &optional _len)
1994-09-14 09:03:27 +00:00
;; Make OVERLAY grow to contain range START to END.
(if after
(move-overlay overlay
(min start (overlay-start overlay))
(max end (overlay-end overlay)))))
1994-09-14 09:03:27 +00:00
;;; Edit Buffer:
Derive from prog-mode, use derived-mode-p, and fix up various minor style issues in lisp/progmodes. * lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> make-local-hook. * lisp/progmodes/sh-script.el (sh-require-final-newline): Remove. (sh-set-shell): Don't set require-final-newline since it's already done by prog-mode. * lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column since we never set it. * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): Use read-string and standard prompt. * lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. * lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. (meta-common-mode-map): Rename from meta-mode-map. Remove C-m binding, which is a user preference, not mode specific. (meta-common-mode): New major mode; replace meta-common-initialization. * lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing around with font-lock. * lisp/progmodes/etags.el (select-tags-table-mode): Derive from special-mode. * lisp/progmodes/octave-mod.el (octave-mode): * lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): Let define-derived-mode do its job. * lisp/progmodes/cpp.el (cpp-edit-mode-map): Move initialization into declaration. (cpp-edit-mode): Use define-derived-mode. (cpp-edit-load): Use derived-mode-p. * lisp/progmodes/mixal-mode.el (mixal-mode): * lisp/progmodes/f90.el (f90-mode): * lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting require-final-newline since prog-mode does it already. * lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string. * lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup. * lisp/progmodes/antlr-mode.el: Require cc-mode upfront. (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in the declaration. (antlr-directory-dependencies, antlr-show-makefile-rules): Use derived-mode-p. (antlr-language-option): Don't assume point-min==1. (antlr-mode): Use define-derived-mode. * lisp/progmodes/ada-mode.el: Use derived-mode-p. (ada-mode): Use define-derived-mode. Use hack-local-variables-hook. * lisp/progmodes/vhdl-mode.el (vhdl-mode): * lisp/progmodes/verilog-mode.el (verilog-mode): * lisp/progmodes/vera-mode.el (vera-mode): * lisp/progmodes/sql.el (sql-mode): * lisp/progmodes/scheme.el (scheme-mode): * lisp/progmodes/perl-mode.el (perl-mode): * lisp/progmodes/octave-inf.el (inferior-octave-mode): * lisp/progmodes/autoconf.el (autoconf-mode): * lisp/progmodes/m4-mode.el (m4-mode): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/icon.el (icon-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) (ebrowse-member-mode, ebrowse-electric-position-mode): Use define-derived-mode. * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): * lisp/progmodes/which-func.el (which-function): * lisp/progmodes/vhdl-mode.el (vhdl-set-style): * lisp/progmodes/verilog-mode.el (verilog-set-compile-command) (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) (verilog-set-define, verilog-auto-reeval-locals): * lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): * lisp/progmodes/simula.el (simula-mode): * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): * lisp/progmodes/python.el (python-check, python-mode): * lisp/progmodes/prolog.el (prolog-mode-variables): * lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions): * lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame): * lisp/progmodes/delphi.el (delphi-mode): * lisp/progmodes/cc-styles.el (c-setup-paragraph-variables): * lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init) (c-font-lock-init): Move make-local-variable to their setq. * lisp/progmodes/xscheme.el (exit-scheme-interaction-mode) (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) (xscheme-debugger-mode-p, xscheme-send-string-1): * lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/ps-mode.el (ps-run-running): * lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): * lisp/progmodes/js.el (js--get-all-known-symbols): * lisp/progmodes/inf-lisp.el (inferior-lisp-proc): * lisp/progmodes/idlwave.el (idlwave-beginning-of-statement) (idlwave-template, idlwave-update-buffer-routine-info) (idlwave-update-current-buffer-info) (idlwave-get-routine-info-from-buffers, idlwave-choose) (idlwave-scan-class-info, idlwave-fix-keywords) (idlwave-list-buffer-load-path-shadows): * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) (idlwave-toolbar-remove): * lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action) (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) (idlwave-shell-menu-def): * lisp/progmodes/idlw-complete-structtag.el (idlwave-prepare-structure-tag-completion): * lisp/progmodes/gud.el (gud-set-buffer): * lisp/progmodes/f90.el (f90-backslash-not-special): * lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
(defvar cpp-edit-mode-map
(let ((map (make-keymap)))
(suppress-keymap map)
(define-key map [ down-mouse-2 ] 'cpp-push-button)
(define-key map [ mouse-2 ] 'ignore)
(define-key map " " 'scroll-up-command)
(define-key map "\C-?" 'scroll-down-command)
Derive from prog-mode, use derived-mode-p, and fix up various minor style issues in lisp/progmodes. * lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> make-local-hook. * lisp/progmodes/sh-script.el (sh-require-final-newline): Remove. (sh-set-shell): Don't set require-final-newline since it's already done by prog-mode. * lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column since we never set it. * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): Use read-string and standard prompt. * lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. * lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. (meta-common-mode-map): Rename from meta-mode-map. Remove C-m binding, which is a user preference, not mode specific. (meta-common-mode): New major mode; replace meta-common-initialization. * lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing around with font-lock. * lisp/progmodes/etags.el (select-tags-table-mode): Derive from special-mode. * lisp/progmodes/octave-mod.el (octave-mode): * lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): Let define-derived-mode do its job. * lisp/progmodes/cpp.el (cpp-edit-mode-map): Move initialization into declaration. (cpp-edit-mode): Use define-derived-mode. (cpp-edit-load): Use derived-mode-p. * lisp/progmodes/mixal-mode.el (mixal-mode): * lisp/progmodes/f90.el (f90-mode): * lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting require-final-newline since prog-mode does it already. * lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string. * lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup. * lisp/progmodes/antlr-mode.el: Require cc-mode upfront. (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in the declaration. (antlr-directory-dependencies, antlr-show-makefile-rules): Use derived-mode-p. (antlr-language-option): Don't assume point-min==1. (antlr-mode): Use define-derived-mode. * lisp/progmodes/ada-mode.el: Use derived-mode-p. (ada-mode): Use define-derived-mode. Use hack-local-variables-hook. * lisp/progmodes/vhdl-mode.el (vhdl-mode): * lisp/progmodes/verilog-mode.el (verilog-mode): * lisp/progmodes/vera-mode.el (vera-mode): * lisp/progmodes/sql.el (sql-mode): * lisp/progmodes/scheme.el (scheme-mode): * lisp/progmodes/perl-mode.el (perl-mode): * lisp/progmodes/octave-inf.el (inferior-octave-mode): * lisp/progmodes/autoconf.el (autoconf-mode): * lisp/progmodes/m4-mode.el (m4-mode): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/icon.el (icon-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) (ebrowse-member-mode, ebrowse-electric-position-mode): Use define-derived-mode. * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): * lisp/progmodes/which-func.el (which-function): * lisp/progmodes/vhdl-mode.el (vhdl-set-style): * lisp/progmodes/verilog-mode.el (verilog-set-compile-command) (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) (verilog-set-define, verilog-auto-reeval-locals): * lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): * lisp/progmodes/simula.el (simula-mode): * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): * lisp/progmodes/python.el (python-check, python-mode): * lisp/progmodes/prolog.el (prolog-mode-variables): * lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions): * lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame): * lisp/progmodes/delphi.el (delphi-mode): * lisp/progmodes/cc-styles.el (c-setup-paragraph-variables): * lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init) (c-font-lock-init): Move make-local-variable to their setq. * lisp/progmodes/xscheme.el (exit-scheme-interaction-mode) (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) (xscheme-debugger-mode-p, xscheme-send-string-1): * lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/ps-mode.el (ps-run-running): * lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): * lisp/progmodes/js.el (js--get-all-known-symbols): * lisp/progmodes/inf-lisp.el (inferior-lisp-proc): * lisp/progmodes/idlwave.el (idlwave-beginning-of-statement) (idlwave-template, idlwave-update-buffer-routine-info) (idlwave-update-current-buffer-info) (idlwave-get-routine-info-from-buffers, idlwave-choose) (idlwave-scan-class-info, idlwave-fix-keywords) (idlwave-list-buffer-load-path-shadows): * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) (idlwave-toolbar-remove): * lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action) (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) (idlwave-shell-menu-def): * lisp/progmodes/idlw-complete-structtag.el (idlwave-prepare-structure-tag-completion): * lisp/progmodes/gud.el (gud-set-buffer): * lisp/progmodes/f90.el (f90-backslash-not-special): * lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
(define-key map [ delete ] 'scroll-down)
(define-key map "\C-c\C-c" 'cpp-edit-apply)
(define-key map "a" 'cpp-edit-apply)
(define-key map "A" 'cpp-edit-apply)
(define-key map "r" 'cpp-edit-reset)
(define-key map "R" 'cpp-edit-reset)
(define-key map "s" 'cpp-edit-save)
(define-key map "S" 'cpp-edit-save)
(define-key map "l" 'cpp-edit-load)
(define-key map "L" 'cpp-edit-load)
(define-key map "h" 'cpp-edit-home)
(define-key map "H" 'cpp-edit-home)
(define-key map "b" 'cpp-edit-background)
(define-key map "B" 'cpp-edit-background)
(define-key map "k" 'cpp-edit-known)
(define-key map "K" 'cpp-edit-known)
(define-key map "u" 'cpp-edit-unknown)
(define-key map "u" 'cpp-edit-unknown)
(define-key map "t" 'cpp-edit-true)
(define-key map "T" 'cpp-edit-true)
(define-key map "f" 'cpp-edit-false)
(define-key map "F" 'cpp-edit-false)
(define-key map "w" 'cpp-edit-write)
(define-key map "W" 'cpp-edit-write)
(define-key map "X" 'cpp-edit-toggle-known)
(define-key map "x" 'cpp-edit-toggle-known)
(define-key map "Y" 'cpp-edit-toggle-unknown)
(define-key map "y" 'cpp-edit-toggle-unknown)
(define-key map "q" 'bury-buffer)
(define-key map "Q" 'bury-buffer)
map)
"Keymap for `cpp-edit-mode'.")
1994-09-14 09:03:27 +00:00
(defvar cpp-edit-symbols nil)
;; Symbols defined in the edit buffer.
(make-variable-buffer-local 'cpp-edit-symbols)
Derive from prog-mode, use derived-mode-p, and fix up various minor style issues in lisp/progmodes. * lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> make-local-hook. * lisp/progmodes/sh-script.el (sh-require-final-newline): Remove. (sh-set-shell): Don't set require-final-newline since it's already done by prog-mode. * lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column since we never set it. * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): Use read-string and standard prompt. * lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. * lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. (meta-common-mode-map): Rename from meta-mode-map. Remove C-m binding, which is a user preference, not mode specific. (meta-common-mode): New major mode; replace meta-common-initialization. * lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing around with font-lock. * lisp/progmodes/etags.el (select-tags-table-mode): Derive from special-mode. * lisp/progmodes/octave-mod.el (octave-mode): * lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): Let define-derived-mode do its job. * lisp/progmodes/cpp.el (cpp-edit-mode-map): Move initialization into declaration. (cpp-edit-mode): Use define-derived-mode. (cpp-edit-load): Use derived-mode-p. * lisp/progmodes/mixal-mode.el (mixal-mode): * lisp/progmodes/f90.el (f90-mode): * lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting require-final-newline since prog-mode does it already. * lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string. * lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup. * lisp/progmodes/antlr-mode.el: Require cc-mode upfront. (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in the declaration. (antlr-directory-dependencies, antlr-show-makefile-rules): Use derived-mode-p. (antlr-language-option): Don't assume point-min==1. (antlr-mode): Use define-derived-mode. * lisp/progmodes/ada-mode.el: Use derived-mode-p. (ada-mode): Use define-derived-mode. Use hack-local-variables-hook. * lisp/progmodes/vhdl-mode.el (vhdl-mode): * lisp/progmodes/verilog-mode.el (verilog-mode): * lisp/progmodes/vera-mode.el (vera-mode): * lisp/progmodes/sql.el (sql-mode): * lisp/progmodes/scheme.el (scheme-mode): * lisp/progmodes/perl-mode.el (perl-mode): * lisp/progmodes/octave-inf.el (inferior-octave-mode): * lisp/progmodes/autoconf.el (autoconf-mode): * lisp/progmodes/m4-mode.el (m4-mode): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/icon.el (icon-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) (ebrowse-member-mode, ebrowse-electric-position-mode): Use define-derived-mode. * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): * lisp/progmodes/which-func.el (which-function): * lisp/progmodes/vhdl-mode.el (vhdl-set-style): * lisp/progmodes/verilog-mode.el (verilog-set-compile-command) (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) (verilog-set-define, verilog-auto-reeval-locals): * lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): * lisp/progmodes/simula.el (simula-mode): * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): * lisp/progmodes/python.el (python-check, python-mode): * lisp/progmodes/prolog.el (prolog-mode-variables): * lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions): * lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame): * lisp/progmodes/delphi.el (delphi-mode): * lisp/progmodes/cc-styles.el (c-setup-paragraph-variables): * lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init) (c-font-lock-init): Move make-local-variable to their setq. * lisp/progmodes/xscheme.el (exit-scheme-interaction-mode) (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) (xscheme-debugger-mode-p, xscheme-send-string-1): * lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/ps-mode.el (ps-run-running): * lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): * lisp/progmodes/js.el (js--get-all-known-symbols): * lisp/progmodes/inf-lisp.el (inferior-lisp-proc): * lisp/progmodes/idlwave.el (idlwave-beginning-of-statement) (idlwave-template, idlwave-update-buffer-routine-info) (idlwave-update-current-buffer-info) (idlwave-get-routine-info-from-buffers, idlwave-choose) (idlwave-scan-class-info, idlwave-fix-keywords) (idlwave-list-buffer-load-path-shadows): * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) (idlwave-toolbar-remove): * lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action) (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) (idlwave-shell-menu-def): * lisp/progmodes/idlw-complete-structtag.el (idlwave-prepare-structure-tag-completion): * lisp/progmodes/gud.el (gud-set-buffer): * lisp/progmodes/f90.el (f90-backslash-not-special): * lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
(define-derived-mode cpp-edit-mode fundamental-mode "CPP Edit"
1994-09-14 18:48:45 +00:00
"Major mode for editing the criteria for highlighting cpp conditionals.
2003-02-04 13:24:35 +00:00
Click on objects to change them.
1994-09-14 09:03:27 +00:00
You can also use the keyboard accelerators indicated like this: [K]ey."
(buffer-disable-undo)
(auto-save-mode -1)
Derive from prog-mode, use derived-mode-p, and fix up various minor style issues in lisp/progmodes. * lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> make-local-hook. * lisp/progmodes/sh-script.el (sh-require-final-newline): Remove. (sh-set-shell): Don't set require-final-newline since it's already done by prog-mode. * lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column since we never set it. * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): Use read-string and standard prompt. * lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. * lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. (meta-common-mode-map): Rename from meta-mode-map. Remove C-m binding, which is a user preference, not mode specific. (meta-common-mode): New major mode; replace meta-common-initialization. * lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing around with font-lock. * lisp/progmodes/etags.el (select-tags-table-mode): Derive from special-mode. * lisp/progmodes/octave-mod.el (octave-mode): * lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): Let define-derived-mode do its job. * lisp/progmodes/cpp.el (cpp-edit-mode-map): Move initialization into declaration. (cpp-edit-mode): Use define-derived-mode. (cpp-edit-load): Use derived-mode-p. * lisp/progmodes/mixal-mode.el (mixal-mode): * lisp/progmodes/f90.el (f90-mode): * lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting require-final-newline since prog-mode does it already. * lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string. * lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup. * lisp/progmodes/antlr-mode.el: Require cc-mode upfront. (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in the declaration. (antlr-directory-dependencies, antlr-show-makefile-rules): Use derived-mode-p. (antlr-language-option): Don't assume point-min==1. (antlr-mode): Use define-derived-mode. * lisp/progmodes/ada-mode.el: Use derived-mode-p. (ada-mode): Use define-derived-mode. Use hack-local-variables-hook. * lisp/progmodes/vhdl-mode.el (vhdl-mode): * lisp/progmodes/verilog-mode.el (verilog-mode): * lisp/progmodes/vera-mode.el (vera-mode): * lisp/progmodes/sql.el (sql-mode): * lisp/progmodes/scheme.el (scheme-mode): * lisp/progmodes/perl-mode.el (perl-mode): * lisp/progmodes/octave-inf.el (inferior-octave-mode): * lisp/progmodes/autoconf.el (autoconf-mode): * lisp/progmodes/m4-mode.el (m4-mode): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/icon.el (icon-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) (ebrowse-member-mode, ebrowse-electric-position-mode): Use define-derived-mode. * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): * lisp/progmodes/which-func.el (which-function): * lisp/progmodes/vhdl-mode.el (vhdl-set-style): * lisp/progmodes/verilog-mode.el (verilog-set-compile-command) (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) (verilog-set-define, verilog-auto-reeval-locals): * lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): * lisp/progmodes/simula.el (simula-mode): * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): * lisp/progmodes/python.el (python-check, python-mode): * lisp/progmodes/prolog.el (prolog-mode-variables): * lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions): * lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame): * lisp/progmodes/delphi.el (delphi-mode): * lisp/progmodes/cc-styles.el (c-setup-paragraph-variables): * lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init) (c-font-lock-init): Move make-local-variable to their setq. * lisp/progmodes/xscheme.el (exit-scheme-interaction-mode) (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) (xscheme-debugger-mode-p, xscheme-send-string-1): * lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/ps-mode.el (ps-run-running): * lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): * lisp/progmodes/js.el (js--get-all-known-symbols): * lisp/progmodes/inf-lisp.el (inferior-lisp-proc): * lisp/progmodes/idlwave.el (idlwave-beginning-of-statement) (idlwave-template, idlwave-update-buffer-routine-info) (idlwave-update-current-buffer-info) (idlwave-get-routine-info-from-buffers, idlwave-choose) (idlwave-scan-class-info, idlwave-fix-keywords) (idlwave-list-buffer-load-path-shadows): * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) (idlwave-toolbar-remove): * lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action) (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) (idlwave-shell-menu-def): * lisp/progmodes/idlw-complete-structtag.el (idlwave-prepare-structure-tag-completion): * lisp/progmodes/gud.el (gud-set-buffer): * lisp/progmodes/f90.el (f90-backslash-not-special): * lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
(setq buffer-read-only t))
1994-09-14 09:03:27 +00:00
(defun cpp-edit-apply ()
"Apply edited display information to original buffer."
(interactive)
(cpp-edit-home)
(cpp-highlight-buffer t))
1994-09-14 09:03:27 +00:00
(defun cpp-edit-reset ()
"Reset display information from original buffer."
(interactive)
(let ((buffer (current-buffer))
(buffer-read-only nil)
(start (window-start))
(pos (point))
symbols)
(set-buffer cpp-edit-buffer)
(setq symbols cpp-parse-symbols)
(set-buffer buffer)
(setq cpp-edit-symbols symbols)
(erase-buffer)
(insert "CPP Display Information for `")
(cpp-make-button (buffer-name cpp-edit-buffer) 'cpp-edit-home)
(insert "'\n\nClick mouse-2 on item you want to change or use\n"
"or switch to this buffer and type the keyboard equivalents.\n"
"Keyboard equivalents are indicated with brackets like [T]his.\n\n")
(cpp-make-button "[H]ome (display the C file)" 'cpp-edit-home)
(insert " ")
(cpp-make-button "[A]pply new settings" 'cpp-edit-apply)
(insert "\n")
(cpp-make-button "[S]ave settings" 'cpp-edit-save)
(insert " ")
(cpp-make-button "[L]oad settings" 'cpp-edit-load)
(insert "\n\n")
1994-09-14 09:03:27 +00:00
(insert "[B]ackground: ")
(cpp-make-button (car (rassq cpp-face-type cpp-face-type-list))
'cpp-edit-background)
(insert "\n[K]nown conditionals: ")
(cpp-make-button (cpp-face-name cpp-known-face)
'cpp-edit-known nil t)
(insert " [X] ")
(cpp-make-button (car (rassq cpp-known-writable cpp-writable-list))
'cpp-edit-toggle-known)
(insert "\n[U]nknown conditionals: ")
(cpp-make-button (cpp-face-name cpp-unknown-face)
'cpp-edit-unknown nil t)
(insert " [Y] ")
(cpp-make-button (car (rassq cpp-unknown-writable cpp-writable-list))
'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))
1994-09-14 09:03:27 +00:00
(while symbols
(let* ((symbol (car symbols))
(entry (assoc symbol cpp-edit-list))
(true (nth 1 entry))
(false (nth 2 entry))
(write (if entry (nth 3 entry) 'both)))
(setq symbols (cdr symbols))
(if (and entry ; Make default entries unknown.
(or (null true) (eq true 'default))
(or (null false) (eq false 'default))
(eq write 'both))
(setq cpp-edit-list (delq entry cpp-edit-list)
entry nil))
2003-02-04 13:24:35 +00:00
(if (> (length symbol) 39)
1994-09-14 09:03:27 +00:00
(insert (substring symbol 0 39) ": ")
(insert (format "%39s: " symbol)))
(cpp-make-button (cpp-face-name true)
'cpp-edit-true symbol t 14)
(insert " ")
(cpp-make-button (cpp-face-name false)
'cpp-edit-false symbol t 14)
(insert " ")
(cpp-make-button (car (rassq write cpp-branch-list))
'cpp-edit-write symbol nil 6)
(insert "\n")))
(insert "\n\n")
(set-window-start nil start)
(goto-char pos)))
(defun cpp-edit-load ()
"Load cpp configuration."
(interactive)
(cond ((null init-file-user)
;; If -q was specified, don't load any init files.
nil)
((file-readable-p cpp-config-file)
(load-file cpp-config-file))
((file-readable-p (concat "~/" cpp-config-file))
(load-file cpp-config-file)))
Derive from prog-mode, use derived-mode-p, and fix up various minor style issues in lisp/progmodes. * lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init) (vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable -> make-local-hook. * lisp/progmodes/sh-script.el (sh-require-final-newline): Remove. (sh-set-shell): Don't set require-final-newline since it's already done by prog-mode. * lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column since we never set it. * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): Use read-string and standard prompt. * lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration. * lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl. (meta-common-mode-syntax-table): Rename from meta-mode-syntax-table. (meta-common-mode-map): Rename from meta-mode-map. Remove C-m binding, which is a user preference, not mode specific. (meta-common-mode): New major mode; replace meta-common-initialization. * lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing around with font-lock. * lisp/progmodes/etags.el (select-tags-table-mode): Derive from special-mode. * lisp/progmodes/octave-mod.el (octave-mode): * lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode) (gdb-frames-mode, gdb-locals-mode, gdb-registers-mode): Let define-derived-mode do its job. * lisp/progmodes/cpp.el (cpp-edit-mode-map): Move initialization into declaration. (cpp-edit-mode): Use define-derived-mode. (cpp-edit-load): Use derived-mode-p. * lisp/progmodes/mixal-mode.el (mixal-mode): * lisp/progmodes/f90.el (f90-mode): * lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting require-final-newline since prog-mode does it already. * lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string. * lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup. * lisp/progmodes/antlr-mode.el: Require cc-mode upfront. (antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in the declaration. (antlr-directory-dependencies, antlr-show-makefile-rules): Use derived-mode-p. (antlr-language-option): Don't assume point-min==1. (antlr-mode): Use define-derived-mode. * lisp/progmodes/ada-mode.el: Use derived-mode-p. (ada-mode): Use define-derived-mode. Use hack-local-variables-hook. * lisp/progmodes/vhdl-mode.el (vhdl-mode): * lisp/progmodes/verilog-mode.el (verilog-mode): * lisp/progmodes/vera-mode.el (vera-mode): * lisp/progmodes/sql.el (sql-mode): * lisp/progmodes/scheme.el (scheme-mode): * lisp/progmodes/perl-mode.el (perl-mode): * lisp/progmodes/octave-inf.el (inferior-octave-mode): * lisp/progmodes/autoconf.el (autoconf-mode): * lisp/progmodes/m4-mode.el (m4-mode): * lisp/progmodes/inf-lisp.el (inferior-lisp-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/icon.el (icon-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode) (ebrowse-member-mode, ebrowse-electric-position-mode): Use define-derived-mode. * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): * lisp/progmodes/which-func.el (which-function): * lisp/progmodes/vhdl-mode.el (vhdl-set-style): * lisp/progmodes/verilog-mode.el (verilog-set-compile-command) (verilog-modify-compile-command, verilog-error-regexp-add-xemacs) (verilog-set-define, verilog-auto-reeval-locals): * lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode): * lisp/progmodes/simula.el (simula-mode): * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): * lisp/progmodes/python.el (python-check, python-mode): * lisp/progmodes/prolog.el (prolog-mode-variables): * lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions): * lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame): * lisp/progmodes/delphi.el (delphi-mode): * lisp/progmodes/cc-styles.el (c-setup-paragraph-variables): * lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init) (c-font-lock-init): Move make-local-variable to their setq. * lisp/progmodes/xscheme.el (exit-scheme-interaction-mode) (xscheme-enter-interaction-mode, xscheme-enter-debugger-mode) (xscheme-debugger-mode-p, xscheme-send-string-1): * lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word) (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/ps-mode.el (ps-run-running): * lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint): * lisp/progmodes/js.el (js--get-all-known-symbols): * lisp/progmodes/inf-lisp.el (inferior-lisp-proc): * lisp/progmodes/idlwave.el (idlwave-beginning-of-statement) (idlwave-template, idlwave-update-buffer-routine-info) (idlwave-update-current-buffer-info) (idlwave-get-routine-info-from-buffers, idlwave-choose) (idlwave-scan-class-info, idlwave-fix-keywords) (idlwave-list-buffer-load-path-shadows): * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add) (idlwave-toolbar-remove): * lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action) (idlwave-shell-file-name, idlwave-shell-electric-debug-all-off) (idlwave-shell-menu-def): * lisp/progmodes/idlw-complete-structtag.el (idlwave-prepare-structure-tag-completion): * lisp/progmodes/gud.el (gud-set-buffer): * lisp/progmodes/f90.el (f90-backslash-not-special): * lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 20:00:25 +00:00
(if (derived-mode-p 'cpp-edit-mode)
1994-09-14 18:29:11 +00:00
(cpp-edit-reset)))
1994-09-14 09:03:27 +00:00
(defun cpp-edit-save ()
"Save the current cpp configuration in a file."
1994-09-14 09:03:27 +00:00
(interactive)
(require 'pp)
* textmodes/two-column.el (2C-split): * textmodes/texnfo-upd.el (texinfo-multi-file-included-list): * textmodes/tex-mode.el (tex-set-buffer-directory): * textmodes/spell.el (spell-region, spell-string): * textmodes/reftex.el (reftex-erase-buffer): (reftex-get-file-buffer-force, reftex-kill-temporary-buffers): * textmodes/reftex-toc.el (reftex-toc-promote-action): * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct) (reftex-select-item): * textmodes/reftex-ref.el (reftex-label-info-update) (reftex-offer-label-menu): * textmodes/reftex-index.el (reftex-index-change-entry) (reftex-index-phrases-info): * textmodes/reftex-global.el (reftex-create-tags-file) (reftex-save-all-document-buffers, reftex-ensure-write-access): * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite) (reftex-view-crossref-from-bibtex): * textmodes/reftex-cite.el (reftex-bibtex-selection-callback) (reftex-extract-bib-entries-from-thebibliography) (reftex-all-used-citation-keys, reftex-create-bibtex-file): * textmodes/refbib.el (r2b-capitalize-title): (r2b-convert-buffer, r2b-help): * textmodes/page-ext.el (pages-directory) (pages-directory-goto-with-mouse): * textmodes/bibtex.el (bibtex-validate-globally): * textmodes/bib-mode.el (bib-capitalize-title): * textmodes/artist.el (artist-clear-buffer, artist-system): * progmodes/xscheme.el (global-set-scheme-interaction-buffer): (local-set-scheme-interaction-buffer, xscheme-process-filter) (verify-xscheme-buffer, xscheme-enter-interaction-mode) (xscheme-enter-debugger-mode, xscheme-debugger-mode-p) (xscheme-send-control-g-interrupt, xscheme-start-process) (xscheme-process-sentinel, xscheme-cd): * progmodes/verilog-mode.el (verilog-read-always-signals) (verilog-set-define, verilog-getopt-file) (verilog-module-inside-filename-p): * progmodes/sh-script.el: * progmodes/python.el (python-pdbtrack-get-source-buffer) (python-pdbtrack-grub-for-buffer, python-execute-file): * progmodes/octave-inf.el (inferior-octave): * progmodes/idlwave.el (idlwave-scan-user-lib-files) (idlwave-shell-compile-helper-routines, idlwave-set-local) (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs) (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows) (idlwave-completion-fontify-classes, idlwave-display-calling-sequence): * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear) (idlwave-shell-filter, idlwave-shell-examine-highlight) (idlwave-shell-sentinel, idlwave-shell-filter-directory) (idlwave-shell-display-line, idlwave-shell-set-bp-in-module) (idlwave-shell-examine-display, idlwave-shell-run-region) (idlwave-shell-filter-bp, idlwave-shell-save-and-action) (idlwave-shell-sources-filter, idlwave-shell-goto-next-error): * progmodes/idlw-help.el (idlwave-help-get-special-help) (idlwave-help-get-help-buffer): * progmodes/gud.el (gud-basic-call, gud-find-class) (gud-tooltip-activate-mouse-motions-if-enabled): * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe): * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as) (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file) (ebrowse-tags-next-file): * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps) (ebnf-eps-production-list, ebnf-begin-file, ebnf-log) (ebnf-eps-finish-and-write): * progmodes/cpp.el (cpp-edit-save): * progmodes/cperl-mode.el (cperl-pod-to-manpage): * progmodes/cc-defs.el (c-emacs-features): * progmodes/antlr-mode.el (antlr-invalidate-context-cache) (antlr-directory-dependencies): * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name) (ada-run-application, ada-find-in-src-path, ada-goto-parent) (ada-find-any-references, ada-make-filename-from-adaname) (ada-make-body-gnatstub): * obsolete/rnews.el (news-list-news-groups): * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file): * obsolete/iso-acc.el (iso-acc-minibuf-setup): * net/rcirc.el (rcirc-debug): * net/newst-treeview.el (newsticker--treeview-list-add-item) (newsticker--treeview-list-clear, newsticker-treeview-browse-url) (newsticker--treeview-list-update-faces, newsticker-treeview-save) (newsticker--treeview-item-show-text, newsticker--treeview-item-show) (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init) (newsticker-treeview-show-item, newsticker--treeview-unfold-node) (newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-update-highlight) (newsticker--treeview-list-highlight-start) (newsticker--treeview-tree-update-highlight) (newsticker--treeview-get-selected-item) (newsticker-treeview-mark-list-items-old) (newsticker--treeview-set-current-node): * net/newst-plainview.el (newsticker--buffer-set-uptodate): * net/newst-backend.el (newsticker--get-news-by-funcall) (newsticker--get-news-by-wget, newsticker--image-get) (newsticker--image-sentinel): * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field): * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session): (eudc-ph-close-session): * net/eudc.el (eudc-save-options): * language/thai-word.el (thai-update-word-table): * language/japan-util.el (japanese-string-conversion): * international/titdic-cnv.el (tsang-quick-converter) (ziranma-converter, ctlau-converter): * international/mule-cmds.el (describe-language-environment): * international/ja-dic-cnv.el (skkdic-convert-okuri-ari) (skkdic-convert-postfix, skkdic-convert-prefix): (skkdic-convert-okuri-nasi, skkdic-convert): * emacs-lisp/re-builder.el (reb-update-overlays): * emacs-lisp/pp.el (pp-to-string, pp-display-expression): * emacs-lisp/gulp.el (gulp-send-requests): * emacs-lisp/find-gc.el (trace-call-tree): * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class) (eieio-describe-generic): * emacs-lisp/eieio-base.el (eieio-persistent-read): * emacs-lisp/edebug.el (edebug-outside-excursion): * emacs-lisp/debug.el (debugger-make-xrefs): * emacs-lisp/cust-print.el (custom-prin1-to-string): * emacs-lisp/chart.el (chart-new-buffer): * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log): Use with-current-buffer. * textmodes/artist.el (artist-system): Don't call copy-sequence on a fresh string. * progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
(with-current-buffer cpp-edit-buffer
(let ((buffer (find-file-noselect cpp-config-file)))
1994-09-14 09:03:27 +00:00
(set-buffer buffer)
(erase-buffer)
(pp (list 'setq 'cpp-known-face
(list 'quote cpp-known-face)) buffer)
(pp (list 'setq 'cpp-unknown-face
(list 'quote cpp-unknown-face)) buffer)
(pp (list 'setq 'cpp-face-type
(list 'quote cpp-face-type)) buffer)
(pp (list 'setq 'cpp-known-writable
(list 'quote cpp-known-writable)) buffer)
(pp (list 'setq 'cpp-unknown-writable
(list 'quote cpp-unknown-writable)) buffer)
(pp (list 'setq 'cpp-edit-list
(list 'quote cpp-edit-list)) buffer)
(write-file cpp-config-file))))
1994-09-14 09:03:27 +00:00
(defun cpp-edit-home ()
"Switch back to original buffer."
(interactive)
(if cpp-button-event
(read-event))
(pop-to-buffer cpp-edit-buffer))
(defun cpp-edit-background ()
"Change default face collection."
(interactive)
(call-interactively 'cpp-choose-default-face)
(cpp-edit-reset))
(defun cpp-edit-known ()
"Select default for known conditionals."
(interactive)
(setq cpp-known-face (cpp-choose-face "Known face" cpp-known-face))
(cpp-edit-reset))
(defun cpp-edit-unknown ()
"Select default for unknown conditionals."
(interactive)
(setq cpp-unknown-face (cpp-choose-face "Unknown face" cpp-unknown-face))
(cpp-edit-reset))
(defun cpp-edit-toggle-known (arg)
"Toggle writable status for known conditionals.
With optional argument ARG, make them writable if ARG is positive,
otherwise make them unwritable."
1994-09-14 09:03:27 +00:00
(interactive "@P")
(if (or (and (null arg) cpp-known-writable)
(<= (prefix-numeric-value arg) 0))
(setq cpp-known-writable nil)
(setq cpp-known-writable t))
(cpp-edit-reset))
(defun cpp-edit-toggle-unknown (arg)
"Toggle writable status for unknown conditionals.
With optional argument ARG, make them writable if ARG is positive,
otherwise make them unwritable."
1994-09-14 09:03:27 +00:00
(interactive "@P")
(if (or (and (null arg) cpp-unknown-writable)
(<= (prefix-numeric-value arg) 0))
(setq cpp-unknown-writable nil)
(setq cpp-unknown-writable t))
(cpp-edit-reset))
(defun cpp-edit-true (symbol face)
"Select SYMBOL's true FACE used for highlighting taken conditionals."
(interactive
(let ((symbol (cpp-choose-symbol)))
(list symbol
(cpp-choose-face "True face"
(nth 1 (assoc symbol cpp-edit-list))))))
(setcar (nthcdr 1 (cpp-edit-list-entry-get-or-create symbol)) face)
(cpp-edit-reset))
(defun cpp-edit-false (symbol face)
"Select SYMBOL's false FACE used for highlighting untaken conditionals."
(interactive
(let ((symbol (cpp-choose-symbol)))
(list symbol
2003-02-04 13:24:35 +00:00
(cpp-choose-face "False face"
1994-09-14 09:03:27 +00:00
(nth 2 (assoc symbol cpp-edit-list))))))
(setcar (nthcdr 2 (cpp-edit-list-entry-get-or-create symbol)) face)
(cpp-edit-reset))
(defun cpp-edit-write (symbol branch)
"Set which branches of SYMBOL should be writable to BRANCH.
BRANCH should be either nil (false branch), t (true branch) or 'both."
(interactive (list (cpp-choose-symbol) (cpp-choose-branch)))
(setcar (nthcdr 3 (cpp-edit-list-entry-get-or-create symbol)) branch)
(cpp-edit-reset))
(defun cpp-edit-list-entry-get-or-create (symbol)
;; Return the entry for SYMBOL in `cpp-edit-list'.
;; If it does not exist, create it.
(let ((entry (assoc symbol cpp-edit-list)))
(or entry
(setq entry (list symbol nil nil 'both nil)
cpp-edit-list (cons entry cpp-edit-list)))
entry))
;;; Prompts:
(defun cpp-choose-symbol ()
;; Choose a symbol if called from keyboard, otherwise use the one clicked on.
(if cpp-button-event
cpp-callback-data
(completing-read "Symbol: " cpp-edit-symbols nil t)))
1994-09-14 09:03:27 +00:00
(defun cpp-choose-branch ()
;; Choose a branch, either nil, t, or both.
(if cpp-button-event
(x-popup-menu cpp-button-event
(list "Branch" (cons "Branch" cpp-branch-list)))
(cdr (assoc (completing-read "Branch: " cpp-branch-list nil t)
cpp-branch-list))))
(defun cpp-choose-face (prompt default)
2001-11-12 22:37:48 +00:00
;; Choose a face from cpp-face-default-list.
1994-09-14 09:03:27 +00:00
;; PROMPT is what to say to the user.
;; DEFAULT is the default face.
(or (if cpp-button-event
(x-popup-menu cpp-button-event
(list prompt (cons prompt cpp-face-default-list)))
(let ((name (car (rassq default cpp-face-default-list))))
(cdr (assoc (completing-read (if name
(concat prompt
" (default " name "): ")
(concat prompt ": "))
cpp-face-default-list nil t)
cpp-face-all-list))))
default))
(defun cpp-choose-default-face (type)
;; Choose default face list for screen of TYPE.
;; Type must be one of the types defined in `cpp-face-type-list'.
(interactive (list (if cpp-button-event
(x-popup-menu cpp-button-event
(list "Screen type"
(cons "Screen type"
cpp-face-type-list)))
(cdr (assoc (completing-read "Screen type: "
cpp-face-type-list
nil t)
cpp-face-type-list)))))
(cond ((null type))
((eq type 'light)
(if cpp-face-light-list
()
(setq cpp-face-light-list
(mapcar 'cpp-create-bg-face cpp-face-light-name-list))
(setq cpp-face-all-list
(append cpp-face-all-list cpp-face-light-list)))
(setq cpp-face-type 'light)
(setq cpp-face-default-list
(append cpp-face-light-list cpp-face-none-list)))
((eq type 'dark)
(if cpp-face-dark-list
()
(setq cpp-face-dark-list
(mapcar 'cpp-create-bg-face cpp-face-dark-name-list))
(setq cpp-face-all-list
(append cpp-face-all-list cpp-face-dark-list)))
(setq cpp-face-type 'dark)
(setq cpp-face-default-list
(append cpp-face-dark-list cpp-face-none-list)))
((eq type 'mono)
(setq cpp-face-type 'mono)
(setq cpp-face-default-list
(append cpp-face-mono-list cpp-face-none-list)))
(t
(setq cpp-face-type 'none)
(setq cpp-face-default-list cpp-face-none-list))))
;;; Buttons:
(defun cpp-make-button (name callback &optional data face padding)
;; Create a button at point.
;; NAME is the name of the button.
;; CALLBACK is the function to call when the button is pushed.
;; DATA will be made available to CALLBACK
;;in the free variable cpp-callback-data.
1994-09-14 09:03:27 +00:00
;; FACE means that NAME is the name of a face in `cpp-face-all-list'.
;; PADDING means NAME will be right justified at that length.
(let ((name (format "%s" name))
from to)
(cond ((null padding)
(setq from (point))
(insert name))
((> (length name) padding)
(setq from (point))
(insert (substring name 0 padding)))
(t
(insert (make-string (- padding (length name)) ? ))
(setq from (point))
(insert name)))
(setq to (point))
(setq face
(if face
(let ((check (cdr (assoc name cpp-face-all-list))))
(if (memq check '(default invisible))
'bold
check))
'bold))
(add-text-properties from to
(append (list 'face face)
'(mouse-face highlight)
'(help-echo "mouse-2: change/use this item")
1994-09-14 09:03:27 +00:00
(list 'cpp-callback callback)
(if data (list 'cpp-data data))))))
(defun cpp-push-button (event)
;; Pushed a CPP button.
(interactive "@e")
(set-buffer (window-buffer (posn-window (event-start event))))
(let ((pos (posn-point (event-start event))))
(let ((cpp-callback-data (get-text-property pos 'cpp-data))
1994-09-14 09:03:27 +00:00
(fun (get-text-property pos 'cpp-callback))
(cpp-button-event event))
(cond (fun
(call-interactively (get-text-property pos 'cpp-callback)))
((lookup-key global-map [ down-mouse-2])
(call-interactively (lookup-key global-map [ down-mouse-2])))))))
;;; Faces:
(defun cpp-create-bg-face (color)
;; Create entry for face with background COLOR.
(cons color (cons 'background-color color)))
1994-09-14 09:03:27 +00:00
2000-07-31 15:36:50 +00:00
(cpp-choose-default-face
(if (or window-system (display-color-p)) cpp-face-type 'none))
1994-09-14 09:03:27 +00:00
(defun cpp-face-name (face)
;; Return the name of FACE from `cpp-face-all-list'.
(let ((entry (rassq (if face face 'default) cpp-face-all-list)))
(if entry
(car entry)
(format "<%s>" face))))
;;; Utilities:
(defvar cpp-progress-time 0)
;; Last time we issued a progress message.
(defun cpp-progress-message (&rest args)
;; Report progress at most once a second. Take same ARGS as `message'.
(let ((time (nth 1 (current-time))))
(if (= time cpp-progress-time)
()
(setq cpp-progress-time time)
(apply 'message args))))
(provide 'cpp)
;;; cpp.el ends here