# HG changeset patch # User Sam Steingold # Date 1006880412 0 # Node ID f1391a41ece3540bbaf2b716e21897968ed8b0d4 # Parent 45db352a0971553ac6fa0fdc6feba9b2f6fe5289 fixed {}() quoting diff -r 45db352a0971 -r f1391a41ece3 lisp/obsolete/c-mode.el --- a/lisp/obsolete/c-mode.el Tue Nov 27 15:52:52 2001 +0000 +++ b/lisp/obsolete/c-mode.el Tue Nov 27 17:00:12 2001 +0000 @@ -794,9 +794,9 @@ (setq indent (save-excursion (c-backward-to-start-of-do) (current-indentation)))) - ((= (following-char) ?}) + ((= (following-char) ?\}) (setq indent (- indent c-indent-level))) - ((= (following-char) ?{) + ((= (following-char) ?\{) (setq indent (+ indent c-brace-offset)))))) (skip-chars-forward " \t") (setq shift-amt (- indent (current-column))) @@ -839,7 +839,7 @@ ;; in which case this line is the first argument decl. (goto-char indent-point) (skip-chars-forward " \t") - (if (= (following-char) ?{) + (if (= (following-char) ?\{) 0 ; Unless it starts a function body (c-backward-to-noncomment (or parse-start (point-min))) ;; Look at previous line that's at column 0 @@ -907,7 +907,7 @@ ;; (= (current-indentation) 0)) ;; 0 c-continued-statement-offset)) - ((/= (char-after containing-sexp) ?{) + ((/= (char-after containing-sexp) ?\{) ;; line is expression, not statement: ;; indent to just after the surrounding open. (goto-char (1+ containing-sexp)) @@ -958,7 +958,7 @@ (save-excursion (goto-char indent-point) (skip-chars-forward " \t") - (not (= (following-char) ?})))) + (not (= (following-char) ?\})))) ;; This line is continuation of preceding line's statement; ;; indent c-continued-statement-offset more than the ;; previous line of the statement. @@ -967,7 +967,7 @@ (+ c-continued-statement-offset (current-column) (if (save-excursion (goto-char indent-point) (skip-chars-forward " \t") - (eq (following-char) ?{)) + (eq (following-char) ?\{)) c-continued-brace-offset 0))) ;; This line starts a new statement. ;; Position following last unclosed open. @@ -1124,10 +1124,10 @@ ;; is a close brace.) (if (save-excursion (forward-sexp 1) - (or (and (not first) (= (preceding-char) ?})) + (or (and (not first) (= (preceding-char) ?\})) (search-forward ";" next-start t (if (and first - (/= (preceding-char) ?})) + (/= (preceding-char) ?\})) 2 1)))) (setq done 'fail) (setq first nil) @@ -1345,7 +1345,7 @@ ;; Yes. ;; Compute the standard indent for this level. (let (val) - (if (= (char-after (car contain-stack)) ?{) + (if (= (char-after (car contain-stack)) ?\{) (save-excursion (goto-char (car contain-stack)) (setq val (calculate-c-indent-after-brace))) @@ -1361,7 +1361,7 @@ ;; Adjust indent of this individual line ;; based on its predecessor. ;; Handle continuation lines, if, else, while, and so on. - (if (/= (char-after (car contain-stack)) ?{) + (if (/= (char-after (car contain-stack)) ?\{) (setq this-indent (car indent-stack)) ;; Line is at statement level. ;; Is it a new statement? Is it an else? @@ -1370,13 +1370,13 @@ (setq this-point (point)) (setq at-else (and (looking-at "else\\b") (not (looking-at "else\\s_")))) - (setq at-brace (= (following-char) ?{)) + (setq at-brace (= (following-char) ?\{)) (setq at-while (and (looking-at "while\\b") (not (looking-at "while\\s_")))) - (if (= (following-char) ?}) + (if (= (following-char) ?\}) (setq this-indent (car indent-stack)) (c-backward-to-noncomment opoint) - (if (not (memq (preceding-char) '(0 ?\, ?\; ?} ?: ?{))) + (if (not (memq (preceding-char) '(0 ?\, ?\; ?\} ?: ?\{))) ;; Preceding line did not end in comma or semi; ;; indent this line c-continued-statement-offset ;; more than previous. @@ -1403,9 +1403,9 @@ (forward-sexp 1) (looking-at ":")))) (setq this-indent (max 1 (+ this-indent c-label-offset)))) - (if (= (following-char) ?}) + (if (= (following-char) ?\}) (setq this-indent (- this-indent c-indent-level))) - (if (= (following-char) ?{) + (if (= (following-char) ?\{) ;; Don't move an open-brace in column 0. ;; This is good when constructs such as ;; `extern "C" {' surround a function definition @@ -1437,7 +1437,7 @@ (parse-partial-sexp beg (point) nil nil state))) (and (not (nth 3 new-state)) (not (nth 5 new-state)))) - (indent-for-comment))))))))))))) + (indent-for-comment))))))))))) ;; Look at all comment-start strings in the current line after point. ;; Return t if one of them starts a real comment. diff -r 45db352a0971 -r f1391a41ece3 lisp/obsolete/cplus-md.el --- a/lisp/obsolete/cplus-md.el Tue Nov 27 15:52:52 2001 +0000 +++ b/lisp/obsolete/cplus-md.el Tue Nov 27 17:00:12 2001 +0000 @@ -24,7 +24,7 @@ ;;; Commentary: -;; 1987 Dave Detlefs +;; 1987 Dave Detlefs ;; and Stewart Clamen . ;; Done by fairly faithful modification of: @@ -33,18 +33,18 @@ ;; Feb, 1990 (Dave Detlefs, dld@cs.cmu.edu) ;; Fixed electric-c++-terminator to handle double colons, at the ;; request of John Hagerman. -;; +;; ;; Jan, 1990 (Doug Lea, dl@oswego.edu) ;; Replaced c++-comment-region and c++-uncomment-region with ;; versions from Igor Metz that avoid potential infinite loops. ;; ;; Oct, 1989 (Dave Detlefs, dld@cs.cmu.edu) ;; Added contribution from Igor Metz : -;; functions c++-comment-region and c++-uncomment-region and +;; functions c++-comment-region and c++-uncomment-region and ;; corresponding key-binding. ;; Also fixed bug in indentation of second line after an empty ;; arglist with empty-arglist non-null. -;; +;; ;; Sept, 1989 (Glen Ditchfield, gjditchfield@violet.uwaterloo.ca): ;; Textual changes to more closely imitate Emacs 18.55's c-mode. ;; Fixed handling of "default:", where ":" was the last character in the @@ -180,14 +180,14 @@ "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right? - + "\\(" ; last type spec including */& "[a-zA-Z0-9_:]+" "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace "\\)?" ; if there is a last type spec "\\(" ; name; take that into the imenu entry "[a-zA-Z0-9_:~]+" ; member function, ctor or dtor... - ; (may not contain * because then + ; (may not contain * because then ; "a::operator char*" would become "char*"!) "\\|" "\\([a-zA-Z0-9_:~]*::\\)?operator" @@ -198,10 +198,10 @@ ; catch cases with () inside the parentheses ; surrounding the parameters ; (like "int foo(int a=bar()) {...}" - - ) 6) - ("Class" - ,(concat + + ) 6) + ("Class" + ,(concat "^" ; beginning of line is required "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" "class[ \t]+" @@ -212,20 +212,20 @@ ;; Uncomment if you want to find these too. It will be a bit slower gathering ;; the indexes. ; ("Prototypes" - ; (, + ; (, ; (concat ; "^" ; beginning of line is required ; "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" ; "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no ; "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right? - + ; "\\(" ; last type spec including */& ; "[a-zA-Z0-9_:]+" ; "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace ; "\\)?" ; if there is a last type spec ; "\\(" ; name; take that into the imenu entry ; "[a-zA-Z0-9_:~]+" ; member function, ctor or dtor... - ; ; (may not contain * because then + ; ; (may not contain * because then ; ; "a::operator char*" would become "char*"!) ; "\\|" ; "\\([a-zA-Z0-9_:~]*::\\)?operator" @@ -235,8 +235,8 @@ ; ; the (...) Can't ; ; catch cases with () inside the parentheses ; ; surrounding the parameters - ; ; (like "int foo(int a=bar());" - ; )) 6) + ; ; (like "int foo(int a=bar());" + ; )) 6) ; ("Struct" ; (, (concat ; "^" ; beginning of line is required @@ -530,9 +530,9 @@ (current-indentation)))) ((looking-at "friend\[ \t]") (setq indent (+ indent c++-friend-offset))) - ((= (following-char) ?}) + ((= (following-char) ?\}) (setq indent (- indent c-indent-level))) - ((= (following-char) ?{) + ((= (following-char) ?\{) (setq indent (+ indent c-brace-offset)))))) (skip-chars-forward " \t") (setq shift-amt (- indent (current-column))) @@ -579,7 +579,7 @@ ;; It is assumed that arg decls and member inits are not mixed. (goto-char indent-point) (skip-chars-forward " \t") - (if (= (following-char) ?{) + (if (= (following-char) ?\{) 0 ; Unless it starts a function body (c++-backward-to-noncomment (or parse-start (point-min))) (if (= (preceding-char) ?\)) @@ -591,7 +591,7 @@ c-argdecl-indent)) (if (= (preceding-char) ?\;) (backward-char 1)) - (if (= (preceding-char) ?}) + (if (= (preceding-char) ?\}) 0 (if (= (preceding-char) ?\)) (forward-list -1)) @@ -607,7 +607,7 @@ (current-column))) (current-indentation))) ))) - ((/= (char-after containing-sexp) ?{) + ((/= (char-after containing-sexp) ?\{) ;; line is expression, not statement: ;; indent to just after the surrounding open -- unless ;; empty arg list, in which case we do what @@ -647,7 +647,7 @@ (save-excursion (goto-char indent-point) (skip-chars-forward " \t") - (not (= (following-char) ?})))) + (not (= (following-char) ?\})))) ;; This line is continuation of preceding line's statement; ;; indent c-continued-statement-offset more than the ;; previous line of the statement. @@ -656,7 +656,7 @@ (+ c-continued-statement-offset (current-column) (if (save-excursion (goto-char indent-point) (skip-chars-forward " \t") - (eq (following-char) ?{)) + (eq (following-char) ?\{)) c-continued-brace-offset 0))) ;; This line starts a new statement. ;; Position following last unclosed open. @@ -688,7 +688,7 @@ ;; The first following code counts ;; if it is before the line we want to indent. (and (< (point) indent-point) - (- + (- (if (> colon-line-end (point)) (- (current-indentation) c-label-offset) (current-column)) @@ -719,7 +719,7 @@ (if (eq (preceding-char) ?\)) (forward-sexp -1)) ;; Get initial indentation of the line we are on. - (current-indentation))))))))))) + (current-indentation)))))))))) (defun c++-backward-to-noncomment (lim) (let (opoint stop) @@ -815,7 +815,7 @@ ;; Just started a new nesting level. ;; Compute the standard indent for this level. (let (val) - (if (= (char-after (car contain-stack)) ?{) + (if (= (char-after (car contain-stack)) ?\{) (save-excursion (goto-char (car contain-stack)) (setq val (calculate-c-indent-after-brace))) @@ -878,7 +878,7 @@ (point)) t) (progn (indent-for-comment) - (beginning-of-line))))))))))) + (beginning-of-line)))))))))) (defun fill-c++-comment () "Fill a comment contained in consecutive lines containing point. @@ -941,10 +941,10 @@ ;; (defvar c++-match-header-strongly nil ;; "*If nil, use `c++-defun-header-weak' to identify beginning of definitions. ;; If non-nil, use `c++-defun-header-strong'.") -;; +;; ;; (defvar c++-defun-header-strong-struct-equivs "\\(class\\|struct\\|enum\\)" ;; "Regexp to match names of structure declaration blocks in C++.") -;; +;; ;; (defconst c++-defun-header-strong ;; (let* ;; (; valid identifiers @@ -953,12 +953,12 @@ ;; ;; to be ;; ;; (id "\\(_\\|\\w\\)+") ;; ;; things no longer work right. Try it and see! -;; +;; ;; ; overloadable operators ;; (op-sym1 ;; "[-+*/%^&|~!=<>]\\|[-+*/%^&|<>=!]=\\|<<=?\\|>>=?") ;; (op-sym2 -;; "&&\\|||\\|\\+\\+\\|--\\|()\\|\\[\\]") +;; "&&\\|||\\|\\+\\+\\|--\\|()\\|\\[\\]") ;; (op-sym (concat "\\(" op-sym1 "\\|" op-sym2 "\\)")) ;; ; whitespace ;; (middle "[^\\*]*\\(\\*+[^/\\*][^\\*]*\\)*") @@ -993,20 +993,20 @@ ;; wh-nec id wh-opt inherit "?" wh-opt "{"))) ;; (concat "^\\(" func-header "\\|" cs-header "\\)")) ;; "Strongly-defined regexp to match beginning of structure or function def.") -;; -;; +;; +;; ;; ;; This part has to do with recognizing defuns. -;; +;; ;; ;; The weak convention we will use is that a defun begins any time ;; ;; there is a left curly brace, or some identifier on the left margin, ;; ;; followed by a left curly somewhere on the line. (This will also ;; ;; incorrectly match some continued strings, but this is after all ;; ;; just a weak heuristic.) Suggestions for improvement (short of the ;; ;; strong scheme shown above) are welcomed. -;; +;; ;; (defconst c++-defun-header-weak "^{\\|^[_a-zA-Z].*{" ;; "Weakly-defined regexp to match beginning of structure or function def.") -;; +;; ;; (defun c++-beginning-of-defun (arg) ;; (interactive "p") ;; (let ((c++-defun-header (if c++-match-header-strongly @@ -1033,8 +1033,8 @@ ;; (forward-char (if (< arg 0) 1 -1))) ;; (and (re-search-backward c++-defun-header nil 'move (or arg 1)) ;; (goto-char (match-beginning 0))))))) -;; -;; +;; +;; ;; (defun c++-end-of-defun (arg) ;; (interactive "p") ;; (let ((c++-defun-header (if c++-match-header-strongly @@ -1044,7 +1044,7 @@ ;; nil ;; (if (and (> arg 0) (looking-at c++-defun-header)) (forward-char 1)) ;; (let ((pos (point))) -;; (c++-beginning-of-defun +;; (c++-beginning-of-defun ;; (if (< arg 0) ;; (- (- arg (if (eobp) 0 1))) ;; arg)) @@ -1054,11 +1054,11 @@ ;; (progn (forward-char -1) ;; (forward-sexp) ;; (beginning-of-line 2))) -;; (if (and (= pos (point)) +;; (if (and (= pos (point)) ;; (re-search-forward c++-defun-header nil 'move)) ;; (c++-end-of-defun 1)))) ;; t))) -;; +;; ;; (defun c++-indent-defun () ;; "Indents the current function definition, struct or class declaration." ;; (interactive)