• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/progmodes/

Lines Matching defs:style

50 ;; `c-add-style' often contains references to functions defined there.
58 (defvar c-style-alist
115 ;; doesn't fit this style at all. :P
226 ;; awk style exists primarily for auto-newline settings. Otherwise it's
248 style, VARIABLE is any Emacs variable, and VALUE is the intended value
249 for that variable when using the selected style.
252 STYLE-STRING. BASE-STYLE names a style that this style inherits from.
253 By default, all styles inherit from the \"user\" style, which is
264 your style, only those that are different from the default.
270 Do not change this variable directly. Use the function `c-add-style'
272 modify existing styles -- you should create a new style that inherits
273 the existing style).")
278 (defun c-set-style-1 (conscell dont-override)
279 ;; Set the style for one variable
310 (not (memq attr c-style-variables))
314 'set-from-style))
321 (defun c-get-style-variables (style basestyles)
322 ;; Return all variables in a style by resolving inheritances.
323 (if (not style)
324 (copy-alist c-fallback-style)
325 (let ((vars (cdr (or (assoc (downcase style) c-style-alist)
326 (assoc (upcase style) c-style-alist)
327 (assoc style c-style-alist)
329 (c-benign-error "Undefined style: %s" style)
337 (nconc (c-get-style-variables base (cons base basestyles))
340 (defvar c-set-style-history nil)
343 (defun c-set-style (stylename &optional dont-override)
344 "Set the current buffer to use the style STYLENAME.
345 STYLENAME, a string, must be an existing CC Mode style - These are contained
346 in the variable `c-style-alist'.
348 The variable `c-indentation-style' will get set to STYLENAME.
350 \"Setting the style\" is done by setting CC Mode's \"style variables\" to the
351 values indicated by the pertinent entry in `c-style-alist'. Other variables
354 If DONT-OVERRIDE is neither nil nor t, style variables whose default values
356 `set-from-style') will not be changed. This avoids overriding global settings
357 done in ~/.emacs. It is useful to call c-set-style from a mode hook in this
360 If DONT-OVERRIDE is t, style variables that already have values (i.e., whose
361 values are not the symbol `set-from-style') will not be overridden. CC Mode
362 calls c-set-style internally in this way whilst initializing a buffer; if
363 cc-set-style is called like this from anywhere else, it will usually behave as
367 (prompt (format "Which %s indentation style? "
369 (completing-read prompt c-style-alist nil t nil
370 'c-set-style-history
371 c-indentation-style))))
373 (error "Buffer %s is not a CC Mode buffer (c-set-style)" (buffer-name)))
375 (error "Argument to c-set-style was not a string"))
376 (c-initialize-builtin-style)
377 (let ((vars (c-get-style-variables stylename nil)))
380 ;; first, or else the hooks from the preceding style will
382 ;; c-get-style-variables contains every valid offset type in the
387 (c-set-style-1 elem dont-override))
391 (setq c-indentation-style stylename)
395 (defun c-add-style (style description &optional set-p)
396 "Adds a style to `c-style-alist', or updates an existing one.
397 STYLE is a string identifying the style to add or update. DESCRIPTION
398 is an association list describing the style and must be of the form:
402 See the variable `c-style-alist' for the semantics of BASESTYLE,
403 VARIABLE and VALUE. This function also sets the current style to
404 STYLE using `c-set-style' if the optional SET-P flag is non-nil."
406 (let ((stylename (completing-read "Style to add: " c-style-alist
407 nil nil nil 'c-set-style-history))
410 (y-or-n-p "Set the style too? "))))
411 (setq style (downcase style))
412 (let ((s (assoc style c-style-alist)))
415 (setq c-style-alist (cons (cons style description) c-style-alist))))
416 (and set-p (c-set-style style)))
602 (defun c-initialize-builtin-style ()
604 ;; crucial because future c-set-style calls will always reset the
605 ;; variables first to the `cc-mode' style before instituting the new
606 ;; style. Only do this once!
607 (unless (get 'c-initialize-builtin-style 'is-run)
608 (put 'c-initialize-builtin-style 'is-run t)
610 (unless (assoc "user" c-style-alist)
611 (let ((vars c-style-variables) var val uservars)
620 ((not (eq val 'set-from-style))
623 (c-add-style "user" uservars)))
624 (unless (assoc "cc-mode" c-style-alist)
625 (c-add-style "cc-mode" '("user")))
626 (if c-style-variables-are-local-p
630 "Make all CC Mode style variables buffer local.
631 If `this-buf-only-p' is non-nil, the style variables will be made
635 The buffer localness of the style variables are normally controlled
636 with the variable `c-style-variables-are-local-p', so there's seldom
639 ;; style variables
643 (varsyms (cons 'c-indentation-style (copy-alist c-style-variables))))
650 (setq c-style-variables-are-local-p t))