1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-05 07:01:11 -08:00

Merge from emacs--devo--0

Patches applied:

 * emacs--devo--0  (patch 583-585)

   - Update from CVS
   - Fix admin/quick-install-emacs to work with recent versions of autoconf

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-160
This commit is contained in:
Miles Bader 2007-01-02 02:34:44 +00:00
commit e35ae98e41
25 changed files with 1031 additions and 430 deletions

View file

@ -1,3 +1,8 @@
2007-01-01 Miles Bader <miles@gnu.org>
* quick-install-emacs (get_config_var): Deal with weird magic
string inserted by recent versions of autoconf.
2006-11-25 Juanma Barranquero <lekktu@gmail.com>
* admin.el (set-version): Set version number in

View file

@ -1,5 +1,8 @@
Tasks needed before the next release.
* UPDATE COPYRIGHTS (Happy New Year :-)
* TO BE DONE SHORTLY BEFORE RELEASE
** 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.
** Check for text in manuals that assumes current version is 21.
** Update AUTHORS.
[Done 2006-10-03]
** Regenerate the postscript files of the reference cards in etc.

View file

@ -136,7 +136,7 @@ fi
CONFIG_STATUS="$BUILD/config.status"
get_config_var ()
{
if ! sed -n "s/^s\(.\)@$1@\1\(.*\)\1.*$/\2/p" $CONFIG_STATUS | sed q | grep ''
if ! sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep ''
then
echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS"
exit 4

View file

@ -1,3 +1,116 @@
2007-01-02 Juanma Barranquero <lekktu@gmail.com>
* files.el (version-control): Doc fix.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-guess-basic-syntax, case 5N): Check
the format of c-state-cache is valid for an optimisation before
using it.
* progmodes/cc-engine.el (c-guess-basic-syntax): New case 5Q "we
are at a statement within a macro". Other changes so that only
the first continuation line in a macro gets the symbol
`cpp-define-intro', the others getting `statement', or whatever.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-cmds.el (c-context-line-break): When invoked within
a string, preserve whitespace. Add a backslash only when also in
a macro.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-defs.el: Correct typos.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-cmds.el (c-context-line-break): Don't indent the
new line after an escaped EOL in a string.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-forward-label): Recognise "foo:" as a
label when it directly follows "else", "do", ....
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-backward-<>-arglist): Tolerate empty
angle brackets (as seen in "explicit specialisations" of C++
templates).
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-vars.el (c-indentation-style): Mention c-file-style
in the doc-string.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-cmds.el (c-mask-paragraph): Fix for C comments,
when the comment ender looks like "=========*/" and is alone on
its line.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-langs.el, progmodes/cc-engine.el: Correct the
spelling of c-opt-op-identiTier-prefix, t -> f. Leave an alias
for the old name.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-mode.el: Bind C-M-a and C-M-e to
c-\(beginning\|end\)-of-defun by default.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-align.el (c-lineup-gnu-DEFUN-intro-cont): New
line-up function, for the DEFUN macro in the Emacs C sources.
Only used in "gnu" style.
* progmodes/cc-styles.el (c-style-alist): Use this new function in
the "gnu" style.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-cmds.el (c-electric-slash): Extend the handling of
clean-up comment-close-slash also to work when there's a comment
terminator on the line.
(c-beginning-of-defun, c-end-of-defun): Refactor and optimise
these for large arg - only take account of top level {..}, except
for initial and final adjustments. M-- C-M-[ae] now go to the
right defuns when the starting point is between defuns. They use
the four new functions:
(c-in-function-trailer-p, c-where-wrt-brace-construct)
(c-backward-to-nth-BOF-{, c-forward-to-nth-EOF-}): New functions to
support c-\(beginning\|end\)-of-defun.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-engine.el (c-forward-label): Analyze ":"
expressions more rigorously, to exclude bit-field specifiers from
being classed as labels.
(c-forward-label): When analyzing a ":" within a macro, be careful
about using c-forward-syntactic-ws at the macro beginning.
(c-beginning-of-decl-1): Whilst searching for "=" as evidence of a
stmt boundary, check for "operator=", etc.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-mode.el (c-postprocess-file-styles): Bind
inhibit-read-only to t, around the call to
c-remove-any-local-eval-or-mode-variables, so that it works on a
RO file.
2007-01-01 Alan Mackenzie <acm@muc.de>
* progmodes/cc-defs.el (c-version): Update the version number to
"5.31.4".
2007-01-01 Richard Stallman <rms@gnu.org>
* isearch.el (isearch-done): Use FOUND-POINT or FOUND-START
only if we restored isearch-window-configuration.
2006-12-31 Romain Francoise <romain@orebokech.com>
* net/tramp.el (tramp-default-method): Don't use `symbol-function'.

View file

@ -242,9 +242,9 @@ breaks any hard links between it and other files."
(defcustom version-control nil
"Control use of version numbers for backup files.
t means make numeric backup versions unconditionally.
nil means make them for files that have some already.
`never' means do not make them."
When t, make numeric backup versions unconditionally.
When nil, make them for files that have some already.
The value `never' means do not make them."
:type '(choice (const :tag "Never" never)
(const :tag "If existing" nil)
(other :tag "Always" t))

View file

@ -780,13 +780,15 @@ NOPUSH is t and EDIT is t."
(lazy-highlight-cleanup lazy-highlight-cleanup)
(let ((found-start (window-start (selected-window)))
(found-point (point)))
(if isearch-window-configuration
(set-window-configuration isearch-window-configuration))
(if isearch-small-window
(goto-char found-point)
;; Exiting the save-window-excursion clobbers window-start; restore it.
(set-window-start (selected-window) found-start t)))
(when isearch-window-configuration
(set-window-configuration isearch-window-configuration)
(if isearch-small-window
(goto-char found-point)
;; set-window-configuration clobbers window-start; restore it.
;; This has an annoying side effect of clearing the last_modiff
;; field of the window, which can cause unwanted scrolling,
;; so don't do it unless truly necessary.
(set-window-start (selected-window) found-start t))))
(setq isearch-mode nil)
(if isearch-input-method-local-p

View file

@ -90,6 +90,29 @@ Works with: topmost-intro-cont."
(c-after-special-operator-id))))
c-basic-offset)))
(defun c-lineup-gnu-DEFUN-intro-cont (langelem)
"Line up the continuation lines of a DEFUN macro in the Emacs C source.
These lines are indented as though they were `knr-argdecl-intro' lines.
Return nil when we're not in such a construct.
This function is for historical compatibility with how previous CC Modes (5.28
and earlier) indented such lines.
Here is an example:
DEFUN (\"forward-char\", Fforward_char, Sforward_char, 0, 1, \"p\",
doc: /* Move point right N characters (left if N is negative).
On reaching end of buffer, stop and signal error. */)
(n) <- c-lineup-gnu-DEFUN-into-cont
Lisp_Object n; <- c-lineup-gnu-DEFUN-into-cont
Works with: topmost-intro-cont."
(save-excursion
(let (case-fold-search)
(goto-char (c-langelem-pos langelem))
(if (looking-at "\\<DEFUN\\>")
(c-calc-offset '(knr-argdecl-intro))))))
(defun c-block-in-arglist-dwim (arglist-start)
;; This function implements the DWIM to avoid far indentation of
;; brace block constructs in arguments in `c-lineup-arglist' etc.

View file

@ -720,7 +720,7 @@
(not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t))
(search-forward-regexp c-awk-div-sign-re (1+ /point) t))
;; A division sign.
(progn (goto-char (1+ /point)) nil)
(progn (goto-char (1+ /point)) nil)
;; A regexp opener
;; Jump over the regexp innards, setting the match data.
(goto-char /point)

View file

