]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cpp.el
Rationalize the use of c-new-BEG and c-new-END in CC Mode.
[gnu-emacs] / lisp / progmodes / cpp.el
index 1b36fe2800d8e9a8ada57448e0320df4dcddce5a..7d641ab47f09da125d1d2c31d6f0c0b33eaef9aa 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cpp.el --- highlight or hide text according to cpp conditionals
 
-;; Copyright (C) 1994-1995, 2001-201 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: c, faces, tools
@@ -57,7 +57,7 @@
   :group 'cpp)
 
 (define-widget 'cpp-face 'lazy
-  "Either a face or the special symbol 'invisible'."
+  "Either a face or the special symbol `invisible'."
   :type '(choice (const invisible) (face)))
 
 (defcustom cpp-known-face 'invisible
@@ -136,13 +136,18 @@ Each entry is a list with the following elements:
     ("true" . t)
     ("both" . both)))
 
+;; FIXME Gets clobbered by cpp-choose-face, so why is even it a defcustom?
 (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))))
+  :type '(alist :key-type (string :tag "Name")
+               :value-type (choice face
+                                   (const invisible)
+                                   (cons (const background-color)
+                                         (string :tag "Color"))))
   :group 'cpp)
 
 (defcustom cpp-face-light-name-list
@@ -229,7 +234,8 @@ A prefix arg suppresses display of that buffer."
       (cpp-progress-message "Parsing...")
       (while (re-search-forward cpp-parse-regexp nil t)
        (cpp-progress-message "Parsing...%d%%"
-                         (/ (* 100 (- (point) (point-min))) (buffer-size)))
+                             (floor (* 100.0 (- (point) (point-min)))
+                                    (buffer-size)))
        (let ((match (buffer-substring (match-beginning 0) (match-end 0))))
          (cond ((or (string-equal match "'")
                     (string-equal match "\""))
@@ -420,6 +426,7 @@ A prefix arg suppresses display of that buffer."
     (define-key map [ down-mouse-2 ] 'cpp-push-button)
     (define-key map [ mouse-2 ] 'ignore)
     (define-key map " " 'scroll-up-command)
+    (define-key map [?\S-\ ] 'scroll-down-command)
     (define-key map "\C-?" 'scroll-down-command)
     (define-key map [ delete ] 'scroll-down)
     (define-key map "\C-c\C-c" 'cpp-edit-apply)
@@ -487,9 +494,10 @@ You can also use the keyboard accelerators indicated like this: [K]ey."
     (set-buffer buffer)
     (setq cpp-edit-symbols symbols)
     (erase-buffer)
-    (insert "CPP Display Information for `")
+    (insert (substitute-command-keys "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"
+    (insert (substitute-command-keys
+            "'\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)
@@ -656,7 +664,7 @@ otherwise make them unwritable."
 
 (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."
+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))