aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann1999-12-21 09:08:41 +0000
committerGerd Moellmann1999-12-21 09:08:41 +0000
commit2936437d104ffd8bd99252d669563c267c7d3d2e (patch)
tree4eb309a7eb4a013cd71b13a789d2189ad7bf965e
parentffb0203dbf2c9474ee68b003ab75090fc6b459c0 (diff)
downloademacs-2936437d104ffd8bd99252d669563c267c7d3d2e.tar.gz
emacs-2936437d104ffd8bd99252d669563c267c7d3d2e.zip
*** empty log message ***
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/cus-load.el12
-rw-r--r--lisp/loaddefs.el147
-rw-r--r--lisp/progmodes/cwarn.el483
4 files changed, 609 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 198c486fd28..0ada0385064 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
11999-12-21 Gerd Moellmann <gerd@gnu.org>
2
3 * progmodes/cwarn.el: New file.
4
11999-12-19 Gerd Moellmann <gerd@gnu.org> 51999-12-19 Gerd Moellmann <gerd@gnu.org>
2 6
3 * bindings.el (completion-ignored-extensions): Add .pdf. 7 * bindings.el (completion-ignored-extensions): Add .pdf.
diff --git a/lisp/cus-load.el b/lisp/cus-load.el
index 8eb5cadf688..8eddad7989a 100644
--- a/lisp/cus-load.el
+++ b/lisp/cus-load.el
@@ -13,6 +13,7 @@
13(put 'nnmail 'custom-loads '("nnmail")) 13(put 'nnmail 'custom-loads '("nnmail"))
14(put 'chistory 'custom-loads '("chistory")) 14(put 'chistory 'custom-loads '("chistory"))
15(put 'shell-directories 'custom-loads '("shell")) 15(put 'shell-directories 'custom-loads '("shell"))
16(put 'footnote 'custom-loads '("footnote"))
16(put 'calendar-tex 'custom-loads '("cal-tex")) 17(put 'calendar-tex 'custom-loads '("cal-tex"))
17(put 'mail-hist 'custom-loads '("mail-hist")) 18(put 'mail-hist 'custom-loads '("mail-hist"))
18(put 'gnus-article-emphasis 'custom-loads '("gnus-art")) 19(put 'gnus-article-emphasis 'custom-loads '("gnus-art"))
@@ -77,6 +78,7 @@
77(put 'info-lookup 'custom-loads '("info-look")) 78(put 'info-lookup 'custom-loads '("info-look"))
78(put 'show-tabs 'custom-loads '("generic-x")) 79(put 'show-tabs 'custom-loads '("generic-x"))
79(put 'gnus-various 'custom-loads '("gnus-sum" "gnus")) 80(put 'gnus-various 'custom-loads '("gnus-sum" "gnus"))
81(put 'elide-head 'custom-loads '("elide-head"))
80(put 'vhdl-compile 'custom-loads '("vhdl-mode")) 82(put 'vhdl-compile 'custom-loads '("vhdl-mode"))
81(put 'font-lock-highlighting-faces 'custom-loads '("font-lock" "vhdl-mode")) 83(put 'font-lock-highlighting-faces 'custom-loads '("font-lock" "vhdl-mode"))
82(put 'flyspell 'custom-loads '("flyspell")) 84(put 'flyspell 'custom-loads '("flyspell"))
@@ -162,6 +164,7 @@
162(put 'gnus-threading 'custom-loads '("gnus-sum")) 164(put 'gnus-threading 'custom-loads '("gnus-sum"))
163(put 'hide-ifdef 'custom-loads '("hideif")) 165(put 'hide-ifdef 'custom-loads '("hideif"))
164(put 'vip 'custom-loads '("vip")) 166(put 'vip 'custom-loads '("vip"))
167(put 'smerge 'custom-loads '("smerge-mode"))
165(put 'spell 'custom-loads '("spell")) 168(put 'spell 'custom-loads '("spell"))
166(put 'rmail-headers 'custom-loads '("rmail")) 169(put 'rmail-headers 'custom-loads '("rmail"))
167(put 'gnus-score-decay 'custom-loads '("gnus-score")) 170(put 'gnus-score-decay 'custom-loads '("gnus-score"))
@@ -214,6 +217,7 @@
214(put 'PostScript-interaction 'custom-loads '("ps-mode")) 217(put 'PostScript-interaction 'custom-loads '("ps-mode"))
215(put 'ps-print 'custom-loads '("ps-print")) 218(put 'ps-print 'custom-loads '("ps-print"))
216(put 'view 'custom-loads '("view" "calendar")) 219(put 'view 'custom-loads '("view" "calendar"))
220(put 'cwarn 'custom-loads '("cwarn"))
217(put 'gnus-score-default 'custom-loads '("gnus-score" "gnus-sum")) 221(put 'gnus-score-default 'custom-loads '("gnus-score" "gnus-sum"))
218(put 'nnmail-duplicate 'custom-loads '("nnmail")) 222(put 'nnmail-duplicate 'custom-loads '("nnmail"))
219(put 'handwrite 'custom-loads '("handwrite")) 223(put 'handwrite 'custom-loads '("handwrite"))
@@ -245,7 +249,7 @@
245(put 'gnus-summary-mail 'custom-loads '("gnus-sum")) 249(put 'gnus-summary-mail 'custom-loads '("gnus-sum"))
246(put 'apropos 'custom-loads '("apropos")) 250(put 'apropos 'custom-loads '("apropos"))
247(put 'gomoku 'custom-loads '("gomoku")) 251(put 'gomoku 'custom-loads '("gomoku"))
248(put 'tools 'custom-loads '("add-log" "compare-w" "diff-mode" "diff" "ediff" "emerge" "gud" "rcompile" "speedbar" "tempo" "tooltip" "vc" "which-func" "copyright" "compile" "etags" "make-mode")) 252(put 'tools 'custom-loads '("add-log" "compare-w" "diff-mode" "diff" "ediff" "elide-head" "emerge" "gud" "rcompile" "smerge-mode" "speedbar" "tempo" "tooltip" "vc" "which-func" "copyright" "compile" "etags" "make-mode"))
249(put 'gnus-topic 'custom-loads '("gnus-topic")) 253(put 'gnus-topic 'custom-loads '("gnus-topic"))
250(put 'sgml 'custom-loads '("sgml-mode")) 254(put 'sgml 'custom-loads '("sgml-mode"))
251(put 'keyboard 'custom-loads '("simple" "chistory" "type-break")) 255(put 'keyboard 'custom-loads '("simple" "chistory" "type-break"))
@@ -371,7 +375,7 @@
371(put 'archive-zoo 'custom-loads '("arc-mode")) 375(put 'archive-zoo 'custom-loads '("arc-mode"))
372(put 'gnus-group-level 'custom-loads '("gnus")) 376(put 'gnus-group-level 'custom-loads '("gnus"))
373(put 'bibtex 'custom-loads '("bibtex")) 377(put 'bibtex 'custom-loads '("bibtex"))
374(put 'faces 'custom-loads '("faces" "facemenu" "cus-edit" "font-lock" "hilit-chg" "paren" "ps-print" "speedbar" "wid-edit" "gnus" "message" "fontset" "make-mode")) 378(put 'faces 'custom-loads '("faces" "facemenu" "cus-edit" "font-lock" "hilit-chg" "paren" "ps-print" "speedbar" "wid-edit" "gnus" "message" "fontset" "cwarn" "make-mode"))
375(put 'fill-comments 'custom-loads '("simple")) 379(put 'fill-comments 'custom-loads '("simple"))
376(put 'gnus-summary-various 'custom-loads '("gnus-sum")) 380(put 'gnus-summary-various 'custom-loads '("gnus-sum"))
377(put 'applications 'custom-loads '("calendar" "cus-edit" "uniquify" "spell")) 381(put 'applications 'custom-loads '("calendar" "cus-edit" "uniquify" "spell"))
@@ -388,7 +392,7 @@
388(put 'debug 'custom-loads '("debug")) 392(put 'debug 'custom-loads '("debug"))
389(put 'vhdl-electric 'custom-loads '("vhdl-mode")) 393(put 'vhdl-electric 'custom-loads '("vhdl-mode"))
390(put 'gnus-extract-archive 'custom-loads '("gnus-uu")) 394(put 'gnus-extract-archive 'custom-loads '("gnus-uu"))
391(put 'message 'custom-loads '("startup" "message")) 395(put 'message 'custom-loads '("startup" "message" "footnote"))
392(put 'message-sending 'custom-loads '("message")) 396(put 'message-sending 'custom-loads '("message"))
393(put 'archive-arc 'custom-loads '("arc-mode")) 397(put 'archive-arc 'custom-loads '("arc-mode"))
394(put 'rmail-output 'custom-loads '("rmailout")) 398(put 'rmail-output 'custom-loads '("rmailout"))
@@ -433,7 +437,7 @@
433(put 'widget-button 'custom-loads '("wid-edit")) 437(put 'widget-button 'custom-loads '("wid-edit"))
434(put 'uniquify 'custom-loads '("uniquify")) 438(put 'uniquify 'custom-loads '("uniquify"))
435(put 'old-c++ 'custom-loads '("cplus-md")) 439(put 'old-c++ 'custom-loads '("cplus-md"))
436(put 'ps-print-font 'custom-loads '("ps-print")) 440(put 'ps-print-font 'custom-loads '("ps-print" "ps-vars"))
437(put 'vhdl-misc 'custom-loads '("vhdl-mode")) 441(put 'vhdl-misc 'custom-loads '("vhdl-mode"))
438(put 'dired-x 'custom-loads '("dired-x")) 442(put 'dired-x 'custom-loads '("dired-x"))
439(put 'spook 'custom-loads '("spook")) 443(put 'spook 'custom-loads '("spook"))
diff --git a/lisp/loaddefs.el b/lisp/loaddefs.el
index 4300756f561..686eb4a9601 100644
--- a/lisp/loaddefs.el
+++ b/lisp/loaddefs.el
@@ -983,7 +983,7 @@ a reflection." t nil)
983;;;;;; bookmark-load bookmark-save bookmark-write bookmark-delete 983;;;;;; bookmark-load bookmark-save bookmark-write bookmark-delete
984;;;;;; bookmark-insert bookmark-rename bookmark-insert-location 984;;;;;; bookmark-insert bookmark-rename bookmark-insert-location
985;;;;;; bookmark-relocate bookmark-jump bookmark-set) "bookmark" 985;;;;;; bookmark-relocate bookmark-jump bookmark-set) "bookmark"
986;;;;;; "bookmark.el" (14415 13511)) 986;;;;;; "bookmark.el" (14419 37278))
987;;; Generated autoloads from bookmark.el 987;;; Generated autoloads from bookmark.el
988 (define-key ctl-x-map "rb" 'bookmark-jump) 988 (define-key ctl-x-map "rb" 'bookmark-jump)
989 (define-key ctl-x-map "rm" 'bookmark-set) 989 (define-key ctl-x-map "rm" 'bookmark-set)
@@ -1446,7 +1446,7 @@ Return a vector containing the lines from `bruce-phrases-file'." nil nil)
1446;;;### (autoloads (batch-byte-recompile-directory batch-byte-compile 1446;;;### (autoloads (batch-byte-recompile-directory batch-byte-compile
1447;;;;;; display-call-tree byte-compile compile-defun byte-compile-file 1447;;;;;; display-call-tree byte-compile compile-defun byte-compile-file
1448;;;;;; byte-recompile-directory byte-force-recompile) "bytecomp" 1448;;;;;; byte-recompile-directory byte-force-recompile) "bytecomp"
1449;;;;;; "emacs-lisp/bytecomp.el" (14297 56999)) 1449;;;;;; "emacs-lisp/bytecomp.el" (14425 19316))
1450;;; Generated autoloads from emacs-lisp/bytecomp.el 1450;;; Generated autoloads from emacs-lisp/bytecomp.el
1451 1451
1452(autoload (quote byte-force-recompile) "bytecomp" "\ 1452(autoload (quote byte-force-recompile) "bytecomp" "\
@@ -2238,7 +2238,7 @@ The return value is a vector of resulting CCL registers." nil nil)
2238;;;;;; checkdoc-continue checkdoc-start checkdoc-current-buffer 2238;;;;;; checkdoc-continue checkdoc-start checkdoc-current-buffer
2239;;;;;; checkdoc-eval-current-buffer checkdoc-message-interactive 2239;;;;;; checkdoc-eval-current-buffer checkdoc-message-interactive
2240;;;;;; checkdoc-interactive checkdoc) "checkdoc" "emacs-lisp/checkdoc.el" 2240;;;;;; checkdoc-interactive checkdoc) "checkdoc" "emacs-lisp/checkdoc.el"
2241;;;;;; (14398 50288)) 2241;;;;;; (14412 8749))
2242;;; Generated autoloads from emacs-lisp/checkdoc.el 2242;;; Generated autoloads from emacs-lisp/checkdoc.el
2243 2243
2244(autoload (quote checkdoc) "checkdoc" "\ 2244(autoload (quote checkdoc) "checkdoc" "\
@@ -2774,7 +2774,7 @@ Enable dynamic word-completion." t nil)
2774;;;### (autoloads (decompose-composite-char compose-last-chars compose-chars-after 2774;;;### (autoloads (decompose-composite-char compose-last-chars compose-chars-after
2775;;;;;; find-composition compose-chars decompose-string compose-string 2775;;;;;; find-composition compose-chars decompose-string compose-string
2776;;;;;; decompose-region compose-region) "composite" "composite.el" 2776;;;;;; decompose-region compose-region) "composite" "composite.el"
2777;;;;;; (14422 54140)) 2777;;;;;; (14422 57499))
2778;;; Generated autoloads from composite.el 2778;;; Generated autoloads from composite.el
2779 2779
2780(defconst reference-point-alist (quote ((tl . 0) (tc . 1) (tr . 2) (Bl . 3) (Bc . 4) (Br . 5) (bl . 6) (bc . 7) (br . 8) (cl . 9) (cc . 10) (cr . 11) (top-left . 0) (top-center . 1) (top-right . 2) (base-left . 3) (base-center . 4) (base-right . 5) (bottom-left . 6) (bottom-center . 7) (bottom-right . 8) (center-left . 9) (center-center . 10) (center-right . 11) (ml . 3) (mc . 10) (mr . 5) (mid-left . 3) (mid-center . 10) (mid-right . 5))) "\ 2780(defconst reference-point-alist (quote ((tl . 0) (tc . 1) (tr . 2) (Bl . 3) (Bc . 4) (Br . 5) (bl . 6) (bc . 7) (br . 8) (cl . 9) (cc . 10) (cr . 11) (top-left . 0) (top-center . 1) (top-right . 2) (base-left . 3) (base-center . 4) (base-right . 5) (bottom-left . 6) (bottom-center . 7) (bottom-right . 8) (center-left . 9) (center-center . 10) (center-right . 11) (ml . 3) (mc . 10) (mr . 5) (mid-left . 3) (mid-center . 10) (mid-right . 5))) "\
@@ -3222,7 +3222,7 @@ With ARG, turn CRiSP mode on if ARG is positive, off otherwise." t nil)
3222;;;;;; customize-option-other-window customize-changed-options customize-option 3222;;;;;; customize-option-other-window customize-changed-options customize-option
3223;;;;;; customize-group-other-window customize-group customize customize-save-variable 3223;;;;;; customize-group-other-window customize-group customize customize-save-variable
3224;;;;;; customize-set-variable customize-set-value) "cus-edit" "cus-edit.el" 3224;;;;;; customize-set-variable customize-set-value) "cus-edit" "cus-edit.el"
3225;;;;;; (14417 23470)) 3225;;;;;; (14419 37278))
3226;;; Generated autoloads from cus-edit.el 3226;;; Generated autoloads from cus-edit.el
3227 (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'") 3227 (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
3228 3228
@@ -3401,6 +3401,32 @@ See `defface' for the format of SPEC." nil nil)
3401 3401
3402;;;*** 3402;;;***
3403 3403
3404;;;### (autoloads (global-cwarn-mode turn-on-cwarn-mode cwarn-mode)
3405;;;;;; "cwarn" "progmodes/cwarn.el" (14431 15379))
3406;;; Generated autoloads from progmodes/cwarn.el
3407
3408(autoload (quote cwarn-mode) "cwarn" "\
3409Minor mode that hightlight suspicious C and C++ constructions.
3410
3411Note, in addition to enabling this minor mode, the major mode must
3412be included in the variable `cwarn-configuration'. By default C and
3413C++ modes are included.
3414
3415With ARG, turn CWarn mode on if and only if arg is positive." t nil)
3416
3417(autoload (quote turn-on-cwarn-mode) "cwarn" "\
3418Turn on CWarn mode.
3419
3420This function is designed to be added to hooks, for example:
3421 (add-hook 'c-mode-hook 'turn-on-cwarn-mode)" nil nil)
3422
3423(autoload (quote global-cwarn-mode) "cwarn" "\
3424Hightlight suspicious C and C++ constructions in all buffers.
3425
3426With ARG, turn CWarn mode on globally if and only if arg is positive." t nil)
3427
3428;;;***
3429
3404;;;### (autoloads (standard-display-cyrillic-translit cyrillic-encode-alternativnyj-char 3430;;;### (autoloads (standard-display-cyrillic-translit cyrillic-encode-alternativnyj-char
3405;;;;;; cyrillic-encode-koi8-r-char setup-cyrillic-alternativnyj-environment 3431;;;;;; cyrillic-encode-koi8-r-char setup-cyrillic-alternativnyj-environment
3406;;;;;; setup-cyrillic-koi8-environment setup-cyrillic-iso-environment) 3432;;;;;; setup-cyrillic-koi8-environment setup-cyrillic-iso-environment)
@@ -3604,7 +3630,7 @@ $
3604;;;*** 3630;;;***
3605 3631
3606;;;### (autoloads (cancel-debug-on-entry debug-on-entry debug) "debug" 3632;;;### (autoloads (cancel-debug-on-entry debug-on-entry debug) "debug"
3607;;;;;; "emacs-lisp/debug.el" (14385 24854)) 3633;;;;;; "emacs-lisp/debug.el" (14428 55109))
3608;;; Generated autoloads from emacs-lisp/debug.el 3634;;; Generated autoloads from emacs-lisp/debug.el
3609 3635
3610(setq debugger (quote debug)) 3636(setq debugger (quote debug))
@@ -3815,7 +3841,7 @@ to provide correct modes for autoloaded files." nil nil)
3815;;;;;; devanagari-decompose-string char-to-glyph-devanagari indian-to-devanagari-string 3841;;;;;; devanagari-decompose-string char-to-glyph-devanagari indian-to-devanagari-string
3816;;;;;; devanagari-to-indian-region indian-to-devanagari-region devanagari-to-indian 3842;;;;;; devanagari-to-indian-region indian-to-devanagari-region devanagari-to-indian
3817;;;;;; indian-to-devanagari setup-devanagari-environment) "devan-util" 3843;;;;;; indian-to-devanagari setup-devanagari-environment) "devan-util"
3818;;;;;; "language/devan-util.el" (14422 54140)) 3844;;;;;; "language/devan-util.el" (14423 51006))
3819;;; Generated autoloads from language/devan-util.el 3845;;; Generated autoloads from language/devan-util.el
3820 3846
3821(autoload (quote setup-devanagari-environment) "devan-util" "\ 3847(autoload (quote setup-devanagari-environment) "devan-util" "\
@@ -3931,7 +3957,7 @@ The backup file is the first file given to `diff'." t nil)
3931;;;*** 3957;;;***
3932 3958
3933;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "diff-mode.el" 3959;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "diff-mode.el"
3934;;;;;; (14412 45411)) 3960;;;;;; (14419 37278))
3935;;; Generated autoloads from diff-mode.el 3961;;; Generated autoloads from diff-mode.el
3936 3962
3937(autoload (quote diff-mode) "diff-mode" "\ 3963(autoload (quote diff-mode) "diff-mode" "\
@@ -3951,7 +3977,7 @@ Minor mode for viewing/editing context diffs.
3951;;;;;; dired dired-copy-preserve-time dired-dwim-target dired-keep-marker-symlink 3977;;;;;; dired dired-copy-preserve-time dired-dwim-target dired-keep-marker-symlink
3952;;;;;; dired-keep-marker-hardlink dired-keep-marker-copy dired-keep-marker-rename 3978;;;;;; dired-keep-marker-hardlink dired-keep-marker-copy dired-keep-marker-rename
3953;;;;;; dired-trivial-filenames dired-ls-F-marks-symlinks dired-listing-switches) 3979;;;;;; dired-trivial-filenames dired-ls-F-marks-symlinks dired-listing-switches)
3954;;;;;; "dired" "dired.el" (14349 51336)) 3980;;;;;; "dired" "dired.el" (14425 19313))
3955;;; Generated autoloads from dired.el 3981;;; Generated autoloads from dired.el
3956 3982
3957(defvar dired-listing-switches "-al" "\ 3983(defvar dired-listing-switches "-al" "\
@@ -4055,7 +4081,7 @@ Like `dired' but returns the dired buffer as value, does not select it." nil nil
4055;;;;;; dired-do-compress dired-compress-file dired-do-kill-lines 4081;;;;;; dired-do-compress dired-compress-file dired-do-kill-lines
4056;;;;;; dired-do-shell-command dired-do-print dired-do-chown dired-do-chgrp 4082;;;;;; dired-do-shell-command dired-do-print dired-do-chown dired-do-chgrp
4057;;;;;; dired-do-chmod dired-backup-diff dired-diff) "dired-aux" 4083;;;;;; dired-do-chmod dired-backup-diff dired-diff) "dired-aux"
4058;;;;;; "dired-aux.el" (14415 3380)) 4084;;;;;; "dired-aux.el" (14419 37278))
4059;;; Generated autoloads from dired-aux.el 4085;;; Generated autoloads from dired-aux.el
4060 4086
4061(autoload (quote dired-diff) "dired-aux" "\ 4087(autoload (quote dired-diff) "dired-aux" "\
@@ -4992,8 +5018,8 @@ Unequivocally turn on eldoc-mode (see variable documentation)." t nil)
4992 5018
4993;;;*** 5019;;;***
4994 5020
4995;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (14409 5021;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (14425
4996;;;;;; 5684)) 5022;;;;;; 19313))
4997;;; Generated autoloads from elide-head.el 5023;;; Generated autoloads from elide-head.el
4998 5024
4999(autoload (quote elide-head) "elide-head" "\ 5025(autoload (quote elide-head) "elide-head" "\
@@ -5579,7 +5605,7 @@ The magic number of such a command displays all lines but itself." t nil)
5579;;;*** 5605;;;***
5580 5606
5581;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot 5607;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot
5582;;;;;; expand-add-abbrevs) "expand" "expand.el" (14001 49633)) 5608;;;;;; expand-add-abbrevs) "expand" "expand.el" (14428 51143))
5583;;; Generated autoloads from expand.el 5609;;; Generated autoloads from expand.el
5584 5610
5585(autoload (quote expand-add-abbrevs) "expand" "\ 5611(autoload (quote expand-add-abbrevs) "expand" "\
@@ -5684,7 +5710,7 @@ with no args, if that value is non-nil." t nil)
5684;;;;;; facemenu-remove-special facemenu-remove-all facemenu-remove-face-props 5710;;;;;; facemenu-remove-special facemenu-remove-all facemenu-remove-face-props
5685;;;;;; facemenu-set-read-only facemenu-set-intangible facemenu-set-invisible 5711;;;;;; facemenu-set-read-only facemenu-set-intangible facemenu-set-invisible
5686;;;;;; facemenu-set-face-from-menu facemenu-set-background facemenu-set-foreground 5712;;;;;; facemenu-set-face-from-menu facemenu-set-background facemenu-set-foreground
5687;;;;;; facemenu-set-face) "facemenu" "facemenu.el" (14411 63600)) 5713;;;;;; facemenu-set-face) "facemenu" "facemenu.el" (14412 8701))
5688;;; Generated autoloads from facemenu.el 5714;;; Generated autoloads from facemenu.el
5689 (define-key global-map "\M-g" 'facemenu-keymap) 5715 (define-key global-map "\M-g" 'facemenu-keymap)
5690 (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap) 5716 (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap)
@@ -5890,7 +5916,7 @@ you can set feedmail-queue-reminder-alist to nil." t nil)
5890;;;*** 5916;;;***
5891 5917
5892;;;### (autoloads (dired-at-point ffap-at-mouse ffap-menu find-file-at-point 5918;;;### (autoloads (dired-at-point ffap-at-mouse ffap-menu find-file-at-point
5893;;;;;; ffap-next) "ffap" "ffap.el" (14411 58300)) 5919;;;;;; ffap-next) "ffap" "ffap.el" (14412 8705))
5894;;; Generated autoloads from ffap.el 5920;;; Generated autoloads from ffap.el
5895 5921
5896(autoload (quote ffap-next) "ffap" "\ 5922(autoload (quote ffap-next) "ffap" "\
@@ -6278,7 +6304,7 @@ in your `~/.emacs' file, replacing [f7] by your favourite key:
6278;;;### (autoloads (font-lock-fontify-buffer global-font-lock-mode 6304;;;### (autoloads (font-lock-fontify-buffer global-font-lock-mode
6279;;;;;; global-font-lock-mode font-lock-remove-keywords font-lock-add-keywords 6305;;;;;; global-font-lock-mode font-lock-remove-keywords font-lock-add-keywords
6280;;;;;; turn-on-font-lock font-lock-mode) "font-lock" "font-lock.el" 6306;;;;;; turn-on-font-lock font-lock-mode) "font-lock" "font-lock.el"
6281;;;;;; (14415 42514)) 6307;;;;;; (14424 65029))
6282;;; Generated autoloads from font-lock.el 6308;;; Generated autoloads from font-lock.el
6283 6309
6284(defvar font-lock-mode-hook nil "\ 6310(defvar font-lock-mode-hook nil "\
@@ -6362,8 +6388,10 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
6362`objc-font-lock-extra-types' and `java-font-lock-extra-types'." nil nil) 6388`objc-font-lock-extra-types' and `java-font-lock-extra-types'." nil nil)
6363 6389
6364(autoload (quote font-lock-remove-keywords) "font-lock" "\ 6390(autoload (quote font-lock-remove-keywords) "font-lock" "\
6365Remove highlighting KEYWORDS from the current buffer. 6391Remove highlighting KEYWORDS for MAJOR-MODE.
6366A non-nil MODE is currently unsupported." nil nil) 6392
6393MAJOR-MODE should be a symbol, the major mode command name, such as `c-mode'
6394or nil. If nil, highlighting keywords are removed for the current buffer." nil nil)
6367 6395
6368(autoload (quote global-font-lock-mode) "font-lock" "\ 6396(autoload (quote global-font-lock-mode) "font-lock" "\
6369Toggle Global Font Lock mode. 6397Toggle Global Font Lock mode.
@@ -6391,7 +6419,7 @@ Fontify the current buffer the way the function `font-lock-mode' would." t nil)
6391;;;*** 6419;;;***
6392 6420
6393;;;### (autoloads (create-fontset-from-fontset-spec) "fontset" "international/fontset.el" 6421;;;### (autoloads (create-fontset-from-fontset-spec) "fontset" "international/fontset.el"
6394;;;;;; (14422 54140)) 6422;;;;;; (14423 50991))
6395;;; Generated autoloads from international/fontset.el 6423;;; Generated autoloads from international/fontset.el
6396 6424
6397(autoload (quote create-fontset-from-fontset-spec) "fontset" "\ 6425(autoload (quote create-fontset-from-fontset-spec) "fontset" "\
@@ -6414,6 +6442,26 @@ It returns a name of the created fontset." nil nil)
6414 6442
6415;;;*** 6443;;;***
6416 6444
6445;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (14423
6446;;;;;; 51009))
6447;;; Generated autoloads from mail/footnote.el
6448
6449(autoload (quote footnote-mode) "footnote" "\
6450Toggle footnote minor mode.
6451\\<message-mode-map>
6452key binding
6453--- -------
6454
6455\\[Footnote-renumber-footnotes] Footnote-renumber-footnotes
6456\\[Footnote-goto-footnote] Footnote-goto-footnote
6457\\[Footnote-delete-footnote] Footnote-delete-footnote
6458\\[Footnote-cycle-style] Footnote-cycle-style
6459\\[Footnote-back-to-message] Footnote-back-to-message
6460\\[Footnote-add-footnote] Footnote-add-footnote
6461" t nil)
6462
6463;;;***
6464
6417;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode) 6465;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode)
6418;;;;;; "forms" "forms.el" (14381 57540)) 6466;;;;;; "forms" "forms.el" (14381 57540))
6419;;; Generated autoloads from forms.el 6467;;; Generated autoloads from forms.el
@@ -7690,7 +7738,7 @@ of `inferior-lisp-program'). Runs the hooks from
7690 7738
7691;;;### (autoloads (Info-speedbar-browser Info-goto-emacs-key-command-node 7739;;;### (autoloads (Info-speedbar-browser Info-goto-emacs-key-command-node
7692;;;;;; Info-goto-emacs-command-node info-standalone info info-other-window) 7740;;;;;; Info-goto-emacs-command-node info-standalone info info-other-window)
7693;;;;;; "info" "info.el" (14411 63935)) 7741;;;;;; "info" "info.el" (14412 8715))
7694;;; Generated autoloads from info.el 7742;;; Generated autoloads from info.el
7695 7743
7696(autoload (quote info-other-window) "info" "\ 7744(autoload (quote info-other-window) "info" "\
@@ -8395,7 +8443,7 @@ Use \\[describe-mode] for more info." t nil)
8395;;;### (autoloads (lao-composition-function lao-transcribe-roman-to-lao-string 8443;;;### (autoloads (lao-composition-function lao-transcribe-roman-to-lao-string
8396;;;;;; lao-transcribe-single-roman-syllable-to-lao lao-compose-string 8444;;;;;; lao-transcribe-single-roman-syllable-to-lao lao-compose-string
8397;;;;;; setup-lao-environment) "lao-util" "language/lao-util.el" 8445;;;;;; setup-lao-environment) "lao-util" "language/lao-util.el"
8398;;;;;; (14422 54141)) 8446;;;;;; (14423 51007))
8399;;; Generated autoloads from language/lao-util.el 8447;;; Generated autoloads from language/lao-util.el
8400 8448
8401(autoload (quote setup-lao-environment) "lao-util" "\ 8449(autoload (quote setup-lao-environment) "lao-util" "\
@@ -8614,7 +8662,7 @@ Print region contents as with Unix command `lpr -p'.
8614 8662
8615;;;*** 8663;;;***
8616 8664
8617;;;### (autoloads nil "ls-lisp" "ls-lisp.el" (14251 18531)) 8665;;;### (autoloads nil "ls-lisp" "ls-lisp.el" (14425 19316))
8618;;; Generated autoloads from ls-lisp.el 8666;;; Generated autoloads from ls-lisp.el
8619 8667
8620(defvar ls-lisp-support-shell-wildcards t "\ 8668(defvar ls-lisp-support-shell-wildcards t "\
@@ -9530,7 +9578,7 @@ The file is saved in the directory `data-directory'." nil nil)
9530;;;;;; coding-system-post-read-conversion coding-system-eol-type-mnemonic 9578;;;;;; coding-system-post-read-conversion coding-system-eol-type-mnemonic
9531;;;;;; lookup-nested-alist set-nested-alist truncate-string-to-width 9579;;;;;; lookup-nested-alist set-nested-alist truncate-string-to-width
9532;;;;;; store-substring string-to-sequence) "mule-util" "international/mule-util.el" 9580;;;;;; store-substring string-to-sequence) "mule-util" "international/mule-util.el"
9533;;;;;; (14422 54140)) 9581;;;;;; (14423 50997))
9534;;; Generated autoloads from international/mule-util.el 9582;;; Generated autoloads from international/mule-util.el
9535 9583
9536(autoload (quote string-to-sequence) "mule-util" "\ 9584(autoload (quote string-to-sequence) "mule-util" "\
@@ -10376,8 +10424,8 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number
10376 10424
10377;;;### (autoloads (ps-mule-begin-page ps-mule-begin-job ps-mule-initialize 10425;;;### (autoloads (ps-mule-begin-page ps-mule-begin-job ps-mule-initialize
10378;;;;;; ps-mule-plot-composition ps-mule-plot-string ps-mule-set-ascii-font 10426;;;;;; ps-mule-plot-composition ps-mule-plot-string ps-mule-set-ascii-font
10379;;;;;; ps-mule-prepare-ascii-font) "ps-mule" "ps-mule.el" (14422 10427;;;;;; ps-mule-prepare-ascii-font) "ps-mule" "ps-mule.el" (14423
10380;;;;;; 54141)) 10428;;;;;; 50875))
10381;;; Generated autoloads from ps-mule.el 10429;;; Generated autoloads from ps-mule.el
10382 10430
10383(autoload (quote ps-mule-prepare-ascii-font) "ps-mule" "\ 10431(autoload (quote ps-mule-prepare-ascii-font) "ps-mule" "\
@@ -10430,8 +10478,8 @@ This checks if all multi-byte characters in the region are printable or not." ni
10430;;;;;; ps-nb-pages-buffer ps-line-lengths ps-despool ps-spool-region-with-faces 10478;;;;;; ps-nb-pages-buffer ps-line-lengths ps-despool ps-spool-region-with-faces
10431;;;;;; ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer 10479;;;;;; ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer
10432;;;;;; ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces 10480;;;;;; ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces
10433;;;;;; ps-print-buffer ps-paper-type) "ps-print" "ps-print.el" (14422 10481;;;;;; ps-print-buffer ps-paper-type) "ps-print" "ps-print.el" (14423
10434;;;;;; 54141)) 10482;;;;;; 50877))
10435;;; Generated autoloads from ps-print.el 10483;;; Generated autoloads from ps-print.el
10436 10484
10437(defvar ps-paper-type (quote letter) "\ 10485(defvar ps-paper-type (quote letter) "\
@@ -10565,7 +10613,7 @@ If EXTENSION is any other symbol, it is ignored." nil nil)
10565;;;### (autoloads (quail-update-leim-list-file quail-defrule-internal 10613;;;### (autoloads (quail-update-leim-list-file quail-defrule-internal
10566;;;;;; quail-defrule quail-install-map quail-define-rules quail-set-keyboard-layout 10614;;;;;; quail-defrule quail-install-map quail-define-rules quail-set-keyboard-layout
10567;;;;;; quail-define-package quail-use-package) "quail" "international/quail.el" 10615;;;;;; quail-define-package quail-use-package) "quail" "international/quail.el"
10568;;;;;; (14422 54140)) 10616;;;;;; (14423 51000))
10569;;; Generated autoloads from international/quail.el 10617;;; Generated autoloads from international/quail.el
10570 10618
10571(autoload (quote quail-use-package) "quail" "\ 10619(autoload (quote quail-use-package) "quail" "\
@@ -10891,7 +10939,7 @@ rectangle which were empty." t nil)
10891;;;*** 10939;;;***
10892 10940
10893;;;### (autoloads (reftex-mode turn-on-reftex) "reftex" "textmodes/reftex.el" 10941;;;### (autoloads (reftex-mode turn-on-reftex) "reftex" "textmodes/reftex.el"
10894;;;;;; (14315 19661)) 10942;;;;;; (14425 19353))
10895;;; Generated autoloads from textmodes/reftex.el 10943;;; Generated autoloads from textmodes/reftex.el
10896 10944
10897(autoload (quote turn-on-reftex) "reftex" "\ 10945(autoload (quote turn-on-reftex) "reftex" "\
@@ -10931,7 +10979,7 @@ on the menu bar.
10931;;;*** 10979;;;***
10932 10980
10933;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el" 10981;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el"
10934;;;;;; (14315 19188)) 10982;;;;;; (14425 19348))
10935;;; Generated autoloads from textmodes/reftex-cite.el 10983;;; Generated autoloads from textmodes/reftex-cite.el
10936 10984
10937(autoload (quote reftex-citation) "reftex-cite" "\ 10985(autoload (quote reftex-citation) "reftex-cite" "\
@@ -10943,6 +10991,8 @@ to `reftex-cite-format' and inserted into the buffer.
10943 10991
10944If NO-INSERT is non-nil, nothing is inserted, only the selected key returned. 10992If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
10945 10993
10994FORAT-KEY can be used to pre-select a citation format.
10995
10946When called with one or two `C-u' prefixes, first rescans the document. 10996When called with one or two `C-u' prefixes, first rescans the document.
10947When called with a numeric prefix, make that many citations. When 10997When called with a numeric prefix, make that many citations. When
10948called with point inside the braces of a `cite' command, it will 10998called with point inside the braces of a `cite' command, it will
@@ -10955,6 +11005,37 @@ While entering the regexp, completion on knows citation keys is possible.
10955 11005
10956;;;*** 11006;;;***
10957 11007
11008;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el"
11009;;;;;; (14425 19352))
11010;;; Generated autoloads from textmodes/reftex-index.el
11011
11012(autoload (quote reftex-index-phrases-mode) "reftex-index" "\
11013Major mode for managing the Index phrases of a LaTeX document.
11014This buffer was created with RefTeX.
11015
11016To insert new phrases, use
11017 - `C-c \\' in the LaTeX document to copy selection or word
11018 - `\\[reftex-index-new-phrase]' in the phrases buffer.
11019
11020To index phrases use one of:
11021
11022\\[reftex-index-this-phrase] index current phrase
11023\\[reftex-index-next-phrase] index next phrase (or N with prefix arg)
11024\\[reftex-index-all-phrases] index all phrases
11025\\[reftex-index-remaining-phrases] index current and following phrases
11026\\[reftex-index-region-phrases] index the phrases in the region
11027
11028You can sort the phrases in this buffer with \\[reftex-index-sort-phrases].
11029To display information about the phrase at point, use \\[reftex-index-phrases-info].
11030
11031For more information see the RefTeX User Manual.
11032
11033Here are all local bindings.
11034
11035\\{reftex-index-phrases-map}" t nil)
11036
11037;;;***
11038
10958;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el" 11039;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el"
10959;;;;;; (14334 30885)) 11040;;;;;; (14334 30885))
10960;;; Generated autoloads from emacs-lisp/regexp-opt.el 11041;;; Generated autoloads from emacs-lisp/regexp-opt.el
@@ -11850,7 +11931,7 @@ To work around that, do:
11850;;;*** 11931;;;***
11851 11932
11852;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el" 11933;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el"
11853;;;;;; (14419 41150)) 11934;;;;;; (14424 59273))
11854;;; Generated autoloads from progmodes/sh-script.el 11935;;; Generated autoloads from progmodes/sh-script.el
11855 11936
11856(put (quote sh-mode) (quote mode-class) (quote special)) 11937(put (quote sh-mode) (quote mode-class) (quote special))
@@ -13359,7 +13440,7 @@ Info `g*' command is inadequate." t nil)
13359;;;### (autoloads (thai-composition-function thai-post-read-conversion 13440;;;### (autoloads (thai-composition-function thai-post-read-conversion
13360;;;;;; thai-compose-buffer thai-compose-string thai-compose-region 13441;;;;;; thai-compose-buffer thai-compose-string thai-compose-region
13361;;;;;; setup-thai-environment) "thai-util" "language/thai-util.el" 13442;;;;;; setup-thai-environment) "thai-util" "language/thai-util.el"
13362;;;;;; (14422 54141)) 13443;;;;;; (14423 51008))
13363;;; Generated autoloads from language/thai-util.el 13444;;; Generated autoloads from language/thai-util.el
13364 13445
13365(autoload (quote setup-thai-environment) "thai-util" "\ 13446(autoload (quote setup-thai-environment) "thai-util" "\
@@ -13422,7 +13503,7 @@ a symbol as a valid THING." nil nil)
13422;;;;;; tibetan-compose-buffer tibetan-decompose-buffer tibetan-composition-function 13503;;;;;; tibetan-compose-buffer tibetan-decompose-buffer tibetan-composition-function
13423;;;;;; tibetan-compose-region tibetan-compose-string tibetan-transcription-to-tibetan 13504;;;;;; tibetan-compose-region tibetan-compose-string tibetan-transcription-to-tibetan
13424;;;;;; tibetan-tibetan-to-transcription tibetan-char-p setup-tibetan-environment) 13505;;;;;; tibetan-tibetan-to-transcription tibetan-char-p setup-tibetan-environment)
13425;;;;;; "tibet-util" "language/tibet-util.el" (14422 54141)) 13506;;;;;; "tibet-util" "language/tibet-util.el" (14423 51008))
13426;;; Generated autoloads from language/tibet-util.el 13507;;; Generated autoloads from language/tibet-util.el
13427 13508
13428(autoload (quote setup-tibetan-environment) "tibet-util" nil t nil) 13509(autoload (quote setup-tibetan-environment) "tibet-util" nil t nil)
diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el
new file mode 100644
index 00000000000..1828a5db6af
--- /dev/null
+++ b/lisp/progmodes/cwarn.el
@@ -0,0 +1,483 @@
1;;; cwarn.el --- Highlight suspicious C and C++ constructions.
2
3;; Copyright (C) 1999 Free Software Foundation, Inc.
4
5;; Author: Anders Lindgren <andersl@andersl.com>
6;; Keywords: c, languages, faces
7;; X-Url: http://www.andersl.com/emacs
8;; Version: 1.3.1 1999-12-13
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25;; Boston, MA 02111-1307, USA.
26
27;;; Commentary:
28
29;;{{{ Documentation
30
31;; Description:
32;;
33;; CWarn is a package that highlights suspicious C and C++ constructions.
34;;
35;; For example, take a look at the following piece of C code:
36;;
37;; if (x = 0);
38;; foo();
39;;
40;; The code contains two, possibly fatal, bugs. The first is that the
41;; assignment operator "=" is used as part of the test; the user
42;; probably ment to use the comparison operator "==".
43;;
44;; The second problem is that an extra semicolon is placed after
45;; closing parenthesis of the test expression. This makes the body of
46;; the if statement to be an empty statement, not the call to the
47;; function "foo", as the user probably intended.
48;;
49;; This package is capable of highlighting the following C and C++
50;; constructions:
51;;
52;; * Assignments inside expressions, including variations like "+=".
53;; * Semicolon following immediately after `if', `for', and `while'
54;; (except, of course, after a `do .. while' statement).
55;; * C++ functions with reference parameters.
56;;
57;; Note that none of the constructions highlighted (especially not C++
58;; reference parameters) are considered errors by the langauage
59;; definitions.
60
61;; Usage:
62;;
63;; CWarn is implemented as two minor modes: `cwarn-mode' and
64;; `global-cwarn-mode'. The former can be applied to individual buffers
65;; and the latter to all buffers.
66;;
67;; Activate this package by Customize, or by placing the following line
68;; into the appropriate init file:
69;;
70;; (global-cwarn-mode 1)
71;;
72;; Also, `font-lock-mode' or `global-font-lock-mode' must be enabled.
73
74;; Afterthought:
75;;
76;; After using this package for several weeks it feels as though I
77;; find stupid typo-style bugs while editing rather than at compile-
78;; or run-time, if I ever find them.
79;;
80;; On the other hand, I find myself using assignments inside
81;; expressions much more often than I used to do. The reason is that
82;; there is no risk of interpreting an assignment operator as a
83;; comparison ("hey, the assignment operator is red, duh!").
84
85;; Reporting bugs:
86;;
87;; Out of the last ten bugs you found, how many did you report?
88;;
89;; When reporting a bug, please:
90;;
91;; * Send a mail the maintainer of the package, or to the author
92;; if no maintainer exists.
93;; * Include the name of the package in the title of the mail, to
94;; simplify for the recipient.
95;; * State exactly what you did, what happened, and what you expected
96;; to see when you found the bug.
97;; * If the bug cause an error, set the variable `debug-on-error' to t,
98;; repreat the operations that triggered the error and include
99;; the backtrace in the letter.
100;; * If possible, include an example that activates the bug.
101;; * Should you speculate about the cause of the problem, please
102;; state explicitly that you are guessing.
103
104;;}}}
105
106;;; Code:
107
108;;{{{ Dependencies
109
110(eval-when-compile (require 'cl))
111
112(require 'custom)
113(require 'font-lock)
114(require 'cc-mode)
115
116;;}}}
117;;{{{ Variables
118
119(defgroup cwarn nil
120 "Highlight suspicious C and C++ constructions."
121 :group 'faces)
122
123(defvar cwarn-mode nil
124 "*Non-nil when Cwarn mode is active.
125
126Never set this variable directly, use the command `cwarn-mode'
127instead.")
128
129(defcustom global-cwarn-mode nil
130 "*When on, suspicious C and C++ constructions are highlighted.
131
132Set this variable using \\[customize] or use the command
133`global-cwarn-mode'."
134 :group 'cwarn
135 :initialize 'custom-initialize-default
136 :set '(lambda (symbol value)
137 (global-cwarn-mode (or value 0)))
138 :type 'boolean
139 :require 'cwarn)
140
141(defcustom cwarn-configuration
142 '((c-mode (not reference))
143 (c++-mode t))
144 "*List of items each describing which features are enable for a mode.
145Each item is on the form (mode featurelist), where featurelist can be
146on one of three forms:
147
148* A list of enabled features.
149* A list starting with the atom `not' followed by the features
150 which are not enabled.
151* The atom t, that represent that all features are enabled.
152
153See variable `cwarn-font-lock-feature-keywords-alist' for available
154features."
155 :group 'cwarn)
156
157(defcustom cwarn-font-lock-feature-keywords-alist
158 '((assign . cwarn-font-lock-assignment-keywords)
159 (semicolon . cwarn-font-lock-semicolon-keywords)
160 (reference . cwarn-font-lock-reference-keywords))
161 "*Maps a CWarn feature to font-lock keywords.
162The keywords could either a font-lock keyword list or a symbol.
163If it is a symbol it is assumed to be a variable containing a font-lock
164keyword list."
165 :group 'cwarn)
166
167(defcustom cwarn-verbose t
168 "*When nil, CWarn mode will not generate any messages.
169
170Currently, messages are generated when the mode is activated and
171deactivated."
172 :group 'cwarn
173 :type 'boolean)
174
175(defcustom cwarn-mode-text " CWarn"
176 "*String to display in the mode line when CWarn mode is active.
177
178\(When the string is not empty, make sure that it has a leading space.)"
179 :tag "CWarn mode text" ; To separate it from `global-...'
180 :group 'cwarn
181 :type 'string)
182
183(defcustom cwarn-mode-hook nil
184 "*Functions to run when CWarn mode is activated."
185 :tag "CWarn mode hook" ; To separate it from `global-...'
186 :group 'cwarn
187 :type 'hook)
188
189(defcustom global-cwarn-mode-text ""
190 "*String to display when Global CWarn mode is active.
191
192The default is nothing since when this mode is active this text doesn't
193vary over time, or between buffers. Hence mode line text
194would only waste precious space."
195 :group 'cwarn
196 :type 'string)
197
198(defcustom global-cwarn-mode-hook nil
199 "*Hook called when Global CWarn mode is activated."
200 :group 'cwarn
201 :type 'hook)
202
203(defcustom cwarn-load-hook nil
204 "*Functions to run when CWarn mode is first loaded."
205 :tag "Load Hook"
206 :group 'cwarn
207 :type 'hook)
208
209;;}}}
210;;{{{ The modes
211
212;;;###autoload
213(defun cwarn-mode (&optional arg)
214 "Minor mode that hightlight suspicious C and C++ constructions.
215
216Note, in addition to enabling this minor mode, the major mode must
217be included in the variable `cwarn-configuration'. By default C and
218C++ modes are included.
219
220With ARG, turn CWarn mode on if and only if arg is positive."
221 (interactive "P")
222 (make-local-variable 'cwarn-mode)
223 (setq cwarn-mode
224 (if (null arg)
225 (not cwarn-mode)
226 (> (prefix-numeric-value arg) 0)))
227 (if (and cwarn-verbose
228 (interactive-p))
229 (message "Cwarn mode is now %s."
230 (if cwarn-mode "on" "off")))
231 (if (not global-cwarn-mode)
232 (if cwarn-mode
233 (cwarn-font-lock-add-keywords)
234 (cwarn-font-lock-remove-keywords)))
235 (font-lock-fontify-buffer)
236 (if cwarn-mode
237 (run-hooks 'cwarn-mode-hook)))
238
239;;;###autoload
240(defun turn-on-cwarn-mode ()
241 "Turn on CWarn mode.
242
243This function is designed to be added to hooks, for example:
244 (add-hook 'c-mode-hook 'turn-on-cwarn-mode)"
245 (cwarn-mode 1))
246
247;;;###autoload
248(defun global-cwarn-mode (&optional arg)
249 "Hightlight suspicious C and C++ constructions in all buffers.
250
251With ARG, turn CWarn mode on globally if and only if arg is positive."
252 (interactive "P")
253 (let ((old-global-cwarn-mode global-cwarn-mode))
254 (setq global-cwarn-mode
255 (if (null arg)
256 (not global-cwarn-mode)
257 (> (prefix-numeric-value arg) 0)))
258 (if (and cwarn-verbose
259 (interactive-p))
260 (message "Global CWarn mode is now %s."
261 (if global-cwarn-mode "on" "off")))
262 (when (not (eq global-cwarn-mode old-global-cwarn-mode))
263 ;; Update for all future buffers.
264 (dolist (conf cwarn-configuration)
265 (if global-cwarn-mode
266 (cwarn-font-lock-add-keywords (car conf))
267 (cwarn-font-lock-remove-keywords (car conf))))
268 ;; Update all existing buffers.
269 (save-excursion
270 (dolist (buffer (buffer-list))
271 (set-buffer buffer)
272 ;; Update keywords in alive buffers.
273 (when (and font-lock-mode
274 (not cwarn-mode)
275 (cwarn-is-enabled major-mode))
276 (if global-cwarn-mode
277 (cwarn-font-lock-add-keywords)
278 (cwarn-font-lock-remove-keywords))
279 (font-lock-fontify-buffer))))))
280 ;; Kills all added keywords :-(
281 ;; (font-lock-mode 0)
282 ;; (makunbound 'font-lock-keywords)
283 ;; (font-lock-mode 1))))
284 (when global-cwarn-mode
285 (run-hooks 'global-cwarn-mode-hook)))
286
287;;}}}
288;;{{{ Help functions
289
290(defun cwarn-is-enabled (mode &optional feature)
291 "Non-nil if CWarn FEATURE is enabled for MODE.
292feature is an atom representing one construction to highlight.
293
294Check if any feature is enabled for MODE if no feature is specified.
295
296The valid features are described by the variable
297`cwarn-font-lock-feature-keywords-alist'."
298 (let ((mode-configuraion (assq mode cwarn-configuration)))
299 (and mode-configuraion
300 (or (null feature)
301 (let ((list-or-t (nth 1 mode-configuraion)))
302 (or (eq list-or-t t)
303 (if (eq (car-safe list-or-t) 'not)
304 (not (memq feature (cdr list-or-t)))
305 (memq feature list-or-t))))))))
306
307(defun cwarn-inside-macro ()
308 "True if point is inside a C macro definition."
309 (save-excursion
310 (beginning-of-line)
311 (while (eq (char-before (1- (point))) ?\\)
312 (forward-line -1))
313 (back-to-indentation)
314 (eq (char-after) ?#)))
315
316(defun cwarn-font-lock-add-keywords (&optional mode)
317 "Install keywords into major MODE, or into current buffer if nil."
318 (dolist (pair cwarn-font-lock-feature-keywords-alist)
319 (let ((feature (car pair))
320 (keywords (cdr pair)))
321 (if (not (listp keywords))
322 (setq keywords (symbol-value keywords)))
323 (if (cwarn-is-enabled (or mode major-mode) feature)
324 (font-lock-add-keywords mode keywords)))))
325
326(defun cwarn-font-lock-remove-keywords (&optional mode)
327 "Remove keywords from major MODE, or from current buffer if nil."
328 (dolist (pair cwarn-font-lock-feature-keywords-alist)
329 (let ((feature (car pair))
330 (keywords (cdr pair)))
331 (if (not (listp keywords))
332 (setq keywords (symbol-value keywords)))
333 (if (cwarn-is-enabled (or mode major-mode) feature)
334 (font-lock-remove-keywords mode keywords)))))
335
336;;}}}
337;;{{{ Backward compatibility
338
339;; This piece of code will be part of CC mode as of Emacs 20.4.
340(if (not (fboundp 'c-at-toplevel-p))
341(defun c-at-toplevel-p ()
342 "Return a determination as to whether point is at the `top-level'.
343Being at the top-level means that point is either outside any
344enclosing block (such function definition), or inside a class
345definition, but outside any method blocks.
346
347If point is not at the top-level (e.g. it is inside a method
348definition), then nil is returned. Otherwise, if point is at a
349top-level not enclosed within a class definition, t is returned.
350Otherwise, a 2-vector is returned where the zeroth element is the
351buffer position of the start of the class declaration, and the first
352element is the buffer position of the enclosing class's opening
353brace."
354 (let ((state (c-parse-state)))
355 (or (not (c-most-enclosing-brace state))
356 (c-search-uplist-for-classkey state))))
357)
358
359;;}}}
360;;{{{ Font-lock keywords and match functions
361
362;; This section contains font-lock keywords. A font lock keyword can
363;; either contain a regular expression or a match function. All
364;; keywords defined here use match functions since the C and C++
365;; constructions highlighted by CWarn are too complex to be matched by
366;; regular expressions.
367;;
368;; A match function should act like a normal forward search. They
369;; should return non-nil if they found a candidate and the match data
370;; should correspond to the highlight part of the font-lock keyword.
371;; The functions shold not generate errors, in that case font-lock
372;; will fail to highlight the buffer. A match function takes one
373;; argument, LIMIT, that represent the end of area to be searched.
374;;
375;; The variable `cwarn-font-lock-feature-keywords-alist' contains a
376;; mapping from CWarn features to the font-lock keywords defined
377;; below.
378
379;;{{{ Assignment in expressions
380
381(defconst cwarn-font-lock-assignment-keywords
382 '((cwarn-font-lock-match-assignment-in-expression
383 (1 font-lock-warning-face))))
384
385(defun cwarn-font-lock-match-assignment-in-expression (limit)
386 "Match assignments inside expressions."
387 (let ((res nil))
388 (while
389 (progn
390 (setq res (re-search-forward "[^!<>=]\\(=\\)[^=]" limit t))
391 (and res
392 (save-excursion
393 (goto-char (match-beginning 1))
394 (condition-case nil ; In case "backward-up-list" barfs.
395 (progn
396 (backward-up-list 1)
397 (or (not (memq (following-char) '(?\( ?\[)))
398 (save-match-data
399 (skip-chars-backward " ")
400 (skip-chars-backward "a-zA-Z0-9_")
401 (or
402 ;; Default parameter of function.
403 (c-at-toplevel-p)
404 (looking-at "for\\>")))))
405 (error t))))))
406 res))
407
408;;}}}
409;;{{{ Semicolon
410
411(defconst cwarn-font-lock-semicolon-keywords
412 '((cwarn-font-lock-match-dangerous-semicolon (0 font-lock-warning-face))))
413
414(defun cwarn-font-lock-match-dangerous-semicolon (limit)
415 "Match semicolons directly after `for', `while', and `if'.
416Tne semicolon after a `do { ... } while (x);' construction is not matched."
417 (let ((res nil))
418 (while
419 (progn
420 (setq res (search-forward ";" limit t))
421 (and res
422 (save-excursion
423 (condition-case nil ; In case something barfs.
424 (save-match-data
425 (backward-sexp 2) ; Expression and keyword.
426 (not (or (looking-at "\\(for\\|if\\)\\>")
427 (and (looking-at "while\\>")
428 (condition-case nil
429 (progn
430 (backward-sexp 2) ; Body and "do".
431 (not (looking-at "do\\>")))
432 (error t))))))
433 (error t))))))
434 res))
435
436;;}}}
437;;{{{ Reference
438
439(defconst cwarn-font-lock-reference-keywords
440 '((cwarn-font-lock-match-reference (1 font-lock-warning-face))))
441
442(defun cwarn-font-lock-match-reference (limit)
443 "Font-lock matcher for C++ reference parameters."
444 (let ((res nil))
445 (while
446 (progn
447 (setq res (re-search-forward "[^&]\\(&\\)[^&=]" limit t))
448 (and res
449 (save-excursion
450 (goto-char (match-beginning 1))
451 (condition-case nil ; In case something barfs.
452 (save-match-data
453 (backward-up-list 1)
454 (or (not (eq (following-char) ?\())
455 (cwarn-inside-macro)
456 (not (c-at-toplevel-p))))
457 (error t))))))
458 res))
459
460;;}}}
461
462;;}}}
463;;{{{ The end
464
465(unless (assq 'cwarn-mode minor-mode-alist)
466 (push '(cwarn-mode cwarn-mode-text)
467 minor-mode-alist))
468(unless (assq 'global-cwarn-mode minor-mode-alist)
469 (push '(global-cwarn-mode global-cwarn-mode-text)
470 minor-mode-alist))
471
472(provide 'cwarn)
473
474(run-hooks 'cwarn-load-hook)
475
476;; This makes it possible to set Global CWarn mode from
477;; Customize.
478(if global-cwarn-mode
479 (global-cwarn-mode 1))
480
481;;}}}
482
483;;; cwarn.el ends here