12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781 |
- (eval-and-compile
- (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
- (eval-when-compile
- (let ((load-path
- (if (and (boundp 'byte-compile-dest-file)
- (stringp byte-compile-dest-file))
- (cons (file-name-directory byte-compile-dest-file) load-path)
- load-path)))
- (load "cc-bytecomp" nil t)))
- (cc-require 'cc-defs)
- (cc-require-when-compile 'cc-langs)
- (cc-require 'cc-vars)
- (cc-require 'cc-engine)
- (cc-require 'cc-styles)
- (cc-require 'cc-cmds)
- (cc-require 'cc-align)
- (cc-require 'cc-menus)
- (cc-require 'cc-guess)
- (cc-bytecomp-defvar adaptive-fill-first-line-regexp)
- (cc-bytecomp-defun set-keymap-parents)
- (cc-bytecomp-defun run-mode-hooks)
- (cc-bytecomp-defvar font-lock-defaults)
- (cc-bytecomp-defvar font-lock-syntactic-keywords)
- (cc-external-require 'easymenu)
- (autoload 'subword-mode "subword"
- "Mode enabling subword movement and editing keys." t)
- (require 'cc-fonts)
- (defun c-leave-cc-mode-mode ()
- (setq c-buffer-is-cc-mode nil))
- (defun c-init-language-vars-for (mode)
- "Initialize the language variables for one of the language modes
- directly supported by CC Mode. This can be used instead of the
- `c-init-language-vars' macro if the language you want to use is one of
- those, rather than a derived language defined through the language
- variable system (see \"cc-langs.el\")."
- (cond ((eq mode 'c-mode) (c-init-language-vars c-mode))
- ((eq mode 'c++-mode) (c-init-language-vars c++-mode))
- ((eq mode 'objc-mode) (c-init-language-vars objc-mode))
- ((eq mode 'java-mode) (c-init-language-vars java-mode))
- ((eq mode 'idl-mode) (c-init-language-vars idl-mode))
- ((eq mode 'pike-mode) (c-init-language-vars pike-mode))
- ((eq mode 'awk-mode) (c-init-language-vars awk-mode))
- (t (error "Unsupported mode %s" mode))))
- (defun c-initialize-cc-mode (&optional new-style-init)
- "Initialize CC Mode for use in the current buffer.
- If the optional NEW-STYLE-INIT is nil or left out then all necessary
- initialization to run CC Mode for the C language is done. Otherwise
- only some basic setup is done, and a call to `c-init-language-vars' or
- `c-init-language-vars-for' is necessary too (which gives more
- control). See \"cc-mode.el\" for more info."
- (setq c-buffer-is-cc-mode t)
- (let ((initprop 'cc-mode-is-initialized)
- c-initialization-ok)
- (unless (get 'c-initialize-cc-mode initprop)
- (unwind-protect
- (progn
- (put 'c-initialize-cc-mode initprop t)
- (c-initialize-builtin-style)
- (run-hooks 'c-initialization-hook)
-
- (if (boundp 'c-comment-continuation-stars)
- (setq c-block-comment-prefix
- (symbol-value 'c-comment-continuation-stars)))
- (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode)
- (setq c-initialization-ok t))
-
- (put 'c-initialize-cc-mode initprop c-initialization-ok))))
- (unless new-style-init
- (c-init-language-vars-for 'c-mode)))
- (defvar c-mode-base-map ()
- "Keymap shared by all CC Mode related modes.")
- (defun c-make-inherited-keymap ()
- (let ((map (make-sparse-keymap)))
-
-
-
- (cond
-
- ((cc-bytecomp-fboundp 'set-keymap-parent)
- (set-keymap-parent map c-mode-base-map))
-
- ((cc-bytecomp-fboundp 'set-keymap-parents)
- (set-keymap-parents map c-mode-base-map))
-
- (t (error "CC Mode is incompatible with this version of Emacs")))
- map))
- (defun c-define-abbrev-table (name defs)
-
-
-
- (let ((table (or (symbol-value name)
- (progn (define-abbrev-table name nil)
- (symbol-value name)))))
- (while defs
- (condition-case nil
- (apply 'define-abbrev table (append (car defs) '(t)))
- (wrong-number-of-arguments
- (apply 'define-abbrev table (car defs))))
- (setq defs (cdr defs)))))
- (put 'c-define-abbrev-table 'lisp-indent-function 1)
- (defun c-bind-special-erase-keys ()
-
-
- (if normal-erase-is-backspace
- (progn
- (define-key c-mode-base-map (kbd "C-c C-<delete>")
- 'c-hungry-delete-forward)
- (define-key c-mode-base-map (kbd "C-c C-<backspace>")
- 'c-hungry-delete-backwards))
- (define-key c-mode-base-map (kbd "C-c C-<delete>")
- 'c-hungry-delete-backwards)
- (define-key c-mode-base-map (kbd "C-c C-<backspace>")
- 'c-hungry-delete-forward)))
- (if c-mode-base-map
- nil
- (setq c-mode-base-map (make-sparse-keymap))
-
-
- (define-key c-mode-base-map [(control meta h)] 'c-mark-function)
- (define-key c-mode-base-map "\e\C-q" 'c-indent-exp)
- (substitute-key-definition 'backward-sentence
- 'c-beginning-of-statement
- c-mode-base-map global-map)
- (substitute-key-definition 'forward-sentence
- 'c-end-of-statement
- c-mode-base-map global-map)
- (substitute-key-definition 'indent-new-comment-line
- 'c-indent-new-comment-line
- c-mode-base-map global-map)
- (substitute-key-definition 'indent-for-tab-command
-
-
- 'c-indent-line-or-region
- c-mode-base-map global-map)
- (when (fboundp 'comment-indent-new-line)
-
-
- (substitute-key-definition 'comment-indent-new-line
- 'c-indent-new-comment-line
- c-mode-base-map global-map))
-
-
- (unless (memq 'argumentative-bod-function c-emacs-features)
- (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)
- (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional)
-
-
-
-
-
-
-
-
- (substitute-key-definition 'fill-paragraph 'c-fill-paragraph
- c-mode-base-map global-map)
-
-
- (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph
- c-mode-base-map global-map)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward)
- (define-key c-mode-base-map "\177" 'c-electric-backspace)
- (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward)
- (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-delete-backwards)
- (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-delete-backwards)
- (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward)
- (define-key c-mode-base-map [?\C-c (control deletechar)]
- 'c-hungry-delete-forward)
- (when (boundp 'normal-erase-is-backspace)
-
-
-
-
- (add-hook 'normal-erase-is-backspace-hook 'c-bind-special-erase-keys)
- (c-bind-special-erase-keys))
- (when (fboundp 'delete-forward-p)
-
-
-
-
-
- (define-key c-mode-base-map [delete] 'c-electric-delete)
- (define-key c-mode-base-map [backspace] 'c-electric-backspace)
- (define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete)
- (define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete)
- (define-key c-mode-base-map (kbd "C-c <backspace>")
- 'c-hungry-delete-backwards)
- (define-key c-mode-base-map (kbd "C-c C-<backspace>")
- 'c-hungry-delete-backwards))
- (define-key c-mode-base-map "#" 'c-electric-pound)
- (define-key c-mode-base-map "{" 'c-electric-brace)
- (define-key c-mode-base-map "}" 'c-electric-brace)
- (define-key c-mode-base-map "/" 'c-electric-slash)
- (define-key c-mode-base-map "*" 'c-electric-star)
- (define-key c-mode-base-map ";" 'c-electric-semi&comma)
- (define-key c-mode-base-map "," 'c-electric-semi&comma)
- (define-key c-mode-base-map ":" 'c-electric-colon)
- (define-key c-mode-base-map "(" 'c-electric-paren)
- (define-key c-mode-base-map ")" 'c-electric-paren)
- (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region)
- (define-key c-mode-base-map "\C-c\C-a" 'c-toggle-auto-newline)
- (define-key c-mode-base-map "\C-c\C-b" 'c-submit-bug-report)
- (define-key c-mode-base-map "\C-c\C-c" 'comment-region)
- (define-key c-mode-base-map "\C-c\C-l" 'c-toggle-electric-state)
- (define-key c-mode-base-map "\C-c\C-o" 'c-set-offset)
- (define-key c-mode-base-map "\C-c\C-q" 'c-indent-defun)
- (define-key c-mode-base-map "\C-c\C-s" 'c-show-syntactic-information)
-
- (define-key c-mode-base-map "\C-c." 'c-set-style)
-
-
-
- (define-key c-mode-base-map "\C-c\C-w" 'subword-mode)
- )
- (cc-bytecomp-defvar outline-level)
- (defun c-mode-menu (modestr)
- "Return a menu spec suitable for `easy-menu-define' that is exactly
- like the C mode menu except that the menu bar item name is MODESTR
- instead of \"C\".
- This function is provided for compatibility only; derived modes should
- preferably use the `c-mode-menu' language constant directly."
- (cons modestr (c-lang-const c-mode-menu c)))
- (defalias 'c-populate-syntax-table
- (cc-eval-when-compile
- (let ((f (symbol-function 'c-populate-syntax-table)))
- (if (byte-code-function-p f) f (byte-compile f)))))
- (defun c-unfind-enclosing-token (pos)
-
-
-
- (save-excursion
- (let ((tok-beg (progn (goto-char pos)
- (and (c-beginning-of-current-token) (point))))
- (tok-end (progn (goto-char pos)
- (and (c-end-of-current-token) (point)))))
- (when (and tok-beg tok-end)
- (c-unfind-type (buffer-substring-no-properties tok-beg tok-end))
- t))))
- (defun c-unfind-coalesced-tokens (beg end)
-
-
-
-
- (or (c-partial-ws-p beg end)
- (save-excursion
- (progn
- (goto-char beg)
- (or (eq beg (point-min))
- (c-skip-ws-backward (1- beg))
- (/= (point) beg)
- (= (c-backward-token-2) 1)
- (c-unfind-type (buffer-substring-no-properties
- (point) beg)))
- (goto-char end)
- (or (eq end (point-max))
- (c-skip-ws-forward (1+ end))
- (/= (point) end)
- (progn (forward-char) (c-end-of-current-token) nil)
- (c-unfind-type (buffer-substring-no-properties
- end (point))))))))
- (defvar c-maybe-stale-found-type nil)
- (make-variable-buffer-local 'c-maybe-stale-found-type)
- (defun c-basic-common-init (mode default-style)
- "Do the necessary initialization for the syntax handling routines
- and the line breaking/filling code. Intended to be used by other
- packages that embed CC Mode.
- MODE is the CC Mode flavor to set up, e.g. 'c-mode or 'java-mode.
- DEFAULT-STYLE tells which indentation style to install. It has the
- same format as `c-default-style'.
- Note that `c-init-language-vars' must be called before this function.
- This function cannot do that since `c-init-language-vars' is a macro
- that requires a literal mode spec at compile time."
- (setq c-buffer-is-cc-mode mode)
-
-
- (make-local-variable 'comment-start)
- (make-local-variable 'comment-end)
- (make-local-variable 'comment-start-skip)
- (make-local-variable 'paragraph-start)
- (make-local-variable 'paragraph-separate)
- (make-local-variable 'paragraph-ignore-fill-prefix)
- (make-local-variable 'adaptive-fill-mode)
- (make-local-variable 'adaptive-fill-regexp)
- (make-local-variable 'fill-paragraph-handle-comment)
-
- (set (make-local-variable 'parse-sexp-ignore-comments) t)
- (set (make-local-variable 'indent-line-function) 'c-indent-line)
- (set (make-local-variable 'indent-region-function) 'c-indent-region)
- (set (make-local-variable 'normal-auto-fill-function) 'c-do-auto-fill)
- (set (make-local-variable 'comment-multi-line) t)
- (set (make-local-variable 'comment-line-break-function)
- 'c-indent-new-comment-line)
-
- (setq fill-paragraph-handle-comment nil)
-
-
-
- (set (make-local-variable 'fill-paragraph-function) 'c-fill-paragraph)
-
- (c-state-cache-init)
- (when (or c-recognize-<>-arglists
- (c-major-mode-is 'awk-mode)
- (c-major-mode-is '(java-mode c-mode c++-mode objc-mode)))
-
-
-
-
-
-
-
-
- (when (boundp 'parse-sexp-lookup-properties)
- (set (make-local-variable 'parse-sexp-lookup-properties) t))
-
- (when (boundp 'lookup-syntax-properties)
- (set (make-local-variable 'lookup-syntax-properties) t)))
-
-
- (when (boundp 'text-property-default-nonsticky)
- (mapc (lambda (tprop)
- (unless (assq tprop text-property-default-nonsticky)
- (set (make-local-variable 'text-property-default-nonsticky)
- (cons `(,tprop . t) text-property-default-nonsticky))))
- '(syntax-table category c-type)))
-
-
-
-
- (c-clear-found-types)
-
- (let ((style (cc-choose-style-for-mode mode default-style)))
-
-
-
-
-
-
-
- (c-set-style style (not (or c-old-style-variable-behavior
- (and (not c-style-variables-are-local-p)
- c-indentation-style
- (not (string-equal c-indentation-style
- style)))))))
- (c-setup-paragraph-variables)
-
-
- (setq c-offsets-alist (copy-alist c-offsets-alist))
-
- (set (make-local-variable 'comment-indent-function) 'c-comment-indent)
- (c-update-modeline)
-
-
- (when (featurep 'xemacs)
- (make-local-hook 'before-change-functions)
- (make-local-hook 'after-change-functions))
- (add-hook 'before-change-functions 'c-before-change nil t)
- (add-hook 'after-change-functions 'c-after-change nil t)
- (set (make-local-variable 'font-lock-extend-after-change-region-function)
- 'c-extend-after-change-region))
-
- (defun c-setup-doc-comment-style ()
- "Initialize the variables that depend on the value of `c-doc-comment-style'."
- (when (and (featurep 'font-lock)
- (symbol-value 'font-lock-mode))
-
- (font-lock-mode 0)
- (font-lock-mode 1)))
- (defvar c-new-BEG 0)
- (make-variable-buffer-local 'c-new-BEG)
- (defvar c-new-END 0)
- (make-variable-buffer-local 'c-new-END)
- (defun c-common-init (&optional mode)
- "Common initialization for all CC Mode modes.
- In addition to the work done by `c-basic-common-init' and
- `c-font-lock-init', this function sets up various other things as
- customary in CC Mode modes but which aren't strictly necessary for CC
- Mode to operate correctly.
- MODE is the symbol for the mode to initialize, like 'c-mode. See
- `c-basic-common-init' for details. It's only optional to be
- compatible with old code; callers should always specify it."
- (unless mode
-
-
- (c-init-language-vars-for 'c-mode))
- (c-basic-common-init mode c-default-style)
- (when mode
-
- (c-font-lock-init))
-
- (save-restriction
- (widen)
- (setq c-new-BEG (point-min))
- (setq c-new-END (point-max))
- (save-excursion
- (mapc (lambda (fn)
- (funcall fn (point-min) (point-max)))
- c-get-state-before-change-functions)
- (mapc (lambda (fn)
- (funcall fn (point-min) (point-max)
- (- (point-max) (point-min))))
- c-before-font-lock-functions)))
- (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
- (set (make-local-variable 'outline-level) 'c-outline-level)
- (let ((rfn (assq mode c-require-final-newline)))
- (when rfn
- (and (cdr rfn)
- (set (make-local-variable 'require-final-newline)
- mode-require-final-newline)))))
- (defun c-count-cfss (lv-alist)
-
-
- (let ((elt-ptr lv-alist) elt (cownt 0))
- (while elt-ptr
- (setq elt (car elt-ptr)
- elt-ptr (cdr elt-ptr))
- (when (eq (car elt) 'c-file-style)
- (setq cownt (1+ cownt))))
- cownt))
- (defun c-before-hack-hook ()
- "Set the CC Mode style and \"offsets\" when in the buffer's local variables.
- They are set only when, respectively, the pseudo variables
- `c-file-style' and `c-file-offsets' are present in the list.
- This function is called from the hook `before-hack-local-variables-hook'."
- (when c-buffer-is-cc-mode
- (let ((mode-cons (assq 'mode file-local-variables-alist))
- (stile (cdr (assq 'c-file-style file-local-variables-alist)))
- (offsets (cdr (assq 'c-file-offsets file-local-variables-alist))))
- (when mode-cons
- (hack-one-local-variable (car mode-cons) (cdr mode-cons))
- (setq file-local-variables-alist
- (delq mode-cons file-local-variables-alist)))
- (when stile
- (or (stringp stile) (error "c-file-style is not a string"))
- (if (boundp 'dir-local-variables-alist)
-
-
- (let ((cfs-in-file-and-dir-count
- (c-count-cfss file-local-variables-alist))
- (cfs-in-dir-count (c-count-cfss dir-local-variables-alist)))
- (c-set-style stile
- (and (= cfs-in-file-and-dir-count cfs-in-dir-count)
- 'keep-defaults)))
- (c-set-style stile)))
- (when offsets
- (mapc
- (lambda (langentry)
- (let ((langelem (car langentry))
- (offset (cdr langentry)))
- (c-set-offset langelem offset)))
- offsets)))))
- (defun c-remove-any-local-eval-or-mode-variables ()
-
-
-
-
-
-
-
-
- (goto-char (point-max))
- (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
- (let (lv-point (prefix "") (suffix ""))
- (when (let ((case-fold-search t))
- (search-forward "Local Variables:" nil t))
- (setq lv-point (point))
-
-
- (skip-chars-forward " \t")
- (or (eolp)
- (setq suffix (buffer-substring (point)
- (progn (end-of-line) (point)))))
- (goto-char (match-beginning 0))
- (or (bolp)
- (setq prefix
- (buffer-substring (point)
- (progn (beginning-of-line) (point)))))
- (while (search-forward-regexp
- (concat "^[ \t]*"
- (regexp-quote prefix)
- "\\(mode\\|eval\\):.*"
- (regexp-quote suffix)
- "$")
- nil t)
- (forward-line 0)
- (delete-region (point) (progn (forward-line) (point)))))
-
- (unless (and lv-point
- (progn (goto-char lv-point)
- (forward-line 0)
- (bobp)))
- (goto-char (point-min))
- (unless (eobp)
- (delete-region (point) (progn (forward-line) (point)))))))
- (defun c-postprocess-file-styles ()
- "Function that post processes relevant file local variables in CC Mode.
- Currently, this function simply applies any style and offset settings
- found in the file's Local Variable list. It first applies any style
- setting found in `c-file-style', then it applies any offset settings
- it finds in `c-file-offsets'.
- Note that the style variables are always made local to the buffer."
-
- (when c-buffer-is-cc-mode
- (if (or c-file-style c-file-offsets)
- (c-make-styles-buffer-local t))
- (when c-file-style
- (or (stringp c-file-style)
- (error "c-file-style is not a string"))
- (c-set-style c-file-style))
- (and c-file-offsets
- (mapc
- (lambda (langentry)
- (let ((langelem (car langentry))
- (offset (cdr langentry)))
- (c-set-offset langelem offset)))
- c-file-offsets))
-
-
-
-
-
-
-
-
-
-
-
-
-
- (if (or c-file-style c-file-offsets)
- (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))))
- (if (boundp 'before-hack-local-variables-hook)
- (add-hook 'before-hack-local-variables-hook 'c-before-hack-hook)
- (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles))
- (defmacro c-run-mode-hooks (&rest hooks)
-
-
- (if (cc-bytecomp-fboundp 'run-mode-hooks)
- `(run-mode-hooks ,@hooks)
- `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
- (defvar c-old-BOM 0)
- (make-variable-buffer-local 'c-old-BOM)
- (defvar c-old-EOM 0)
- (make-variable-buffer-local 'c-old-EOM)
- (defun c-extend-region-for-CPP (beg end)
-
-
-
-
-
-
-
-
-
-
- (goto-char beg)
- (c-beginning-of-macro)
- (setq c-old-BOM (point))
- (goto-char end)
- (when (c-beginning-of-macro)
- (c-end-of-macro)
- (or (eobp) (forward-char)))
-
- (setq c-old-EOM (point)))
- (defun c-extend-font-lock-region-for-macros (begg endd &optional old-len)
-
-
-
-
-
-
-
-
- (let (limits new-beg new-end)
- (goto-char c-old-BOM)
- (setq new-beg
- (min begg
- (if (setq limits (c-state-literal-at (point)))
- (cdr limits)
- (point))))
- (goto-char endd)
- (if (setq limits (c-state-literal-at (point)))
- (goto-char (car limits)))
- (if (c-beginning-of-macro)
- (c-end-of-macro))
- (setq new-end (max endd
- (if old-len
- (+ (- c-old-EOM old-len) (- endd begg))
- c-old-EOM)
- (point)))
- (cons new-beg new-end)))
- (defun c-neutralize-CPP-line (beg end)
-
-
-
-
-
-
-
-
- (save-excursion
- (let (s)
- (while
- (progn
- (setq s (parse-partial-sexp beg end -1))
- (cond
- ((< (nth 0 s) 0)
- (c-put-char-property (1- (point)) 'syntax-table '(1))
- t)
- ((nth 3 s)
- (c-put-char-property (nth 8 s) 'syntax-table '(1))
- t)
- ((> (nth 0 s) 0)
- (c-put-char-property (nth 1 s) 'syntax-table '(1))
- t)
- (t nil)))))))
- (defun c-neutralize-syntax-in-and-mark-CPP (begg endd old-len)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (c-save-buffer-state (new-bounds)
-
-
-
- (setq new-bounds (c-extend-font-lock-region-for-macros
- c-new-BEG c-new-END old-len))
- (setq c-new-BEG (max (car new-bounds) (c-determine-limit 500 begg))
- c-new-END (min (cdr new-bounds) (c-determine-+ve-limit 500 endd)))
-
- (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))
- (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter)
-
-
- (goto-char c-new-BEG)
- (let ((pps-position c-new-BEG) pps-state mbeg)
- (while (and (< (point) c-new-END)
- (search-forward-regexp c-anchored-cpp-prefix c-new-END t))
-
- (setq pps-state
- (parse-partial-sexp pps-position (point) nil nil pps-state)
- pps-position (point))
- (unless (or (nth 3 pps-state)
- (nth 4 pps-state))
- (goto-char (match-beginning 0))
- (setq mbeg (point))
- (if (> (c-syntactic-end-of-macro) mbeg)
- (progn
- (c-neutralize-CPP-line mbeg (point))
- (c-set-cpp-delimiters mbeg (point))
-
- )
- (forward-line))
- )))))
- (defun c-before-change (beg end)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (setq c-maybe-stale-found-type nil)
- (save-restriction
- (save-match-data
- (widen)
- (save-excursion
-
- (c-unfind-enclosing-token beg)
- (c-unfind-enclosing-token end)
-
- (when (< beg end)
- (c-unfind-coalesced-tokens beg end))
-
-
-
-
-
-
- (let (lim
- type type-pos
- marked-id term-pos
- (end1
- (or (and (eq (get-text-property end 'face) 'font-lock-comment-face)
- (previous-single-property-change end 'face))
- end)))
- (when (>= end1 beg)
-
- (while
- (and (/= (skip-chars-backward "^;{}") 0)
- (> (point) (point-min))
- (memq (c-get-char-property (1- (point)) 'face)
- '(font-lock-comment-face font-lock-string-face))))
- (setq lim (max (point-min) (1- (point))))
-
- (when (and (> end1 (point-min))
- (setq type-pos
- (if (get-text-property (1- end1) 'c-type)
- end1
- (previous-single-property-change end1 'c-type nil lim))))
- (setq type (get-text-property (max (1- type-pos) lim) 'c-type))
- (when (memq type '(c-decl-id-start c-decl-type-start))
-
- (goto-char (1- type-pos))
- (setq marked-id
- (when (looking-at "\\(\\sw\\|\\s_\\)")
- (c-beginning-of-current-token)
- (buffer-substring-no-properties (point) type-pos)))
- (goto-char end1)
- (skip-chars-forward "^;{}")
- (setq lim (point))
- (setq term-pos
- (or (next-single-property-change end 'c-type nil lim) lim))
- (setq c-maybe-stale-found-type
- (list type marked-id
- type-pos term-pos
- (buffer-substring-no-properties type-pos term-pos)
- (buffer-substring-no-properties beg end)))))))
- (if c-get-state-before-change-functions
- (mapc (lambda (fn)
- (funcall fn beg end))
- c-get-state-before-change-functions))
- ))))
- (defvar c-in-after-change-fontification nil)
- (make-variable-buffer-local 'c-in-after-change-fontification)
- (defun c-after-change (beg end old-len)
-
-
-
-
-
-
-
-
-
-
-
-
- (c-save-buffer-state ()
-
-
-
- (save-restriction
- (save-match-data
- (widen)
- (when (> end (point-max))
-
-
-
-
- (setq end (point-max))
- (when (> beg end)
- (setq beg end)))
-
-
-
- (c-clear-char-property-with-value beg end 'syntax-table
- c-<-as-paren-syntax)
- (c-clear-char-property-with-value beg end 'syntax-table
- c->-as-paren-syntax)
- (c-trim-found-types beg end old-len)
- (c-invalidate-sws-region-after beg end)
- (c-invalidate-state-cache beg)
- (c-invalidate-find-decl-cache beg)
- (when c-recognize-<>-arglists
- (c-after-change-check-<>-operators beg end))
-
-
- (setq c-new-BEG beg
- c-new-END end)
- (setq c-in-after-change-fontification t)
- (save-excursion
- (mapc (lambda (fn)
- (funcall fn beg end old-len))
- c-before-font-lock-functions))))))
- (defun c-set-fl-decl-start (pos)
-
-
-
-
-
-
-
-
-
- (let ((lit-limits (c-literal-limits))
- (new-pos pos)
- bod-lim bo-decl)
- (goto-char (c-point 'bol new-pos))
- (when lit-limits
- (goto-char (car lit-limits)))
- (setq bod-lim (c-determine-limit 500))
- (while
-
- (and
- (eq (car (c-beginning-of-decl-1 bod-lim)) 'same)
- (progn (setq bo-decl (point))
-
-
- (when (or (looking-at c-prefix-spec-kwds-re)
- (c-forward-type t))
-
- (setq new-pos (min new-pos bo-decl))
- (goto-char bo-decl))
- t)
-
- (progn
- (c-backward-syntactic-ws bod-lim)
- (and (> (point) bod-lim)
- (or (memq (char-before) '(?\( ?\[))
- (and (eq (char-before) ?\<)
- (eq (c-get-char-property
- (1- (point)) 'syntax-table)
- c-<-as-paren-syntax)))))
- (not (bobp)))
- (backward-char))
- new-pos))
- (defun c-change-set-fl-decl-start (beg end old-len)
-
-
-
-
- (if font-lock-mode
- (setq c-new-BEG (c-set-fl-decl-start c-new-BEG))))
- (defun c-context-set-fl-decl-start (beg end)
-
-
-
- (cons (c-set-fl-decl-start beg) end))
- (defvar c-standard-font-lock-fontify-region-function nil
- "Standard value of `font-lock-fontify-region-function'")
- (defun c-font-lock-fontify-region (beg end &optional verbose)
-
-
-
-
-
-
-
-
-
-
-
-
-
- (let ((new-beg beg) (new-end end) new-region case-fold-search)
- (if c-in-after-change-fontification
- (setq c-in-after-change-fontification nil)
- (save-restriction
- (widen)
- (save-excursion
- (mapc (lambda (fn)
- (setq new-region (funcall fn new-beg new-end))
- (setq new-beg (car new-region) new-end (cdr new-region)))
- c-before-context-fontification-functions))))
- (funcall c-standard-font-lock-fontify-region-function
- new-beg new-end verbose)))
- (defun c-after-font-lock-init ()
-
-
-
- (remove-hook 'after-change-functions 'c-after-change t)
- (add-hook 'after-change-functions 'c-after-change nil t)
- (setq c-standard-font-lock-fontify-region-function
- (default-value 'font-lock-fontify-region-function)))
- (defun c-font-lock-init ()
- "Set up the font-lock variables for using the font-lock support in CC Mode.
- This does not load the font-lock package. Use after
- `c-basic-common-init' and after cc-fonts has been loaded.
- This function is called from `c-common-init', once per mode initialization."
- (set (make-local-variable 'font-lock-defaults)
- `(,(if (c-major-mode-is 'awk-mode)
- ;; awk-mode currently has only one font lock level.
- 'awk-font-lock-keywords
- (mapcar 'c-mode-symbol
- '("font-lock-keywords" "font-lock-keywords-1"
- "font-lock-keywords-2" "font-lock-keywords-3")))
- nil nil
- ,c-identifier-syntax-modifications
- c-beginning-of-syntax
- (font-lock-mark-block-function
- . c-mark-function)))
- (make-local-variable 'font-lock-fontify-region-function)
- (setq font-lock-fontify-region-function 'c-font-lock-fontify-region)
- (if (featurep 'xemacs)
- (make-local-hook 'font-lock-mode-hook))
- (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t))
- (defun c-extend-after-change-region (beg end old-len)
- "Extend the region to be fontified, if necessary."
-
-
-
-
-
-
-
-
-
- (cons c-new-BEG c-new-END))
- (defvar c-mode-syntax-table nil
- "Syntax table used in c-mode buffers.")
- (or c-mode-syntax-table
- (setq c-mode-syntax-table
- (funcall (c-lang-const c-make-mode-syntax-table c))))
- (defvar c-mode-abbrev-table nil
- "Abbreviation table used in c-mode buffers.")
- (c-define-abbrev-table 'c-mode-abbrev-table
- '(("else" "else" c-electric-continued-statement 0)
- ("while" "while" c-electric-continued-statement 0)))
- (defvar c-mode-map ()
- "Keymap used in c-mode buffers.")
- (if c-mode-map
- nil
- (setq c-mode-map (c-make-inherited-keymap))
-
- (define-key c-mode-map "\C-c\C-e" 'c-macro-expand)
- )
- (easy-menu-define c-c-menu c-mode-map "C Mode Commands"
- (cons "C" (c-lang-const c-mode-menu c)))
- (define-derived-mode c-mode prog-mode "C"
- "Major mode for editing K&R and ANSI C code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from a
- c-mode buffer. This automatically sets up a mail buffer with version
- information already added. You just need to add a description of the
- problem, including a reproducible test case, and send the message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `c-mode-hook'.
- Key bindings:
- \\{c-mode-map}"
- (c-initialize-cc-mode t)
- (set-syntax-table c-mode-syntax-table)
- (setq local-abbrev-table c-mode-abbrev-table
- abbrev-mode t)
- (use-local-map c-mode-map)
- (c-init-language-vars-for 'c-mode)
- (c-make-macro-with-semi-re)
- (c-common-init 'c-mode)
- (easy-menu-add c-c-menu)
- (cc-imenu-init cc-imenu-c-generic-expression)
- (c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
- (c-update-modeline))
- (defvar c++-mode-syntax-table nil
- "Syntax table used in c++-mode buffers.")
- (or c++-mode-syntax-table
- (setq c++-mode-syntax-table
- (funcall (c-lang-const c-make-mode-syntax-table c++))))
- (defvar c++-mode-abbrev-table nil
- "Abbreviation table used in c++-mode buffers.")
- (c-define-abbrev-table 'c++-mode-abbrev-table
- '(("else" "else" c-electric-continued-statement 0)
- ("while" "while" c-electric-continued-statement 0)
- ("catch" "catch" c-electric-continued-statement 0)))
- (defvar c++-mode-map ()
- "Keymap used in c++-mode buffers.")
- (if c++-mode-map
- nil
- (setq c++-mode-map (c-make-inherited-keymap))
-
- (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand)
- (define-key c++-mode-map "\C-c:" 'c-scope-operator)
- (define-key c++-mode-map "<" 'c-electric-lt-gt)
- (define-key c++-mode-map ">" 'c-electric-lt-gt))
- (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands"
- (cons "C++" (c-lang-const c-mode-menu c++)))
- (define-derived-mode c++-mode prog-mode "C++"
- "Major mode for editing C++ code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from a
- c++-mode buffer. This automatically sets up a mail buffer with
- version information already added. You just need to add a description
- of the problem, including a reproducible test case, and send the
- message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `c++-mode-hook'.
- Key bindings:
- \\{c++-mode-map}"
- (c-initialize-cc-mode t)
- (set-syntax-table c++-mode-syntax-table)
- (setq local-abbrev-table c++-mode-abbrev-table
- abbrev-mode t)
- (use-local-map c++-mode-map)
- (c-init-language-vars-for 'c++-mode)
- (c-make-macro-with-semi-re)
- (c-common-init 'c++-mode)
- (easy-menu-add c-c++-menu)
- (cc-imenu-init cc-imenu-c++-generic-expression)
- (c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook)
- (c-update-modeline))
- (defvar objc-mode-syntax-table nil
- "Syntax table used in objc-mode buffers.")
- (or objc-mode-syntax-table
- (setq objc-mode-syntax-table
- (funcall (c-lang-const c-make-mode-syntax-table objc))))
- (defvar objc-mode-abbrev-table nil
- "Abbreviation table used in objc-mode buffers.")
- (c-define-abbrev-table 'objc-mode-abbrev-table
- '(("else" "else" c-electric-continued-statement 0)
- ("while" "while" c-electric-continued-statement 0)))
- (defvar objc-mode-map ()
- "Keymap used in objc-mode buffers.")
- (if objc-mode-map
- nil
- (setq objc-mode-map (c-make-inherited-keymap))
-
- (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand))
- (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands"
- (cons "ObjC" (c-lang-const c-mode-menu objc)))
- (define-derived-mode objc-mode prog-mode "ObjC"
- "Major mode for editing Objective C code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from an
- objc-mode buffer. This automatically sets up a mail buffer with
- version information already added. You just need to add a description
- of the problem, including a reproducible test case, and send the
- message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `objc-mode-hook'.
- Key bindings:
- \\{objc-mode-map}"
- (c-initialize-cc-mode t)
- (set-syntax-table objc-mode-syntax-table)
- (setq local-abbrev-table objc-mode-abbrev-table
- abbrev-mode t)
- (use-local-map objc-mode-map)
- (c-init-language-vars-for 'objc-mode)
- (c-make-macro-with-semi-re)
- (c-common-init 'objc-mode)
- (easy-menu-add c-objc-menu)
- (cc-imenu-init nil 'cc-imenu-objc-function)
- (c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook)
- (c-update-modeline))
- (defvar java-mode-syntax-table nil
- "Syntax table used in java-mode buffers.")
- (or java-mode-syntax-table
- (setq java-mode-syntax-table
- (funcall (c-lang-const c-make-mode-syntax-table java))))
- (defvar java-mode-abbrev-table nil
- "Abbreviation table used in java-mode buffers.")
- (c-define-abbrev-table 'java-mode-abbrev-table
- '(("else" "else" c-electric-continued-statement 0)
- ("while" "while" c-electric-continued-statement 0)
- ("catch" "catch" c-electric-continued-statement 0)
- ("finally" "finally" c-electric-continued-statement 0)))
- (defvar java-mode-map ()
- "Keymap used in java-mode buffers.")
- (if java-mode-map
- nil
- (setq java-mode-map (c-make-inherited-keymap))
-
- )
- (defconst c-Java-defun-prompt-regexp
- "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-+\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\\s-*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-zA-Z][^][ \t:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] \t]*\\)\\(\\s-*\\<throws\\>\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)[, \t\n\r\f\v]*\\)+\\)?\\s-*")
- (easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
- (cons "Java" (c-lang-const c-mode-menu java)))
- (define-derived-mode java-mode prog-mode "Java"
- "Major mode for editing Java code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from a
- java-mode buffer. This automatically sets up a mail buffer with
- version information already added. You just need to add a description
- of the problem, including a reproducible test case, and send the
- message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `java-mode-hook'.
- Key bindings:
- \\{java-mode-map}"
- (c-initialize-cc-mode t)
- (set-syntax-table java-mode-syntax-table)
- (setq local-abbrev-table java-mode-abbrev-table
- abbrev-mode t)
- (use-local-map java-mode-map)
- (c-init-language-vars-for 'java-mode)
- (c-common-init 'java-mode)
- (easy-menu-add c-java-menu)
- (cc-imenu-init cc-imenu-java-generic-expression)
- (c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook)
- (c-update-modeline))
- (defvar idl-mode-syntax-table nil
- "Syntax table used in idl-mode buffers.")
- (or idl-mode-syntax-table
- (setq idl-mode-syntax-table
- (funcall (c-lang-const c-make-mode-syntax-table idl))))
- (defvar idl-mode-abbrev-table nil
- "Abbreviation table used in idl-mode buffers.")
- (c-define-abbrev-table 'idl-mode-abbrev-table nil)
- (defvar idl-mode-map ()
- "Keymap used in idl-mode buffers.")
- (if idl-mode-map
- nil
- (setq idl-mode-map (c-make-inherited-keymap))
-
- )
- (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands"
- (cons "IDL" (c-lang-const c-mode-menu idl)))
- (define-derived-mode idl-mode prog-mode "IDL"
- "Major mode for editing CORBA's IDL, PSDL and CIDL code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from an
- idl-mode buffer. This automatically sets up a mail buffer with
- version information already added. You just need to add a description
- of the problem, including a reproducible test case, and send the
- message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `idl-mode-hook'.
- Key bindings:
- \\{idl-mode-map}"
- (c-initialize-cc-mode t)
- (set-syntax-table idl-mode-syntax-table)
- (setq local-abbrev-table idl-mode-abbrev-table)
- (use-local-map idl-mode-map)
- (c-init-language-vars-for 'idl-mode)
- (c-common-init 'idl-mode)
- (easy-menu-add c-idl-menu)
-
- (c-run-mode-hooks 'c-mode-common-hook 'idl-mode-hook)
- (c-update-modeline))
- (defvar pike-mode-syntax-table nil
- "Syntax table used in pike-mode buffers.")
- (or pike-mode-syntax-table
- (setq pike-mode-syntax-table
- (funcall (c-lang-const c-make-mode-syntax-table pike))))
- (defvar pike-mode-abbrev-table nil
- "Abbreviation table used in pike-mode buffers.")
- (c-define-abbrev-table 'pike-mode-abbrev-table
- '(("else" "else" c-electric-continued-statement 0)
- ("while" "while" c-electric-continued-statement 0)))
- (defvar pike-mode-map ()
- "Keymap used in pike-mode buffers.")
- (if pike-mode-map
- nil
- (setq pike-mode-map (c-make-inherited-keymap))
-
- (define-key pike-mode-map "\C-c\C-e" 'c-macro-expand))
- (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands"
- (cons "Pike" (c-lang-const c-mode-menu pike)))
- (define-derived-mode pike-mode prog-mode "Pike"
- "Major mode for editing Pike code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from a
- pike-mode buffer. This automatically sets up a mail buffer with
- version information already added. You just need to add a description
- of the problem, including a reproducible test case, and send the
- message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `pike-mode-hook'.
- Key bindings:
- \\{pike-mode-map}"
- (c-initialize-cc-mode t)
- (set-syntax-table pike-mode-syntax-table)
- (setq local-abbrev-table pike-mode-abbrev-table
- abbrev-mode t)
- (use-local-map pike-mode-map)
- (c-init-language-vars-for 'pike-mode)
- (c-common-init 'pike-mode)
- (easy-menu-add c-pike-menu)
-
- (c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook)
- (c-update-modeline))
- (defvar awk-mode-abbrev-table nil
- "Abbreviation table used in awk-mode buffers.")
- (c-define-abbrev-table 'awk-mode-abbrev-table
- '(("else" "else" c-electric-continued-statement 0)
- ("while" "while" c-electric-continued-statement 0)))
- (defvar awk-mode-map ()
- "Keymap used in awk-mode buffers.")
- (if awk-mode-map
- nil
- (setq awk-mode-map (c-make-inherited-keymap))
-
- (define-key awk-mode-map "#" 'self-insert-command)
- (define-key awk-mode-map "/" 'self-insert-command)
- (define-key awk-mode-map "*" 'self-insert-command)
- (define-key awk-mode-map "\C-c\C-n" 'undefined)
- (define-key awk-mode-map "\C-c\C-p" 'undefined)
- (define-key awk-mode-map "\C-c\C-u" 'undefined)
- (define-key awk-mode-map "\M-a" 'c-beginning-of-statement)
- (define-key awk-mode-map "\M-e" 'c-end-of-statement)
- (define-key awk-mode-map "\C-\M-a" 'c-awk-beginning-of-defun)
- (define-key awk-mode-map "\C-\M-e" 'c-awk-end-of-defun))
- (easy-menu-define c-awk-menu awk-mode-map "AWK Mode Commands"
- (cons "AWK" (c-lang-const c-mode-menu awk)))
- (defvar awk-mode-syntax-table)
- (declare-function c-awk-unstick-NL-prop "cc-awk" ())
- (define-derived-mode awk-mode prog-mode "AWK"
- "Major mode for editing AWK code.
- To submit a problem report, enter `\\[c-submit-bug-report]' from an
- awk-mode buffer. This automatically sets up a mail buffer with version
- information already added. You just need to add a description of the
- problem, including a reproducible test case, and send the message.
- To see what version of CC Mode you are running, enter `\\[c-version]'.
- The hook `c-mode-common-hook' is run with no args at mode
- initialization, then `awk-mode-hook'.
- Key bindings:
- \\{awk-mode-map}"
-
-
-
- :syntax-table nil
- (require 'cc-awk)
- (c-initialize-cc-mode t)
- (set-syntax-table awk-mode-syntax-table)
- (setq local-abbrev-table awk-mode-abbrev-table
- abbrev-mode t)
- (use-local-map awk-mode-map)
- (c-init-language-vars-for 'awk-mode)
- (c-common-init 'awk-mode)
- (c-awk-unstick-NL-prop)
- (c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook)
- (c-update-modeline))
- (defconst c-mode-help-address
- "bug-cc-mode@gnu.org"
- "Address(es) for CC Mode bug reports.")
- (defun c-version ()
- "Echo the current version of CC Mode in the minibuffer."
- (interactive)
- (message "Using CC Mode version %s" c-version)
- (c-keep-region-active))
- (defvar c-prepare-bug-report-hooks nil)
- (defvar reporter-prompt-for-summary-p)
- (defvar reporter-dont-compact-list)
- (defun c-submit-bug-report ()
- "Submit via mail a bug report on CC Mode."
- (interactive)
- (require 'reporter)
-
- (let ((reporter-prompt-for-summary-p t)
- (reporter-dont-compact-list '(c-offsets-alist))
- (style c-indentation-style)
- (c-features c-emacs-features))
- (and
- (if (y-or-n-p "Do you want to submit a report on CC Mode? ")
- t (message "") nil)
- (reporter-submit-bug-report
- c-mode-help-address
- (concat "CC Mode " c-version " (" mode-name ")")
- (let ((vars (append
- c-style-variables
- '(c-buffer-is-cc-mode
- c-tab-always-indent
- c-syntactic-indentation
- c-syntactic-indentation-in-macros
- c-ignore-auto-fill
- c-auto-align-backslashes
- c-backspace-function
- c-delete-function
- c-electric-pound-behavior
- c-default-style
- c-enable-xemacs-performance-kludge-p
- c-old-style-variable-behavior
- defun-prompt-regexp
- tab-width
- comment-column
- parse-sexp-ignore-comments
- parse-sexp-lookup-properties
- lookup-syntax-properties
- ;; A brain-damaged XEmacs only variable that, if
- ;; set to nil can cause all kinds of chaos.
- signal-error-on-buffer-boundary
- ;; Variables that affect line breaking and comments.
- auto-fill-mode
- auto-fill-function
- filladapt-mode
- comment-multi-line
- comment-start-skip
- fill-prefix
- fill-column
- paragraph-start
- adaptive-fill-mode
- adaptive-fill-regexp)
- nil)))
- (mapc (lambda (var) (unless (boundp var)
- (setq vars (delq var vars))))
- '(signal-error-on-buffer-boundary
- filladapt-mode
- defun-prompt-regexp
- font-lock-mode
- font-lock-maximum-decoration
- parse-sexp-lookup-properties
- lookup-syntax-properties))
- vars)
- (lambda ()
- (run-hooks 'c-prepare-bug-report-hooks)
- (insert (format "Buffer Style: %s\nc-emacs-features: %s\n"
- style c-features)))))))
- (cc-provide 'cc-mode)
|