@ -53,6 +53,7 @@
(cc-bytecomp-defun c-forward-subword)
(cc-bytecomp-defun c-backward-subword)
;; Indentation / Display syntax functions
(defvar c-fix-backslashes t)
(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."
(forward-line)))))
;; Minor mode functions.
(defun c-update-modeline ()
(let ((fmt (format "/%s%s%s%s"
(if c-electric-flag "l" "")
@ -843,13 +845,17 @@ is inhibited."
(eq literal 'c)
(memq 'comment-close-slash c-cleanup-list)
(eq last-command-char ?/)
(looking-at (concat "[ \t]*\\("
(regexp-quote comment-end) "\\)?$"))
; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */
(save-excursion
(back-to-indentation)
(looking-at (concat c-current-comment-prefix "[ \t]*$"))))
(end-of-line)
(delete-horizontal-space)
(or (eq (char-before) ?*) (insert-char ?* 1))) ; Do I need a t (retain sticky properties) here?
(save-restriction
(narrow-to-region (point-min) (point))
(back-to-indentation)
(looking-at (concat c-current-comment-prefix "[ \t]*$")))))
(kill-region (progn (forward-line 0) (point))
(progn (end-of-line) (point)))
(insert-char ?* 1)) ; the / comes later. ; Do I need a t (retain sticky properties) here?
(setq indentp (and (not arg)
c-syntactic-indentation
@ -1253,7 +1259,11 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'."
(backward-char)
(skip-chars-backward " \t")
(setq beg (point))
(c-save-buffer-state () (c-on-identifier))))
(c-save-buffer-state () (c-on-identifier))
;; Don't add a space into #define FOO()....
(not (and (c-beginning-of-macro)
(c-forward-over-cpp-define-id)
(eq (point) beg)))))
(save-excursion
(delete-region beg end)
(goto-char beg)
@ -1308,6 +1318,7 @@ keyword on the line, the keyword is not inserted inside a literal, and
(delete-char -2)))))
;; "nomenclature" functions + c-scope-operator.
(defun c-forward-into-nomenclature (&optional arg)
"Compatibility alias for `c-forward-subword'."
(interactive "p")
@ -1328,6 +1339,160 @@ No indentation or other \"electric\" behavior is performed."
(interactive "*")
(insert-and-inherit "::"))
;; Movement (etc.) by defuns.
(defun c-in-function-trailer-p (&optional lim)
;; Return non-nil if point is between the closing brace and the semicolon of
;; a brace construct which needs a semicolon, e.g. within the "variables"
;; portion of a declaration like "struct foo {...} bar ;".
;;
;; Return the position of the main declaration. Otherwise, return nil.
;; Point is assumed to be at the top level and outside of any macro or
;; literal.
;;
;; If LIM is non-nil, it is the bound on a the backward search for the
;; beginning of the declaration.
;;
;; This function might do hidden buffer changes.
(and c-opt-block-decls-with-vars-key
(save-excursion
(c-syntactic-skip-backward "^;}" lim)
(and (eq (char-before) ?\})
(eq (car (c-beginning-of-decl-1 lim)) 'previous)
(looking-at c-opt-block-decls-with-vars-key)
(point)))))
(defun c-where-wrt-brace-construct ()
;; Determine where we are with respect to functions (or other brace
;; constructs, included in the term "function" in the rest of this comment).
;; Point is assumed to be outside any macro or literal.
;; This is used by c-\(begining\|end\)-of-defun.
;;
;; Return one of these symbols:
;; at-header : we're at the start of a function's header.
;; in-header : we're inside a function's header, this extending right
;; up to the brace. This bit includes any k&r declarations.
;; in-block : we're inside a function's brace block.
;; in-trailer : we're in the area between the "}" and ";" of something
;; like "struct foo {...} bar, baz;".
;; at-function-end : we're just after the closing brace (or semicolon) that
;; terminates the function.
;; outwith-function: we're not at or in any function. Being inside a
;; non-brace construct also counts as 'outwith-function'.
;;
;; This function might do hidden buffer changes.
(save-excursion
(let* (pos
kluge-start
decl-result brace-decl-p
(start (point))
(paren-state (c-parse-state))
(least-enclosing (c-least-enclosing-brace paren-state)))
(cond
((and least-enclosing
(eq (char-after least-enclosing) ?\{))
'in-block)
((c-in-function-trailer-p)
'in-trailer)
((and (not least-enclosing)
(consp paren-state)
(consp (car paren-state))
(eq start (cdar paren-state)))
'at-function-end)
(t
;; Find the start of the current declaration. NOTE: If we're in the
;; variables after a "struct/eval" type block, we don't get to the
;; real declaration here - we detect and correct for this later.
;;If we're in the parameters' parens, move back out of them.
(if least-enclosing (goto-char least-enclosing))
;; Kluge so that c-beginning-of-decl-1 won't go back if we're already
;; at a declaration.
(if (or (and (eolp) (not (eobp))) ; EOL is matched by "\\s>"
(not (looking-at
"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")))
(forward-char))
(setq kluge-start (point))
(setq decl-result
(car (c-beginning-of-decl-1
(and least-enclosing ; LIMIT for c-b-of-decl-1
(c-safe-position least-enclosing paren-state)))))
;; Has the declaration we've gone back to got braces?
(setq pos (point)) ; the search limit for c-recognize-knr-p
(setq brace-decl-p
(save-excursion
(and (c-syntactic-re-search-forward "[;{]" nil t t)
(or (eq (char-before) ?\{)
(and c-recognize-knr-p
;; Might have stopped on the
;; ';' in a K&R argdecl. In
;; that case the declaration
;; should contain a block.
(c-in-knr-argdecl pos))))))
(cond
((= (point) kluge-start) ; might be BOB or unbalanced parens.
'outwith-function)
((eq decl-result 'same)
(if brace-decl-p
(if (eq (point) start)
'at-header
'in-header)
'outwith-function))
((eq decl-result 'previous)
(if (and (not brace-decl-p)
(c-in-function-trailer-p))
'at-function-end
'outwith-function))
(t (error
"c-where-wrt-brace-construct: c-beginning-of-decl-1 returned %s"
decl-result))))))))
(defun c-backward-to-nth-BOF-{ (n where)
;; Skip to the opening brace of the Nth function before point. If
;; point is inside a function, this counts as the first. Point must be
;; outside any comment/string or macro.
;;
;; N must be strictly positive.
;; WHERE describes the position of point, one of the symbols `at-header',
;; `in-header', `in-block', `in-trailer', `at-function-end',
;; `outwith-function' as returned by c-where-wrt-brace-construct.
;;
;; If we run out of functions, leave point at BOB. Return zero on success,
;; otherwise the number of {s still to go.
;;
;; This function may do hidden buffer changes
(cond
;; What we do to go back the first defun depends on where we start.
((bobp))
((eq where 'in-block)
(goto-char (c-least-enclosing-brace (c-parse-state)))
(setq n (1- n)))
((eq where 'in-header)
(c-syntactic-re-search-forward "{")
(backward-char)
(setq n (1- n)))
(;; (or (eq where 'at-header) (eq where 'outwith-function)
;; (eq where 'at-function-end) (eq where 'in-trailer))
(memq where '(at-header outwith-function at-function-end in-trailer))
(c-syntactic-skip-backward "^}")
(when (eq (char-before) ?\})
(backward-sexp)
(setq n (1- n))))
(t (error "Unknown `where' %s in c-backward-to-nth-EOF-{" where)))
;; Each time round the loop, go back to a "{" at the outermost level.
(while (and (> n 0) (not (bobp)))
(c-parse-state) ; This call speeds up the following one
; by a factor of ~6. Hmmm. 2006/4/5.
(c-syntactic-skip-backward "^}")
(when (eq (char-before) ?\})
(backward-sexp)
(setq n (1- n))))
n)
(defun c-beginning-of-defun (&optional arg)
"Move backward to the beginning of a defun.
Every top level declaration that contains a brace paren block is
@ -1344,88 +1509,99 @@ defun."
(interactive "p")
(or arg (setq arg 1))
(if (< arg 0)
(when (c-end-of-defun (- arg))
(c-save-buffer-state nil (c-forward-syntactic-ws))
t)
(c-save-buffer-state
((start (point))
where paren-state pos)
(c-save-buffer-state (paren-state lim pos)
(catch 'exit
(while (> arg 0)
;; Note: Partial code duplication in `c-end-of-defun' and
;; `c-declaration-limits'.
;; Move back out of any macro/comment/string we happen to be in.
(c-beginning-of-macro)
(setq pos (c-literal-limits))
(if pos (goto-char (car pos)))
(setq paren-state (c-parse-state))
(unless (c-safe
(goto-char (c-least-enclosing-brace paren-state))
;; If we moved to the outermost enclosing paren
;; then we can use c-safe-position to set the
;; limit. Can't do that otherwise since the
;; earlier paren pair on paren-state might very
;; well be part of the declaration we should go
;; to.
(setq lim (c-safe-position (point) paren-state))
t)
;; At top level. Make sure we aren't inside a literal.
(setq pos (c-literal-limits
(c-safe-position (point) paren-state)))
(if pos (goto-char (car pos))))
(setq where (c-where-wrt-brace-construct))
(while (let ((start (point)))
(c-beginning-of-decl-1 lim)
(if (= (point) start)
;; Didn't move. Might be due to bob or unbalanced
;; parens. Try to continue if it's the latter.
(unless (c-safe (goto-char
(c-down-list-backward (point))))
;; Didn't work, so it's bob then.
(goto-char (point-min))
(throw 'exit nil)))
(if (< arg 0)
;; Move forward to the closing brace of a function.
(progn
(if ;; (or (eq where 'at-function-end) (eq where 'outwith-function))
(memq where '(at-function-end outwith-function))
(setq arg (1+ arg)))
(if (< arg 0)
(setq arg (c-forward-to-nth-EOF-} (- arg) where)))
;; Move forward to the next opening brace....
(when (and (= arg 0)
(c-syntactic-re-search-forward "{" nil t))
(backward-char)
;; ... and backward to the function header.
(c-beginning-of-decl-1)
t))
(save-excursion
;; Check if the declaration contains a brace
;; block. If not, we try another one.
(setq pos (point))
(not (and (c-syntactic-re-search-forward "[;{]" nil t t)
(or (eq (char-before) ?{)
(and c-recognize-knr-p
;; Might have stopped on the
;; ';' in a K&R argdecl. In
;; that case the declaration
;; should contain a block.
(c-in-knr-argdecl pos)))))))
(setq lim nil))
;; Move backward to the opening brace of a function.
(when (and (> arg 0)
(eq (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))
;; Check if `c-beginning-of-decl-1' put us after the block
;; in a declaration that doesn't end there. We're searching
;; back and forth over the block here, which can be
;; expensive.
(setq pos (point))
(if (and c-opt-block-decls-with-vars-key
(progn
(c-backward-syntactic-ws)
(eq (char-before) ?}))
(eq (car (c-beginning-of-decl-1))
'previous)
(save-excursion
(c-end-of-decl-1)
(> (point) pos)))
nil
(goto-char pos))
;; Go backward to this function's header.
(c-beginning-of-decl-1)
(setq pos (point))
;; Try to be line oriented; position point at the closest
;; preceding boi that isn't inside a comment, but if we hit
;; the previous declaration then we use the current point
;; instead.
(while (and (/= (point) (c-point 'boi))
(c-backward-single-comment)))
(if (/= (point) (c-point 'boi))
(goto-char pos))
(setq pos (point))
;; We're now there, modulo comments and whitespace.
;; Try to be line oriented; position point at the closest
;; preceding boi that isn't inside a comment, but if we hit
;; the previous declaration then we use the current point
;; instead.
(while (and (/= (point) (c-point 'boi))
(c-backward-single-comment)))
(if (/= (point) (c-point 'boi))
(goto-char pos)))
(setq arg (1- arg)))))
(c-keep-region-active)
(= arg 0)))
(c-keep-region-active)
(= arg 0))))
(defun c-forward-to-nth-EOF-} (n where)
;; Skip to the closing brace of the Nth function after point. If
;; point is inside a function, this counts as the first. Point must be
;; outside any comment/string or macro.
;;
;; N must be strictly positive.
;; WHERE describes the position of point, one of the symbols `at-header',
;; `in-header', `in-block', `in-trailer', `at-function-end',
;; `outwith-function' as returned by c-where-wrt-brace-construct.
;;
;; If we run out of functions, leave point at EOB. Return zero on success,
;; otherwise the number of }s still to go.
;;
;; This function may do hidden buffer changes.
(cond
;; What we do to go forward over the first defun depends on where we
;; start. We go to the closing brace of that defun, even when we go
;; backwards to it (in a "struct foo {...} bar ;").
((eobp))
((eq where 'in-block)
(goto-char (c-least-enclosing-brace (c-parse-state)))
(forward-sexp)
(setq n (1- n)))
((eq where 'in-trailer)
(c-syntactic-skip-backward "^}")
(setq n (1- n)))
(;; (or (eq where 'at-function-end) (eq where 'outwith-function)
;; (eq where 'at-header) (eq where 'in-header))
(memq where '(at-function-end outwith-function at-header in-header))
(c-syntactic-re-search-forward "{")
(backward-char)
(forward-sexp)
(setq n (1- n)))
(t (error "c-forward-to-nth-EOF-}: `where' is %s" where)))
;; Each time round the loop, go forward to a "}" at the outermost level.
(while (and (> n 0) (not (eobp)))
;(c-parse-state) ; This call speeds up the following one by a factor
; of ~6. Hmmm. 2006/4/5.
(when (c-syntactic-re-search-forward "{" nil 'eob)
(backward-char)
(forward-sexp))
(setq n (1- n)))
n)
(defun c-end-of-defun (&optional arg)
"Move forward to the end of a top level declaration.
@ -1435,82 +1611,56 @@ beginning or end of buffer.
An end of a defun occurs right after the close-parenthesis that matches
the open-parenthesis that starts a defun; see `beginning-of-defun'."
(interactive "p")
(or arg (setq arg 1))
(if (< arg 0)
(when (c-beginning-of-defun (- arg))
(c-save-buffer-state nil (c-backward-syntactic-ws))
t)
(c-save-buffer-state
((start (point))
where paren-state pos)
(c-save-buffer-state (paren-state lim pos)
(catch 'exit
(while (> arg 0)
;; Note: Partial code duplication in `c-beginning-of-defun'
;; and `c-declaration-limits'.
;; Move back out of any macro/comment/string we happen to be in.
(c-beginning-of-macro)
(setq pos (c-literal-limits))
(if pos (goto-char (car pos)))
(setq paren-state (c-parse-state))
(unless (c-safe
(goto-char (c-least-enclosing-brace paren-state))
;; If we moved to the outermost enclosing paren
;; then we can use c-safe-position to set the
;; limit. Can't do that otherwise since the
;; earlier paren pair on paren-state might very
;; well be part of the declaration we should go
;; to.
(setq lim (c-safe-position (point) paren-state))
t)
;; At top level. Make sure we aren't inside a literal.
(setq pos (car-safe (c-literal-limits
(c-safe-position (point) paren-state))))
(if pos (goto-char pos)))
(setq where (c-where-wrt-brace-construct))
;; Have to move to the start first so that `c-end-of-decl-1'
;; has the correct start position.
(setq pos (point))
(when (memq (car (c-beginning-of-decl-1 lim))
'(previous macro))
;; We moved back over the previous defun or a macro. Move
;; to the next token; it's the start of the next
;; declaration. We can also be directly after the block
;; in a `c-opt-block-decls-with-vars-key' declaration, but
;; then we won't move significantly far here.
(goto-char pos)
(c-forward-token-2 0))
(if (< arg 0)
;; Move backwards to the } of a function
(progn
(if ;; (or (eq where 'at-header) (eq where 'outwith-function))
(memq where '(at-header outwith-function))
(setq arg (1+ arg)))
(if (< arg 0)
(setq arg (c-backward-to-nth-BOF-{ (- arg) where)))
(when (and (= arg 0)
(c-syntactic-skip-backward "^}")
(eq (char-before) ?\}))
t))
(while (let ((start (point)))
(c-end-of-decl-1)
(if (= (point) start)
;; Didn't move. Might be due to eob or unbalanced
;; parens. Try to continue if it's the latter.
(if (c-safe (goto-char (c-up-list-forward (point))))
t
;; Didn't work, so it's eob then.
(goto-char (point-max))
(throw 'exit nil))
;; Move forward to the } of a function
(if (> arg 0)
(setq arg (c-forward-to-nth-EOF-} arg where))))
(save-excursion
;; Check if the declaration contains a brace
;; block. If not, we try another one.
(setq pos (point))
(goto-char start)
(not (c-syntactic-re-search-forward "{" pos t t))))))
;; Do we need to move forward from the brace to the semicolon?
(when (eq arg 0)
(if (c-in-function-trailer-p) ; after "}" of struct/enum, etc.
(c-syntactic-re-search-forward ";"))
(setq pos (point))
;; Try to be line oriented; position point after the next
;; newline that isn't inside a comment, but if we hit the
;; next declaration then we use the current point instead.
(while (and (not (bolp))
(not (looking-at "\\s *$"))
(c-forward-single-comment)))
(cond ((bolp))
((looking-at "\\s *$")
(forward-line 1))
(t
(goto-char pos)))
(setq pos (point))
;; We're there now, modulo comments and whitespace.
;; Try to be line oriented; position point after the next
;; newline that isn't inside a comment, but if we hit the
;; next declaration then we use the current point instead.
(while (and (not (bolp))
(not (looking-at "\\s *$"))
(c-forward-single-comment)))
(cond ((bolp))
((looking-at "\\s *$")
(forward-line 1))
(t
(goto-char pos))))
(setq arg (1- arg)))))
(c-keep-region-active)
(= arg 0)))
@ -1646,6 +1796,7 @@ function does not require the declaration to contain a brace block."
(push-mark (cdr decl-limits) nil t))))
;; Movement by statements.
(defun c-in-comment-line-prefix-p ()
;; Point is within a comment. Is it also within a comment-prefix?
;; 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."
(if (/= count 0) (setq count (1- count))))
(c-keep-region-active))))
;; set up electric character functions to work with pending-del,
;; (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."
(put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del
;; Inserting/indenting comments
(defun c-calc-comment-indent (entry)
;; This function might do hidden buffer changes.
(if (symbolp entry)
@ -2550,6 +2701,7 @@ See `c-indent-comment-alist' for a description."
(current-column))))
;; Movement by CPP conditionals.
(defun c-up-conditional (count)
"Move back to the containing preprocessor conditional, leaving mark behind.
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."
;; Restore point on undo. It's necessary since we do a lot of
;; hidden inserts and deletes below that should be as transparent
;; as possible.
(if (and buffer-undo-list (not (eq buffer-undo-list t)))
(if (and buffer-undo-list (not (eq buffer-undo-list t)))
(setq buffer-undo-list (cons (point) buffer-undo-list)))
;; Determine the limits and type of the containing literal (if any):
;; C-LIT-LIMITS, C-LIT-TYPE; and the limits of the current paragraph:
;; BEG and END.
(c-save-buffer-state ()
(save-restriction
;; Widen to catch comment limits correctly.
@ -3651,6 +3806,13 @@ command to conveniently insert and align the necessary backslashes."
(unwind-protect
(progn
;; For each of the possible types of text (string, C comment ...)
;; determine BEG and END, the region we will narrow to. If we're in
;; a literal, constrain BEG and END to the limits of this literal.
;;
;; For some of these text types, particularly a block comment, we
;; may need to massage whitespace near literal delimiters, so that
;; these don't get filled inappropriately.
(cond
((eq c-lit-type 'c++) ; Line comment.
@ -3675,21 +3837,27 @@ command to conveniently insert and align the necessary backslashes."
((eq c-lit-type 'c) ; Block comment.
(when (>= end (cdr c-lit-limits))
;; The region includes the comment ender which we might
;; want to keep together with the last word.
(unless (save-excursion
(goto-char (cdr c-lit-limits))
(beginning-of-line)
(and (looking-at (concat "[ \t]*\\("
c-current-comment-prefix
"\\)\\*/"))
(eq (cdr c-lit-limits) (match-end 0))
;; The comment ender is on a line of its
;; own. Keep it that way.
(set-marker end (point))))
;; The region includes the comment ender. If it's on its own
;; line, it stays on its own line. If it's got company on the
;; line, it keeps (at least one word of) it. "=====*/" counts
;; as a comment ender here, but "===== */" doesn't and "foo*/"
;; doesn't.
(unless
(save-excursion
(goto-char (cdr c-lit-limits))
(beginning-of-line)
(and (search-forward-regexp
(concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
(- (cdr c-lit-limits) 2) t)
(not (search-forward-regexp
"\\(\\s \\|\\sw\\)"
(- (cdr c-lit-limits) 2) 'limit))
;; The comment ender IS on its own line. Exclude
;; this line from the filling.
(set-marker end (c-point 'bol))))
;; The comment ender should hang. Replace all space between
;; it and the last word either by one or two 'x's (when
;; The comment ender is hanging. Replace all space between it
;; and the last word either by one or two 'x's (when
;; FILL-PARAGRAPH is non-nil), or a row of x's the same width
;; as the whitespace (when auto filling), and include it in
;; the region. We'll change them back to whitespace
@ -3706,23 +3874,26 @@ command to conveniently insert and align the necessary backslashes."
spaces)
(save-excursion
;; Insert a CR after the "*/", adjust END
(goto-char (cdr c-lit-limits))
(setq tmp-post (point-marker))
(insert ?\n)
(set-marker end (point))
(forward-line -1) ; last line of the comment
(if (and (looking-at (concat "[ \t]*\\(\\("
c-current-comment-prefix
"\\)[ \t]*\\)"))
(eq ender-start (match-end 0)))
;; The comment ender is prefixed by nothing
;; but a comment line prefix. Remove it
;; along with surrounding ws.
;; The comment ender is prefixed by nothing but a
;; comment line prefix. IS THIS POSSIBLE? (ACM,
;; 2006/4/28). Remove it along with surrounding ws.
(setq spaces (- (match-end 1) (match-end 2)))
(goto-char ender-start))
(skip-chars-backward " \t\r\n") ; Surely this can be
; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18)
;; What's being tested here? 2006/4/20. FIXME!!!
(if (/= (point) ender-start)
(progn
(if (<= here (point))
@ -4172,49 +4343,63 @@ it.
When point is inside a comment, continue it with the appropriate
comment prefix (see the `c-comment-prefix-regexp' and
`c-block-comment-prefix' variables for details). The end of a
C++-style line comment doesn't count as inside it."
C++-style line comment doesn't count as inside it.
When point is inside a string, only insert a backslash when it is also
inside a preprocessor directive."
(interactive "*")
(let* (c-lit-limits c-lit-type
(c-macro-start c-macro-start))
(if (c-save-buffer-state ()
(setq c-lit-limits (c-literal-limits nil nil t)
c-lit-type (c-literal-type c-lit-limits))
(or (eq c-lit-type 'c)
(and (eq c-lit-type 'c++)
(< (save-excursion
(skip-chars-forward " \t")
(point))
(1- (cdr (setq c-lit-limits (c-collect-line-comments
c-lit-limits))))))
(and (or (not (looking-at "\\s *$"))
(eq (char-before) ?\\))
(c-query-and-set-macro-start)
(<= (save-excursion
(goto-char c-macro-start)
(if (looking-at c-opt-cpp-start)
(goto-char (match-end 0)))
(point))
(point)))))
(c-save-buffer-state ()
(setq c-lit-limits (c-literal-limits nil nil t)
c-lit-type (c-literal-type c-lit-limits))
(when (eq c-lit-type 'c++)
(setq c-lit-limits (c-collect-line-comments c-lit-limits)))
(c-query-and-set-macro-start))
(let ((comment-multi-line t)
(fill-prefix nil))
(c-indent-new-comment-line nil t))
(cond
((or (eq c-lit-type 'c)
(and (eq c-lit-type 'c++) ; C++ comment, but not at the very end of it.
(< (save-excursion
(skip-chars-forward " \t")
(point))
(1- (cdr c-lit-limits))))
(and (numberp c-macro-start) ; Macro, but not at the very end of
; it, not in a string, and not in the
; cpp keyword.
(not (eq c-lit-type 'string))
(or (not (looking-at "\\s *$"))
(eq (char-before) ?\\))
(<= (save-excursion
(goto-char c-macro-start)
(if (looking-at c-opt-cpp-start)
(goto-char (match-end 0)))
(point))
(point))))
(let ((comment-multi-line t)
(fill-prefix nil))
(c-indent-new-comment-line nil t)))
(delete-horizontal-space)
(newline)
((eq c-lit-type 'string)
(if (and (numberp c-macro-start)
(not (eq (char-before) ?\\)))
(insert ?\\))
(newline))
(t (delete-horizontal-space)
(newline)
;; c-indent-line may look at the current indentation, so let's
;; start out with the same indentation as the previous line.
(let ((col (save-excursion
(forward-line -1)
(while (and (looking-at "[ \t]*\\\\?$")
(= (forward-line -1) 0)))
(current-indentation))))
(indent-to col))
(indent-according-to-mode))))
(let ((col (save-excursion
(backward-char)
(forward-line 0)
(while (and (looking-at "[ \t]*\\\\?$")
(= (forward-line -1) 0)))
(current-indentation))))
(indent-to col))
(indent-according-to-mode)))))
(defun c-context-open-line ()
"Insert a line break suitable to the context and leave point before it.

View file

@ -95,7 +95,7 @@
;;; Variables also used at compile time.
(defconst c-version "5.31.3"
(defconst c-version "5.31.4"
"CC Mode version number.")
(defconst c-version-sym (intern c-version))
@ -764,7 +764,7 @@ be after it."
;; call `c-beginning-of-statement-1'.
;;
;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing
;; scheme used by the `c-at-vsemp-p-fn', hence the name - the status is
;; scheme used by the `c-at-vsemi-p-fn', hence the name - the status is
;; "unknown" if there is no cache entry current for the line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1620,7 +1620,7 @@ itself is evaluated."
(defmacro c-lang-defconst (name &rest args)
"Set the language specific values of the language constant NAME.
The second argument can be an optional docstring. The rest of the
The second argument can optionally be a docstring. The rest of the
arguments are one or more repetitions of LANG VAL where LANG specifies
the language(s) that VAL applies to. LANG is the name of the
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."
;; Emacs has a weird bug where it seems to fail to read
;; backquote lists from byte compiled files correctly (,@
;; forms, to be specific), so make sure the bindings in the
;; expansion below doesn't contain any backquote stuff.
;; expansion below don't contain any backquote stuff.
;; (XEmacs handles it correctly and doesn't need this for that
;; reason, but we also use this expansion handle
;; `c-lang-defconst-eval-immediately' and to register

View file

@ -255,6 +255,18 @@ comment at the start of cc-engine.el for more info."
(forward-char)
t))))
(defun c-forward-over-cpp-define-id ()
;; Assuming point is at the "#" that introduces a preprocessor
;; directive, it's moved forward to the end of the identifier which is
;; "#define"d (or whatever c-opt-cpp-macro-define specifies). Non-nil
;; is returned in this case, in all other cases nil is returned and
;; point isn't moved.
;;
;; This function might do hidden buffer changes.
(when (and c-opt-cpp-macro-define-id
(looking-at c-opt-cpp-macro-define-id))
(goto-char (match-end 0))))
(defun c-forward-to-cpp-define-body ()
;; Assuming point is at the "#" that introduces a preprocessor
;; 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."
(= (c-backward-token-2 0) 0))
(cond ((and (looking-at c-overloadable-operators-regexp)
(or (not c-opt-op-identitier-prefix)
(or (not c-opt-op-identifier-prefix)
(and (= (c-backward-token-2 1) 0)
(looking-at c-opt-op-identitier-prefix))))
(looking-at c-opt-op-identifier-prefix))))
(point))
((save-excursion
(and c-opt-op-identitier-prefix
(looking-at c-opt-op-identitier-prefix)
(and c-opt-op-identifier-prefix
(looking-at c-opt-op-identifier-prefix)
(= (c-forward-token-2 1) 0)
(looking-at c-overloadable-operators-regexp)))
(point))))
@ -3843,7 +3855,7 @@ comment at the start of cc-engine.el for more info."
;; good start position for the search, so do it.
(c-find-decl-prefix-search)))
;; Now loop. We already got the first match.
;; Now loop. Round what? (ACM, 2006/7/5). We already got the first match.
(while (progn
(while (and
@ -4534,41 +4546,42 @@ comment at the start of cc-engine.el for more info."
(goto-char start)
nil)
(while (and
(while (progn
(c-syntactic-skip-backward "^<;{}" limit t)
(if (eq (char-before) ?<)
t
;; Stopped at bob or a char that isn't allowed in an
;; arglist, so we've failed.
(goto-char start)
nil)
(and
(if (eq (char-before) ?<)
t
;; Stopped at bob or a char that isn't allowed in an
;; arglist, so we've failed.
(goto-char start)
nil)
(if (> (point)
(progn (c-beginning-of-current-token)
(point)))
;; If we moved then the "<" was part of some
;; multicharacter token.
t
(if (> (point)
(progn (c-beginning-of-current-token)
(point)))
;; If we moved then the "<" was part of some
;; multicharacter token.
t
(backward-char)
(let ((beg-pos (point)))
(if (c-forward-<>-arglist all-types)
(cond ((= (point) start)
;; Matched the arglist. Break the while.
(goto-char beg-pos)
nil)
((> (point) start)
;; We started from a non-paren ">" inside an
;; arglist.
(goto-char start)
nil)
(t
;; Matched a shorter arglist. Can be a nested
;; one so continue looking.
(goto-char beg-pos)
t))
t)))))
(backward-char)
(let ((beg-pos (point)))
(if (c-forward-<>-arglist all-types)
(cond ((= (point) start)
;; Matched the arglist. Break the while.
(goto-char beg-pos)
nil)
((> (point) start)
;; We started from a non-paren ">" inside an
;; arglist.
(goto-char start)
nil)
(t
;; Matched a shorter arglist. Can be a nested
;; one so continue looking.
(goto-char beg-pos)
t))
t))))))
(/= (point) start))))
@ -5793,17 +5806,32 @@ y ;; True if there's a suffix match outside the outermost
nil))))
(defun c-forward-label (&optional assume-markup preceding-token-end limit)
;; Assuming the point is at the beginning of a token, check if it
;; starts a label and if so move over it and return t, otherwise
;; don't move and return nil. The end of the label is taken to be
;; the end of the first submatch in `c-opt-extra-label-key' if it
;; matched, otherwise it's the colon. The point is directly after
;; the end on return. The terminating char is marked with
;; `c-decl-end' to improve recognition of the following declaration
;; or statement.
;; Assuming that point is at the beginning of a token, check if it starts a
;; label and if so move over it and return t, otherwise don't move and
;; return nil. "Label" here means "most things with a colon".
;;
;; More precisely, a "label" is regarded as one of:
;; (i) a goto target like "foo:";
;; (ii) A case label - either the entire construct "case FOO:" or just the
;; bare "case", should the colon be missing;
;; (iii) a keyword which needs a colon, like "default:" or "private:";
;; (iv) One of QT's "extended" C++ variants of
;; "private:"/"protected:"/"public:"/"more:" looking like "public slots:".
;; (v) One of the keywords matched by `c-opt-extra-label-key' (without any
;; colon). Currently (2006-03), this applies only to Objective C's
;; keywords "@private", "@protected", and "@public".
;;
;; One of the things which will NOT be recognised as a label is a bit-field
;; element of a struct, something like "int foo:5".
;;
;; The end of the label is taken to be just after the colon, or the end of
;; the first submatch in `c-opt-extra-label-key'. The point is directly
;; after the end on return. The terminating char gets marked with
;; `c-decl-end' to improve recognition of the following declaration or
;; statement.
;;
;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding
;; label, if any, has been marked up like that.
;; label, if any, has already been marked up like that.
;;
;; If PRECEDING-TOKEN-END is given, it should be the first position
;; 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
;;
;; This function might do hidden buffer changes.
(let ((start (point)))
(let ((start (point))
qt-symbol-idx
macro-start) ; if we're in one.
(cond
;; "case" or "default" (Doesn't apply to AWK).
((looking-at c-label-kwds-regexp)
(let ((kwd-end (match-end 1)))
;; Record only the keyword itself for fontification, since in
@ -5840,7 +5871,7 @@ y ;; True if there's a suffix match outside the outermost
(match-beginning 2))
(progn
(goto-char (match-beginning 2))
(goto-char (match-beginning 2)) ; just after the :
(c-put-c-type-property (1- (point)) 'c-decl-end)
t)
@ -5851,6 +5882,7 @@ y ;; True if there's a suffix match outside the outermost
(goto-char kwd-end)
t)))
;; @private, @protected, @public, in Objective C, or similar.
((and c-opt-extra-label-key
(looking-at c-opt-extra-label-key))
;; 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
(c-put-c-type-property (1- (point)) 'c-decl-end)
t)
((and c-recognize-colon-labels
;; All other cases of labels.
((and c-recognize-colon-labels ; nil for AWK and IDL, otherwise t.
;; A colon label must have something before the colon.
(not (eq (char-after) ?:))
@ -5890,7 +5923,8 @@ y ;; True if there's a suffix match outside the outermost
(save-excursion
(goto-char (1- preceding-token-end))
(c-beginning-of-current-token)
(looking-at c-label-prefix-re))
(or (looking-at c-label-prefix-re)
(looking-at c-block-stmt-1-key)))
(and (eq (char-before preceding-token-end) ?\))
(c-after-conditional)))
@ -5899,7 +5933,8 @@ y ;; True if there's a suffix match outside the outermost
(save-excursion
(goto-char (1- preceding-token-end))
(c-beginning-of-current-token)
(looking-at c-label-prefix-re))
(or (looking-at c-label-prefix-re)
(looking-at c-block-stmt-1-key)))
(cond
((eq (char-before preceding-token-end) ?\))
@ -5907,26 +5942,52 @@ y ;; True if there's a suffix match outside the outermost
((eq (char-before preceding-token-end) ?:)
;; Might be after another label, so check it recursively.
(save-excursion
(goto-char (1- preceding-token-end))
;; Essentially the same as the
;; `c-syntactic-re-search-forward' regexp below.
(c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
(let ((pte (point))
;; If the caller turned on recording for us,
;; it shouldn't apply when we check the
;; preceding label.
c-record-type-identifiers)
(c-forward-syntactic-ws)
(c-forward-label nil pte start))))))))
(save-restriction
(save-excursion
(goto-char (1- preceding-token-end))
;; Essentially the same as the
;; `c-syntactic-re-search-forward' regexp below.
(setq macro-start
(save-excursion (and (c-beginning-of-macro)
(point))))
(if macro-start (narrow-to-region macro-start (point-max)))
(c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
;; Note: the following should work instead of the
;; narrow-to-region above. Investigate why not,
;; sometime. ACM, 2006-03-31.
;; (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+"
;; macro-start t)
(let ((pte (point))
;; If the caller turned on recording for us,
;; it shouldn't apply when we check the
;; preceding label.
c-record-type-identifiers)
;; A label can't start at a cpp directive. Check for
;; this, since c-forward-syntactic-ws would foul up on it.
(unless (and c-opt-cpp-prefix (looking-at c-opt-cpp-prefix))
(c-forward-syntactic-ws)
(c-forward-label nil pte start))))))))))
;; Check that the next nonsymbol token is ":". Allow '('
;; for the sake of macro arguments. FIXME: Should build
;; this regexp from the language constants.
(c-syntactic-re-search-forward
"[[:?;{=*/%&|,<>!@+-]" limit t t)
(eq (char-before) ?:)
(not (eq (char-after) ?:)))
;; Check that the next nonsymbol token is ":", or that we're in one
;; of QT's "slots" declarations. Allow '(' for the sake of macro
;; arguments. FIXME: Should build this regexp from the language
;; constants.
(when (c-syntactic-re-search-forward
"[ \t[:?;{=*/%&|,<>!@+-]" limit t t) ; not at EOB
(backward-char)
(setq qt-symbol-idx
(and (c-major-mode-is 'c++-mode)
(string-match
"\\(p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|more\\)\\>"
(buffer-substring start (point)))))
(c-forward-syntactic-ws limit)
(when (or (looking-at ":\\([^:]\\|\\'\\)") ; A single colon.
(and qt-symbol-idx
(search-forward-regexp "\\=slots\\>" limit t)
(progn (c-forward-syntactic-ws limit)
(looking-at ":\\([^:]\\|\\'\\)")))) ; A single colon
(forward-char) ; to after the colon.
t)))
(save-restriction
(narrow-to-region start (point))
@ -6145,8 +6206,8 @@ comment at the start of cc-engine.el for more info."
;; so that we don't get stuck on that instead of the
;; function arglist.
(c-forward-sexp))
((and c-opt-op-identitier-prefix
(looking-at c-opt-op-identitier-prefix))
((and c-opt-op-identifier-prefix
(looking-at c-opt-op-identifier-prefix))
;; Don't trip up on "operator ()".
(c-forward-token-2 2 t)))
(and (< (point) beg)
@ -6263,10 +6324,10 @@ comment at the start of cc-engine.el for more info."
(and c-overloadable-operators-regexp
(zerop (c-backward-token-2 1 nil lim))
(looking-at c-overloadable-operators-regexp)
(or (not c-opt-op-identitier-prefix)
(or (not c-opt-op-identifier-prefix)
(and
(zerop (c-backward-token-2 1 nil lim))
(looking-at c-opt-op-identitier-prefix)))
(looking-at c-opt-op-identifier-prefix)))
(point))))
(defsubst c-backward-to-block-anchor (&optional lim)
@ -6314,7 +6375,7 @@ comment at the start of cc-engine.el for more info."
;; operator token preceded by "operator".
(save-excursion
(and (c-safe (c-backward-sexp) t)
(looking-at c-opt-op-identitier-prefix)))
(looking-at c-opt-op-identifier-prefix)))
(and (eq (char-before) ?<)
(c-with-syntax-table c++-template-syntax-table
(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."
;; construct, i.e. if it isn't preceded by ';', '}', ':', bob,
;; or an open paren.
(let ((beg (point)) tentative-move)
;; Go back one "statement" each time round the loop until we're just
;; after a ;, }, or :, or at BOB or the start of a macro or start of
;; an ObjC method. This will move over a multiple declaration whose
;; components are comma separated.
(while (and
;; Must check with c-opt-method-key in ObjC mode.
(not (and c-opt-method-key
@ -6397,25 +6462,39 @@ comment at the start of cc-engine.el for more info."
knr-argdecl-start))
(goto-char fallback-pos))))
;; `c-beginning-of-statement-1' counts each brace block as a
;; separate statement, so the result will be 'previous if we've
;; moved over any. If they were brace list initializers we might
;; not have moved over a declaration boundary though, so change it
;; to 'same if we've moved past a '=' before '{', but not ';'.
;; (This ought to be integrated into `c-beginning-of-statement-1',
;; so we avoid this extra pass which potentially can search over a
;; large amount of text.)
;; `c-beginning-of-statement-1' counts each brace block as a separate
;; statement, so the result will be 'previous if we've moved over any.
;; So change our result back to 'same if necessary.
;;
;; If they were brace list initializers we might not have moved over a
;; declaration boundary though, so change it to 'same if we've moved
;; past a '=' before '{', but not ';'. (This ought to be integrated
;; into `c-beginning-of-statement-1', so we avoid this extra pass which
;; potentially can search over a large amount of text.). Take special
;; pains not to get mislead by C++'s "operator=", and the like.
(if (and (eq move 'previous)
(c-with-syntax-table (if (c-major-mode-is 'c++-mode)
c++-template-syntax-table
(syntax-table))
(save-excursion
(and (c-syntactic-re-search-forward "[;={]" start t t t)
(eq (char-before) ?=)
(c-syntactic-re-search-forward "[;{]" start t t)
(eq (char-before) ?{)
(c-safe (goto-char (c-up-list-forward (point))) t)
(not (c-syntactic-re-search-forward ";" start t t))))))
(and
(progn
(while ; keep going back to "[;={"s until we either find
; no more, or get to one which isn't an "operator ="
(and (c-syntactic-re-search-forward "[;={]" start t t t)
(eq (char-before) ?=)
c-overloadable-operators-regexp
c-opt-op-identifier-prefix
(save-excursion
(eq (c-backward-token-2) 0)
(looking-at c-overloadable-operators-regexp)
(eq (c-backward-token-2) 0)
(looking-at c-opt-op-identifier-prefix))))
(eq (char-before) ?=))
(c-syntactic-re-search-forward "[;{]" start t t)
(eq (char-before) ?{)
(c-safe (goto-char (c-up-list-forward (point))) t)
(not (c-syntactic-re-search-forward ";" start t t))))))
(cons 'same nil)
(cons move nil)))))
@ -6725,8 +6804,8 @@ comment at the start of cc-engine.el for more info."
(setq braceassignp
(cond
;; Check for operator =
((and c-opt-op-identitier-prefix
(looking-at c-opt-op-identitier-prefix))
((and c-opt-op-identifier-prefix
(looking-at c-opt-op-identifier-prefix))
nil)
;; Check for `<opchar>= in Pike.
((and (c-major-mode-is 'pike-mode)
@ -7000,6 +7079,11 @@ comment at the start of cc-engine.el for more info."
stop-at-boi-only
containing-sexp
paren-state)
;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as
;; needed with further syntax elements of the types `substatement',
;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and
;; `defun-block-intro'.
;;
;; Do the generic processing to anchor the given syntax symbol on
;; the preceding statement: Skip over any labels and containing
;; 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."
(and (eq (char-before) ?})
(save-excursion
(let ((start (point)))
(if c-state-cache
(if (and c-state-cache
(consp (car c-state-cache))
(eq (cdar c-state-cache) (point)))
;; Speed up the backward search a bit.
(goto-char (caar c-state-cache)))
(c-beginning-of-decl-1 containing-sexp)
@ -8103,26 +8189,30 @@ comment at the start of cc-engine.el for more info."
;; CASE 5J: we are at the topmost level, make
;; sure we skip back past any access specifiers
((save-excursion
(setq placeholder (point))
(or (memq char-before-ip '(?\; ?{ ?} nil))
(c-at-vsemi-p before-ws-ip)
(when (and (eq char-before-ip ?:)
(eq (c-beginning-of-statement-1 lim)
'label))
(c-backward-syntactic-ws lim)
(setq placeholder (point)))
(and (c-major-mode-is 'objc-mode)
(catch 'not-in-directive
(c-beginning-of-statement-1 lim)
(setq placeholder (point))
(while (and (c-forward-objc-directive)
(< (point) indent-point))
(c-forward-syntactic-ws)
(if (>= (point) indent-point)
(throw 'not-in-directive t))
(setq placeholder (point)))
nil))))
((and
;; A macro continuation line is never at top level.
(not (and macro-start
(> indent-point macro-start)))
(save-excursion
(setq placeholder (point))
(or (memq char-before-ip '(?\; ?{ ?} nil))
(c-at-vsemi-p before-ws-ip)
(when (and (eq char-before-ip ?:)
(eq (c-beginning-of-statement-1 lim)
'label))
(c-backward-syntactic-ws lim)
(setq placeholder (point)))
(and (c-major-mode-is 'objc-mode)
(catch 'not-in-directive
(c-beginning-of-statement-1 lim)
(setq placeholder (point))
(while (and (c-forward-objc-directive)
(< (point) indent-point))
(c-forward-syntactic-ws)
(if (>= (point) indent-point)
(throw 'not-in-directive t))
(setq placeholder (point)))
nil)))))
;; For historic reasons we anchor at bol of the last
;; line of the previous declaration. That's clearly
;; 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."
(c-beginning-of-statement-1 (c-safe-position (point) paren-state))
(c-add-syntax 'template-args-cont (c-point 'boi)))
;; CASE 5Q: we are at a statement within a macro.
(macro-start
(c-beginning-of-statement-1 containing-sexp)
(c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
;; CASE 5M: we are at a topmost continuation line
(t
(c-beginning-of-statement-1 (c-safe-position (point) paren-state))

View file

@ -685,6 +685,16 @@ definition, or nil if the language doesn't have any."
(c-lang-defvar c-opt-cpp-macro-define-start
(c-lang-const c-opt-cpp-macro-define-start))
(c-lang-defconst c-opt-cpp-macro-define-id
;; Regexp matching everything up to the end of the identifier defined
;; by a cpp define.
t (if (c-lang-const c-opt-cpp-macro-define)
(concat (c-lang-const c-opt-cpp-prefix) ; #
(c-lang-const c-opt-cpp-macro-define) ; define
"[ \t]+\\(\\sw\\|_\\)+")))
(c-lang-defvar c-opt-cpp-macro-define-id
(c-lang-const c-opt-cpp-macro-define-id))
(c-lang-defconst c-cpp-expr-directives
"List if cpp directives (without the prefix) that are followed by an
expression."
@ -882,7 +892,7 @@ since CC Mode treats every identifier as an expression."
(c-lang-defconst c-overloadable-operators
"List of the operators that are overloadable, in their \"identifier
form\". See also `c-op-identitier-prefix'."
form\". See also `c-op-identifier-prefix'."
t nil
c++ '("new" "delete" ;; Can be followed by "[]" but we ignore that.
"+" "-" "*" "/" "%"
@ -905,7 +915,7 @@ form\". See also `c-op-identitier-prefix'."
(c-lang-defvar c-overloadable-operators-regexp
(c-lang-const c-overloadable-operators-regexp))
(c-lang-defconst c-opt-op-identitier-prefix
(c-lang-defconst c-opt-op-identifier-prefix
"Regexp matching the token before the ones in
`c-overloadable-operators' when operators are specified in their
\"identifier form\". This typically matches \"operator\" in C++ where
@ -916,8 +926,15 @@ identifier is listed in `c-overloadable-operators'.
This regexp is assumed to not match any non-operator identifier."
t nil
c++ (c-make-keywords-re t '("operator")))
(c-lang-defvar c-opt-op-identitier-prefix
(c-lang-const c-opt-op-identitier-prefix))
(c-lang-defvar c-opt-op-identifier-prefix
(c-lang-const c-opt-op-identifier-prefix))
;; Note: the following alias is an old name which was a mis-spelling. It has
;; been corrected above and throughout cc-engine.el. It will be removed at
;; some release very shortly in the future. ACM, 2006-04-14.
(defalias 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix)
(make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix
"CC Mode 5.31.4, 2006-04-14")
(c-lang-defconst c-other-op-syntax-tokens
"List of the tokens made up of characters in the punctuation or

View file

@ -288,8 +288,9 @@ control). See \"cc-mode.el\" for more info."
c-mode-base-map global-map))
;; RMS says don't make these the default.
;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun)
;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)
;; (April 2006): RMS has now approved these commands as defaults.
(define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun)
(define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)
(define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional)
(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."
;; We prevent this by temporarily removing `mode' from the Local Variables
;; section.
(if (or c-file-style c-file-offsets)
(c-tentative-buffer-changes
(let ((hack-local-variables-hook nil))
(let ((hack-local-variables-hook nil) (inhibit-read-only t))
(c-tentative-buffer-changes
(c-remove-any-local-eval-or-mode-variables)
(hack-local-variables))
nil))))

View file

@ -68,7 +68,10 @@
(arglist-intro . c-lineup-arglist-intro-after-paren)
(arglist-close . c-lineup-arglist)
(inline-open . 0)
(brace-list-open . +)))
(brace-list-open . +)
(topmost-intro-cont
. (first c-lineup-topmost-intro-cont
c-lineup-gnu-DEFUN-intro-cont))))
(c-special-indent-hook . c-gnu-impose-minimum)
(c-block-comment-prefix . ""))

View file

@ -622,10 +622,10 @@ name:
empty-defun-braces -- Clean up empty defun braces by placing the
braces on the same line. Clean up occurs when
the defun closing brace is typed.
one-liner-defun -- If the code inside a function body is a single
line then remove any newlines between that
line and the defun braces so that the whole
body becomes a single line.
one-liner-defun -- If the code inside a function body can fit in
a single line, then remove any newlines
between that line and the defun braces so that
the whole body becomes a single line.
`c-max-one-liner-length' gives the maximum
length allowed for the resulting line. Clean
up occurs when the closing brace is typed.
@ -1604,7 +1604,8 @@ statically (e.g. with `setq').")
(defvar c-indentation-style nil
"Name of the currently installed style.
Don't change this directly; call `c-set-style' instead.")
Don't change this directly; call `c-set-style' instead, or set the variable
`c-file-style' in the file's Local Variable list.")
(defvar c-current-comment-prefix nil
"The current comment prefix regexp.

View file

@ -1,3 +1,19 @@
2007-01-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
* xlwmenu.c (xlwMenuResources): Add XtNleaveCallback, XtNenterCallback.
(display_menu, map_event_to_widget_value): Generate enter and
leave callbacks.
(pop_up_menu): Initialize mw->menu.inside_entry.
* xlwmenu.h (XtNleaveCallback, XtNenterCallback): New strings.
* xlwmenuP.h (_XlwMenu_part): Add enter/leave callbacks and
inside_entry.
* lwlib-Xlw.c (enter_hook, leave_hook): New functions
(xlw_create_menubar, xlw_create_popup_menu): Connect XtNenter/leave
to enter/leave_hook.
2006-10-30 Chong Yidong <cyd@stupidchicken.com>
* Makefile.in (lwlib-utils.o): Use CPPFLAGS.

View file

@ -83,6 +83,25 @@ highlight_hook (w, client_data, call_data)
instance->info->highlight_cb (w, instance->info->id, call_data);
}
static void
enter_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
{
highlight_hook (w, client_data, call_data);
}
static void
leave_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
{
highlight_hook (w, client_data, NULL);
}
static void
pre_hook (w, client_data, call_data)
Widget w;
@ -152,8 +171,8 @@ xlw_create_menubar (instance)
XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
(XtPointer)instance);
XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
return widget;
}
@ -179,8 +198,8 @@ xlw_create_popup_menu (instance)
popup_shell, al, ac);
XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
(XtPointer)instance);
XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
return popup_shell;
}

View file

@ -161,6 +161,10 @@ xlwMenuResources[] =
offset(menu.select), XtRCallback, (XtPointer)NULL},
{XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(menu.highlight), XtRCallback, (XtPointer)NULL},
{XtNenterCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(menu.enter), XtRCallback, (XtPointer)NULL},
{XtNleaveCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(menu.leave), XtRCallback, (XtPointer)NULL},
{XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer),
offset(menu.contents), XtRImmediate, (XtPointer)NULL},
{XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
@ -1186,8 +1190,17 @@ display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
{
if (val->enabled)
*hit_return = val;
else
no_return = 1;
else
no_return = 1;
if (mw->menu.inside_entry != val)
{
if (mw->menu.inside_entry)
XtCallCallbackList ((Widget)mw, mw->menu.leave,
(XtPointer) mw->menu.inside_entry);
mw->menu.inside_entry = val;
XtCallCallbackList ((Widget)mw, mw->menu.enter,
(XtPointer) mw->menu.inside_entry);
}
}
if (horizontal_p)
@ -1452,7 +1465,7 @@ motion_event_is_in_menu (mw, ev, level, relative_pos)
relative_pos->x = ev->x_root - x;
relative_pos->y = ev->y_root - y;
return (x - shadow < ev->x_root && ev->x_root < x + ws->width
&& y - shadow < ev->y_root && ev->y_root < y + ws->height);
&& y - shadow < ev->y_root && ev->y_root < y + ws->height);
}
static Boolean
@ -1465,6 +1478,7 @@ map_event_to_widget_value (mw, ev, val, level)
int i;
XPoint relative_pos;
window_state* ws;
int inside = 0;
*val = NULL;
@ -1474,6 +1488,7 @@ map_event_to_widget_value (mw, ev, val, level)
ws = &mw->menu.windows [i];
if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos))
{
inside = 1;
display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL);
if (*val)
@ -1483,6 +1498,15 @@ map_event_to_widget_value (mw, ev, val, level)
}
}
}
if (!inside)
{
if (mw->menu.inside_entry != NULL)
XtCallCallbackList ((Widget)mw, mw->menu.leave,
(XtPointer) mw->menu.inside_entry);
mw->menu.inside_entry = NULL;
}
return False;
}
@ -2416,6 +2440,7 @@ pop_up_menu (mw, event)
next_release_must_exit = 0;
mw->menu.inside_entry = NULL;
XtCallCallbackList ((Widget)mw, mw->menu.open, NULL);
if (XtIsShell (XtParent ((Widget)mw)))

View file

@ -44,6 +44,8 @@ Boston, MA 02110-1301, USA. */
#define XtNopen "open"
#define XtNselect "select"
#define XtNhighlightCallback "highlightCallback"
#define XtNenterCallback "enterCallback"
#define XtNleaveCallback "leaveCallback"
#define XtNmenuBorderWidth "menuBorderWidth"
#define XtNhorizontal "horizontal"
#define XtCHorizontal "Horizontal"

View file

@ -64,6 +64,7 @@ typedef struct _XlwMenu_part
Cursor cursor_shape;
XtCallbackList open;
XtCallbackList select, highlight;
XtCallbackList enter, leave;
widget_value* contents;
int horizontal;
@ -76,6 +77,7 @@ typedef struct _XlwMenu_part
int old_depth;
widget_value** old_stack;
int old_stack_length;
widget_value* inside_entry;
/* New state after the user moved */
int new_depth;

View file

@ -1,6 +1,47 @@
2007-01-01 Alan Mackenzie <acm@muc.de>
* cc-mode.texi ("Limitations and Known Bugs"): Document problems with
eval-after-load in Emacs <=21 and a workaround. Document that
trigraphs are not supported.
2007-01-01 Alan Mackenzie <acm@muc.de>
* cc-mode.texi ("Filling and Breaking"): Amend the doc for
c-context-line-break. When invoked within a string, preserve
whitespace. Add a backslash only when also in a macro.
2007-01-01 Alan Mackenzie <acm@muc.de>
* cc-mode.texi ("Choosing a Style"): Mention c-file-style.
2007-01-01 Alan Mackenzie <acm@muc.de>
* cc-mode.texi ("Movement Commands", "Sample .emacs File"): C-M-[ae]
are now bound by default to c-\(beginning\|end\)-of-defun by default.
2007-01-01 Alan Mackenzie <acm@muc.de>
* cc-mode.texi ("Other Commands"): Move c-set-style (C-c .) here from
"Choosing a Style".
* cc-mode.texi ("Styles"): Add @dfn{style}.
2007-01-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
* xresources.texi (Table of Resources): Add scrollBarWidth resource.
2007-01-01 Richard Stallman <rms@gnu.org>
* commands.texi (User Input): Document keys stolen by window mangers.
2006-12-31 Richard Stallman <rms@gnu.org>
* custom.texi (Specific Customization): Document customize-option
instead of customize-variable.
2006-12-31 Kim F. Storm <storm@cua.dk>
* major.texi (Choosing Modes): Document auto-mode-case-fond.
* major.texi (Choosing Modes): Document auto-mode-case-fold.
2006-12-30 Kim F. Storm <storm@cua.dk>

View file

@ -486,7 +486,7 @@ work just fine right out of the box. Note however that you might not
have the latest @ccmode{} release and might want to upgrade your copy
(see below).
You should probably start by reading the entire chapter
You should probably start by skimming through the entire chapter
@ref{Commands} to get an overview of @ccmode{}'s capabilities.
After trying out some commands, you may dislike some aspects of
@ -687,7 +687,7 @@ that begins at the line's left margin.
@item
When it's @code{nil}, the command indents the line by an extra
@code{c-basic-offset} columns. A prefix argument acts as a
multiplier. A bare prefix (@kbd{C-u @key{TAB}} is equivalent to -1,
multiplier. A bare prefix (@kbd{C-u @key{TAB}}) is equivalent to -1,
removing @code{c-basic-offset} columns from the indentation.
@end itemize
@ -880,30 +880,29 @@ lines.
@ccmode{} contains some useful commands for moving around in C code.
@table @asis
@item @kbd{M-x c-beginning-of-defun}
@itemx @kbd{M-x c-end-of-defun}
@item @kbd{C-M-a}
@itemx @kbd{C-M-e}
@findex c-beginning-of-defun
@findex c-end-of-defun
@findex beginning-of-defun (c-)
@findex end-of-defun (c-)
@findex beginning-of-defun
@findex end-of-defun
Move to the start or end of the current top-level definition. This is
the outermost brace pair which encloses point, together with the
function header or similar preamble which precedes the opening brace.
Move to the beginning or end of the current or next function. Other
constructs (such as a structs or classes) which have a brace block
also count as ``functions'' here. To move over several functions, you
can give these commands a repeat count.
The start of a function is at its header. The end of the function is
after its closing brace, or after the semicolon of a construct (such
as a @code{struct}) which doesn't end at the brace. These two
commands try to leave point at the beginning of a line near the actual
start or end of the function. This occasionally causes point not to
move at all.
These functions are analogous to the Emacs built-in commands
@code{beginning-of-defun} and @code{end-of-defun}, except they
eliminate the constraint that the top-level opening brace of the defun
must be in column zero. See @ref{Defuns,,,@emacsman{},
@emacsmantitle{}}, for more information.
Depending on the coding style you're using, you might prefer these two
commands to the standard Emacs ones. If so, consider binding them to
@kbd{C-M-a} and @kbd{C-M-e}. @xref{Sample .emacs File}. This
customization won't affect the special bindings for these key
sequences in force in AWK Mode. For backwards compatibility reasons,
the default bindings for @kbd{C-M-a} and @kbd{C-M-e} remain in effect.
@item @kbd{C-M-a} (AWK Mode) (@code{c-awk-beginning-of-defun})
@itemx @kbd{C-M-e} (AWK Mode) (@code{c-awk-end-of-defun})
@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.
@findex awk-beginning-of-defun (c-)
@findex c-awk-end-of-defun
@findex awk-end-of-defun (c-)
Move back to the beginning or forward to the end of the current AWK
defun. These functions are bound to @kbd{C-M-a} and @kbd{C-M-e} by
default in AWK Mode. They can take prefix-arguments, their
functionality being entirely equivalent to @code{beginning-of-defun}
and @code{end-of-defun}.
Move to the beginning or end of the current or next AWK defun. These
commands can take prefix-arguments, their functionality being entirely
equivalent to @code{beginning-of-defun} and @code{end-of-defun}.
AWK Mode @dfn{defuns} are either pattern/action pairs (either of which
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
indented like @code{newline-and-indent} would do. In macros it acts
like @code{newline-and-indent} but additionally inserts and optionally
aligns the line ending backslash so that the macro remains unbroken.
@xref{Custom Macros}, for details about the backslash alignment.
@xref{Custom Macros}, for details about the backslash alignment. In a
string, a backslash is inserted only if the string is within a
macro@footnote{In GCC, unescaped line breaks within strings are
valid.}.
This function is not bound to a key by default, but it's intended to be
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}.
Here are the various other commands that didn't fit anywhere else:
@table @asis
@item @kbd{C-c .} (@code{c-set-style})
@kindex C-c .
@findex c-set-style
@findex set-style (c-)
Switch to the specified style in the current buffer. Use like this:
@example
@kbd{C-c . @var{style-name} @key{RET}}
@end example
You can use the @key{TAB} in the normal way to do completion on the
style name. Note that all style names are case insensitive, even the
ones you define yourself.
Setting a style in this way does @emph{not} automatically reindent your
file. For commands that you can use to view the effect of your changes,
see @ref{Indentation Commands} and @ref{Filling and Breaking}.
For details of the @ccmode{} style system, see @ref{Styles}.
@item @kbd{C-c :} (@code{c-scope-operator})
@kindex C-c :
@findex c-scope-operator
@ -2363,7 +2382,7 @@ last thing when you enter that language mode.
@end defvar
Although these hooks are variables defined in @ccmode{}, you can give
them values before @ccmode{}'s code is loaded - indeed, this is the
them values before @ccmode{}'s code is loaded---indeed, this is the
only way to use @code{c-initialization-hook}. Their values aren't
overwritten when @ccmode{} gets loaded.
@ -2476,6 +2495,11 @@ Commas});@*
@cindex styles
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
By @dfn{style} we mean the layout of the code---things like how many
columns to indent a block of code, whether an opening brace gets
indented to the level of the code it encloses, or of the construct
that introduces it, or ``hangs'' at the end of a line.
Most people only need to edit code formatted in just a few well-defined
and consistent styles. For example, their organization might impose a
``blessed'' style that all its programmers must conform to. Similarly,
@ -2577,35 +2601,19 @@ afterwards.
@subsection Choosing a Style
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Use @kbd{C-c .} to choose a style interactively:
@deffn Command c-set-style style-name
@findex set-style (c-)
@kindex C-c .
Switch to the specified style in the current buffer. Use
interactively like this:
@example
@kbd{C-c . @var{style-name} @key{RET}}
@end example
You can use the @key{TAB} in the normal way to do completion on the
style name. Note that all style names are case insensitive, even the
ones you define yourself.
Setting a style in this way does @emph{not} automatically reindent your
file. For commands that you can use to view the effect of your changes,
see @ref{Indentation Commands} and @ref{Filling and Breaking}.
@end deffn
The default style in all newly created buffers is @code{gnu}, except
in Java and AWK modes where it's @code{java} and @code{awk}.
When you create a new buffer, its style will be set from
@code{c-default-style}. The factory default is the style @code{gnu},
except in Java and AWK modes where it's @code{java} and @code{awk}.
Remember that if you set a style variable with the Customization
interface or at the top level of your @file{.emacs} file before the
style system is initialised (@pxref{Config Basics}), this setting will
override the one that the style system would have given the variable.
To set a buffer's style interactively, use the command @kbd{C-c .}
(@pxref{Other Commands}). To set it from a file's local variable
list, @ref{File Styles}.
@defopt c-default-style
@vindex default-style (c-)
This variable specifies which style to install by default in new
@ -3247,8 +3255,8 @@ the proper functioning of @ccmode{}.
This variable is also bound in three other circumstances:
(i)@w{ }when calling a c-hanging-semi&comma-criteria function
(@pxref{Hanging Semicolons and Commas}; (ii)@w{ }when calling a
line-up function (@pxref{Custom Line-Up}; (iii)@w{ }when calling a
(@pxref{Hanging Semicolons and Commas}); (ii)@w{ }when calling a
line-up function (@pxref{Custom Line-Up}); (iii)@w{ }when calling a
c-special-indent-hook function (@pxref{Other Indentation}).
@end defvar
@ -3430,7 +3438,11 @@ newlines after semicolons inside one-line inline method definitions
@dfn{Clean-ups} are mechanisms which remove (or exceptionally, add)
whitespace in specific circumstances and are complementary to colon
and brace hanging. You enable a clean-up by adding its symbol into
@code{c-cleanup-list}.
@code{c-cleanup-list}, e.g. like this:
@example
(add-to-list 'c-cleanup-list 'space-before-funcall)
@end example
On the surface, it would seem that clean-ups overlap the functionality
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
closing parenthesis is typed.
@item comment-close-slash
When inside a block comment, terminate the comment when you type a
slash at the beginning of a line (i.e. immediately after the comment
prefix). This clean-up removes whitespace preceding the slash and if
needed, inserts a star to complete the token @samp{*/}.
When inside a block comment, terminate the comment when you type a slash
at the beginning of a line (i.e. immediately after the comment prefix).
This clean-up removes whitespace preceding the slash and if needed,
inserts a star to complete the token @samp{*/}. Type @kbd{C-q /} in this
situation if you just want a literal @samp{/} inserted.
@end table
@ -5182,7 +5195,7 @@ If an offset specification evaluates to @code{nil}, then a relative
offset of 0 (zero) is used@footnote{There is however a variable
@code{c-strict-syntax-p} that when set to non-@code{nil} will cause an
error to be signaled in that case. It's now considered obsolete since
it doesn't work well with some of the alignment functions that returns
it doesn't work well with some of the alignment functions that return
@code{nil} instead of zero. You should therefore leave
@code{c-strict-syntax-p} set to @code{nil}.}.
@ -6549,18 +6562,16 @@ anchoring position to indent the line in that case.
@appendix Sample .emacs File
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@verbatim
;; Here's a sample .emacs file fragment that might help you along the
;; way. Just copy this region and paste it into your .emacs file.
;; You might want to change some of the actual values.
Here's a sample .emacs file fragment that might help you along the way.
Just copy this region and paste it into your .emacs file. You might want
to change some of the actual values.
;; Make some non-standard key bindings. We can put these in
@verbatim
;; Make a non-standard key binding. We can put this in
;; c-mode-base-map because c-mode-map, c++-mode-map, and so on,
;; inherit from it.
(defun my-c-initialization-hook ()
(define-key c-mode-base-map "\C-m" 'c-context-line-break)
(define-key c-mode-base-map [?\C-\M-a] 'c-beginning-of-defun)
(define-key c-mode-base-map [?\C-\M-e] 'c-end-of-defun))
(define-key c-mode-base-map "\C-m" 'c-context-line-break))
(add-hook 'c-initialization-hook 'my-c-initialization-hook)
;; offset customizations not in my-c-style
@ -6647,9 +6658,6 @@ embodied in the @code{beginning-of-defun} function. @ccmode now
caches syntactic information much better, so that the delay caused by
searching for such a brace when it's not in column 0 is minimal,
except perhaps when you've just moved a long way inside the file.
Don't forget to rebind @kbd{C-M-a} and @kbd{C-M-e} to the @ccmode{}
functions @code{beginning-of-defun} and @code{end-of-defun} if you're
going to be hanging your braces! @xref{Sample .emacs File}.
@findex defun-prompt-regexp
@vindex c-Java-defun-prompt-regexp
@ -6725,6 +6733,12 @@ more info.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@itemize @bullet
@item
@ccmode{} doesn't support trigraphs. (These are character sequences
such as @samp{??(}, which represents @samp{[}. They date from a time
when some character sets didn't have all the characters that C needs,
and are now utterly obsolete.)
@item
There is no way to apply auto newline settings (@pxref{Auto-newlines})
on already typed lines. That's only a feature to ease interactive
@ -6747,6 +6761,25 @@ When a non-nested template is used in a declaration, @ccmode{} indents
it and font-locks it OK. Templates used in expressions, and nested
templates do not fare so well. Sometimes a workaround is to refontify
the expression after typing the closing @samp{>}.
@item
On loading @ccmode{}, sometimes this error message appears:
@example
File mode specification error: (void-variable c-font-lock-keywords-3)
@end example
This is due to a bug in the function @code{eval-after-load} in some
versions of (X)Emacs. It can manifest itself when there is a symbolic
link in the path of the directory which contains (X)Emacs. As a
workaround, put the following into your @file{.emacs} file, fairly
early on:
@example
(defun my-load-cc-fonts ()
(require "cc-fonts"))
(add-hook 'c-initialization-hook 'my-load-cc-fonts)
@end example
@end itemize
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View file

@ -134,6 +134,15 @@ because the keyboard input routines catch these special sequences
and convert them to function key events before any other part of Emacs
gets to see them.
@cindex keys stolen by window manager
@cindex window manager, keys stolen by
On graphical displays, the window manager is likely to block the
character @kbd{Meta-@key{TAB}} before Emacs can see it. It may also
block @kbd{Meta-@key{SPC}}, @kbd{C-M-d} and @kbd{C-M-l}. If you have
these problems, we recommend that you customize your window manager to
turn off those commands, or put them on key combinations that Emacs
does not use.
@node Keys, Commands, User Input, Top
@section Keys

View file

@ -625,8 +625,9 @@ structure of groups, here are other ways to specify the settings that
you want to customize.
@table @kbd
@item M-x customize-variable @key{RET} @var{variable} @key{RET}
Set up a customization buffer with just one variable, @var{variable}.
@item M-x customize-option @key{RET} @var{option} @key{RET}
Set up a customization buffer with just one user option variable,
@var{option}.
@item M-x customize-face @key{RET} @var{face} @key{RET}
Set up a customization buffer with just one face, @var{face}.
@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}.
@item M-x customize-apropos @key{RET} @var{regexp} @key{RET}
Set up a customization buffer with all the settings and groups that
match @var{regexp}.
@item M-x customize-changed-options @key{RET} @var{version} @key{RET}
@item M-x customize-changed @key{RET} @var{version} @key{RET}
Set up a customization buffer with all the settings and groups
whose meaning has changed since Emacs version @var{version}.
@item M-x customize-saved
@ -645,15 +646,16 @@ Set up a customization buffer containing all settings that you have
customized but not saved.
@end table
@findex customize-variable
If you want to alter a particular variable with the customization
@findex customize-option
If you want to alter a particular user option with the customization
buffer, and you know its name, you can use the command @kbd{M-x
customize-variable} and specify the variable name. This sets up the
customization buffer with just one variable---the one that you asked
for. Editing, setting and saving the value work as described above,
but only for the specified variable. Minibuffer completion is handy
if you only know part of the name. However, this command can only see
options that have been loaded in the current Emacs session.
customize-option} and specify the user option (variable) name. This
sets up the customization buffer with just one user option---the one
that you asked for. Editing, setting and saving the value work as
described above, but only for the specified user option. Minibuffer
completion is handy if you only know part of the name. However, this
command can only see options that have been loaded in the current
Emacs session.
@findex customize-face
Likewise, you can modify a specific face, chosen by name, using
@ -663,9 +665,9 @@ on the character after point.
@findex customize-group
You can also set up the customization buffer with a specific group,
using @kbd{M-x customize-group}. The immediate contents of the chosen
group, including settings (variables and faces), and other groups, all
appear as well (even if not already loaded). However, the subgroups'
own contents are not included.
group, including settings (user options and faces), and other groups,
all appear as well (even if not already loaded). However, the
subgroups' own contents are not included.
@findex customize-apropos
For a more general way of controlling what to customize, you can use

View file

@ -294,6 +294,11 @@ specified if @samp{off}.
Gamma correction for colors, equivalent to the frame parameter
@code{screen-gamma}.
@item @code{scrollBarWidth} (class @code{ScrollBarWidth})
@cindex scrollbar width
The scroll bar width in pixels, equivalent to the frame parameter
@code{scroll-bar-width}.
@ifnottex
@item @code{selectionFont} (class @code{SelectionFont})
Font name for pop-up menu items, in non-toolkit versions of Emacs. (For