]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-cmds.el
; Minor updates in admin/MAINTAINERS
[gnu-emacs] / lisp / progmodes / cc-cmds.el
index 68075f356ab8a6c17de8433c5254b21152362ecc..32ce8c6a249e5343d62ab54bc748a7b9315babc6 100644 (file)
@@ -428,7 +428,7 @@ the function `delete-forward-p' is defined and returns non-nil, it
 deletes forward.  Otherwise it deletes backward.
 
 Note: This is the way in XEmacs to choose the correct action for the
-\[delete] key, whichever key that means.  Other flavors don't use this
+[delete] key, whichever key that means.  Other flavors don't use this
 function to control that."
   (interactive "*P")
   (if (and (fboundp 'delete-forward-p)
@@ -445,7 +445,7 @@ forward using `c-hungry-delete-forward'.  Otherwise it deletes
 backward using `c-hungry-backspace'.
 
 Note: This is the way in XEmacs to choose the correct action for the
-\[delete] key, whichever key that means.  Other flavors don't use this
+[delete] key, whichever key that means.  Other flavors don't use this
 function to control that."
   (interactive)
   (if (and (fboundp 'delete-forward-p)
@@ -1143,9 +1143,9 @@ numeric argument is supplied, or the point is inside a literal."
                           (eq (char-before) ?<))
                         (progn
                           (backward-char)
-                          (looking-at "\\s\("))))
+                          (looking-at "\\s("))))
                    (and (eq (char-after) ?<)
-                        (not (looking-at "\\s\("))
+                        (not (looking-at "\\s("))
                         (progn (c-backward-syntactic-ws)
                                (c-simple-skip-symbol-backward))
                         (or (looking-at c-opt-<>-sexp-key)
@@ -1317,6 +1317,9 @@ keyword on the line, the keyword is not inserted inside a literal, and
   (autoload 'c-subword-mode "cc-subword"
     "Mode enabling subword movement and editing keys." t)))
 
+(declare-function c-forward-subword "ext:cc-subword" (&optional arg))
+(declare-function c-backward-subword "ext:cc-subword" (&optional arg))
+
 ;; "nomenclature" functions + c-scope-operator.
 (defun c-forward-into-nomenclature (&optional arg)
   "Compatibility alias for `c-forward-subword'."
@@ -1377,13 +1380,13 @@ No indentation or other \"electric\" behavior is performed."
                ;; be the return type of a function, or the like.  Exclude
                ;; this case.
                (c-syntactic-re-search-forward
-                (concat "[;=\(\[{]\\|\\("
+                (concat "[;=([{]\\|\\("
                         c-opt-block-decls-with-vars-key
                         "\\)")
                 eo-block t t t)
                (match-beginning 1)     ; Is there a "struct" etc., somewhere?
                (not (eq (char-before) ?_))
-               (c-syntactic-re-search-forward "[;=\(\[{]" eo-block t t t)
+               (c-syntactic-re-search-forward "[;=([{]" eo-block t t t)
                (eq (char-before) ?\{)
                bod)))))
 
@@ -1806,7 +1809,7 @@ with a brace block."
   (c-save-buffer-state
       (beginning-of-defun-function end-of-defun-function
        where pos name-end case-fold-search)
+
     (save-restriction
       (widen)
       (save-excursion
@@ -2850,19 +2853,28 @@ sentence motion in or near comments and multiline strings."
 \f
 ;; set up electric character functions to work with pending-del,
 ;; (a.k.a. delsel) mode.  All symbols get the t value except
-;; the functions which delete, which gets 'supersede.
+;; the functions which delete, which gets 'supersede, and (from Emacs
+;; 25) `c-electric-brace' and `c-electric-paren' get special handling
+;; so as to work gracefully with `electric-pair-mode'.
 (mapc
  (function
   (lambda (sym)
     (put sym 'delete-selection t)      ; for delsel (Emacs)
     (put sym 'pending-delete t)))      ; for pending-del (XEmacs)
  '(c-electric-pound
-   c-electric-brace
    c-electric-slash
    c-electric-star
    c-electric-semi&comma
    c-electric-lt-gt
-   c-electric-colon
+   c-electric-colon))
+(mapc
+ (function
+  (lambda (sym)
+    (put sym 'delete-selection (if (fboundp 'delete-selection-uses-region-p)
+                                  'delete-selection-uses-region-p
+                                t))
+    (put sym 'pending-delete t)))
+ '(c-electric-brace
    c-electric-paren))
 (put 'c-electric-delete    'delete-selection 'supersede) ; delsel
 (put 'c-electric-delete    'pending-delete   'supersede) ; pending-del
@@ -3409,7 +3421,7 @@ Otherwise reindent just the current line."
       (if (< c-progress-interval (- now lastsecs))
          (progn
            (message "Indenting region... (%d%% complete)"
-                    (/ (* 100 (- (point) start)) (- end start)))
+                    (floor (* 100.0 (- (point) start)) (- end start)))
            (aset c-progress-info 2 now)))
       )))
 
@@ -4443,7 +4455,7 @@ is in situations like the following:
 
 char description[] = \"\\
 A very long description of something that you want to fill to make
-nicely formatted output.\"\;
+nicely formatted output.\";
 
 If point is in any other situation, i.e. in normal code, do nothing.
 
@@ -4757,8 +4769,8 @@ normally bound to C-o.  See `c-context-line-break' for the details."
 \f
 (cc-provide 'cc-cmds)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-cmds.el ends here