Function: c-guess-view-reorder-offsets-alist-in-style

c-guess-view-reorder-offsets-alist-in-style is a byte-compiled function defined in cc-guess.el.gz.

Signature

(c-guess-view-reorder-offsets-alist-in-style STYLE GUESSED-SYNTACTIC-SYMBOLS)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-guess.el.gz
(defun c-guess-view-reorder-offsets-alist-in-style (style guessed-syntactic-symbols)
  ;; Reorder the `c-offsets-alist' field of STYLE.
  ;; If an entry in `c-offsets-alist' holds a guessed value, move it to
  ;; front in the field. In addition alphabetical sort by entry name is done.
  (setq style (copy-tree style))
  (let ((offsets-alist-cell (assq 'c-offsets-alist style)))
    (setcdr offsets-alist-cell
	    (sort (cdr offsets-alist-cell)
		  (lambda (a b)
		    (let ((a-guessed? (memq (car a) guessed-syntactic-symbols))
			  (b-guessed? (memq (car b) guessed-syntactic-symbols)))
		      (cond
		       ((or (and a-guessed? b-guessed?)
			    (not (or a-guessed? b-guessed?)))
			(string-lessp (car a) (car b)))
		       (a-guessed? t)
		       (b-guessed? nil)))))))
  style)