Mercurial > hg > xemacs-beta
comparison lisp/modes/cc-mode.el @ 155:43dd3413c7c7 r20-3b4
Import from CVS: tag r20-3b4
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:39:39 +0200 |
parents | 25f70ba0133c |
children | 6b37e6ddd302 |
comparison
equal
deleted
inserted
replaced
154:94141801dd7e | 155:43dd3413c7c7 |
---|---|
479 (defcustom c-special-indent-hook nil | 479 (defcustom c-special-indent-hook nil |
480 "*Hook for user defined special indentation adjustments. | 480 "*Hook for user defined special indentation adjustments. |
481 This hook gets called after a line is indented by the mode." | 481 This hook gets called after a line is indented by the mode." |
482 :type 'hook | 482 :type 'hook |
483 :group 'cc-indent) | 483 :group 'cc-indent) |
484 (defcustom c-delete-function 'backward-delete-char-untabify | 484 (defcustom c-delete-function (if (fboundp 'backspace-or-delete) |
485 'backspace-or-delete | |
486 'backward-delete-char-untabify) | |
485 "*Function called by `c-electric-delete' when deleting characters." | 487 "*Function called by `c-electric-delete' when deleting characters." |
486 :type 'function | 488 :type 'function |
487 :group 'cc-mode) | 489 :group 'cc-mode) |
488 (defcustom c-electric-pound-behavior nil | 490 (defcustom c-electric-pound-behavior nil |
489 "*List of behaviors for electric pound insertion. | 491 "*List of behaviors for electric pound insertion. |
1033 (define-key c-mode-map "\eq" 'c-fill-paragraph)) | 1035 (define-key c-mode-map "\eq" 'c-fill-paragraph)) |
1034 (define-key c-mode-map "\C-c\C-n" 'c-forward-conditional) | 1036 (define-key c-mode-map "\C-c\C-n" 'c-forward-conditional) |
1035 (define-key c-mode-map "\C-c\C-p" 'c-backward-conditional) | 1037 (define-key c-mode-map "\C-c\C-p" 'c-backward-conditional) |
1036 (define-key c-mode-map "\C-c\C-u" 'c-up-conditional) | 1038 (define-key c-mode-map "\C-c\C-u" 'c-up-conditional) |
1037 (define-key c-mode-map "\t" 'c-indent-command) | 1039 (define-key c-mode-map "\t" 'c-indent-command) |
1038 ;; GDF - don't rebind the DEL key | 1040 (define-key c-mode-map "\177" 'c-electric-delete) |
1039 ;; (define-key c-mode-map "\177" 'c-electric-delete) | |
1040 ;; these are new keybindings, with no counterpart to BOCM | 1041 ;; these are new keybindings, with no counterpart to BOCM |
1041 (define-key c-mode-map "," 'c-electric-semi&comma) | 1042 (define-key c-mode-map "," 'c-electric-semi&comma) |
1042 (define-key c-mode-map "*" 'c-electric-star) | 1043 (define-key c-mode-map "*" 'c-electric-star) |
1043 (define-key c-mode-map "\C-c\C-q" 'c-indent-defun) | 1044 (define-key c-mode-map "\C-c\C-q" 'c-indent-defun) |
1044 (define-key c-mode-map "\C-c\C-\\" 'c-backslash-region) | 1045 (define-key c-mode-map "\C-c\C-\\" 'c-backslash-region) |
1426 | 1427 |
1427 Key bindings: | 1428 Key bindings: |
1428 \\{c-mode-map}" | 1429 \\{c-mode-map}" |
1429 (interactive) | 1430 (interactive) |
1430 (kill-all-local-variables) | 1431 (kill-all-local-variables) |
1431 (make-local-hook 'backspace-or-delete-hook) | |
1432 (add-hook 'backspace-or-delete-hook 'c-electric-delete nil t) | |
1433 (set-syntax-table c-mode-syntax-table) | 1432 (set-syntax-table c-mode-syntax-table) |
1434 (setq major-mode 'c-mode | 1433 (setq major-mode 'c-mode |
1435 mode-name "C" | 1434 mode-name "C" |
1436 local-abbrev-table c-mode-abbrev-table) | 1435 local-abbrev-table c-mode-abbrev-table) |
1437 (use-local-map c-mode-map) | 1436 (use-local-map c-mode-map) |
1939 (c-keep-region-active)) | 1938 (c-keep-region-active)) |
1940 | 1939 |
1941 | 1940 |
1942 ;; COMMANDS | 1941 ;; COMMANDS |
1943 (defun c-electric-delete (arg) | 1942 (defun c-electric-delete (arg) |
1944 "Deletes preceding character or whitespace. | 1943 "Deletes preceding or following character or whitespace. |
1945 If `c-hungry-delete-key' is non-nil, as evidenced by the \"/h\" or | 1944 If `c-hungry-delete-key' is non-nil, as evidenced by the \"/h\" or |
1946 \"/ah\" string on the mode line, then all preceding whitespace is | 1945 \"/ah\" string on the mode line, then all preceding or following |
1947 consumed. If however an ARG is supplied, or `c-hungry-delete-key' is | 1946 whitespace is consumed. If however an ARG is supplied, or |
1948 nil, or point is inside a literal then the function in the variable | 1947 `c-hungry-delete-key' is nil, or point is inside a literal then the |
1949 `c-delete-function' is called." | 1948 function in the variable `c-delete-function' is called." |
1950 (interactive "P") | 1949 (interactive "P") |
1951 (if (or (not c-hungry-delete-key) | 1950 (if (or (not c-hungry-delete-key) |
1952 arg | 1951 arg |
1953 (c-in-literal)) | 1952 (c-in-literal)) |
1954 (funcall c-delete-function (prefix-numeric-value arg)) | 1953 (funcall c-delete-function (prefix-numeric-value arg)) |
1955 (let ((here (point))) | 1954 (let ((here (point))) |
1956 (skip-chars-backward " \t\n") | 1955 (if (and (boundp 'delete-erases-forward) |
1956 delete-erases-forward) | |
1957 (skip-chars-forward " \t\n") | |
1958 (skip-chars-backward " \t\n")) | |
1957 (if (/= (point) here) | 1959 (if (/= (point) here) |
1958 (delete-region (point) here) | 1960 (delete-region (point) here) |
1959 (funcall c-delete-function 1)))) | 1961 (funcall c-delete-function 1))))) |
1960 t) | |
1961 | 1962 |
1962 (defun c-electric-pound (arg) | 1963 (defun c-electric-pound (arg) |
1963 "Electric pound (`#') insertion. | 1964 "Electric pound (`#') insertion. |
1964 Inserts a `#' character specially depending on the variable | 1965 Inserts a `#' character specially depending on the variable |
1965 `c-electric-pound-behavior'. If a numeric ARG is supplied, or if | 1966 `c-electric-pound-behavior'. If a numeric ARG is supplied, or if |