diff options
| -rw-r--r-- | admin/ChangeLog | 5 | ||||
| -rw-r--r-- | admin/FOR-RELEASE | 4 | ||||
| -rwxr-xr-x | admin/quick-install-emacs | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 113 | ||||
| -rw-r--r-- | lisp/files.el | 6 | ||||
| -rw-r--r-- | lisp/isearch.el | 16 | ||||
| -rw-r--r-- | lisp/progmodes/cc-align.el | 23 | ||||
| -rw-r--r-- | lisp/progmodes/cc-awk.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 613 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 319 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 25 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 9 | ||||
| -rw-r--r-- | lisp/progmodes/cc-styles.el | 5 | ||||
| -rw-r--r-- | lisp/progmodes/cc-vars.el | 11 | ||||
| -rw-r--r-- | lwlib/ChangeLog | 16 | ||||
| -rw-r--r-- | lwlib/lwlib-Xlw.c | 27 | ||||
| -rw-r--r-- | lwlib/xlwmenu.c | 31 | ||||
| -rw-r--r-- | lwlib/xlwmenu.h | 2 | ||||
| -rw-r--r-- | lwlib/xlwmenuP.h | 2 | ||||
| -rw-r--r-- | man/ChangeLog | 43 | ||||
| -rw-r--r-- | man/cc-mode.texi | 167 | ||||
| -rw-r--r-- | man/commands.texi | 9 | ||||
| -rw-r--r-- | man/custom.texi | 30 | ||||
| -rw-r--r-- | man/xresources.texi | 5 |
25 files changed, 1047 insertions, 446 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index 0f01e1ae1c7..65606c02cb5 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-01-01 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * quick-install-emacs (get_config_var): Deal with weird magic | ||
| 4 | string inserted by recent versions of autoconf. | ||
| 5 | |||
| 1 | 2006-11-25 Juanma Barranquero <lekktu@gmail.com> | 6 | 2006-11-25 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * admin.el (set-version): Set version number in | 8 | * admin.el (set-version): Set version number in |
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 3b7eb8c4560..f45c5819466 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | Tasks needed before the next release. | 1 | Tasks needed before the next release. |
| 2 | 2 | ||
| 3 | * UPDATE COPYRIGHTS (Happy New Year :-) | ||
| 4 | |||
| 5 | |||
| 3 | * TO BE DONE SHORTLY BEFORE RELEASE | 6 | * TO BE DONE SHORTLY BEFORE RELEASE |
| 4 | 7 | ||
| 5 | ** Check for widow and orphan lines in manuals; | 8 | ** Check for widow and orphan lines in manuals; |
| @@ -8,7 +11,6 @@ make sure all the pages really look ok in the manual as formatted. | |||
| 8 | ** Check for text in manuals that assumes current version is 21. | 11 | ** Check for text in manuals that assumes current version is 21. |
| 9 | 12 | ||
| 10 | ** Update AUTHORS. | 13 | ** Update AUTHORS. |
| 11 | [Done 2006-10-03] | ||
| 12 | 14 | ||
| 13 | ** Regenerate the postscript files of the reference cards in etc. | 15 | ** Regenerate the postscript files of the reference cards in etc. |
| 14 | 16 | ||
diff --git a/admin/quick-install-emacs b/admin/quick-install-emacs index 9a9d1203d96..2167b8ee2d1 100755 --- a/admin/quick-install-emacs +++ b/admin/quick-install-emacs | |||
| @@ -136,7 +136,7 @@ fi | |||
| 136 | CONFIG_STATUS="$BUILD/config.status" | 136 | CONFIG_STATUS="$BUILD/config.status" |
| 137 | get_config_var () | 137 | get_config_var () |
| 138 | { | 138 | { |
| 139 | if ! sed -n "s/^s\(.\)@$1@\1\(.*\)\1.*$/\2/p" $CONFIG_STATUS | sed q | grep '' | 139 | if ! sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep '' |
| 140 | then | 140 | then |
| 141 | echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS" | 141 | echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS" |
| 142 | exit 4 | 142 | exit 4 |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 51f8114feab..4ab077fedd3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,116 @@ | |||
| 1 | 2007-01-02 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * files.el (version-control): Doc fix. | ||
| 4 | |||
| 5 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 6 | |||
| 7 | * progmodes/cc-engine.el (c-guess-basic-syntax, case 5N): Check | ||
| 8 | the format of c-state-cache is valid for an optimisation before | ||
| 9 | using it. | ||
| 10 | |||
| 11 | * progmodes/cc-engine.el (c-guess-basic-syntax): New case 5Q "we | ||
| 12 | are at a statement within a macro". Other changes so that only | ||
| 13 | the first continuation line in a macro gets the symbol | ||
| 14 | `cpp-define-intro', the others getting `statement', or whatever. | ||
| 15 | |||
| 16 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 17 | |||
| 18 | * progmodes/cc-cmds.el (c-context-line-break): When invoked within | ||
| 19 | a string, preserve whitespace. Add a backslash only when also in | ||
| 20 | a macro. | ||
| 21 | |||
| 22 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 23 | |||
| 24 | * progmodes/cc-defs.el: Correct typos. | ||
| 25 | |||
| 26 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 27 | |||
| 28 | * progmodes/cc-cmds.el (c-context-line-break): Don't indent the | ||
| 29 | new line after an escaped EOL in a string. | ||
| 30 | |||
| 31 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 32 | |||
| 33 | * progmodes/cc-engine.el (c-forward-label): Recognise "foo:" as a | ||
| 34 | label when it directly follows "else", "do", .... | ||
| 35 | |||
| 36 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 37 | |||
| 38 | * progmodes/cc-engine.el (c-backward-<>-arglist): Tolerate empty | ||
| 39 | angle brackets (as seen in "explicit specialisations" of C++ | ||
| 40 | templates). | ||
| 41 | |||
| 42 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 43 | |||
| 44 | * progmodes/cc-vars.el (c-indentation-style): Mention c-file-style | ||
| 45 | in the doc-string. | ||
| 46 | |||
| 47 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 48 | |||
| 49 | * progmodes/cc-cmds.el (c-mask-paragraph): Fix for C comments, | ||
| 50 | when the comment ender looks like "=========*/" and is alone on | ||
| 51 | its line. | ||
| 52 | |||
| 53 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 54 | |||
| 55 | * progmodes/cc-langs.el, progmodes/cc-engine.el: Correct the | ||
| 56 | spelling of c-opt-op-identiTier-prefix, t -> f. Leave an alias | ||
| 57 | for the old name. | ||
| 58 | |||
| 59 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 60 | |||
| 61 | * progmodes/cc-mode.el: Bind C-M-a and C-M-e to | ||
| 62 | c-\(beginning\|end\)-of-defun by default. | ||
| 63 | |||
| 64 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 65 | |||
| 66 | * progmodes/cc-align.el (c-lineup-gnu-DEFUN-intro-cont): New | ||
| 67 | line-up function, for the DEFUN macro in the Emacs C sources. | ||
| 68 | Only used in "gnu" style. | ||
| 69 | |||
| 70 | * progmodes/cc-styles.el (c-style-alist): Use this new function in | ||
| 71 | the "gnu" style. | ||
| 72 | |||
| 73 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 74 | |||
| 75 | * progmodes/cc-cmds.el (c-electric-slash): Extend the handling of | ||
| 76 | clean-up comment-close-slash also to work when there's a comment | ||
| 77 | terminator on the line. | ||
| 78 | (c-beginning-of-defun, c-end-of-defun): Refactor and optimise | ||
| 79 | these for large arg - only take account of top level {..}, except | ||
| 80 | for initial and final adjustments. M-- C-M-[ae] now go to the | ||
| 81 | right defuns when the starting point is between defuns. They use | ||
| 82 | the four new functions: | ||
| 83 | (c-in-function-trailer-p, c-where-wrt-brace-construct) | ||
| 84 | (c-backward-to-nth-BOF-{, c-forward-to-nth-EOF-}): New functions to | ||
| 85 | support c-\(beginning\|end\)-of-defun. | ||
| 86 | |||
| 87 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 88 | |||
| 89 | * progmodes/cc-engine.el (c-forward-label): Analyze ":" | ||
| 90 | expressions more rigorously, to exclude bit-field specifiers from | ||
| 91 | being classed as labels. | ||
| 92 | (c-forward-label): When analyzing a ":" within a macro, be careful | ||
| 93 | about using c-forward-syntactic-ws at the macro beginning. | ||
| 94 | (c-beginning-of-decl-1): Whilst searching for "=" as evidence of a | ||
| 95 | stmt boundary, check for "operator=", etc. | ||
| 96 | |||
| 97 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 98 | |||
| 99 | * progmodes/cc-mode.el (c-postprocess-file-styles): Bind | ||
| 100 | inhibit-read-only to t, around the call to | ||
| 101 | c-remove-any-local-eval-or-mode-variables, so that it works on a | ||
| 102 | RO file. | ||
| 103 | |||
| 104 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 105 | |||
| 106 | * progmodes/cc-defs.el (c-version): Update the version number to | ||
| 107 | "5.31.4". | ||
| 108 | |||
| 109 | 2007-01-01 Richard Stallman <rms@gnu.org> | ||
| 110 | |||
| 111 | * isearch.el (isearch-done): Use FOUND-POINT or FOUND-START | ||
| 112 | only if we restored isearch-window-configuration. | ||
| 113 | |||
| 1 | 2006-12-31 Romain Francoise <romain@orebokech.com> | 114 | 2006-12-31 Romain Francoise <romain@orebokech.com> |
| 2 | 115 | ||
| 3 | * net/tramp.el (tramp-default-method): Don't use `symbol-function'. | 116 | * net/tramp.el (tramp-default-method): Don't use `symbol-function'. |
diff --git a/lisp/files.el b/lisp/files.el index c462e5cce9d..cc4cd1220f9 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -242,9 +242,9 @@ breaks any hard links between it and other files." | |||
| 242 | 242 | ||
| 243 | (defcustom version-control nil | 243 | (defcustom version-control nil |
| 244 | "Control use of version numbers for backup files. | 244 | "Control use of version numbers for backup files. |
| 245 | t means make numeric backup versions unconditionally. | 245 | When t, make numeric backup versions unconditionally. |
| 246 | nil means make them for files that have some already. | 246 | When nil, make them for files that have some already. |
| 247 | `never' means do not make them." | 247 | The value `never' means do not make them." |
| 248 | :type '(choice (const :tag "Never" never) | 248 | :type '(choice (const :tag "Never" never) |
| 249 | (const :tag "If existing" nil) | 249 | (const :tag "If existing" nil) |
| 250 | (other :tag "Always" t)) | 250 | (other :tag "Always" t)) |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 6e418fc1161..66b1bef19ca 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -780,13 +780,15 @@ NOPUSH is t and EDIT is t." | |||
| 780 | (lazy-highlight-cleanup lazy-highlight-cleanup) | 780 | (lazy-highlight-cleanup lazy-highlight-cleanup) |
| 781 | (let ((found-start (window-start (selected-window))) | 781 | (let ((found-start (window-start (selected-window))) |
| 782 | (found-point (point))) | 782 | (found-point (point))) |
| 783 | (if isearch-window-configuration | 783 | (when isearch-window-configuration |
| 784 | (set-window-configuration isearch-window-configuration)) | 784 | (set-window-configuration isearch-window-configuration) |
| 785 | 785 | (if isearch-small-window | |
| 786 | (if isearch-small-window | 786 | (goto-char found-point) |
| 787 | (goto-char found-point) | 787 | ;; set-window-configuration clobbers window-start; restore it. |
| 788 | ;; Exiting the save-window-excursion clobbers window-start; restore it. | 788 | ;; This has an annoying side effect of clearing the last_modiff |
| 789 | (set-window-start (selected-window) found-start t))) | 789 | ;; field of the window, which can cause unwanted scrolling, |
| 790 | ;; so don't do it unless truly necessary. | ||
| 791 | (set-window-start (selected-window) found-start t)))) | ||
| 790 | 792 | ||
| 791 | (setq isearch-mode nil) | 793 | (setq isearch-mode nil) |
| 792 | (if isearch-input-method-local-p | 794 | (if isearch-input-method-local-p |
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 9c2427a71af..847e43a46b7 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -90,6 +90,29 @@ Works with: topmost-intro-cont." | |||
| 90 | (c-after-special-operator-id)))) | 90 | (c-after-special-operator-id)))) |
| 91 | c-basic-offset))) | 91 | c-basic-offset))) |
| 92 | 92 | ||
| 93 | (defun c-lineup-gnu-DEFUN-intro-cont (langelem) | ||
| 94 | "Line up the continuation lines of a DEFUN macro in the Emacs C source. | ||
| 95 | These lines are indented as though they were `knr-argdecl-intro' lines. | ||
| 96 | Return nil when we're not in such a construct. | ||
| 97 | |||
| 98 | This function is for historical compatibility with how previous CC Modes (5.28 | ||
| 99 | and earlier) indented such lines. | ||
| 100 | |||
| 101 | Here is an example: | ||
| 102 | |||
| 103 | DEFUN (\"forward-char\", Fforward_char, Sforward_char, 0, 1, \"p\", | ||
| 104 | doc: /* Move point right N characters (left if N is negative). | ||
| 105 | On reaching end of buffer, stop and signal error. */) | ||
| 106 | (n) <- c-lineup-gnu-DEFUN-into-cont | ||
| 107 | Lisp_Object n; <- c-lineup-gnu-DEFUN-into-cont | ||
| 108 | |||
| 109 | Works with: topmost-intro-cont." | ||
| 110 | (save-excursion | ||
| 111 | (let (case-fold-search) | ||
| 112 | (goto-char (c-langelem-pos langelem)) | ||
| 113 | (if (looking-at "\\<DEFUN\\>") | ||
| 114 | (c-calc-offset '(knr-argdecl-intro)))))) | ||
| 115 | |||
| 93 | (defun c-block-in-arglist-dwim (arglist-start) | 116 | (defun c-block-in-arglist-dwim (arglist-start) |
| 94 | ;; This function implements the DWIM to avoid far indentation of | 117 | ;; This function implements the DWIM to avoid far indentation of |
| 95 | ;; brace block constructs in arguments in `c-lineup-arglist' etc. | 118 | ;; brace block constructs in arguments in `c-lineup-arglist' etc. |
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index e2fcbd8d06b..bc745873638 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el | |||
| @@ -720,7 +720,7 @@ | |||
| 720 | (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t)) | 720 | (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t)) |
| 721 | (search-forward-regexp c-awk-div-sign-re (1+ /point) t)) | 721 | (search-forward-regexp c-awk-div-sign-re (1+ /point) t)) |
| 722 | ;; A division sign. | 722 | ;; A division sign. |
| 723 | (progn (goto-char (1+ /point)) nil) | 723 | (progn (goto-char (1+ /point)) nil) |
| 724 | ;; A regexp opener | 724 | ;; A regexp opener |
| 725 | ;; Jump over the regexp innards, setting the match data. | 725 | ;; Jump over the regexp innards, setting the match data. |
| 726 | (goto-char /point) | 726 | (goto-char /point) |
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 1c266e8a5de..063cfe89777 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | (cc-bytecomp-defun c-forward-subword) | 53 | (cc-bytecomp-defun c-forward-subword) |
| 54 | (cc-bytecomp-defun c-backward-subword) | 54 | (cc-bytecomp-defun c-backward-subword) |
| 55 | 55 | ||
| 56 | ;; Indentation / Display syntax functions | ||
| 56 | (defvar c-fix-backslashes t) | 57 | (defvar c-fix-backslashes t) |
| 57 | 58 | ||
| 58 | (defun c-indent-line (&optional syntax quiet ignore-point-pos) | 59 | (defun c-indent-line (&optional syntax quiet ignore-point-pos) |
| @@ -252,6 +253,7 @@ With universal argument, inserts the analysis as a comment on that line." | |||
| 252 | (forward-line))))) | 253 | (forward-line))))) |
| 253 | 254 | ||
| 254 | 255 | ||
| 256 | ;; Minor mode functions. | ||
| 255 | (defun c-update-modeline () | 257 | (defun c-update-modeline () |
| 256 | (let ((fmt (format "/%s%s%s%s" | 258 | (let ((fmt (format "/%s%s%s%s" |
| 257 | (if c-electric-flag "l" "") | 259 | (if c-electric-flag "l" "") |
| @@ -843,13 +845,17 @@ is inhibited." | |||
| 843 | (eq literal 'c) | 845 | (eq literal 'c) |
| 844 | (memq 'comment-close-slash c-cleanup-list) | 846 | (memq 'comment-close-slash c-cleanup-list) |
| 845 | (eq last-command-char ?/) | 847 | (eq last-command-char ?/) |
| 848 | (looking-at (concat "[ \t]*\\(" | ||
| 849 | (regexp-quote comment-end) "\\)?$")) | ||
| 846 | ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */ | 850 | ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */ |
| 847 | (save-excursion | 851 | (save-excursion |
| 848 | (back-to-indentation) | 852 | (save-restriction |
| 849 | (looking-at (concat c-current-comment-prefix "[ \t]*$")))) | 853 | (narrow-to-region (point-min) (point)) |
| 850 | (end-of-line) | 854 | (back-to-indentation) |
| 851 | (delete-horizontal-space) | 855 | (looking-at (concat c-current-comment-prefix "[ \t]*$"))))) |
| 852 | (or (eq (char-before) ?*) (insert-char ?* 1))) ; Do I need a t (retain sticky properties) here? | 856 | (kill-region (progn (forward-line 0) (point)) |
| 857 | (progn (end-of-line) (point))) | ||
| 858 | (insert-char ?* 1)) ; the / comes later. ; Do I need a t (retain sticky properties) here? | ||
| 853 | 859 | ||
| 854 | (setq indentp (and (not arg) | 860 | (setq indentp (and (not arg) |
| 855 | c-syntactic-indentation | 861 | c-syntactic-indentation |
| @@ -1253,7 +1259,11 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'." | |||
| 1253 | (backward-char) | 1259 | (backward-char) |
| 1254 | (skip-chars-backward " \t") | 1260 | (skip-chars-backward " \t") |
| 1255 | (setq beg (point)) | 1261 | (setq beg (point)) |
| 1256 | (c-save-buffer-state () (c-on-identifier)))) | 1262 | (c-save-buffer-state () (c-on-identifier)) |
| 1263 | ;; Don't add a space into #define FOO().... | ||
| 1264 | (not (and (c-beginning-of-macro) | ||
| 1265 | (c-forward-over-cpp-define-id) | ||
| 1266 | (eq (point) beg))))) | ||
| 1257 | (save-excursion | 1267 | (save-excursion |
| 1258 | (delete-region beg end) | 1268 | (delete-region beg end) |
| 1259 | (goto-char beg) | 1269 | (goto-char beg) |
| @@ -1308,6 +1318,7 @@ keyword on the line, the keyword is not inserted inside a literal, and | |||
| 1308 | (delete-char -2))))) | 1318 | (delete-char -2))))) |
| 1309 | 1319 | ||
| 1310 | 1320 | ||
| 1321 | ;; "nomenclature" functions + c-scope-operator. | ||
| 1311 | (defun c-forward-into-nomenclature (&optional arg) | 1322 | (defun c-forward-into-nomenclature (&optional arg) |
| 1312 | "Compatibility alias for `c-forward-subword'." | 1323 | "Compatibility alias for `c-forward-subword'." |
| 1313 | (interactive "p") | 1324 | (interactive "p") |
| @@ -1328,6 +1339,160 @@ No indentation or other \"electric\" behavior is performed." | |||
| 1328 | (interactive "*") | 1339 | (interactive "*") |
| 1329 | (insert-and-inherit "::")) | 1340 | (insert-and-inherit "::")) |
| 1330 | 1341 | ||
| 1342 | |||
| 1343 | ;; Movement (etc.) by defuns. | ||
| 1344 | (defun c-in-function-trailer-p (&optional lim) | ||
| 1345 | ;; Return non-nil if point is between the closing brace and the semicolon of | ||
| 1346 | ;; a brace construct which needs a semicolon, e.g. within the "variables" | ||
| 1347 | ;; portion of a declaration like "struct foo {...} bar ;". | ||
| 1348 | ;; | ||
| 1349 | ;; Return the position of the main declaration. Otherwise, return nil. | ||
| 1350 | ;; Point is assumed to be at the top level and outside of any macro or | ||
| 1351 | ;; literal. | ||
| 1352 | ;; | ||
| 1353 | ;; If LIM is non-nil, it is the bound on a the backward search for the | ||
| 1354 | ;; beginning of the declaration. | ||
| 1355 | ;; | ||
| 1356 | ;; This function might do hidden buffer changes. | ||
| 1357 | (and c-opt-block-decls-with-vars-key | ||
| 1358 | (save-excursion | ||
| 1359 | (c-syntactic-skip-backward "^;}" lim) | ||
| 1360 | (and (eq (char-before) ?\}) | ||
| 1361 | (eq (car (c-beginning-of-decl-1 lim)) 'previous) | ||
| 1362 | (looking-at c-opt-block-decls-with-vars-key) | ||
| 1363 | (point))))) | ||
| 1364 | |||
| 1365 | (defun c-where-wrt-brace-construct () | ||
| 1366 | ;; Determine where we are with respect to functions (or other brace | ||
| 1367 | ;; constructs, included in the term "function" in the rest of this comment). | ||
| 1368 | ;; Point is assumed to be outside any macro or literal. | ||
| 1369 | ;; This is used by c-\(begining\|end\)-of-defun. | ||
| 1370 | ;; | ||
| 1371 | ;; Return one of these symbols: | ||
| 1372 | ;; at-header : we're at the start of a function's header. | ||
| 1373 | ;; in-header : we're inside a function's header, this extending right | ||
| 1374 | ;; up to the brace. This bit includes any k&r declarations. | ||
| 1375 | ;; in-block : we're inside a function's brace block. | ||
| 1376 | ;; in-trailer : we're in the area between the "}" and ";" of something | ||
| 1377 | ;; like "struct foo {...} bar, baz;". | ||
| 1378 | ;; at-function-end : we're just after the closing brace (or semicolon) that | ||
| 1379 | ;; terminates the function. | ||
| 1380 | ;; outwith-function: we're not at or in any function. Being inside a | ||
| 1381 | ;; non-brace construct also counts as 'outwith-function'. | ||
| 1382 | ;; | ||
| 1383 | ;; This function might do hidden buffer changes. | ||
| 1384 | (save-excursion | ||
| 1385 | (let* (pos | ||
| 1386 | kluge-start | ||
| 1387 | decl-result brace-decl-p | ||
| 1388 | (start (point)) | ||
| 1389 | (paren-state (c-parse-state)) | ||
| 1390 | (least-enclosing (c-least-enclosing-brace paren-state))) | ||
| 1391 | |||
| 1392 | (cond | ||
| 1393 | ((and least-enclosing | ||
| 1394 | (eq (char-after least-enclosing) ?\{)) | ||
| 1395 | 'in-block) | ||
| 1396 | ((c-in-function-trailer-p) | ||
| 1397 | 'in-trailer) | ||
| 1398 | ((and (not least-enclosing) | ||
| 1399 | (consp paren-state) | ||
| 1400 | (consp (car paren-state)) | ||
| 1401 | (eq start (cdar paren-state))) | ||
| 1402 | 'at-function-end) | ||
| 1403 | (t | ||
| 1404 | ;; Find the start of the current declaration. NOTE: If we're in the | ||
| 1405 | ;; variables after a "struct/eval" type block, we don't get to the | ||
| 1406 | ;; real declaration here - we detect and correct for this later. | ||
| 1407 | |||
| 1408 | ;;If we're in the parameters' parens, move back out of them. | ||
| 1409 | (if least-enclosing (goto-char least-enclosing)) | ||
| 1410 | ;; Kluge so that c-beginning-of-decl-1 won't go back if we're already | ||
| 1411 | ;; at a declaration. | ||
| 1412 | (if (or (and (eolp) (not (eobp))) ; EOL is matched by "\\s>" | ||
| 1413 | (not (looking-at | ||
| 1414 | "\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)"))) | ||
| 1415 | (forward-char)) | ||
| 1416 | (setq kluge-start (point)) | ||
| 1417 | (setq decl-result | ||
| 1418 | (car (c-beginning-of-decl-1 | ||
| 1419 | (and least-enclosing ; LIMIT for c-b-of-decl-1 | ||
| 1420 | (c-safe-position least-enclosing paren-state))))) | ||
| 1421 | |||
| 1422 | ;; Has the declaration we've gone back to got braces? | ||
| 1423 | (setq pos (point)) ; the search limit for c-recognize-knr-p | ||
| 1424 | (setq brace-decl-p | ||
| 1425 | (save-excursion | ||
| 1426 | (and (c-syntactic-re-search-forward "[;{]" nil t t) | ||
| 1427 | (or (eq (char-before) ?\{) | ||
| 1428 | (and c-recognize-knr-p | ||
| 1429 | ;; Might have stopped on the | ||
| 1430 | ;; ';' in a K&R argdecl. In | ||
| 1431 | ;; that case the declaration | ||
| 1432 | ;; should contain a block. | ||
| 1433 | (c-in-knr-argdecl pos)))))) | ||
| 1434 | |||
| 1435 | (cond | ||
| 1436 | ((= (point) kluge-start) ; might be BOB or unbalanced parens. | ||
| 1437 | 'outwith-function) | ||
| 1438 | ((eq decl-result 'same) | ||
| 1439 | (if brace-decl-p | ||
| 1440 | (if (eq (point) start) | ||
| 1441 | 'at-header | ||
| 1442 | 'in-header) | ||
| 1443 | 'outwith-function)) | ||
| 1444 | ((eq decl-result 'previous) | ||
| 1445 | (if (and (not brace-decl-p) | ||
| 1446 | (c-in-function-trailer-p)) | ||
| 1447 | 'at-function-end | ||
| 1448 | 'outwith-function)) | ||
| 1449 | (t (error | ||
| 1450 | "c-where-wrt-brace-construct: c-beginning-of-decl-1 returned %s" | ||
| 1451 | decl-result)))))))) | ||
| 1452 | |||
| 1453 | (defun c-backward-to-nth-BOF-{ (n where) | ||
| 1454 | ;; Skip to the opening brace of the Nth function before point. If | ||
| 1455 | ;; point is inside a function, this counts as the first. Point must be | ||
| 1456 | ;; outside any comment/string or macro. | ||
| 1457 | ;; | ||
| 1458 | ;; N must be strictly positive. | ||
| 1459 | ;; WHERE describes the position of point, one of the symbols `at-header', | ||
| 1460 | ;; `in-header', `in-block', `in-trailer', `at-function-end', | ||
| 1461 | ;; `outwith-function' as returned by c-where-wrt-brace-construct. | ||
| 1462 | ;; | ||
| 1463 | ;; If we run out of functions, leave point at BOB. Return zero on success, | ||
| 1464 | ;; otherwise the number of {s still to go. | ||
| 1465 | ;; | ||
| 1466 | ;; This function may do hidden buffer changes | ||
| 1467 | (cond | ||
| 1468 | ;; What we do to go back the first defun depends on where we start. | ||
| 1469 | ((bobp)) | ||
| 1470 | ((eq where 'in-block) | ||
| 1471 | (goto-char (c-least-enclosing-brace (c-parse-state))) | ||
| 1472 | (setq n (1- n))) | ||
| 1473 | ((eq where 'in-header) | ||
| 1474 | (c-syntactic-re-search-forward "{") | ||
| 1475 | (backward-char) | ||
| 1476 | (setq n (1- n))) | ||
| 1477 | (;; (or (eq where 'at-header) (eq where 'outwith-function) | ||
| 1478 | ;; (eq where 'at-function-end) (eq where 'in-trailer)) | ||
| 1479 | (memq where '(at-header outwith-function at-function-end in-trailer)) | ||
| 1480 | (c-syntactic-skip-backward "^}") | ||
| 1481 | (when (eq (char-before) ?\}) | ||
| 1482 | (backward-sexp) | ||
| 1483 | (setq n (1- n)))) | ||
| 1484 | (t (error "Unknown `where' %s in c-backward-to-nth-EOF-{" where))) | ||
| 1485 | |||
| 1486 | ;; Each time round the loop, go back to a "{" at the outermost level. | ||
| 1487 | (while (and (> n 0) (not (bobp))) | ||
| 1488 | (c-parse-state) ; This call speeds up the following one | ||
| 1489 | ; by a factor of ~6. Hmmm. 2006/4/5. | ||
| 1490 | (c-syntactic-skip-backward "^}") | ||
| 1491 | (when (eq (char-before) ?\}) | ||
| 1492 | (backward-sexp) | ||
| 1493 | (setq n (1- n)))) | ||
| 1494 | n) | ||
| 1495 | |||
| 1331 | (defun c-beginning-of-defun (&optional arg) | 1496 | (defun c-beginning-of-defun (&optional arg) |
| 1332 | "Move backward to the beginning of a defun. | 1497 | "Move backward to the beginning of a defun. |
| 1333 | Every top level declaration that contains a brace paren block is | 1498 | Every top level declaration that contains a brace paren block is |
| @@ -1344,88 +1509,99 @@ defun." | |||
| 1344 | (interactive "p") | 1509 | (interactive "p") |
| 1345 | (or arg (setq arg 1)) | 1510 | (or arg (setq arg 1)) |
| 1346 | 1511 | ||
| 1347 | (if (< arg 0) | 1512 | (c-save-buffer-state |
| 1348 | (when (c-end-of-defun (- arg)) | 1513 | ((start (point)) |
| 1349 | (c-save-buffer-state nil (c-forward-syntactic-ws)) | 1514 | where paren-state pos) |
| 1350 | t) | ||
| 1351 | |||
| 1352 | (c-save-buffer-state (paren-state lim pos) | ||
| 1353 | (catch 'exit | ||
| 1354 | (while (> arg 0) | ||
| 1355 | ;; Note: Partial code duplication in `c-end-of-defun' and | ||
| 1356 | ;; `c-declaration-limits'. | ||
| 1357 | |||
| 1358 | (setq paren-state (c-parse-state)) | ||
| 1359 | (unless (c-safe | ||
| 1360 | (goto-char (c-least-enclosing-brace paren-state)) | ||
| 1361 | ;; If we moved to the outermost enclosing paren | ||
| 1362 | ;; then we can use c-safe-position to set the | ||
| 1363 | ;; limit. Can't do that otherwise since the | ||
| 1364 | ;; earlier paren pair on paren-state might very | ||
| 1365 | ;; well be part of the declaration we should go | ||
| 1366 | ;; to. | ||
| 1367 | (setq lim (c-safe-position (point) paren-state)) | ||
| 1368 | t) | ||
| 1369 | ;; At top level. Make sure we aren't inside a literal. | ||
| 1370 | (setq pos (c-literal-limits | ||
| 1371 | (c-safe-position (point) paren-state))) | ||
| 1372 | (if pos (goto-char (car pos)))) | ||
| 1373 | |||
| 1374 | (while (let ((start (point))) | ||
| 1375 | (c-beginning-of-decl-1 lim) | ||
| 1376 | (if (= (point) start) | ||
| 1377 | ;; Didn't move. Might be due to bob or unbalanced | ||
| 1378 | ;; parens. Try to continue if it's the latter. | ||
| 1379 | (unless (c-safe (goto-char | ||
| 1380 | (c-down-list-backward (point)))) | ||
| 1381 | ;; Didn't work, so it's bob then. | ||
| 1382 | (goto-char (point-min)) | ||
| 1383 | (throw 'exit nil))) | ||
| 1384 | 1515 | ||
| 1385 | (save-excursion | 1516 | ;; Move back out of any macro/comment/string we happen to be in. |
| 1386 | ;; Check if the declaration contains a brace | 1517 | (c-beginning-of-macro) |
| 1387 | ;; block. If not, we try another one. | 1518 | (setq pos (c-literal-limits)) |
| 1388 | (setq pos (point)) | 1519 | (if pos (goto-char (car pos))) |
| 1389 | (not (and (c-syntactic-re-search-forward "[;{]" nil t t) | 1520 | |
| 1390 | (or (eq (char-before) ?{) | 1521 | (setq where (c-where-wrt-brace-construct)) |
| 1391 | (and c-recognize-knr-p | 1522 | |
| 1392 | ;; Might have stopped on the | 1523 | (if (< arg 0) |
| 1393 | ;; ';' in a K&R argdecl. In | 1524 | ;; Move forward to the closing brace of a function. |
| 1394 | ;; that case the declaration | 1525 | (progn |
| 1395 | ;; should contain a block. | 1526 | (if ;; (or (eq where 'at-function-end) (eq where 'outwith-function)) |
| 1396 | (c-in-knr-argdecl pos))))))) | 1527 | (memq where '(at-function-end outwith-function)) |
| 1397 | (setq lim nil)) | 1528 | (setq arg (1+ arg))) |
| 1398 | 1529 | (if (< arg 0) | |
| 1399 | ;; Check if `c-beginning-of-decl-1' put us after the block | 1530 | (setq arg (c-forward-to-nth-EOF-} (- arg) where))) |
| 1400 | ;; in a declaration that doesn't end there. We're searching | 1531 | ;; Move forward to the next opening brace.... |
| 1401 | ;; back and forth over the block here, which can be | 1532 | (when (and (= arg 0) |
| 1402 | ;; expensive. | 1533 | (c-syntactic-re-search-forward "{" nil t)) |
| 1403 | (setq pos (point)) | 1534 | (backward-char) |
| 1404 | (if (and c-opt-block-decls-with-vars-key | 1535 | ;; ... and backward to the function header. |
| 1405 | (progn | 1536 | (c-beginning-of-decl-1) |
| 1406 | (c-backward-syntactic-ws) | 1537 | t)) |
| 1407 | (eq (char-before) ?})) | 1538 | |
| 1408 | (eq (car (c-beginning-of-decl-1)) | 1539 | ;; Move backward to the opening brace of a function. |
| 1409 | 'previous) | 1540 | (when (and (> arg 0) |
| 1410 | (save-excursion | 1541 | (eq (setq arg (c-backward-to-nth-BOF-{ arg where)) 0)) |
| 1411 | (c-end-of-decl-1) | 1542 | |
| 1412 | (> (point) pos))) | 1543 | ;; Go backward to this function's header. |
| 1413 | nil | 1544 | (c-beginning-of-decl-1) |
| 1414 | (goto-char pos)) | 1545 | |
| 1415 | 1546 | (setq pos (point)) | |
| 1416 | (setq pos (point)) | 1547 | ;; We're now there, modulo comments and whitespace. |
| 1417 | ;; Try to be line oriented; position point at the closest | 1548 | ;; Try to be line oriented; position point at the closest |
| 1418 | ;; preceding boi that isn't inside a comment, but if we hit | 1549 | ;; preceding boi that isn't inside a comment, but if we hit |
| 1419 | ;; the previous declaration then we use the current point | 1550 | ;; the previous declaration then we use the current point |
| 1420 | ;; instead. | 1551 | ;; instead. |
| 1421 | (while (and (/= (point) (c-point 'boi)) | 1552 | (while (and (/= (point) (c-point 'boi)) |
| 1422 | (c-backward-single-comment))) | 1553 | (c-backward-single-comment))) |
| 1423 | (if (/= (point) (c-point 'boi)) | 1554 | (if (/= (point) (c-point 'boi)) |
| 1424 | (goto-char pos)) | 1555 | (goto-char pos))) |
| 1425 | 1556 | ||
| 1426 | (setq arg (1- arg))))) | 1557 | (c-keep-region-active) |
| 1427 | (c-keep-region-active) | 1558 | (= arg 0)))) |
| 1428 | (= arg 0))) | 1559 | |
| 1560 | (defun c-forward-to-nth-EOF-} (n where) | ||
| 1561 | ;; Skip to the closing brace of the Nth function after point. If | ||
| 1562 | ;; point is inside a function, this counts as the first. Point must be | ||
| 1563 | ;; outside any comment/string or macro. | ||
| 1564 | ;; | ||
| 1565 | ;; N must be strictly positive. | ||
| 1566 | ;; WHERE describes the position of point, one of the symbols `at-header', | ||
| 1567 | ;; `in-header', `in-block', `in-trailer', `at-function-end', | ||
| 1568 | ;; `outwith-function' as returned by c-where-wrt-brace-construct. | ||
| 1569 | ;; | ||
| 1570 | ;; If we run out of functions, leave point at EOB. Return zero on success, | ||
| 1571 | ;; otherwise the number of }s still to go. | ||
| 1572 | ;; | ||
| 1573 | ;; This function may do hidden buffer changes. | ||
| 1574 | |||
| 1575 | (cond | ||
| 1576 | ;; What we do to go forward over the first defun depends on where we | ||
| 1577 | ;; start. We go to the closing brace of that defun, even when we go | ||
| 1578 | ;; backwards to it (in a "struct foo {...} bar ;"). | ||
| 1579 | ((eobp)) | ||
| 1580 | ((eq where 'in-block) | ||
| 1581 | (goto-char (c-least-enclosing-brace (c-parse-state))) | ||
| 1582 | (forward-sexp) | ||
| 1583 | (setq n (1- n))) | ||
| 1584 | ((eq where 'in-trailer) | ||
| 1585 | (c-syntactic-skip-backward "^}") | ||
| 1586 | (setq n (1- n))) | ||
| 1587 | (;; (or (eq where 'at-function-end) (eq where 'outwith-function) | ||
| 1588 | ;; (eq where 'at-header) (eq where 'in-header)) | ||
| 1589 | (memq where '(at-function-end outwith-function at-header in-header)) | ||
| 1590 | (c-syntactic-re-search-forward "{") | ||
| 1591 | (backward-char) | ||
| 1592 | (forward-sexp) | ||
| 1593 | (setq n (1- n))) | ||
| 1594 | (t (error "c-forward-to-nth-EOF-}: `where' is %s" where))) | ||
| 1595 | |||
| 1596 | ;; Each time round the loop, go forward to a "}" at the outermost level. | ||
| 1597 | (while (and (> n 0) (not (eobp))) | ||
| 1598 | ;(c-parse-state) ; This call speeds up the following one by a factor | ||
| 1599 | ; of ~6. Hmmm. 2006/4/5. | ||
| 1600 | (when (c-syntactic-re-search-forward "{" nil 'eob) | ||
| 1601 | (backward-char) | ||
| 1602 | (forward-sexp)) | ||
| 1603 | (setq n (1- n))) | ||
| 1604 | n) | ||
| 1429 | 1605 | ||
| 1430 | (defun c-end-of-defun (&optional arg) | 1606 | (defun c-end-of-defun (&optional arg) |
| 1431 | "Move forward to the end of a top level declaration. | 1607 | "Move forward to the end of a top level declaration. |
| @@ -1435,82 +1611,56 @@ beginning or end of buffer. | |||
| 1435 | 1611 | ||
| 1436 | An end of a defun occurs right after the close-parenthesis that matches | 1612 | An end of a defun occurs right after the close-parenthesis that matches |
| 1437 | the open-parenthesis that starts a defun; see `beginning-of-defun'." | 1613 | the open-parenthesis that starts a defun; see `beginning-of-defun'." |
| 1438 | |||
| 1439 | (interactive "p") | 1614 | (interactive "p") |
| 1440 | (or arg (setq arg 1)) | 1615 | (or arg (setq arg 1)) |
| 1441 | 1616 | ||
| 1442 | (if (< arg 0) | 1617 | (c-save-buffer-state |
| 1443 | (when (c-beginning-of-defun (- arg)) | 1618 | ((start (point)) |
| 1444 | (c-save-buffer-state nil (c-backward-syntactic-ws)) | 1619 | where paren-state pos) |
| 1445 | t) | 1620 | |
| 1446 | 1621 | ;; Move back out of any macro/comment/string we happen to be in. | |
| 1447 | (c-save-buffer-state (paren-state lim pos) | 1622 | (c-beginning-of-macro) |
| 1448 | (catch 'exit | 1623 | (setq pos (c-literal-limits)) |
| 1449 | (while (> arg 0) | 1624 | (if pos (goto-char (car pos))) |
| 1450 | ;; Note: Partial code duplication in `c-beginning-of-defun' | 1625 | |
| 1451 | ;; and `c-declaration-limits'. | 1626 | (setq where (c-where-wrt-brace-construct)) |
| 1452 | 1627 | ||
| 1453 | (setq paren-state (c-parse-state)) | 1628 | (if (< arg 0) |
| 1454 | (unless (c-safe | 1629 | ;; Move backwards to the } of a function |
| 1455 | (goto-char (c-least-enclosing-brace paren-state)) | 1630 | (progn |
| 1456 | ;; If we moved to the outermost enclosing paren | 1631 | (if ;; (or (eq where 'at-header) (eq where 'outwith-function)) |
| 1457 | ;; then we can use c-safe-position to set the | 1632 | (memq where '(at-header outwith-function)) |
| 1458 | ;; limit. Can't do that otherwise since the | 1633 | (setq arg (1+ arg))) |
| 1459 | ;; earlier paren pair on paren-state might very | 1634 | (if (< arg 0) |
| 1460 | ;; well be part of the declaration we should go | 1635 | (setq arg (c-backward-to-nth-BOF-{ (- arg) where))) |
| 1461 | ;; to. | 1636 | (when (and (= arg 0) |
| 1462 | (setq lim (c-safe-position (point) paren-state)) | 1637 | (c-syntactic-skip-backward "^}") |
| 1463 | t) | 1638 | (eq (char-before) ?\})) |
| 1464 | ;; At top level. Make sure we aren't inside a literal. | 1639 | t)) |
| 1465 | (setq pos (car-safe (c-literal-limits | 1640 | |
| 1466 | (c-safe-position (point) paren-state)))) | 1641 | ;; Move forward to the } of a function |
| 1467 | (if pos (goto-char pos))) | 1642 | (if (> arg 0) |
| 1468 | 1643 | (setq arg (c-forward-to-nth-EOF-} arg where)))) | |
| 1469 | ;; Have to move to the start first so that `c-end-of-decl-1' | 1644 | |
| 1470 | ;; has the correct start position. | 1645 | ;; Do we need to move forward from the brace to the semicolon? |
| 1471 | (setq pos (point)) | 1646 | (when (eq arg 0) |
| 1472 | (when (memq (car (c-beginning-of-decl-1 lim)) | 1647 | (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. |
| 1473 | '(previous macro)) | 1648 | (c-syntactic-re-search-forward ";")) |
| 1474 | ;; We moved back over the previous defun or a macro. Move | 1649 | |
| 1475 | ;; to the next token; it's the start of the next | 1650 | (setq pos (point)) |
| 1476 | ;; declaration. We can also be directly after the block | 1651 | ;; We're there now, modulo comments and whitespace. |
| 1477 | ;; in a `c-opt-block-decls-with-vars-key' declaration, but | 1652 | ;; Try to be line oriented; position point after the next |
| 1478 | ;; then we won't move significantly far here. | 1653 | ;; newline that isn't inside a comment, but if we hit the |
| 1479 | (goto-char pos) | 1654 | ;; next declaration then we use the current point instead. |
| 1480 | (c-forward-token-2 0)) | 1655 | (while (and (not (bolp)) |
| 1481 | 1656 | (not (looking-at "\\s *$")) | |
| 1482 | (while (let ((start (point))) | 1657 | (c-forward-single-comment))) |
| 1483 | (c-end-of-decl-1) | 1658 | (cond ((bolp)) |
| 1484 | (if (= (point) start) | 1659 | ((looking-at "\\s *$") |
| 1485 | ;; Didn't move. Might be due to eob or unbalanced | 1660 | (forward-line 1)) |
| 1486 | ;; parens. Try to continue if it's the latter. | 1661 | (t |
| 1487 | (if (c-safe (goto-char (c-up-list-forward (point)))) | 1662 | (goto-char pos)))) |
| 1488 | t | ||
| 1489 | ;; Didn't work, so it's eob then. | ||
| 1490 | (goto-char (point-max)) | ||
| 1491 | (throw 'exit nil)) | ||
| 1492 | |||
| 1493 | (save-excursion | ||
| 1494 | ;; Check if the declaration contains a brace | ||
| 1495 | ;; block. If not, we try another one. | ||
| 1496 | (setq pos (point)) | ||
| 1497 | (goto-char start) | ||
| 1498 | (not (c-syntactic-re-search-forward "{" pos t t)))))) | ||
| 1499 | |||
| 1500 | (setq pos (point)) | ||
| 1501 | ;; Try to be line oriented; position point after the next | ||
| 1502 | ;; newline that isn't inside a comment, but if we hit the | ||
| 1503 | ;; next declaration then we use the current point instead. | ||
| 1504 | (while (and (not (bolp)) | ||
| 1505 | (not (looking-at "\\s *$")) | ||
| 1506 | (c-forward-single-comment))) | ||
| 1507 | (cond ((bolp)) | ||
| 1508 | ((looking-at "\\s *$") | ||
| 1509 | (forward-line 1)) | ||
| 1510 | (t | ||
| 1511 | (goto-char pos))) | ||
| 1512 | 1663 | ||
| 1513 | (setq arg (1- arg))))) | ||
| 1514 | (c-keep-region-active) | 1664 | (c-keep-region-active) |
| 1515 | (= arg 0))) | 1665 | (= arg 0))) |
| 1516 | 1666 | ||
| @@ -1646,6 +1796,7 @@ function does not require the declaration to contain a brace block." | |||
| 1646 | (push-mark (cdr decl-limits) nil t)))) | 1796 | (push-mark (cdr decl-limits) nil t)))) |
| 1647 | 1797 | ||
| 1648 | 1798 | ||
| 1799 | ;; Movement by statements. | ||
| 1649 | (defun c-in-comment-line-prefix-p () | 1800 | (defun c-in-comment-line-prefix-p () |
| 1650 | ;; Point is within a comment. Is it also within a comment-prefix? | 1801 | ;; Point is within a comment. Is it also within a comment-prefix? |
| 1651 | ;; Space at BOL which precedes a comment-prefix counts as part of it. | 1802 | ;; Space at BOL which precedes a comment-prefix counts as part of it. |
| @@ -2429,7 +2580,6 @@ sentence motion in or near comments and multiline strings." | |||
| 2429 | (if (/= count 0) (setq count (1- count)))) | 2580 | (if (/= count 0) (setq count (1- count)))) |
| 2430 | (c-keep-region-active)))) | 2581 | (c-keep-region-active)))) |
| 2431 | 2582 | ||
| 2432 | |||
| 2433 | 2583 | ||
| 2434 | ;; set up electric character functions to work with pending-del, | 2584 | ;; set up electric character functions to work with pending-del, |
| 2435 | ;; (a.k.a. delsel) mode. All symbols get the t value except | 2585 | ;; (a.k.a. delsel) mode. All symbols get the t value except |
| @@ -2455,6 +2605,7 @@ sentence motion in or near comments and multiline strings." | |||
| 2455 | (put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del | 2605 | (put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del |
| 2456 | 2606 | ||
| 2457 | 2607 | ||
| 2608 | ;; Inserting/indenting comments | ||
| 2458 | (defun c-calc-comment-indent (entry) | 2609 | (defun c-calc-comment-indent (entry) |
| 2459 | ;; This function might do hidden buffer changes. | 2610 | ;; This function might do hidden buffer changes. |
| 2460 | (if (symbolp entry) | 2611 | (if (symbolp entry) |
| @@ -2550,6 +2701,7 @@ See `c-indent-comment-alist' for a description." | |||
| 2550 | (current-column)))) | 2701 | (current-column)))) |
| 2551 | 2702 | ||
| 2552 | 2703 | ||
| 2704 | ;; Movement by CPP conditionals. | ||
| 2553 | (defun c-up-conditional (count) | 2705 | (defun c-up-conditional (count) |
| 2554 | "Move back to the containing preprocessor conditional, leaving mark behind. | 2706 | "Move back to the containing preprocessor conditional, leaving mark behind. |
| 2555 | A prefix argument acts as a repeat count. With a negative argument, | 2707 | A prefix argument acts as a repeat count. With a negative argument, |
| @@ -3621,9 +3773,12 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3621 | ;; Restore point on undo. It's necessary since we do a lot of | 3773 | ;; Restore point on undo. It's necessary since we do a lot of |
| 3622 | ;; hidden inserts and deletes below that should be as transparent | 3774 | ;; hidden inserts and deletes below that should be as transparent |
| 3623 | ;; as possible. | 3775 | ;; as possible. |
| 3624 | (if (and buffer-undo-list (not (eq buffer-undo-list t))) | 3776 | (if (and buffer-undo-list (not (eq buffer-undo-list t))) |
| 3625 | (setq buffer-undo-list (cons (point) buffer-undo-list))) | 3777 | (setq buffer-undo-list (cons (point) buffer-undo-list))) |
| 3626 | 3778 | ||
| 3779 | ;; Determine the limits and type of the containing literal (if any): | ||
| 3780 | ;; C-LIT-LIMITS, C-LIT-TYPE; and the limits of the current paragraph: | ||
| 3781 | ;; BEG and END. | ||
| 3627 | (c-save-buffer-state () | 3782 | (c-save-buffer-state () |
| 3628 | (save-restriction | 3783 | (save-restriction |
| 3629 | ;; Widen to catch comment limits correctly. | 3784 | ;; Widen to catch comment limits correctly. |
| @@ -3651,6 +3806,13 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3651 | 3806 | ||
| 3652 | (unwind-protect | 3807 | (unwind-protect |
| 3653 | (progn | 3808 | (progn |
| 3809 | ;; For each of the possible types of text (string, C comment ...) | ||
| 3810 | ;; determine BEG and END, the region we will narrow to. If we're in | ||
| 3811 | ;; a literal, constrain BEG and END to the limits of this literal. | ||
| 3812 | ;; | ||
| 3813 | ;; For some of these text types, particularly a block comment, we | ||
| 3814 | ;; may need to massage whitespace near literal delimiters, so that | ||
| 3815 | ;; these don't get filled inappropriately. | ||
| 3654 | (cond | 3816 | (cond |
| 3655 | 3817 | ||
| 3656 | ((eq c-lit-type 'c++) ; Line comment. | 3818 | ((eq c-lit-type 'c++) ; Line comment. |
| @@ -3675,21 +3837,27 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3675 | 3837 | ||
| 3676 | ((eq c-lit-type 'c) ; Block comment. | 3838 | ((eq c-lit-type 'c) ; Block comment. |
| 3677 | (when (>= end (cdr c-lit-limits)) | 3839 | (when (>= end (cdr c-lit-limits)) |
| 3678 | ;; The region includes the comment ender which we might | 3840 | ;; The region includes the comment ender. If it's on its own |
| 3679 | ;; want to keep together with the last word. | 3841 | ;; line, it stays on its own line. If it's got company on the |
| 3680 | (unless (save-excursion | 3842 | ;; line, it keeps (at least one word of) it. "=====*/" counts |
| 3681 | (goto-char (cdr c-lit-limits)) | 3843 | ;; as a comment ender here, but "===== */" doesn't and "foo*/" |
| 3682 | (beginning-of-line) | 3844 | ;; doesn't. |
| 3683 | (and (looking-at (concat "[ \t]*\\(" | 3845 | (unless |
| 3684 | c-current-comment-prefix | 3846 | (save-excursion |
| 3685 | "\\)\\*/")) | 3847 | (goto-char (cdr c-lit-limits)) |
| 3686 | (eq (cdr c-lit-limits) (match-end 0)) | 3848 | (beginning-of-line) |
| 3687 | ;; The comment ender is on a line of its | 3849 | (and (search-forward-regexp |
| 3688 | ;; own. Keep it that way. | 3850 | (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)") |
| 3689 | (set-marker end (point)))) | 3851 | (- (cdr c-lit-limits) 2) t) |
| 3690 | 3852 | (not (search-forward-regexp | |
| 3691 | ;; The comment ender should hang. Replace all space between | 3853 | "\\(\\s \\|\\sw\\)" |
| 3692 | ;; it and the last word either by one or two 'x's (when | 3854 | (- (cdr c-lit-limits) 2) 'limit)) |
| 3855 | ;; The comment ender IS on its own line. Exclude | ||
| 3856 | ;; this line from the filling. | ||
| 3857 | (set-marker end (c-point 'bol)))) | ||
| 3858 | |||
| 3859 | ;; The comment ender is hanging. Replace all space between it | ||
| 3860 | ;; and the last word either by one or two 'x's (when | ||
| 3693 | ;; FILL-PARAGRAPH is non-nil), or a row of x's the same width | 3861 | ;; FILL-PARAGRAPH is non-nil), or a row of x's the same width |
| 3694 | ;; as the whitespace (when auto filling), and include it in | 3862 | ;; as the whitespace (when auto filling), and include it in |
| 3695 | ;; the region. We'll change them back to whitespace | 3863 | ;; the region. We'll change them back to whitespace |
| @@ -3706,23 +3874,26 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3706 | spaces) | 3874 | spaces) |
| 3707 | 3875 | ||
| 3708 | (save-excursion | 3876 | (save-excursion |
| 3877 | ;; Insert a CR after the "*/", adjust END | ||
| 3709 | (goto-char (cdr c-lit-limits)) | 3878 | (goto-char (cdr c-lit-limits)) |
| 3710 | (setq tmp-post (point-marker)) | 3879 | (setq tmp-post (point-marker)) |
| 3711 | (insert ?\n) | 3880 | (insert ?\n) |
| 3712 | (set-marker end (point)) | 3881 | (set-marker end (point)) |
| 3882 | |||
| 3713 | (forward-line -1) ; last line of the comment | 3883 | (forward-line -1) ; last line of the comment |
| 3714 | (if (and (looking-at (concat "[ \t]*\\(\\(" | 3884 | (if (and (looking-at (concat "[ \t]*\\(\\(" |
| 3715 | c-current-comment-prefix | 3885 | c-current-comment-prefix |
| 3716 | "\\)[ \t]*\\)")) | 3886 | "\\)[ \t]*\\)")) |
| 3717 | (eq ender-start (match-end 0))) | 3887 | (eq ender-start (match-end 0))) |
| 3718 | ;; The comment ender is prefixed by nothing | 3888 | ;; The comment ender is prefixed by nothing but a |
| 3719 | ;; but a comment line prefix. Remove it | 3889 | ;; comment line prefix. IS THIS POSSIBLE? (ACM, |
| 3720 | ;; along with surrounding ws. | 3890 | ;; 2006/4/28). Remove it along with surrounding ws. |
| 3721 | (setq spaces (- (match-end 1) (match-end 2))) | 3891 | (setq spaces (- (match-end 1) (match-end 2))) |
| 3722 | (goto-char ender-start)) | 3892 | (goto-char ender-start)) |
| 3723 | (skip-chars-backward " \t\r\n") ; Surely this can be | 3893 | (skip-chars-backward " \t\r\n") ; Surely this can be |
| 3724 | ; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18) | 3894 | ; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18) |
| 3725 | 3895 | ||
| 3896 | ;; What's being tested here? 2006/4/20. FIXME!!! | ||
| 3726 | (if (/= (point) ender-start) | 3897 | (if (/= (point) ender-start) |
| 3727 | (progn | 3898 | (progn |
| 3728 | (if (<= here (point)) | 3899 | (if (<= here (point)) |
| @@ -4172,49 +4343,63 @@ it. | |||
| 4172 | When point is inside a comment, continue it with the appropriate | 4343 | When point is inside a comment, continue it with the appropriate |
| 4173 | comment prefix (see the `c-comment-prefix-regexp' and | 4344 | comment prefix (see the `c-comment-prefix-regexp' and |
| 4174 | `c-block-comment-prefix' variables for details). The end of a | 4345 | `c-block-comment-prefix' variables for details). The end of a |
| 4175 | C++-style line comment doesn't count as inside it." | 4346 | C++-style line comment doesn't count as inside it. |
| 4347 | |||
| 4348 | When point is inside a string, only insert a backslash when it is also | ||
| 4349 | inside a preprocessor directive." | ||
| 4176 | 4350 | ||
| 4177 | (interactive "*") | 4351 | (interactive "*") |
| 4178 | (let* (c-lit-limits c-lit-type | 4352 | (let* (c-lit-limits c-lit-type |
| 4179 | (c-macro-start c-macro-start)) | 4353 | (c-macro-start c-macro-start)) |
| 4180 | 4354 | ||
| 4181 | (if (c-save-buffer-state () | 4355 | (c-save-buffer-state () |
| 4182 | (setq c-lit-limits (c-literal-limits nil nil t) | 4356 | (setq c-lit-limits (c-literal-limits nil nil t) |
| 4183 | c-lit-type (c-literal-type c-lit-limits)) | 4357 | c-lit-type (c-literal-type c-lit-limits)) |
| 4184 | (or (eq c-lit-type 'c) | 4358 | (when (eq c-lit-type 'c++) |
| 4185 | (and (eq c-lit-type 'c++) | 4359 | (setq c-lit-limits (c-collect-line-comments c-lit-limits))) |
| 4186 | (< (save-excursion | 4360 | (c-query-and-set-macro-start)) |
| 4187 | (skip-chars-forward " \t") | ||
| 4188 | (point)) | ||
| 4189 | (1- (cdr (setq c-lit-limits (c-collect-line-comments | ||
| 4190 | c-lit-limits)))))) | ||
| 4191 | (and (or (not (looking-at "\\s *$")) | ||
| 4192 | (eq (char-before) ?\\)) | ||
| 4193 | (c-query-and-set-macro-start) | ||
| 4194 | (<= (save-excursion | ||
| 4195 | (goto-char c-macro-start) | ||
| 4196 | (if (looking-at c-opt-cpp-start) | ||
| 4197 | (goto-char (match-end 0))) | ||
| 4198 | (point)) | ||
| 4199 | (point))))) | ||
| 4200 | |||
| 4201 | (let ((comment-multi-line t) | ||
| 4202 | (fill-prefix nil)) | ||
| 4203 | (c-indent-new-comment-line nil t)) | ||
| 4204 | |||
| 4205 | (delete-horizontal-space) | ||
| 4206 | (newline) | ||
| 4207 | 4361 | ||
| 4362 | (cond | ||
| 4363 | ((or (eq c-lit-type 'c) | ||
| 4364 | (and (eq c-lit-type 'c++) ; C++ comment, but not at the very end of it. | ||
| 4365 | (< (save-excursion | ||
| 4366 | (skip-chars-forward " \t") | ||
| 4367 | (point)) | ||
| 4368 | (1- (cdr c-lit-limits)))) | ||
| 4369 | (and (numberp c-macro-start) ; Macro, but not at the very end of | ||
| 4370 | ; it, not in a string, and not in the | ||
| 4371 | ; cpp keyword. | ||
| 4372 | (not (eq c-lit-type 'string)) | ||
| 4373 | (or (not (looking-at "\\s *$")) | ||
| 4374 | (eq (char-before) ?\\)) | ||
| 4375 | (<= (save-excursion | ||
| 4376 | (goto-char c-macro-start) | ||
| 4377 | (if (looking-at c-opt-cpp-start) | ||
| 4378 | (goto-char (match-end 0))) | ||
| 4379 | (point)) | ||
| 4380 | (point)))) | ||
| 4381 | (let ((comment-multi-line t) | ||
| 4382 | (fill-prefix nil)) | ||
| 4383 | (c-indent-new-comment-line nil t))) | ||
| 4384 | |||
| 4385 | ((eq c-lit-type 'string) | ||
| 4386 | (if (and (numberp c-macro-start) | ||
| 4387 | (not (eq (char-before) ?\\))) | ||
| 4388 | (insert ?\\)) | ||
| 4389 | (newline)) | ||
| 4390 | |||
| 4391 | (t (delete-horizontal-space) | ||
| 4392 | (newline) | ||
| 4208 | ;; c-indent-line may look at the current indentation, so let's | 4393 | ;; c-indent-line may look at the current indentation, so let's |
| 4209 | ;; start out with the same indentation as the previous line. | 4394 | ;; start out with the same indentation as the previous line. |
| 4210 | (let ((col (save-excursion | 4395 | (let ((col (save-excursion |
| 4211 | (forward-line -1) | 4396 | (backward-char) |
| 4212 | (while (and (looking-at "[ \t]*\\\\?$") | 4397 | (forward-line 0) |
| 4213 | (= (forward-line -1) 0))) | 4398 | (while (and (looking-at "[ \t]*\\\\?$") |
| 4214 | (current-indentation)))) | 4399 | (= (forward-line -1) 0))) |
| 4215 | (indent-to col)) | 4400 | (current-indentation)))) |
| 4216 | 4401 | (indent-to col)) | |
| 4217 | (indent-according-to-mode)))) | 4402 | (indent-according-to-mode))))) |
| 4218 | 4403 | ||
| 4219 | (defun c-context-open-line () | 4404 | (defun c-context-open-line () |
| 4220 | "Insert a line break suitable to the context and leave point before it. | 4405 | "Insert a line break suitable to the context and leave point before it. |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index df2f247f048..b4063554384 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -95,7 +95,7 @@ | |||
| 95 | 95 | ||
| 96 | ;;; Variables also used at compile time. | 96 | ;;; Variables also used at compile time. |
| 97 | 97 | ||
| 98 | (defconst c-version "5.31.3" | 98 | (defconst c-version "5.31.4" |
| 99 | "CC Mode version number.") | 99 | "CC Mode version number.") |
| 100 | 100 | ||
| 101 | (defconst c-version-sym (intern c-version)) | 101 | (defconst c-version-sym (intern c-version)) |
| @@ -764,7 +764,7 @@ be after it." | |||
| 764 | ;; call `c-beginning-of-statement-1'. | 764 | ;; call `c-beginning-of-statement-1'. |
| 765 | ;; | 765 | ;; |
| 766 | ;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing | 766 | ;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing |
| 767 | ;; scheme used by the `c-at-vsemp-p-fn', hence the name - the status is | 767 | ;; scheme used by the `c-at-vsemi-p-fn', hence the name - the status is |
| 768 | ;; "unknown" if there is no cache entry current for the line. | 768 | ;; "unknown" if there is no cache entry current for the line. |
| 769 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 769 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 770 | 770 | ||
| @@ -1620,7 +1620,7 @@ itself is evaluated." | |||
| 1620 | 1620 | ||
| 1621 | (defmacro c-lang-defconst (name &rest args) | 1621 | (defmacro c-lang-defconst (name &rest args) |
| 1622 | "Set the language specific values of the language constant NAME. | 1622 | "Set the language specific values of the language constant NAME. |
| 1623 | The second argument can be an optional docstring. The rest of the | 1623 | The second argument can optionally be a docstring. The rest of the |
| 1624 | arguments are one or more repetitions of LANG VAL where LANG specifies | 1624 | arguments are one or more repetitions of LANG VAL where LANG specifies |
| 1625 | the language(s) that VAL applies to. LANG is the name of the | 1625 | the language(s) that VAL applies to. LANG is the name of the |
| 1626 | language, i.e. the mode name without the \"-mode\" suffix, or a list | 1626 | language, i.e. the mode name without the \"-mode\" suffix, or a list |
| @@ -1717,7 +1717,7 @@ constant. A file is identified by its base name." | |||
| 1717 | ;; Emacs has a weird bug where it seems to fail to read | 1717 | ;; Emacs has a weird bug where it seems to fail to read |
| 1718 | ;; backquote lists from byte compiled files correctly (,@ | 1718 | ;; backquote lists from byte compiled files correctly (,@ |
| 1719 | ;; forms, to be specific), so make sure the bindings in the | 1719 | ;; forms, to be specific), so make sure the bindings in the |
| 1720 | ;; expansion below doesn't contain any backquote stuff. | 1720 | ;; expansion below don't contain any backquote stuff. |
| 1721 | ;; (XEmacs handles it correctly and doesn't need this for that | 1721 | ;; (XEmacs handles it correctly and doesn't need this for that |
| 1722 | ;; reason, but we also use this expansion handle | 1722 | ;; reason, but we also use this expansion handle |
| 1723 | ;; `c-lang-defconst-eval-immediately' and to register | 1723 | ;; `c-lang-defconst-eval-immediately' and to register |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 5cb00929007..bacb4670ea0 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -255,6 +255,18 @@ comment at the start of cc-engine.el for more info." | |||
| 255 | (forward-char) | 255 | (forward-char) |
| 256 | t)))) | 256 | t)))) |
| 257 | 257 | ||
| 258 | (defun c-forward-over-cpp-define-id () | ||
| 259 | ;; Assuming point is at the "#" that introduces a preprocessor | ||
| 260 | ;; directive, it's moved forward to the end of the identifier which is | ||
| 261 | ;; "#define"d (or whatever c-opt-cpp-macro-define specifies). Non-nil | ||
| 262 | ;; is returned in this case, in all other cases nil is returned and | ||
| 263 | ;; point isn't moved. | ||
| 264 | ;; | ||
| 265 | ;; This function might do hidden buffer changes. | ||
| 266 | (when (and c-opt-cpp-macro-define-id | ||
| 267 | (looking-at c-opt-cpp-macro-define-id)) | ||
| 268 | (goto-char (match-end 0)))) | ||
| 269 | |||
| 258 | (defun c-forward-to-cpp-define-body () | 270 | (defun c-forward-to-cpp-define-body () |
| 259 | ;; Assuming point is at the "#" that introduces a preprocessor | 271 | ;; Assuming point is at the "#" that introduces a preprocessor |
| 260 | ;; directive, it's moved forward to the start of the definition body | 272 | ;; directive, it's moved forward to the start of the definition body |
| @@ -2442,14 +2454,14 @@ comment at the start of cc-engine.el for more info." | |||
| 2442 | (= (c-backward-token-2 0) 0)) | 2454 | (= (c-backward-token-2 0) 0)) |
| 2443 | 2455 | ||
| 2444 | (cond ((and (looking-at c-overloadable-operators-regexp) | 2456 | (cond ((and (looking-at c-overloadable-operators-regexp) |
| 2445 | (or (not c-opt-op-identitier-prefix) | 2457 | (or (not c-opt-op-identifier-prefix) |
| 2446 | (and (= (c-backward-token-2 1) 0) | 2458 | (and (= (c-backward-token-2 1) 0) |
| 2447 | (looking-at c-opt-op-identitier-prefix)))) | 2459 | (looking-at c-opt-op-identifier-prefix)))) |
| 2448 | (point)) | 2460 | (point)) |
| 2449 | 2461 | ||
| 2450 | ((save-excursion | 2462 | ((save-excursion |
| 2451 | (and c-opt-op-identitier-prefix | 2463 | (and c-opt-op-identifier-prefix |
| 2452 | (looking-at c-opt-op-identitier-prefix) | 2464 | (looking-at c-opt-op-identifier-prefix) |
| 2453 | (= (c-forward-token-2 1) 0) | 2465 | (= (c-forward-token-2 1) 0) |
| 2454 | (looking-at c-overloadable-operators-regexp))) | 2466 | (looking-at c-overloadable-operators-regexp))) |
| 2455 | (point)))) | 2467 | (point)))) |
| @@ -3843,7 +3855,7 @@ comment at the start of cc-engine.el for more info." | |||
| 3843 | ;; good start position for the search, so do it. | 3855 | ;; good start position for the search, so do it. |
| 3844 | (c-find-decl-prefix-search))) | 3856 | (c-find-decl-prefix-search))) |
| 3845 | 3857 | ||
| 3846 | ;; Now loop. We already got the first match. | 3858 | ;; Now loop. Round what? (ACM, 2006/7/5). We already got the first match. |
| 3847 | 3859 | ||
| 3848 | (while (progn | 3860 | (while (progn |
| 3849 | (while (and | 3861 | (while (and |
| @@ -4534,41 +4546,42 @@ comment at the start of cc-engine.el for more info." | |||
| 4534 | (goto-char start) | 4546 | (goto-char start) |
| 4535 | nil) | 4547 | nil) |
| 4536 | 4548 | ||
| 4537 | (while (and | 4549 | (while (progn |
| 4538 | (c-syntactic-skip-backward "^<;{}" limit t) | 4550 | (c-syntactic-skip-backward "^<;{}" limit t) |
| 4539 | 4551 | ||
| 4540 | (if (eq (char-before) ?<) | 4552 | (and |
| 4541 | t | 4553 | (if (eq (char-before) ?<) |
| 4542 | ;; Stopped at bob or a char that isn't allowed in an | 4554 | t |
| 4543 | ;; arglist, so we've failed. | 4555 | ;; Stopped at bob or a char that isn't allowed in an |
| 4544 | (goto-char start) | 4556 | ;; arglist, so we've failed. |
| 4545 | nil) | 4557 | (goto-char start) |
| 4558 | nil) | ||
| 4546 | 4559 | ||
| 4547 | (if (> (point) | 4560 | (if (> (point) |
| 4548 | (progn (c-beginning-of-current-token) | 4561 | (progn (c-beginning-of-current-token) |
| 4549 | (point))) | 4562 | (point))) |
| 4550 | ;; If we moved then the "<" was part of some | 4563 | ;; If we moved then the "<" was part of some |
| 4551 | ;; multicharacter token. | 4564 | ;; multicharacter token. |
| 4552 | t | 4565 | t |
| 4553 | 4566 | ||
| 4554 | (backward-char) | 4567 | (backward-char) |
| 4555 | (let ((beg-pos (point))) | 4568 | (let ((beg-pos (point))) |
| 4556 | (if (c-forward-<>-arglist all-types) | 4569 | (if (c-forward-<>-arglist all-types) |
| 4557 | (cond ((= (point) start) | 4570 | (cond ((= (point) start) |
| 4558 | ;; Matched the arglist. Break the while. | 4571 | ;; Matched the arglist. Break the while. |
| 4559 | (goto-char beg-pos) | 4572 | (goto-char beg-pos) |
| 4560 | nil) | 4573 | nil) |
| 4561 | ((> (point) start) | 4574 | ((> (point) start) |
| 4562 | ;; We started from a non-paren ">" inside an | 4575 | ;; We started from a non-paren ">" inside an |
| 4563 | ;; arglist. | 4576 | ;; arglist. |
| 4564 | (goto-char start) | 4577 | (goto-char start) |
| 4565 | nil) | 4578 | nil) |
| 4566 | (t | 4579 | (t |
| 4567 | ;; Matched a shorter arglist. Can be a nested | 4580 | ;; Matched a shorter arglist. Can be a nested |
| 4568 | ;; one so continue looking. | 4581 | ;; one so continue looking. |
| 4569 | (goto-char beg-pos) | 4582 | (goto-char beg-pos) |
| 4570 | t)) | 4583 | t)) |
| 4571 | t))))) | 4584 | t)))))) |
| 4572 | 4585 | ||
| 4573 | (/= (point) start)))) | 4586 | (/= (point) start)))) |
| 4574 | 4587 | ||
| @@ -5793,17 +5806,32 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5793 | nil)))) | 5806 | nil)))) |
| 5794 | 5807 | ||
| 5795 | (defun c-forward-label (&optional assume-markup preceding-token-end limit) | 5808 | (defun c-forward-label (&optional assume-markup preceding-token-end limit) |
| 5796 | ;; Assuming the point is at the beginning of a token, check if it | 5809 | ;; Assuming that point is at the beginning of a token, check if it starts a |
| 5797 | ;; starts a label and if so move over it and return t, otherwise | 5810 | ;; label and if so move over it and return t, otherwise don't move and |
| 5798 | ;; don't move and return nil. The end of the label is taken to be | 5811 | ;; return nil. "Label" here means "most things with a colon". |
| 5799 | ;; the end of the first submatch in `c-opt-extra-label-key' if it | 5812 | ;; |
| 5800 | ;; matched, otherwise it's the colon. The point is directly after | 5813 | ;; More precisely, a "label" is regarded as one of: |
| 5801 | ;; the end on return. The terminating char is marked with | 5814 | ;; (i) a goto target like "foo:"; |
| 5802 | ;; `c-decl-end' to improve recognition of the following declaration | 5815 | ;; (ii) A case label - either the entire construct "case FOO:" or just the |
| 5803 | ;; or statement. | 5816 | ;; bare "case", should the colon be missing; |
| 5817 | ;; (iii) a keyword which needs a colon, like "default:" or "private:"; | ||
| 5818 | ;; (iv) One of QT's "extended" C++ variants of | ||
| 5819 | ;; "private:"/"protected:"/"public:"/"more:" looking like "public slots:". | ||
| 5820 | ;; (v) One of the keywords matched by `c-opt-extra-label-key' (without any | ||
| 5821 | ;; colon). Currently (2006-03), this applies only to Objective C's | ||
| 5822 | ;; keywords "@private", "@protected", and "@public". | ||
| 5823 | ;; | ||
| 5824 | ;; One of the things which will NOT be recognised as a label is a bit-field | ||
| 5825 | ;; element of a struct, something like "int foo:5". | ||
| 5826 | ;; | ||
| 5827 | ;; The end of the label is taken to be just after the colon, or the end of | ||
| 5828 | ;; the first submatch in `c-opt-extra-label-key'. The point is directly | ||
| 5829 | ;; after the end on return. The terminating char gets marked with | ||
| 5830 | ;; `c-decl-end' to improve recognition of the following declaration or | ||
| 5831 | ;; statement. | ||
| 5804 | ;; | 5832 | ;; |
| 5805 | ;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding | 5833 | ;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding |
| 5806 | ;; label, if any, has been marked up like that. | 5834 | ;; label, if any, has already been marked up like that. |
| 5807 | ;; | 5835 | ;; |
| 5808 | ;; If PRECEDING-TOKEN-END is given, it should be the first position | 5836 | ;; If PRECEDING-TOKEN-END is given, it should be the first position |
| 5809 | ;; after the preceding token, i.e. on the other side of the | 5837 | ;; after the preceding token, i.e. on the other side of the |
| @@ -5819,8 +5847,11 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5819 | ;; | 5847 | ;; |
| 5820 | ;; This function might do hidden buffer changes. | 5848 | ;; This function might do hidden buffer changes. |
| 5821 | 5849 | ||
| 5822 | (let ((start (point))) | 5850 | (let ((start (point)) |
| 5851 | qt-symbol-idx | ||
| 5852 | macro-start) ; if we're in one. | ||
| 5823 | (cond | 5853 | (cond |
| 5854 | ;; "case" or "default" (Doesn't apply to AWK). | ||
| 5824 | ((looking-at c-label-kwds-regexp) | 5855 | ((looking-at c-label-kwds-regexp) |
| 5825 | (let ((kwd-end (match-end 1))) | 5856 | (let ((kwd-end (match-end 1))) |
| 5826 | ;; Record only the keyword itself for fontification, since in | 5857 | ;; Record only the keyword itself for fontification, since in |
| @@ -5840,7 +5871,7 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5840 | (match-beginning 2)) | 5871 | (match-beginning 2)) |
| 5841 | 5872 | ||
| 5842 | (progn | 5873 | (progn |
| 5843 | (goto-char (match-beginning 2)) | 5874 | (goto-char (match-beginning 2)) ; just after the : |
| 5844 | (c-put-c-type-property (1- (point)) 'c-decl-end) | 5875 | (c-put-c-type-property (1- (point)) 'c-decl-end) |
| 5845 | t) | 5876 | t) |
| 5846 | 5877 | ||
| @@ -5851,6 +5882,7 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5851 | (goto-char kwd-end) | 5882 | (goto-char kwd-end) |
| 5852 | t))) | 5883 | t))) |
| 5853 | 5884 | ||
| 5885 | ;; @private, @protected, @public, in Objective C, or similar. | ||
| 5854 | ((and c-opt-extra-label-key | 5886 | ((and c-opt-extra-label-key |
| 5855 | (looking-at c-opt-extra-label-key)) | 5887 | (looking-at c-opt-extra-label-key)) |
| 5856 | ;; For a `c-opt-extra-label-key' match, we record the whole | 5888 | ;; For a `c-opt-extra-label-key' match, we record the whole |
| @@ -5862,7 +5894,8 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5862 | (c-put-c-type-property (1- (point)) 'c-decl-end) | 5894 | (c-put-c-type-property (1- (point)) 'c-decl-end) |
| 5863 | t) | 5895 | t) |
| 5864 | 5896 | ||
| 5865 | ((and c-recognize-colon-labels | 5897 | ;; All other cases of labels. |
| 5898 | ((and c-recognize-colon-labels ; nil for AWK and IDL, otherwise t. | ||
| 5866 | 5899 | ||
| 5867 | ;; A colon label must have something before the colon. | 5900 | ;; A colon label must have something before the colon. |
| 5868 | (not (eq (char-after) ?:)) | 5901 | (not (eq (char-after) ?:)) |
| @@ -5890,7 +5923,8 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5890 | (save-excursion | 5923 | (save-excursion |
| 5891 | (goto-char (1- preceding-token-end)) | 5924 | (goto-char (1- preceding-token-end)) |
| 5892 | (c-beginning-of-current-token) | 5925 | (c-beginning-of-current-token) |
| 5893 | (looking-at c-label-prefix-re)) | 5926 | (or (looking-at c-label-prefix-re) |
| 5927 | (looking-at c-block-stmt-1-key))) | ||
| 5894 | 5928 | ||
| 5895 | (and (eq (char-before preceding-token-end) ?\)) | 5929 | (and (eq (char-before preceding-token-end) ?\)) |
| 5896 | (c-after-conditional))) | 5930 | (c-after-conditional))) |
| @@ -5899,7 +5933,8 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5899 | (save-excursion | 5933 | (save-excursion |
| 5900 | (goto-char (1- preceding-token-end)) | 5934 | (goto-char (1- preceding-token-end)) |
| 5901 | (c-beginning-of-current-token) | 5935 | (c-beginning-of-current-token) |
| 5902 | (looking-at c-label-prefix-re)) | 5936 | (or (looking-at c-label-prefix-re) |
| 5937 | (looking-at c-block-stmt-1-key))) | ||
| 5903 | 5938 | ||
| 5904 | (cond | 5939 | (cond |
| 5905 | ((eq (char-before preceding-token-end) ?\)) | 5940 | ((eq (char-before preceding-token-end) ?\)) |
| @@ -5907,26 +5942,52 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5907 | 5942 | ||
| 5908 | ((eq (char-before preceding-token-end) ?:) | 5943 | ((eq (char-before preceding-token-end) ?:) |
| 5909 | ;; Might be after another label, so check it recursively. | 5944 | ;; Might be after another label, so check it recursively. |
| 5910 | (save-excursion | 5945 | (save-restriction |
| 5911 | (goto-char (1- preceding-token-end)) | 5946 | (save-excursion |
| 5912 | ;; Essentially the same as the | 5947 | (goto-char (1- preceding-token-end)) |
| 5913 | ;; `c-syntactic-re-search-forward' regexp below. | 5948 | ;; Essentially the same as the |
| 5914 | (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t) | 5949 | ;; `c-syntactic-re-search-forward' regexp below. |
| 5915 | (let ((pte (point)) | 5950 | (setq macro-start |
| 5916 | ;; If the caller turned on recording for us, | 5951 | (save-excursion (and (c-beginning-of-macro) |
| 5917 | ;; it shouldn't apply when we check the | 5952 | (point)))) |
| 5918 | ;; preceding label. | 5953 | (if macro-start (narrow-to-region macro-start (point-max))) |
| 5919 | c-record-type-identifiers) | 5954 | (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t) |
| 5920 | (c-forward-syntactic-ws) | 5955 | ;; Note: the following should work instead of the |
| 5921 | (c-forward-label nil pte start)))))))) | 5956 | ;; narrow-to-region above. Investigate why not, |
| 5922 | 5957 | ;; sometime. ACM, 2006-03-31. | |
| 5923 | ;; Check that the next nonsymbol token is ":". Allow '(' | 5958 | ;; (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" |
| 5924 | ;; for the sake of macro arguments. FIXME: Should build | 5959 | ;; macro-start t) |
| 5925 | ;; this regexp from the language constants. | 5960 | (let ((pte (point)) |
| 5926 | (c-syntactic-re-search-forward | 5961 | ;; If the caller turned on recording for us, |
| 5927 | "[[:?;{=*/%&|,<>!@+-]" limit t t) | 5962 | ;; it shouldn't apply when we check the |
| 5928 | (eq (char-before) ?:) | 5963 | ;; preceding label. |
| 5929 | (not (eq (char-after) ?:))) | 5964 | c-record-type-identifiers) |
| 5965 | ;; A label can't start at a cpp directive. Check for | ||
| 5966 | ;; this, since c-forward-syntactic-ws would foul up on it. | ||
| 5967 | (unless (and c-opt-cpp-prefix (looking-at c-opt-cpp-prefix)) | ||
| 5968 | (c-forward-syntactic-ws) | ||
| 5969 | (c-forward-label nil pte start)))))))))) | ||
| 5970 | |||
| 5971 | ;; Check that the next nonsymbol token is ":", or that we're in one | ||
| 5972 | ;; of QT's "slots" declarations. Allow '(' for the sake of macro | ||
| 5973 | ;; arguments. FIXME: Should build this regexp from the language | ||
| 5974 | ;; constants. | ||
| 5975 | (when (c-syntactic-re-search-forward | ||
| 5976 | "[ \t[:?;{=*/%&|,<>!@+-]" limit t t) ; not at EOB | ||
| 5977 | (backward-char) | ||
| 5978 | (setq qt-symbol-idx | ||
| 5979 | (and (c-major-mode-is 'c++-mode) | ||
| 5980 | (string-match | ||
| 5981 | "\\(p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|more\\)\\>" | ||
| 5982 | (buffer-substring start (point))))) | ||
| 5983 | (c-forward-syntactic-ws limit) | ||
| 5984 | (when (or (looking-at ":\\([^:]\\|\\'\\)") ; A single colon. | ||
| 5985 | (and qt-symbol-idx | ||
| 5986 | (search-forward-regexp "\\=slots\\>" limit t) | ||
| 5987 | (progn (c-forward-syntactic-ws limit) | ||
| 5988 | (looking-at ":\\([^:]\\|\\'\\)")))) ; A single colon | ||
| 5989 | (forward-char) ; to after the colon. | ||
| 5990 | t))) | ||
| 5930 | 5991 | ||
| 5931 | (save-restriction | 5992 | (save-restriction |
| 5932 | (narrow-to-region start (point)) | 5993 | (narrow-to-region start (point)) |
| @@ -6145,8 +6206,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6145 | ;; so that we don't get stuck on that instead of the | 6206 | ;; so that we don't get stuck on that instead of the |
| 6146 | ;; function arglist. | 6207 | ;; function arglist. |
| 6147 | (c-forward-sexp)) | 6208 | (c-forward-sexp)) |
| 6148 | ((and c-opt-op-identitier-prefix | 6209 | ((and c-opt-op-identifier-prefix |
| 6149 | (looking-at c-opt-op-identitier-prefix)) | 6210 | (looking-at c-opt-op-identifier-prefix)) |
| 6150 | ;; Don't trip up on "operator ()". | 6211 | ;; Don't trip up on "operator ()". |
| 6151 | (c-forward-token-2 2 t))) | 6212 | (c-forward-token-2 2 t))) |
| 6152 | (and (< (point) beg) | 6213 | (and (< (point) beg) |
| @@ -6263,10 +6324,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6263 | (and c-overloadable-operators-regexp | 6324 | (and c-overloadable-operators-regexp |
| 6264 | (zerop (c-backward-token-2 1 nil lim)) | 6325 | (zerop (c-backward-token-2 1 nil lim)) |
| 6265 | (looking-at c-overloadable-operators-regexp) | 6326 | (looking-at c-overloadable-operators-regexp) |
| 6266 | (or (not c-opt-op-identitier-prefix) | 6327 | (or (not c-opt-op-identifier-prefix) |
| 6267 | (and | 6328 | (and |
| 6268 | (zerop (c-backward-token-2 1 nil lim)) | 6329 | (zerop (c-backward-token-2 1 nil lim)) |
| 6269 | (looking-at c-opt-op-identitier-prefix))) | 6330 | (looking-at c-opt-op-identifier-prefix))) |
| 6270 | (point)))) | 6331 | (point)))) |
| 6271 | 6332 | ||
| 6272 | (defsubst c-backward-to-block-anchor (&optional lim) | 6333 | (defsubst c-backward-to-block-anchor (&optional lim) |
| @@ -6314,7 +6375,7 @@ comment at the start of cc-engine.el for more info." | |||
| 6314 | ;; operator token preceded by "operator". | 6375 | ;; operator token preceded by "operator". |
| 6315 | (save-excursion | 6376 | (save-excursion |
| 6316 | (and (c-safe (c-backward-sexp) t) | 6377 | (and (c-safe (c-backward-sexp) t) |
| 6317 | (looking-at c-opt-op-identitier-prefix))) | 6378 | (looking-at c-opt-op-identifier-prefix))) |
| 6318 | (and (eq (char-before) ?<) | 6379 | (and (eq (char-before) ?<) |
| 6319 | (c-with-syntax-table c++-template-syntax-table | 6380 | (c-with-syntax-table c++-template-syntax-table |
| 6320 | (if (c-safe (goto-char (c-up-list-forward (point)))) | 6381 | (if (c-safe (goto-char (c-up-list-forward (point)))) |
| @@ -6354,6 +6415,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6354 | ;; construct, i.e. if it isn't preceded by ';', '}', ':', bob, | 6415 | ;; construct, i.e. if it isn't preceded by ';', '}', ':', bob, |
| 6355 | ;; or an open paren. | 6416 | ;; or an open paren. |
| 6356 | (let ((beg (point)) tentative-move) | 6417 | (let ((beg (point)) tentative-move) |
| 6418 | ;; Go back one "statement" each time round the loop until we're just | ||
| 6419 | ;; after a ;, }, or :, or at BOB or the start of a macro or start of | ||
| 6420 | ;; an ObjC method. This will move over a multiple declaration whose | ||
| 6421 | ;; components are comma separated. | ||
| 6357 | (while (and | 6422 | (while (and |
| 6358 | ;; Must check with c-opt-method-key in ObjC mode. | 6423 | ;; Must check with c-opt-method-key in ObjC mode. |
| 6359 | (not (and c-opt-method-key | 6424 | (not (and c-opt-method-key |
| @@ -6397,25 +6462,39 @@ comment at the start of cc-engine.el for more info." | |||
| 6397 | knr-argdecl-start)) | 6462 | knr-argdecl-start)) |
| 6398 | (goto-char fallback-pos)))) | 6463 | (goto-char fallback-pos)))) |
| 6399 | 6464 | ||
| 6400 | ;; `c-beginning-of-statement-1' counts each brace block as a | 6465 | ;; `c-beginning-of-statement-1' counts each brace block as a separate |
| 6401 | ;; separate statement, so the result will be 'previous if we've | 6466 | ;; statement, so the result will be 'previous if we've moved over any. |
| 6402 | ;; moved over any. If they were brace list initializers we might | 6467 | ;; So change our result back to 'same if necessary. |
| 6403 | ;; not have moved over a declaration boundary though, so change it | 6468 | ;; |
| 6404 | ;; to 'same if we've moved past a '=' before '{', but not ';'. | 6469 | ;; If they were brace list initializers we might not have moved over a |
| 6405 | ;; (This ought to be integrated into `c-beginning-of-statement-1', | 6470 | ;; declaration boundary though, so change it to 'same if we've moved |
| 6406 | ;; so we avoid this extra pass which potentially can search over a | 6471 | ;; past a '=' before '{', but not ';'. (This ought to be integrated |
| 6407 | ;; large amount of text.) | 6472 | ;; into `c-beginning-of-statement-1', so we avoid this extra pass which |
| 6473 | ;; potentially can search over a large amount of text.). Take special | ||
| 6474 | ;; pains not to get mislead by C++'s "operator=", and the like. | ||
| 6408 | (if (and (eq move 'previous) | 6475 | (if (and (eq move 'previous) |
| 6409 | (c-with-syntax-table (if (c-major-mode-is 'c++-mode) | 6476 | (c-with-syntax-table (if (c-major-mode-is 'c++-mode) |
| 6410 | c++-template-syntax-table | 6477 | c++-template-syntax-table |
| 6411 | (syntax-table)) | 6478 | (syntax-table)) |
| 6412 | (save-excursion | 6479 | (save-excursion |
| 6413 | (and (c-syntactic-re-search-forward "[;={]" start t t t) | 6480 | (and |
| 6414 | (eq (char-before) ?=) | 6481 | (progn |
| 6415 | (c-syntactic-re-search-forward "[;{]" start t t) | 6482 | (while ; keep going back to "[;={"s until we either find |
| 6416 | (eq (char-before) ?{) | 6483 | ; no more, or get to one which isn't an "operator =" |
| 6417 | (c-safe (goto-char (c-up-list-forward (point))) t) | 6484 | (and (c-syntactic-re-search-forward "[;={]" start t t t) |
| 6418 | (not (c-syntactic-re-search-forward ";" start t t)))))) | 6485 | (eq (char-before) ?=) |
| 6486 | c-overloadable-operators-regexp | ||
| 6487 | c-opt-op-identifier-prefix | ||
| 6488 | (save-excursion | ||
| 6489 | (eq (c-backward-token-2) 0) | ||
| 6490 | (looking-at c-overloadable-operators-regexp) | ||
| 6491 | (eq (c-backward-token-2) 0) | ||
| 6492 | (looking-at c-opt-op-identifier-prefix)))) | ||
| 6493 | (eq (char-before) ?=)) | ||
| 6494 | (c-syntactic-re-search-forward "[;{]" start t t) | ||
| 6495 | (eq (char-before) ?{) | ||
| 6496 | (c-safe (goto-char (c-up-list-forward (point))) t) | ||
| 6497 | (not (c-syntactic-re-search-forward ";" start t t)))))) | ||
| 6419 | (cons 'same nil) | 6498 | (cons 'same nil) |
| 6420 | (cons move nil))))) | 6499 | (cons move nil))))) |
| 6421 | 6500 | ||
| @@ -6725,8 +6804,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6725 | (setq braceassignp | 6804 | (setq braceassignp |
| 6726 | (cond | 6805 | (cond |
| 6727 | ;; Check for operator = | 6806 | ;; Check for operator = |
| 6728 | ((and c-opt-op-identitier-prefix | 6807 | ((and c-opt-op-identifier-prefix |
| 6729 | (looking-at c-opt-op-identitier-prefix)) | 6808 | (looking-at c-opt-op-identifier-prefix)) |
| 6730 | nil) | 6809 | nil) |
| 6731 | ;; Check for `<opchar>= in Pike. | 6810 | ;; Check for `<opchar>= in Pike. |
| 6732 | ((and (c-major-mode-is 'pike-mode) | 6811 | ((and (c-major-mode-is 'pike-mode) |
| @@ -7000,6 +7079,11 @@ comment at the start of cc-engine.el for more info." | |||
| 7000 | stop-at-boi-only | 7079 | stop-at-boi-only |
| 7001 | containing-sexp | 7080 | containing-sexp |
| 7002 | paren-state) | 7081 | paren-state) |
| 7082 | ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as | ||
| 7083 | ;; needed with further syntax elements of the types `substatement', | ||
| 7084 | ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and | ||
| 7085 | ;; `defun-block-intro'. | ||
| 7086 | ;; | ||
| 7003 | ;; Do the generic processing to anchor the given syntax symbol on | 7087 | ;; Do the generic processing to anchor the given syntax symbol on |
| 7004 | ;; the preceding statement: Skip over any labels and containing | 7088 | ;; the preceding statement: Skip over any labels and containing |
| 7005 | ;; statements on the same line, and then search backward until we | 7089 | ;; statements on the same line, and then search backward until we |
| @@ -8085,7 +8169,9 @@ comment at the start of cc-engine.el for more info." | |||
| 8085 | (and (eq (char-before) ?}) | 8169 | (and (eq (char-before) ?}) |
| 8086 | (save-excursion | 8170 | (save-excursion |
| 8087 | (let ((start (point))) | 8171 | (let ((start (point))) |
| 8088 | (if c-state-cache | 8172 | (if (and c-state-cache |
| 8173 | (consp (car c-state-cache)) | ||
| 8174 | (eq (cdar c-state-cache) (point))) | ||
| 8089 | ;; Speed up the backward search a bit. | 8175 | ;; Speed up the backward search a bit. |
| 8090 | (goto-char (caar c-state-cache))) | 8176 | (goto-char (caar c-state-cache))) |
| 8091 | (c-beginning-of-decl-1 containing-sexp) | 8177 | (c-beginning-of-decl-1 containing-sexp) |
| @@ -8103,26 +8189,30 @@ comment at the start of cc-engine.el for more info." | |||
| 8103 | 8189 | ||
| 8104 | ;; CASE 5J: we are at the topmost level, make | 8190 | ;; CASE 5J: we are at the topmost level, make |
| 8105 | ;; sure we skip back past any access specifiers | 8191 | ;; sure we skip back past any access specifiers |
| 8106 | ((save-excursion | 8192 | ((and |
| 8107 | (setq placeholder (point)) | 8193 | ;; A macro continuation line is never at top level. |
| 8108 | (or (memq char-before-ip '(?\; ?{ ?} nil)) | 8194 | (not (and macro-start |
| 8109 | (c-at-vsemi-p before-ws-ip) | 8195 | (> indent-point macro-start))) |
| 8110 | (when (and (eq char-before-ip ?:) | 8196 | (save-excursion |
| 8111 | (eq (c-beginning-of-statement-1 lim) | 8197 | (setq placeholder (point)) |
| 8112 | 'label)) | 8198 | (or (memq char-before-ip '(?\; ?{ ?} nil)) |
| 8113 | (c-backward-syntactic-ws lim) | 8199 | (c-at-vsemi-p before-ws-ip) |
| 8114 | (setq placeholder (point))) | 8200 | (when (and (eq char-before-ip ?:) |
| 8115 | (and (c-major-mode-is 'objc-mode) | 8201 | (eq (c-beginning-of-statement-1 lim) |
| 8116 | (catch 'not-in-directive | 8202 | 'label)) |
| 8117 | (c-beginning-of-statement-1 lim) | 8203 | (c-backward-syntactic-ws lim) |
| 8118 | (setq placeholder (point)) | 8204 | (setq placeholder (point))) |
| 8119 | (while (and (c-forward-objc-directive) | 8205 | (and (c-major-mode-is 'objc-mode) |
| 8120 | (< (point) indent-point)) | 8206 | (catch 'not-in-directive |
| 8121 | (c-forward-syntactic-ws) | 8207 | (c-beginning-of-statement-1 lim) |
| 8122 | (if (>= (point) indent-point) | 8208 | (setq placeholder (point)) |
| 8123 | (throw 'not-in-directive t)) | 8209 | (while (and (c-forward-objc-directive) |
| 8124 | (setq placeholder (point))) | 8210 | (< (point) indent-point)) |
| 8125 | nil)))) | 8211 | (c-forward-syntactic-ws) |
| 8212 | (if (>= (point) indent-point) | ||
| 8213 | (throw 'not-in-directive t)) | ||
| 8214 | (setq placeholder (point))) | ||
| 8215 | nil))))) | ||
| 8126 | ;; For historic reasons we anchor at bol of the last | 8216 | ;; For historic reasons we anchor at bol of the last |
| 8127 | ;; line of the previous declaration. That's clearly | 8217 | ;; line of the previous declaration. That's clearly |
| 8128 | ;; highly bogus and useless, and it makes our lives hard | 8218 | ;; highly bogus and useless, and it makes our lives hard |
| @@ -8177,6 +8267,11 @@ comment at the start of cc-engine.el for more info." | |||
| 8177 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) | 8267 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) |
| 8178 | (c-add-syntax 'template-args-cont (c-point 'boi))) | 8268 | (c-add-syntax 'template-args-cont (c-point 'boi))) |
| 8179 | 8269 | ||
| 8270 | ;; CASE 5Q: we are at a statement within a macro. | ||
| 8271 | (macro-start | ||
| 8272 | (c-beginning-of-statement-1 containing-sexp) | ||
| 8273 | (c-add-stmt-syntax 'statement nil t containing-sexp paren-state)) | ||
| 8274 | |||
| 8180 | ;; CASE 5M: we are at a topmost continuation line | 8275 | ;; CASE 5M: we are at a topmost continuation line |
| 8181 | (t | 8276 | (t |
| 8182 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) | 8277 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index bd9af00d9c6..b3c0a578649 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -685,6 +685,16 @@ definition, or nil if the language doesn't have any." | |||
| 685 | (c-lang-defvar c-opt-cpp-macro-define-start | 685 | (c-lang-defvar c-opt-cpp-macro-define-start |
| 686 | (c-lang-const c-opt-cpp-macro-define-start)) | 686 | (c-lang-const c-opt-cpp-macro-define-start)) |
| 687 | 687 | ||
| 688 | (c-lang-defconst c-opt-cpp-macro-define-id | ||
| 689 | ;; Regexp matching everything up to the end of the identifier defined | ||
| 690 | ;; by a cpp define. | ||
| 691 | t (if (c-lang-const c-opt-cpp-macro-define) | ||
| 692 | (concat (c-lang-const c-opt-cpp-prefix) ; # | ||
| 693 | (c-lang-const c-opt-cpp-macro-define) ; define | ||
| 694 | "[ \t]+\\(\\sw\\|_\\)+"))) | ||
| 695 | (c-lang-defvar c-opt-cpp-macro-define-id | ||
| 696 | (c-lang-const c-opt-cpp-macro-define-id)) | ||
| 697 | |||
| 688 | (c-lang-defconst c-cpp-expr-directives | 698 | (c-lang-defconst c-cpp-expr-directives |
| 689 | "List if cpp directives (without the prefix) that are followed by an | 699 | "List if cpp directives (without the prefix) that are followed by an |
| 690 | expression." | 700 | expression." |
| @@ -882,7 +892,7 @@ since CC Mode treats every identifier as an expression." | |||
| 882 | 892 | ||
| 883 | (c-lang-defconst c-overloadable-operators | 893 | (c-lang-defconst c-overloadable-operators |
| 884 | "List of the operators that are overloadable, in their \"identifier | 894 | "List of the operators that are overloadable, in their \"identifier |
| 885 | form\". See also `c-op-identitier-prefix'." | 895 | form\". See also `c-op-identifier-prefix'." |
| 886 | t nil | 896 | t nil |
| 887 | c++ '("new" "delete" ;; Can be followed by "[]" but we ignore that. | 897 | c++ '("new" "delete" ;; Can be followed by "[]" but we ignore that. |
| 888 | "+" "-" "*" "/" "%" | 898 | "+" "-" "*" "/" "%" |
| @@ -905,7 +915,7 @@ form\". See also `c-op-identitier-prefix'." | |||
| 905 | (c-lang-defvar c-overloadable-operators-regexp | 915 | (c-lang-defvar c-overloadable-operators-regexp |
| 906 | (c-lang-const c-overloadable-operators-regexp)) | 916 | (c-lang-const c-overloadable-operators-regexp)) |
| 907 | 917 | ||
| 908 | (c-lang-defconst c-opt-op-identitier-prefix | 918 | (c-lang-defconst c-opt-op-identifier-prefix |
| 909 | "Regexp matching the token before the ones in | 919 | "Regexp matching the token before the ones in |
| 910 | `c-overloadable-operators' when operators are specified in their | 920 | `c-overloadable-operators' when operators are specified in their |
| 911 | \"identifier form\". This typically matches \"operator\" in C++ where | 921 | \"identifier form\". This typically matches \"operator\" in C++ where |
| @@ -916,8 +926,15 @@ identifier is listed in `c-overloadable-operators'. | |||
| 916 | This regexp is assumed to not match any non-operator identifier." | 926 | This regexp is assumed to not match any non-operator identifier." |
| 917 | t nil | 927 | t nil |
| 918 | c++ (c-make-keywords-re t '("operator"))) | 928 | c++ (c-make-keywords-re t '("operator"))) |
| 919 | (c-lang-defvar c-opt-op-identitier-prefix | 929 | (c-lang-defvar c-opt-op-identifier-prefix |
| 920 | (c-lang-const c-opt-op-identitier-prefix)) | 930 | (c-lang-const c-opt-op-identifier-prefix)) |
| 931 | |||
| 932 | ;; Note: the following alias is an old name which was a mis-spelling. It has | ||
| 933 | ;; been corrected above and throughout cc-engine.el. It will be removed at | ||
| 934 | ;; some release very shortly in the future. ACM, 2006-04-14. | ||
| 935 | (defalias 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix) | ||
| 936 | (make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix | ||
| 937 | "CC Mode 5.31.4, 2006-04-14") | ||
| 921 | 938 | ||
| 922 | (c-lang-defconst c-other-op-syntax-tokens | 939 | (c-lang-defconst c-other-op-syntax-tokens |
| 923 | "List of the tokens made up of characters in the punctuation or | 940 | "List of the tokens made up of characters in the punctuation or |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 40407f3819a..993fd102951 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -288,8 +288,9 @@ control). See \"cc-mode.el\" for more info." | |||
| 288 | c-mode-base-map global-map)) | 288 | c-mode-base-map global-map)) |
| 289 | 289 | ||
| 290 | ;; RMS says don't make these the default. | 290 | ;; RMS says don't make these the default. |
| 291 | ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) | 291 | ;; (April 2006): RMS has now approved these commands as defaults. |
| 292 | ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | 292 | (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) |
| 293 | (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | ||
| 293 | 294 | ||
| 294 | (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) | 295 | (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) |
| 295 | (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) | 296 | (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) |
| @@ -728,8 +729,8 @@ Note that the style variables are always made local to the buffer." | |||
| 728 | ;; We prevent this by temporarily removing `mode' from the Local Variables | 729 | ;; We prevent this by temporarily removing `mode' from the Local Variables |
| 729 | ;; section. | 730 | ;; section. |
| 730 | (if (or c-file-style c-file-offsets) | 731 | (if (or c-file-style c-file-offsets) |
| 731 | (c-tentative-buffer-changes | 732 | (let ((hack-local-variables-hook nil) (inhibit-read-only t)) |
| 732 | (let ((hack-local-variables-hook nil)) | 733 | (c-tentative-buffer-changes |
| 733 | (c-remove-any-local-eval-or-mode-variables) | 734 | (c-remove-any-local-eval-or-mode-variables) |
| 734 | (hack-local-variables)) | 735 | (hack-local-variables)) |
| 735 | nil)))) | 736 | nil)))) |
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index 81048d52072..98bc4e1f801 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -68,7 +68,10 @@ | |||
| 68 | (arglist-intro . c-lineup-arglist-intro-after-paren) | 68 | (arglist-intro . c-lineup-arglist-intro-after-paren) |
| 69 | (arglist-close . c-lineup-arglist) | 69 | (arglist-close . c-lineup-arglist) |
| 70 | (inline-open . 0) | 70 | (inline-open . 0) |
| 71 | (brace-list-open . +))) | 71 | (brace-list-open . +) |
| 72 | (topmost-intro-cont | ||
| 73 | . (first c-lineup-topmost-intro-cont | ||
| 74 | c-lineup-gnu-DEFUN-intro-cont)))) | ||
| 72 | (c-special-indent-hook . c-gnu-impose-minimum) | 75 | (c-special-indent-hook . c-gnu-impose-minimum) |
| 73 | (c-block-comment-prefix . "")) | 76 | (c-block-comment-prefix . "")) |
| 74 | 77 | ||
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 0f0da939230..2f3e83886d2 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -622,10 +622,10 @@ name: | |||
| 622 | empty-defun-braces -- Clean up empty defun braces by placing the | 622 | empty-defun-braces -- Clean up empty defun braces by placing the |
| 623 | braces on the same line. Clean up occurs when | 623 | braces on the same line. Clean up occurs when |
| 624 | the defun closing brace is typed. | 624 | the defun closing brace is typed. |
| 625 | one-liner-defun -- If the code inside a function body is a single | 625 | one-liner-defun -- If the code inside a function body can fit in |
| 626 | line then remove any newlines between that | 626 | a single line, then remove any newlines |
| 627 | line and the defun braces so that the whole | 627 | between that line and the defun braces so that |
| 628 | body becomes a single line. | 628 | the whole body becomes a single line. |
| 629 | `c-max-one-liner-length' gives the maximum | 629 | `c-max-one-liner-length' gives the maximum |
| 630 | length allowed for the resulting line. Clean | 630 | length allowed for the resulting line. Clean |
| 631 | up occurs when the closing brace is typed. | 631 | up occurs when the closing brace is typed. |
| @@ -1604,7 +1604,8 @@ statically (e.g. with `setq').") | |||
| 1604 | 1604 | ||
| 1605 | (defvar c-indentation-style nil | 1605 | (defvar c-indentation-style nil |
| 1606 | "Name of the currently installed style. | 1606 | "Name of the currently installed style. |
| 1607 | Don't change this directly; call `c-set-style' instead.") | 1607 | Don't change this directly; call `c-set-style' instead, or set the variable |
| 1608 | `c-file-style' in the file's Local Variable list.") | ||
| 1608 | 1609 | ||
| 1609 | (defvar c-current-comment-prefix nil | 1610 | (defvar c-current-comment-prefix nil |
| 1610 | "The current comment prefix regexp. | 1611 | "The current comment prefix regexp. |
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 904d8eadf05..d3e8c2eb4c3 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2007-01-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xlwmenu.c (xlwMenuResources): Add XtNleaveCallback, XtNenterCallback. | ||
| 4 | (display_menu, map_event_to_widget_value): Generate enter and | ||
| 5 | leave callbacks. | ||
| 6 | (pop_up_menu): Initialize mw->menu.inside_entry. | ||
| 7 | |||
| 8 | * xlwmenu.h (XtNleaveCallback, XtNenterCallback): New strings. | ||
| 9 | |||
| 10 | * xlwmenuP.h (_XlwMenu_part): Add enter/leave callbacks and | ||
| 11 | inside_entry. | ||
| 12 | |||
| 13 | * lwlib-Xlw.c (enter_hook, leave_hook): New functions | ||
| 14 | (xlw_create_menubar, xlw_create_popup_menu): Connect XtNenter/leave | ||
| 15 | to enter/leave_hook. | ||
| 16 | |||
| 1 | 2006-10-30 Chong Yidong <cyd@stupidchicken.com> | 17 | 2006-10-30 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 18 | ||
| 3 | * Makefile.in (lwlib-utils.o): Use CPPFLAGS. | 19 | * Makefile.in (lwlib-utils.o): Use CPPFLAGS. |
diff --git a/lwlib/lwlib-Xlw.c b/lwlib/lwlib-Xlw.c index 4799b1dbd9d..dd366e4cca1 100644 --- a/lwlib/lwlib-Xlw.c +++ b/lwlib/lwlib-Xlw.c | |||
| @@ -84,6 +84,25 @@ highlight_hook (w, client_data, call_data) | |||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static void | 86 | static void |
| 87 | enter_hook (w, client_data, call_data) | ||
| 88 | Widget w; | ||
| 89 | XtPointer client_data; | ||
| 90 | XtPointer call_data; | ||
| 91 | { | ||
| 92 | highlight_hook (w, client_data, call_data); | ||
| 93 | } | ||
| 94 | |||
| 95 | static void | ||
| 96 | leave_hook (w, client_data, call_data) | ||
| 97 | Widget w; | ||
| 98 | XtPointer client_data; | ||
| 99 | XtPointer call_data; | ||
| 100 | { | ||
| 101 | highlight_hook (w, client_data, NULL); | ||
| 102 | } | ||
| 103 | |||
| 104 | |||
| 105 | static void | ||
| 87 | pre_hook (w, client_data, call_data) | 106 | pre_hook (w, client_data, call_data) |
| 88 | Widget w; | 107 | Widget w; |
| 89 | XtPointer client_data; | 108 | XtPointer client_data; |
| @@ -152,8 +171,8 @@ xlw_create_menubar (instance) | |||
| 152 | 171 | ||
| 153 | XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance); | 172 | XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance); |
| 154 | XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); | 173 | XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); |
| 155 | XtAddCallback (widget, XtNhighlightCallback, highlight_hook, | 174 | XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance); |
| 156 | (XtPointer)instance); | 175 | XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance); |
| 157 | return widget; | 176 | return widget; |
| 158 | } | 177 | } |
| 159 | 178 | ||
| @@ -179,8 +198,8 @@ xlw_create_popup_menu (instance) | |||
| 179 | popup_shell, al, ac); | 198 | popup_shell, al, ac); |
| 180 | 199 | ||
| 181 | XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); | 200 | XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); |
| 182 | XtAddCallback (widget, XtNhighlightCallback, highlight_hook, | 201 | XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance); |
| 183 | (XtPointer)instance); | 202 | XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance); |
| 184 | 203 | ||
| 185 | return popup_shell; | 204 | return popup_shell; |
| 186 | } | 205 | } |
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 77cc50e9d7a..fc73746dc86 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c | |||
| @@ -161,6 +161,10 @@ xlwMenuResources[] = | |||
| 161 | offset(menu.select), XtRCallback, (XtPointer)NULL}, | 161 | offset(menu.select), XtRCallback, (XtPointer)NULL}, |
| 162 | {XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer), | 162 | {XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer), |
| 163 | offset(menu.highlight), XtRCallback, (XtPointer)NULL}, | 163 | offset(menu.highlight), XtRCallback, (XtPointer)NULL}, |
| 164 | {XtNenterCallback, XtCCallback, XtRCallback, sizeof(XtPointer), | ||
| 165 | offset(menu.enter), XtRCallback, (XtPointer)NULL}, | ||
| 166 | {XtNleaveCallback, XtCCallback, XtRCallback, sizeof(XtPointer), | ||
| 167 | offset(menu.leave), XtRCallback, (XtPointer)NULL}, | ||
| 164 | {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer), | 168 | {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer), |
| 165 | offset(menu.contents), XtRImmediate, (XtPointer)NULL}, | 169 | offset(menu.contents), XtRImmediate, (XtPointer)NULL}, |
| 166 | {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), | 170 | {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), |
| @@ -1186,8 +1190,17 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return, | |||
| 1186 | { | 1190 | { |
| 1187 | if (val->enabled) | 1191 | if (val->enabled) |
| 1188 | *hit_return = val; | 1192 | *hit_return = val; |
| 1189 | else | 1193 | else |
| 1190 | no_return = 1; | 1194 | no_return = 1; |
| 1195 | if (mw->menu.inside_entry != val) | ||
| 1196 | { | ||
| 1197 | if (mw->menu.inside_entry) | ||
| 1198 | XtCallCallbackList ((Widget)mw, mw->menu.leave, | ||
| 1199 | (XtPointer) mw->menu.inside_entry); | ||
| 1200 | mw->menu.inside_entry = val; | ||
| 1201 | XtCallCallbackList ((Widget)mw, mw->menu.enter, | ||
| 1202 | (XtPointer) mw->menu.inside_entry); | ||
| 1203 | } | ||
| 1191 | } | 1204 | } |
| 1192 | 1205 | ||
| 1193 | if (horizontal_p) | 1206 | if (horizontal_p) |
| @@ -1452,7 +1465,7 @@ motion_event_is_in_menu (mw, ev, level, relative_pos) | |||
| 1452 | relative_pos->x = ev->x_root - x; | 1465 | relative_pos->x = ev->x_root - x; |
| 1453 | relative_pos->y = ev->y_root - y; | 1466 | relative_pos->y = ev->y_root - y; |
| 1454 | return (x - shadow < ev->x_root && ev->x_root < x + ws->width | 1467 | return (x - shadow < ev->x_root && ev->x_root < x + ws->width |
| 1455 | && y - shadow < ev->y_root && ev->y_root < y + ws->height); | 1468 | && y - shadow < ev->y_root && ev->y_root < y + ws->height); |
| 1456 | } | 1469 | } |
| 1457 | 1470 | ||
| 1458 | static Boolean | 1471 | static Boolean |
| @@ -1465,6 +1478,7 @@ map_event_to_widget_value (mw, ev, val, level) | |||
| 1465 | int i; | 1478 | int i; |
| 1466 | XPoint relative_pos; | 1479 | XPoint relative_pos; |
| 1467 | window_state* ws; | 1480 | window_state* ws; |
| 1481 | int inside = 0; | ||
| 1468 | 1482 | ||
| 1469 | *val = NULL; | 1483 | *val = NULL; |
| 1470 | 1484 | ||
| @@ -1474,6 +1488,7 @@ map_event_to_widget_value (mw, ev, val, level) | |||
| 1474 | ws = &mw->menu.windows [i]; | 1488 | ws = &mw->menu.windows [i]; |
| 1475 | if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos)) | 1489 | if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos)) |
| 1476 | { | 1490 | { |
| 1491 | inside = 1; | ||
| 1477 | display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL); | 1492 | display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL); |
| 1478 | 1493 | ||
| 1479 | if (*val) | 1494 | if (*val) |
| @@ -1483,6 +1498,15 @@ map_event_to_widget_value (mw, ev, val, level) | |||
| 1483 | } | 1498 | } |
| 1484 | } | 1499 | } |
| 1485 | } | 1500 | } |
| 1501 | |||
| 1502 | if (!inside) | ||
| 1503 | { | ||
| 1504 | if (mw->menu.inside_entry != NULL) | ||
| 1505 | XtCallCallbackList ((Widget)mw, mw->menu.leave, | ||
| 1506 | (XtPointer) mw->menu.inside_entry); | ||
| 1507 | mw->menu.inside_entry = NULL; | ||
| 1508 | } | ||
| 1509 | |||
| 1486 | return False; | 1510 | return False; |
| 1487 | } | 1511 | } |
| 1488 | 1512 | ||
| @@ -2416,6 +2440,7 @@ pop_up_menu (mw, event) | |||
| 2416 | 2440 | ||
| 2417 | next_release_must_exit = 0; | 2441 | next_release_must_exit = 0; |
| 2418 | 2442 | ||
| 2443 | mw->menu.inside_entry = NULL; | ||
| 2419 | XtCallCallbackList ((Widget)mw, mw->menu.open, NULL); | 2444 | XtCallCallbackList ((Widget)mw, mw->menu.open, NULL); |
| 2420 | 2445 | ||
| 2421 | if (XtIsShell (XtParent ((Widget)mw))) | 2446 | if (XtIsShell (XtParent ((Widget)mw))) |
diff --git a/lwlib/xlwmenu.h b/lwlib/xlwmenu.h index fa5dc887330..9b7a6b099db 100644 --- a/lwlib/xlwmenu.h +++ b/lwlib/xlwmenu.h | |||
| @@ -44,6 +44,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 44 | #define XtNopen "open" | 44 | #define XtNopen "open" |
| 45 | #define XtNselect "select" | 45 | #define XtNselect "select" |
| 46 | #define XtNhighlightCallback "highlightCallback" | 46 | #define XtNhighlightCallback "highlightCallback" |
| 47 | #define XtNenterCallback "enterCallback" | ||
| 48 | #define XtNleaveCallback "leaveCallback" | ||
| 47 | #define XtNmenuBorderWidth "menuBorderWidth" | 49 | #define XtNmenuBorderWidth "menuBorderWidth" |
| 48 | #define XtNhorizontal "horizontal" | 50 | #define XtNhorizontal "horizontal" |
| 49 | #define XtCHorizontal "Horizontal" | 51 | #define XtCHorizontal "Horizontal" |
diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h index ce170d7bfe4..b90bc3da827 100644 --- a/lwlib/xlwmenuP.h +++ b/lwlib/xlwmenuP.h | |||
| @@ -64,6 +64,7 @@ typedef struct _XlwMenu_part | |||
| 64 | Cursor cursor_shape; | 64 | Cursor cursor_shape; |
| 65 | XtCallbackList open; | 65 | XtCallbackList open; |
| 66 | XtCallbackList select, highlight; | 66 | XtCallbackList select, highlight; |
| 67 | XtCallbackList enter, leave; | ||
| 67 | widget_value* contents; | 68 | widget_value* contents; |
| 68 | int horizontal; | 69 | int horizontal; |
| 69 | 70 | ||
| @@ -76,6 +77,7 @@ typedef struct _XlwMenu_part | |||
| 76 | int old_depth; | 77 | int old_depth; |
| 77 | widget_value** old_stack; | 78 | widget_value** old_stack; |
| 78 | int old_stack_length; | 79 | int old_stack_length; |
| 80 | widget_value* inside_entry; | ||
| 79 | 81 | ||
| 80 | /* New state after the user moved */ | 82 | /* New state after the user moved */ |
| 81 | int new_depth; | 83 | int new_depth; |
diff --git a/man/ChangeLog b/man/ChangeLog index 3e6fb6d8164..34c900ed619 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,6 +1,47 @@ | |||
| 1 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | * cc-mode.texi ("Limitations and Known Bugs"): Document problems with | ||
| 4 | eval-after-load in Emacs <=21 and a workaround. Document that | ||
| 5 | trigraphs are not supported. | ||
| 6 | |||
| 7 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 8 | |||
| 9 | * cc-mode.texi ("Filling and Breaking"): Amend the doc for | ||
| 10 | c-context-line-break. When invoked within a string, preserve | ||
| 11 | whitespace. Add a backslash only when also in a macro. | ||
| 12 | |||
| 13 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 14 | |||
| 15 | * cc-mode.texi ("Choosing a Style"): Mention c-file-style. | ||
| 16 | |||
| 17 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 18 | |||
| 19 | * cc-mode.texi ("Movement Commands", "Sample .emacs File"): C-M-[ae] | ||
| 20 | are now bound by default to c-\(beginning\|end\)-of-defun by default. | ||
| 21 | |||
| 22 | 2007-01-01 Alan Mackenzie <acm@muc.de> | ||
| 23 | |||
| 24 | * cc-mode.texi ("Other Commands"): Move c-set-style (C-c .) here from | ||
| 25 | "Choosing a Style". | ||
| 26 | |||
| 27 | * cc-mode.texi ("Styles"): Add @dfn{style}. | ||
| 28 | |||
| 29 | 2007-01-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 30 | |||
| 31 | * xresources.texi (Table of Resources): Add scrollBarWidth resource. | ||
| 32 | |||
| 33 | 2007-01-01 Richard Stallman <rms@gnu.org> | ||
| 34 | |||
| 35 | * commands.texi (User Input): Document keys stolen by window mangers. | ||
| 36 | |||
| 37 | 2006-12-31 Richard Stallman <rms@gnu.org> | ||
| 38 | |||
| 39 | * custom.texi (Specific Customization): Document customize-option | ||
| 40 | instead of customize-variable. | ||
| 41 | |||
| 1 | 2006-12-31 Kim F. Storm <storm@cua.dk> | 42 | 2006-12-31 Kim F. Storm <storm@cua.dk> |
| 2 | 43 | ||
| 3 | * major.texi (Choosing Modes): Document auto-mode-case-fond. | 44 | * major.texi (Choosing Modes): Document auto-mode-case-fold. |
| 4 | 45 | ||
| 5 | 2006-12-30 Kim F. Storm <storm@cua.dk> | 46 | 2006-12-30 Kim F. Storm <storm@cua.dk> |
| 6 | 47 | ||
diff --git a/man/cc-mode.texi b/man/cc-mode.texi index 801f098b9ce..e9a7d46d7fe 100644 --- a/man/cc-mode.texi +++ b/man/cc-mode.texi | |||
| @@ -486,7 +486,7 @@ work just fine right out of the box. Note however that you might not | |||
| 486 | have the latest @ccmode{} release and might want to upgrade your copy | 486 | have the latest @ccmode{} release and might want to upgrade your copy |
| 487 | (see below). | 487 | (see below). |
| 488 | 488 | ||
| 489 | You should probably start by reading the entire chapter | 489 | You should probably start by skimming through the entire chapter |
| 490 | @ref{Commands} to get an overview of @ccmode{}'s capabilities. | 490 | @ref{Commands} to get an overview of @ccmode{}'s capabilities. |
| 491 | 491 | ||
| 492 | After trying out some commands, you may dislike some aspects of | 492 | After trying out some commands, you may dislike some aspects of |
| @@ -687,7 +687,7 @@ that begins at the line's left margin. | |||
| 687 | @item | 687 | @item |
| 688 | When it's @code{nil}, the command indents the line by an extra | 688 | When it's @code{nil}, the command indents the line by an extra |
| 689 | @code{c-basic-offset} columns. A prefix argument acts as a | 689 | @code{c-basic-offset} columns. A prefix argument acts as a |
| 690 | multiplier. A bare prefix (@kbd{C-u @key{TAB}} is equivalent to -1, | 690 | multiplier. A bare prefix (@kbd{C-u @key{TAB}}) is equivalent to -1, |
| 691 | removing @code{c-basic-offset} columns from the indentation. | 691 | removing @code{c-basic-offset} columns from the indentation. |
| 692 | @end itemize | 692 | @end itemize |
| 693 | 693 | ||
| @@ -880,30 +880,29 @@ lines. | |||
| 880 | @ccmode{} contains some useful commands for moving around in C code. | 880 | @ccmode{} contains some useful commands for moving around in C code. |
| 881 | 881 | ||
| 882 | @table @asis | 882 | @table @asis |
| 883 | @item @kbd{M-x c-beginning-of-defun} | 883 | @item @kbd{C-M-a} |
| 884 | @itemx @kbd{M-x c-end-of-defun} | 884 | @itemx @kbd{C-M-e} |
| 885 | @findex c-beginning-of-defun | 885 | @findex c-beginning-of-defun |
| 886 | @findex c-end-of-defun | 886 | @findex c-end-of-defun |
| 887 | @findex beginning-of-defun (c-) | 887 | |
| 888 | @findex end-of-defun (c-) | 888 | Move to the beginning or end of the current or next function. Other |
| 889 | @findex beginning-of-defun | 889 | constructs (such as a structs or classes) which have a brace block |
| 890 | @findex end-of-defun | 890 | also count as ``functions'' here. To move over several functions, you |
| 891 | Move to the start or end of the current top-level definition. This is | 891 | can give these commands a repeat count. |
| 892 | the outermost brace pair which encloses point, together with the | 892 | |
| 893 | function header or similar preamble which precedes the opening brace. | 893 | The start of a function is at its header. The end of the function is |
| 894 | after its closing brace, or after the semicolon of a construct (such | ||
| 895 | as a @code{struct}) which doesn't end at the brace. These two | ||
| 896 | commands try to leave point at the beginning of a line near the actual | ||
| 897 | start or end of the function. This occasionally causes point not to | ||
| 898 | move at all. | ||
| 899 | |||
| 894 | These functions are analogous to the Emacs built-in commands | 900 | These functions are analogous to the Emacs built-in commands |
| 895 | @code{beginning-of-defun} and @code{end-of-defun}, except they | 901 | @code{beginning-of-defun} and @code{end-of-defun}, except they |
| 896 | eliminate the constraint that the top-level opening brace of the defun | 902 | eliminate the constraint that the top-level opening brace of the defun |
| 897 | must be in column zero. See @ref{Defuns,,,@emacsman{}, | 903 | must be in column zero. See @ref{Defuns,,,@emacsman{}, |
| 898 | @emacsmantitle{}}, for more information. | 904 | @emacsmantitle{}}, for more information. |
| 899 | 905 | ||
| 900 | Depending on the coding style you're using, you might prefer these two | ||
| 901 | commands to the standard Emacs ones. If so, consider binding them to | ||
| 902 | @kbd{C-M-a} and @kbd{C-M-e}. @xref{Sample .emacs File}. This | ||
| 903 | customization won't affect the special bindings for these key | ||
| 904 | sequences in force in AWK Mode. For backwards compatibility reasons, | ||
| 905 | the default bindings for @kbd{C-M-a} and @kbd{C-M-e} remain in effect. | ||
| 906 | |||
| 907 | @item @kbd{C-M-a} (AWK Mode) (@code{c-awk-beginning-of-defun}) | 906 | @item @kbd{C-M-a} (AWK Mode) (@code{c-awk-beginning-of-defun}) |
| 908 | @itemx @kbd{C-M-e} (AWK Mode) (@code{c-awk-end-of-defun}) | 907 | @itemx @kbd{C-M-e} (AWK Mode) (@code{c-awk-end-of-defun}) |
| 909 | @kindex C-M-a (AWK Mode) | 908 | @kindex C-M-a (AWK Mode) |
| @@ -912,11 +911,9 @@ the default bindings for @kbd{C-M-a} and @kbd{C-M-e} remain in effect. | |||
| 912 | @findex awk-beginning-of-defun (c-) | 911 | @findex awk-beginning-of-defun (c-) |
| 913 | @findex c-awk-end-of-defun | 912 | @findex c-awk-end-of-defun |
| 914 | @findex awk-end-of-defun (c-) | 913 | @findex awk-end-of-defun (c-) |
| 915 | Move back to the beginning or forward to the end of the current AWK | 914 | Move to the beginning or end of the current or next AWK defun. These |
| 916 | defun. These functions are bound to @kbd{C-M-a} and @kbd{C-M-e} by | 915 | commands can take prefix-arguments, their functionality being entirely |
| 917 | default in AWK Mode. They can take prefix-arguments, their | 916 | equivalent to @code{beginning-of-defun} and @code{end-of-defun}. |
| 918 | functionality being entirely equivalent to @code{beginning-of-defun} | ||
| 919 | and @code{end-of-defun}. | ||
| 920 | 917 | ||
| 921 | AWK Mode @dfn{defuns} are either pattern/action pairs (either of which | 918 | AWK Mode @dfn{defuns} are either pattern/action pairs (either of which |
| 922 | might be implicit) or user defined functions. Having the @samp{@{} and | 919 | might be implicit) or user defined functions. Having the @samp{@{} and |
| @@ -1094,7 +1091,10 @@ prefix like @code{c-indent-new-comment-line}. In normal code it's | |||
| 1094 | indented like @code{newline-and-indent} would do. In macros it acts | 1091 | indented like @code{newline-and-indent} would do. In macros it acts |
| 1095 | like @code{newline-and-indent} but additionally inserts and optionally | 1092 | like @code{newline-and-indent} but additionally inserts and optionally |
| 1096 | aligns the line ending backslash so that the macro remains unbroken. | 1093 | aligns the line ending backslash so that the macro remains unbroken. |
| 1097 | @xref{Custom Macros}, for details about the backslash alignment. | 1094 | @xref{Custom Macros}, for details about the backslash alignment. In a |
| 1095 | string, a backslash is inserted only if the string is within a | ||
| 1096 | macro@footnote{In GCC, unescaped line breaks within strings are | ||
| 1097 | valid.}. | ||
| 1098 | 1098 | ||
| 1099 | This function is not bound to a key by default, but it's intended to be | 1099 | This function is not bound to a key by default, but it's intended to be |
| 1100 | used on the @kbd{RET} key. If you like the behavior of | 1100 | used on the @kbd{RET} key. If you like the behavior of |
| @@ -1710,6 +1710,25 @@ buffers by typing @kbd{M-x c-subword-mode}. | |||
| 1710 | Here are the various other commands that didn't fit anywhere else: | 1710 | Here are the various other commands that didn't fit anywhere else: |
| 1711 | 1711 | ||
| 1712 | @table @asis | 1712 | @table @asis |
| 1713 | @item @kbd{C-c .} (@code{c-set-style}) | ||
| 1714 | @kindex C-c . | ||
| 1715 | @findex c-set-style | ||
| 1716 | @findex set-style (c-) | ||
| 1717 | Switch to the specified style in the current buffer. Use like this: | ||
| 1718 | |||
| 1719 | @example | ||
| 1720 | @kbd{C-c . @var{style-name} @key{RET}} | ||
| 1721 | @end example | ||
| 1722 | |||
| 1723 | You can use the @key{TAB} in the normal way to do completion on the | ||
| 1724 | style name. Note that all style names are case insensitive, even the | ||
| 1725 | ones you define yourself. | ||
| 1726 | |||
| 1727 | Setting a style in this way does @emph{not} automatically reindent your | ||
| 1728 | file. For commands that you can use to view the effect of your changes, | ||
| 1729 | see @ref{Indentation Commands} and @ref{Filling and Breaking}. | ||
| 1730 | |||
| 1731 | For details of the @ccmode{} style system, see @ref{Styles}. | ||
| 1713 | @item @kbd{C-c :} (@code{c-scope-operator}) | 1732 | @item @kbd{C-c :} (@code{c-scope-operator}) |
| 1714 | @kindex C-c : | 1733 | @kindex C-c : |
| 1715 | @findex c-scope-operator | 1734 | @findex c-scope-operator |
| @@ -2363,7 +2382,7 @@ last thing when you enter that language mode. | |||
| 2363 | @end defvar | 2382 | @end defvar |
| 2364 | 2383 | ||
| 2365 | Although these hooks are variables defined in @ccmode{}, you can give | 2384 | Although these hooks are variables defined in @ccmode{}, you can give |
| 2366 | them values before @ccmode{}'s code is loaded - indeed, this is the | 2385 | them values before @ccmode{}'s code is loaded---indeed, this is the |
| 2367 | only way to use @code{c-initialization-hook}. Their values aren't | 2386 | only way to use @code{c-initialization-hook}. Their values aren't |
| 2368 | overwritten when @ccmode{} gets loaded. | 2387 | overwritten when @ccmode{} gets loaded. |
| 2369 | 2388 | ||
| @@ -2476,6 +2495,11 @@ Commas});@* | |||
| 2476 | @cindex styles | 2495 | @cindex styles |
| 2477 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 2496 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 2478 | 2497 | ||
| 2498 | By @dfn{style} we mean the layout of the code---things like how many | ||
| 2499 | columns to indent a block of code, whether an opening brace gets | ||
| 2500 | indented to the level of the code it encloses, or of the construct | ||
| 2501 | that introduces it, or ``hangs'' at the end of a line. | ||
| 2502 | |||
| 2479 | Most people only need to edit code formatted in just a few well-defined | 2503 | Most people only need to edit code formatted in just a few well-defined |
| 2480 | and consistent styles. For example, their organization might impose a | 2504 | and consistent styles. For example, their organization might impose a |
| 2481 | ``blessed'' style that all its programmers must conform to. Similarly, | 2505 | ``blessed'' style that all its programmers must conform to. Similarly, |
| @@ -2577,35 +2601,19 @@ afterwards. | |||
| 2577 | @subsection Choosing a Style | 2601 | @subsection Choosing a Style |
| 2578 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 2602 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 2579 | 2603 | ||
| 2580 | Use @kbd{C-c .} to choose a style interactively: | 2604 | When you create a new buffer, its style will be set from |
| 2581 | 2605 | @code{c-default-style}. The factory default is the style @code{gnu}, | |
| 2582 | @deffn Command c-set-style style-name | 2606 | except in Java and AWK modes where it's @code{java} and @code{awk}. |
| 2583 | @findex set-style (c-) | ||
| 2584 | @kindex C-c . | ||
| 2585 | Switch to the specified style in the current buffer. Use | ||
| 2586 | interactively like this: | ||
| 2587 | |||
| 2588 | @example | ||
| 2589 | @kbd{C-c . @var{style-name} @key{RET}} | ||
| 2590 | @end example | ||
| 2591 | |||
| 2592 | You can use the @key{TAB} in the normal way to do completion on the | ||
| 2593 | style name. Note that all style names are case insensitive, even the | ||
| 2594 | ones you define yourself. | ||
| 2595 | |||
| 2596 | Setting a style in this way does @emph{not} automatically reindent your | ||
| 2597 | file. For commands that you can use to view the effect of your changes, | ||
| 2598 | see @ref{Indentation Commands} and @ref{Filling and Breaking}. | ||
| 2599 | @end deffn | ||
| 2600 | |||
| 2601 | The default style in all newly created buffers is @code{gnu}, except | ||
| 2602 | in Java and AWK modes where it's @code{java} and @code{awk}. | ||
| 2603 | 2607 | ||
| 2604 | Remember that if you set a style variable with the Customization | 2608 | Remember that if you set a style variable with the Customization |
| 2605 | interface or at the top level of your @file{.emacs} file before the | 2609 | interface or at the top level of your @file{.emacs} file before the |
| 2606 | style system is initialised (@pxref{Config Basics}), this setting will | 2610 | style system is initialised (@pxref{Config Basics}), this setting will |
| 2607 | override the one that the style system would have given the variable. | 2611 | override the one that the style system would have given the variable. |
| 2608 | 2612 | ||
| 2613 | To set a buffer's style interactively, use the command @kbd{C-c .} | ||
| 2614 | (@pxref{Other Commands}). To set it from a file's local variable | ||
| 2615 | list, @ref{File Styles}. | ||
| 2616 | |||
| 2609 | @defopt c-default-style | 2617 | @defopt c-default-style |
| 2610 | @vindex default-style (c-) | 2618 | @vindex default-style (c-) |
| 2611 | This variable specifies which style to install by default in new | 2619 | This variable specifies which style to install by default in new |
| @@ -3247,8 +3255,8 @@ the proper functioning of @ccmode{}. | |||
| 3247 | 3255 | ||
| 3248 | This variable is also bound in three other circumstances: | 3256 | This variable is also bound in three other circumstances: |
| 3249 | (i)@w{ }when calling a c-hanging-semi&comma-criteria function | 3257 | (i)@w{ }when calling a c-hanging-semi&comma-criteria function |
| 3250 | (@pxref{Hanging Semicolons and Commas}; (ii)@w{ }when calling a | 3258 | (@pxref{Hanging Semicolons and Commas}); (ii)@w{ }when calling a |
| 3251 | line-up function (@pxref{Custom Line-Up}; (iii)@w{ }when calling a | 3259 | line-up function (@pxref{Custom Line-Up}); (iii)@w{ }when calling a |
| 3252 | c-special-indent-hook function (@pxref{Other Indentation}). | 3260 | c-special-indent-hook function (@pxref{Other Indentation}). |
| 3253 | @end defvar | 3261 | @end defvar |
| 3254 | 3262 | ||
| @@ -3430,7 +3438,11 @@ newlines after semicolons inside one-line inline method definitions | |||
| 3430 | @dfn{Clean-ups} are mechanisms which remove (or exceptionally, add) | 3438 | @dfn{Clean-ups} are mechanisms which remove (or exceptionally, add) |
| 3431 | whitespace in specific circumstances and are complementary to colon | 3439 | whitespace in specific circumstances and are complementary to colon |
| 3432 | and brace hanging. You enable a clean-up by adding its symbol into | 3440 | and brace hanging. You enable a clean-up by adding its symbol into |
| 3433 | @code{c-cleanup-list}. | 3441 | @code{c-cleanup-list}, e.g. like this: |
| 3442 | |||
| 3443 | @example | ||
| 3444 | (add-to-list 'c-cleanup-list 'space-before-funcall) | ||
| 3445 | @end example | ||
| 3434 | 3446 | ||
| 3435 | On the surface, it would seem that clean-ups overlap the functionality | 3447 | On the surface, it would seem that clean-ups overlap the functionality |
| 3436 | provided by the @code{c-hanging-*-alist} variables. Clean-ups, | 3448 | provided by the @code{c-hanging-*-alist} variables. Clean-ups, |
| @@ -3661,10 +3673,11 @@ it's only an empty parenthesis pair. I.e. you will get @samp{signal | |||
| 3661 | closing parenthesis is typed. | 3673 | closing parenthesis is typed. |
| 3662 | 3674 | ||
| 3663 | @item comment-close-slash | 3675 | @item comment-close-slash |
| 3664 | When inside a block comment, terminate the comment when you type a | 3676 | When inside a block comment, terminate the comment when you type a slash |
| 3665 | slash at the beginning of a line (i.e. immediately after the comment | 3677 | at the beginning of a line (i.e. immediately after the comment prefix). |
| 3666 | prefix). This clean-up removes whitespace preceding the slash and if | 3678 | This clean-up removes whitespace preceding the slash and if needed, |
| 3667 | needed, inserts a star to complete the token @samp{*/}. | 3679 | inserts a star to complete the token @samp{*/}. Type @kbd{C-q /} in this |
| 3680 | situation if you just want a literal @samp{/} inserted. | ||
| 3668 | @end table | 3681 | @end table |
| 3669 | 3682 | ||
| 3670 | 3683 | ||
| @@ -5182,7 +5195,7 @@ If an offset specification evaluates to @code{nil}, then a relative | |||
| 5182 | offset of 0 (zero) is used@footnote{There is however a variable | 5195 | offset of 0 (zero) is used@footnote{There is however a variable |
| 5183 | @code{c-strict-syntax-p} that when set to non-@code{nil} will cause an | 5196 | @code{c-strict-syntax-p} that when set to non-@code{nil} will cause an |
| 5184 | error to be signaled in that case. It's now considered obsolete since | 5197 | error to be signaled in that case. It's now considered obsolete since |
| 5185 | it doesn't work well with some of the alignment functions that returns | 5198 | it doesn't work well with some of the alignment functions that return |
| 5186 | @code{nil} instead of zero. You should therefore leave | 5199 | @code{nil} instead of zero. You should therefore leave |
| 5187 | @code{c-strict-syntax-p} set to @code{nil}.}. | 5200 | @code{c-strict-syntax-p} set to @code{nil}.}. |
| 5188 | 5201 | ||
| @@ -6549,18 +6562,16 @@ anchoring position to indent the line in that case. | |||
| 6549 | @appendix Sample .emacs File | 6562 | @appendix Sample .emacs File |
| 6550 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 6563 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 6551 | 6564 | ||
| 6552 | @verbatim | 6565 | Here's a sample .emacs file fragment that might help you along the way. |
| 6553 | ;; Here's a sample .emacs file fragment that might help you along the | 6566 | Just copy this region and paste it into your .emacs file. You might want |
| 6554 | ;; way. Just copy this region and paste it into your .emacs file. | 6567 | to change some of the actual values. |
| 6555 | ;; You might want to change some of the actual values. | ||
| 6556 | 6568 | ||
| 6557 | ;; Make some non-standard key bindings. We can put these in | 6569 | @verbatim |
| 6570 | ;; Make a non-standard key binding. We can put this in | ||
| 6558 | ;; c-mode-base-map because c-mode-map, c++-mode-map, and so on, | 6571 | ;; c-mode-base-map because c-mode-map, c++-mode-map, and so on, |
| 6559 | ;; inherit from it. | 6572 | ;; inherit from it. |
| 6560 | (defun my-c-initialization-hook () | 6573 | (defun my-c-initialization-hook () |
| 6561 | (define-key c-mode-base-map "\C-m" 'c-context-line-break) | 6574 | (define-key c-mode-base-map "\C-m" 'c-context-line-break)) |
| 6562 | (define-key c-mode-base-map [?\C-\M-a] 'c-beginning-of-defun) | ||
| 6563 | (define-key c-mode-base-map [?\C-\M-e] 'c-end-of-defun)) | ||
| 6564 | (add-hook 'c-initialization-hook 'my-c-initialization-hook) | 6575 | (add-hook 'c-initialization-hook 'my-c-initialization-hook) |
| 6565 | 6576 | ||
| 6566 | ;; offset customizations not in my-c-style | 6577 | ;; offset customizations not in my-c-style |
| @@ -6647,9 +6658,6 @@ embodied in the @code{beginning-of-defun} function. @ccmode now | |||
| 6647 | caches syntactic information much better, so that the delay caused by | 6658 | caches syntactic information much better, so that the delay caused by |
| 6648 | searching for such a brace when it's not in column 0 is minimal, | 6659 | searching for such a brace when it's not in column 0 is minimal, |
| 6649 | except perhaps when you've just moved a long way inside the file. | 6660 | except perhaps when you've just moved a long way inside the file. |
| 6650 | Don't forget to rebind @kbd{C-M-a} and @kbd{C-M-e} to the @ccmode{} | ||
| 6651 | functions @code{beginning-of-defun} and @code{end-of-defun} if you're | ||
| 6652 | going to be hanging your braces! @xref{Sample .emacs File}. | ||
| 6653 | 6661 | ||
| 6654 | @findex defun-prompt-regexp | 6662 | @findex defun-prompt-regexp |
| 6655 | @vindex c-Java-defun-prompt-regexp | 6663 | @vindex c-Java-defun-prompt-regexp |
| @@ -6726,6 +6734,12 @@ more info. | |||
| 6726 | 6734 | ||
| 6727 | @itemize @bullet | 6735 | @itemize @bullet |
| 6728 | @item | 6736 | @item |
| 6737 | @ccmode{} doesn't support trigraphs. (These are character sequences | ||
| 6738 | such as @samp{??(}, which represents @samp{[}. They date from a time | ||
| 6739 | when some character sets didn't have all the characters that C needs, | ||
| 6740 | and are now utterly obsolete.) | ||
| 6741 | |||
| 6742 | @item | ||
| 6729 | There is no way to apply auto newline settings (@pxref{Auto-newlines}) | 6743 | There is no way to apply auto newline settings (@pxref{Auto-newlines}) |
| 6730 | on already typed lines. That's only a feature to ease interactive | 6744 | on already typed lines. That's only a feature to ease interactive |
| 6731 | editing. | 6745 | editing. |
| @@ -6747,6 +6761,25 @@ When a non-nested template is used in a declaration, @ccmode{} indents | |||
| 6747 | it and font-locks it OK. Templates used in expressions, and nested | 6761 | it and font-locks it OK. Templates used in expressions, and nested |
| 6748 | templates do not fare so well. Sometimes a workaround is to refontify | 6762 | templates do not fare so well. Sometimes a workaround is to refontify |
| 6749 | the expression after typing the closing @samp{>}. | 6763 | the expression after typing the closing @samp{>}. |
| 6764 | |||
| 6765 | @item | ||
| 6766 | On loading @ccmode{}, sometimes this error message appears: | ||
| 6767 | |||
| 6768 | @example | ||
| 6769 | File mode specification error: (void-variable c-font-lock-keywords-3) | ||
| 6770 | @end example | ||
| 6771 | |||
| 6772 | This is due to a bug in the function @code{eval-after-load} in some | ||
| 6773 | versions of (X)Emacs. It can manifest itself when there is a symbolic | ||
| 6774 | link in the path of the directory which contains (X)Emacs. As a | ||
| 6775 | workaround, put the following into your @file{.emacs} file, fairly | ||
| 6776 | early on: | ||
| 6777 | |||
| 6778 | @example | ||
| 6779 | (defun my-load-cc-fonts () | ||
| 6780 | (require "cc-fonts")) | ||
| 6781 | (add-hook 'c-initialization-hook 'my-load-cc-fonts) | ||
| 6782 | @end example | ||
| 6750 | @end itemize | 6783 | @end itemize |
| 6751 | 6784 | ||
| 6752 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 6785 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
diff --git a/man/commands.texi b/man/commands.texi index dd518252f24..1f67a671fbe 100644 --- a/man/commands.texi +++ b/man/commands.texi | |||
| @@ -134,6 +134,15 @@ because the keyboard input routines catch these special sequences | |||
| 134 | and convert them to function key events before any other part of Emacs | 134 | and convert them to function key events before any other part of Emacs |
| 135 | gets to see them. | 135 | gets to see them. |
| 136 | 136 | ||
| 137 | @cindex keys stolen by window manager | ||
| 138 | @cindex window manager, keys stolen by | ||
| 139 | On graphical displays, the window manager is likely to block the | ||
| 140 | character @kbd{Meta-@key{TAB}} before Emacs can see it. It may also | ||
| 141 | block @kbd{Meta-@key{SPC}}, @kbd{C-M-d} and @kbd{C-M-l}. If you have | ||
| 142 | these problems, we recommend that you customize your window manager to | ||
| 143 | turn off those commands, or put them on key combinations that Emacs | ||
| 144 | does not use. | ||
| 145 | |||
| 137 | @node Keys, Commands, User Input, Top | 146 | @node Keys, Commands, User Input, Top |
| 138 | @section Keys | 147 | @section Keys |
| 139 | 148 | ||
diff --git a/man/custom.texi b/man/custom.texi index d20558dd06b..49c7e6215ea 100644 --- a/man/custom.texi +++ b/man/custom.texi | |||
| @@ -625,8 +625,9 @@ structure of groups, here are other ways to specify the settings that | |||
| 625 | you want to customize. | 625 | you want to customize. |
| 626 | 626 | ||
| 627 | @table @kbd | 627 | @table @kbd |
| 628 | @item M-x customize-variable @key{RET} @var{variable} @key{RET} | 628 | @item M-x customize-option @key{RET} @var{option} @key{RET} |
| 629 | Set up a customization buffer with just one variable, @var{variable}. | 629 | Set up a customization buffer with just one user option variable, |
| 630 | @var{option}. | ||
| 630 | @item M-x customize-face @key{RET} @var{face} @key{RET} | 631 | @item M-x customize-face @key{RET} @var{face} @key{RET} |
| 631 | Set up a customization buffer with just one face, @var{face}. | 632 | Set up a customization buffer with just one face, @var{face}. |
| 632 | @item M-x customize-group @key{RET} @var{group} @key{RET} | 633 | @item M-x customize-group @key{RET} @var{group} @key{RET} |
| @@ -634,7 +635,7 @@ Set up a customization buffer with just one group, @var{group}. | |||
| 634 | @item M-x customize-apropos @key{RET} @var{regexp} @key{RET} | 635 | @item M-x customize-apropos @key{RET} @var{regexp} @key{RET} |
| 635 | Set up a customization buffer with all the settings and groups that | 636 | Set up a customization buffer with all the settings and groups that |
| 636 | match @var{regexp}. | 637 | match @var{regexp}. |
| 637 | @item M-x customize-changed-options @key{RET} @var{version} @key{RET} | 638 | @item M-x customize-changed @key{RET} @var{version} @key{RET} |
| 638 | Set up a customization buffer with all the settings and groups | 639 | Set up a customization buffer with all the settings and groups |
| 639 | whose meaning has changed since Emacs version @var{version}. | 640 | whose meaning has changed since Emacs version @var{version}. |
| 640 | @item M-x customize-saved | 641 | @item M-x customize-saved |
| @@ -645,15 +646,16 @@ Set up a customization buffer containing all settings that you have | |||
| 645 | customized but not saved. | 646 | customized but not saved. |
| 646 | @end table | 647 | @end table |
| 647 | 648 | ||
| 648 | @findex customize-variable | 649 | @findex customize-option |
| 649 | If you want to alter a particular variable with the customization | 650 | If you want to alter a particular user option with the customization |
| 650 | buffer, and you know its name, you can use the command @kbd{M-x | 651 | buffer, and you know its name, you can use the command @kbd{M-x |
| 651 | customize-variable} and specify the variable name. This sets up the | 652 | customize-option} and specify the user option (variable) name. This |
| 652 | customization buffer with just one variable---the one that you asked | 653 | sets up the customization buffer with just one user option---the one |
| 653 | for. Editing, setting and saving the value work as described above, | 654 | that you asked for. Editing, setting and saving the value work as |
| 654 | but only for the specified variable. Minibuffer completion is handy | 655 | described above, but only for the specified user option. Minibuffer |
| 655 | if you only know part of the name. However, this command can only see | 656 | completion is handy if you only know part of the name. However, this |
| 656 | options that have been loaded in the current Emacs session. | 657 | command can only see options that have been loaded in the current |
| 658 | Emacs session. | ||
| 657 | 659 | ||
| 658 | @findex customize-face | 660 | @findex customize-face |
| 659 | Likewise, you can modify a specific face, chosen by name, using | 661 | Likewise, you can modify a specific face, chosen by name, using |
| @@ -663,9 +665,9 @@ on the character after point. | |||
| 663 | @findex customize-group | 665 | @findex customize-group |
| 664 | You can also set up the customization buffer with a specific group, | 666 | You can also set up the customization buffer with a specific group, |
| 665 | using @kbd{M-x customize-group}. The immediate contents of the chosen | 667 | using @kbd{M-x customize-group}. The immediate contents of the chosen |
| 666 | group, including settings (variables and faces), and other groups, all | 668 | group, including settings (user options and faces), and other groups, |
| 667 | appear as well (even if not already loaded). However, the subgroups' | 669 | all appear as well (even if not already loaded). However, the |
| 668 | own contents are not included. | 670 | subgroups' own contents are not included. |
| 669 | 671 | ||
| 670 | @findex customize-apropos | 672 | @findex customize-apropos |
| 671 | For a more general way of controlling what to customize, you can use | 673 | For a more general way of controlling what to customize, you can use |
diff --git a/man/xresources.texi b/man/xresources.texi index 142b1bc70a0..3fec4200863 100644 --- a/man/xresources.texi +++ b/man/xresources.texi | |||
| @@ -294,6 +294,11 @@ specified if @samp{off}. | |||
| 294 | Gamma correction for colors, equivalent to the frame parameter | 294 | Gamma correction for colors, equivalent to the frame parameter |
| 295 | @code{screen-gamma}. | 295 | @code{screen-gamma}. |
| 296 | 296 | ||
| 297 | @item @code{scrollBarWidth} (class @code{ScrollBarWidth}) | ||
| 298 | @cindex scrollbar width | ||
| 299 | The scroll bar width in pixels, equivalent to the frame parameter | ||
| 300 | @code{scroll-bar-width}. | ||
| 301 | |||
| 297 | @ifnottex | 302 | @ifnottex |
| 298 | @item @code{selectionFont} (class @code{SelectionFont}) | 303 | @item @code{selectionFont} (class @code{SelectionFont}) |
| 299 | Font name for pop-up menu items, in non-toolkit versions of Emacs. (For | 304 | Font name for pop-up menu items, in non-toolkit versions of Emacs. (For |