Initial commit
This commit is contained in:
commit
a491ef2093
813 changed files with 345031 additions and 0 deletions
340
site-lisp/cc-mode/5.31.2/COPYING
Normal file
340
site-lisp/cc-mode/5.31.2/COPYING
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
42
site-lisp/cc-mode/5.31.2/MANIFEST
Normal file
42
site-lisp/cc-mode/5.31.2/MANIFEST
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
Manifest for CC Mode 5.31
|
||||
|
||||
You should have received the following files in this distribution:
|
||||
|
||||
MANIFEST: This file.
|
||||
|
||||
README: Quick intro into how to get CC Mode up and running.
|
||||
|
||||
NEWS: A list of the user visible changes in each version.
|
||||
|
||||
cc-align.el, cc-awk.el, cc-cmds.el, cc-defs.el, cc-engine.el,
|
||||
cc-fonts.el, cc-langs.el, cc-menus.el, cc-mode.el, cc-styles.el,
|
||||
cc-subword.el, cc-vars.el: The source code.
|
||||
|
||||
cc-compat.el: Helps ease the transition from c-mode.el (BOCM) to
|
||||
the new indentation engine. This is provided for your convenience
|
||||
only, and is unguaranteed and unsupported.
|
||||
|
||||
cc-fix.el: (previously named cc-mode-19.el). Detects and corrects
|
||||
bugs in various older (X)Emacs versions.
|
||||
|
||||
cc-guess.el: Experiments in style guessing. This is provided for
|
||||
your convenience only, and is unguaranteed and unsupported.
|
||||
|
||||
cc-lobotomy.el: Performance vs. accuracy trade-offs. May not
|
||||
work, yadda, yadda.
|
||||
|
||||
cc-bytecomp.el: Contains helpers used during byte compiling to
|
||||
ensure that there's no mixup with earler versions of CC Mode which
|
||||
might be loaded.
|
||||
|
||||
cc-mode.texi: The latest CC Mode Texinfo manual.
|
||||
|
||||
ANNOUNCEMENT: Release announcement as it appeared on various
|
||||
forums.
|
||||
|
||||
Note that of the above files, the following are distributed with Emacs
|
||||
and XEmacs:
|
||||
|
||||
cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-compat.el,
|
||||
cc-defs.el, cc-engine.el, cc-fonts.el, cc-langs.el, cc-menus.el,
|
||||
cc-mode.el, cc-styles.el, cc-subword.el, cc-vars.el, cc-mode.texi
|
||||
1062
site-lisp/cc-mode/5.31.2/NEWS
Normal file
1062
site-lisp/cc-mode/5.31.2/NEWS
Normal file
File diff suppressed because it is too large
Load diff
123
site-lisp/cc-mode/5.31.2/README
Normal file
123
site-lisp/cc-mode/5.31.2/README
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
README for CC Mode 5.31
|
||||
Current maintainers: Martin Stjernholm and Alan Mackenzie
|
||||
Contact address : bug-cc-mode@gnu.org
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
The canonical web location for all knowledge CC Mode is:
|
||||
|
||||
<http://cc-mode.sourceforge.net/>
|
||||
|
||||
Please read the cc-mode.texi manual for details on using CC Mode.
|
||||
This is available on-line from:
|
||||
|
||||
<http://cc-mode.sourceforge.net/cc-mode.html>
|
||||
|
||||
As of this writing (November 18, 2005), CC Mode currently works
|
||||
out of the box with XEmacs versions 21.4 and later, and with Emacs
|
||||
versions 20.4 and later, 21.x and 22.x. (It will very likely work
|
||||
with later versions too, when they become available.)
|
||||
|
||||
Note that with CC Mode 5.31, we have finally dropped support for
|
||||
Emacs 19.34 and XEmacs 19.15. CC Mode 5.31 _won't_ work with
|
||||
these old versions. Upgrade them now!
|
||||
|
||||
Currently, the new Subword Mode doesn't work in Emacs 20.n.
|
||||
|
||||
MORE INFORMATION
|
||||
|
||||
Check out the CC Mode web site for the latest information,
|
||||
updates, tips, installation and compatibility notes, etc. on using
|
||||
CC Mode. The installation instructions given below are an excerpt
|
||||
of the on-line instructions. If you have problems installing CC
|
||||
Mode, please check out the URL above before submitting a bug
|
||||
report. Thanks!
|
||||
|
||||
The MANIFEST file contains a description of all the files you
|
||||
should have gotten with this distribution.
|
||||
|
||||
MANUALS
|
||||
|
||||
Preformatted versions of the manual in DVI, PostScript, and Info,
|
||||
are all available at the CC Mode web page. The Info manual has
|
||||
two variants, one for GNU Emacs, the other for XEmacs - the only
|
||||
differences between them are the targets of some cross references
|
||||
within the manual.
|
||||
|
||||
To build the manual yourself, you will need Texinfo 4.7 or later.
|
||||
Simply type:
|
||||
|
||||
% makeinfo cc-mode.texi # For GNU Emacs
|
||||
or
|
||||
% makeinfo -DXEMACS cc-mode.texi # For XEmacs
|
||||
|
||||
To make the DVI version, type:
|
||||
|
||||
% texi2dvi cc-mode.texi
|
||||
|
||||
INSTALLATION
|
||||
|
||||
Here is a quick guide for installing CC Mode. For the latest
|
||||
information on installing CC Mode, please see the CC Mode web site
|
||||
given above.
|
||||
|
||||
Byte Compiling
|
||||
|
||||
It is highly recommended that you byte-compile CC Mode for
|
||||
performance reasons. Running CC Mode non-byte-compiled is not
|
||||
supported.
|
||||
|
||||
You can compile CC Mode in the same way as any other package. To
|
||||
compile it from a running (X)Emacs session:
|
||||
|
||||
M-0 M-x byte-recompile-directory RET /path/to/cc-mode RET
|
||||
|
||||
To compile CC Mode from the shell:
|
||||
|
||||
% cd /path/to/cc-mode
|
||||
% $(EMACS) -batch -no-site-file -q -f batch-byte-compile cc-*.el
|
||||
|
||||
where $(EMACS) is either emacs or xemacs depending on the flavor
|
||||
you use. Note that the byte compiled files from one version of
|
||||
(X)Emacs are likely not to work on a different version - compile
|
||||
them fresh when you upgrade your (X)Emacs version.
|
||||
|
||||
Installing
|
||||
|
||||
Put the compiled files somewhere (X)Emacs will find them, i.e. in
|
||||
some path that's in the load-path variable. You must make sure
|
||||
they are found before any CC Mode files which are distributed with
|
||||
(X)Emacs. A directory has higher precendence than all directories
|
||||
after it in the load-path list.
|
||||
|
||||
If you're going to be using AWK Mode, insert the following line
|
||||
into your .emacs or init.el file:
|
||||
|
||||
(autoload 'awk-mode "cc-mode" nil t)
|
||||
|
||||
This will cause (X)Emacs to use the new AWK Mode for AWK files,
|
||||
rather than the older mode contained in the file awk-mode.elc.
|
||||
(See also the note below under "Compatibility Issues".)
|
||||
|
||||
To test that you have things set up correctly, visit a C file and
|
||||
then type:
|
||||
|
||||
M-x c-version RET
|
||||
=> Using CC Mode version 5.XX
|
||||
|
||||
where XX is the correct minor revision number.
|
||||
|
||||
Compatibility Issues
|
||||
|
||||
CC Mode should work fine with most versions of Emacs and XEmacs
|
||||
which aren't ancient (see the introduction above).
|
||||
|
||||
If you're using AWK, you can verify that you've got Emacs set up
|
||||
to use CC Mode for AWK files by displaying the mode documentation
|
||||
string with C-h m from an AWK buffer. The current mode's doc
|
||||
string contains "to submit a problem report, enter `C-c C-b'" near
|
||||
the top of the doc string where the obsolete awk-mode.el has "This
|
||||
is much like C mode except ....".
|
||||
|
||||
For more details about interactions with different packages, see
|
||||
the CC Mode web page.
|
||||
1272
site-lisp/cc-mode/5.31.2/cc-align.el
Normal file
1272
site-lisp/cc-mode/5.31.2/cc-align.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-align.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-align.elc
Normal file
Binary file not shown.
1014
site-lisp/cc-mode/5.31.2/cc-awk.el
Normal file
1014
site-lisp/cc-mode/5.31.2/cc-awk.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-awk.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-awk.elc
Normal file
Binary file not shown.
440
site-lisp/cc-mode/5.31.2/cc-bytecomp.el
Normal file
440
site-lisp/cc-mode/5.31.2/cc-bytecomp.el
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
;;; cc-bytecomp.el --- compile time setup for proper compilation
|
||||
|
||||
;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Author: Martin Stjernholm
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 15-Jul-2000
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is used to ensure that the CC Mode files are correctly
|
||||
;; compiled regardless the environment (e.g. if an older CC Mode with
|
||||
;; outdated macros are loaded during compilation). It also provides
|
||||
;; features to defeat the compiler warnings for selected symbols.
|
||||
;;
|
||||
;; There's really nothing CC Mode specific here; this functionality
|
||||
;; ought to be provided by the byte compilers or some accompanying
|
||||
;; library. To use it from some package "foo.el", begin by putting
|
||||
;; the following blurb at the top of the file:
|
||||
;;
|
||||
;; (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))
|
||||
;;
|
||||
;; This (unfortunately rather clumsy) form will ensure that the
|
||||
;; cc-bytecomp.el in the same directory as foo.el is loaded during
|
||||
;; byte compilation of the latter.
|
||||
;;
|
||||
;; At the end of foo.el there should normally be a "(provide 'foo)".
|
||||
;; Replace it with "(cc-provide 'foo)"; that is necessary to restore
|
||||
;; the environment after the byte compilation. If you don't have a
|
||||
;; `provide' at the end, you have to add the following as the very
|
||||
;; last form in the file:
|
||||
;;
|
||||
;; (eval-when-compile (cc-bytecomp-restore-environment))
|
||||
;;
|
||||
;; Now everything is set to use the various functions and macros in
|
||||
;; this package.
|
||||
;;
|
||||
;; If your package is split into several files, you should use
|
||||
;; `cc-require', `cc-require-when-compile' or `cc-load' to load them.
|
||||
;; That ensures that the files in the same directory always are
|
||||
;; loaded, to avoid mixup with other versions of them that might exist
|
||||
;; elsewhere in the load path.
|
||||
;;
|
||||
;; To suppress byte compiler warnings, use the macros
|
||||
;; `cc-bytecomp-defun', `cc-bytecomp-defvar',
|
||||
;; `cc-bytecomp-obsolete-fun', and `cc-bytecomp-obsolete-var'.
|
||||
;;
|
||||
;; This file is not used at all after the package has been byte
|
||||
;; compiled. It is however necessary when running uncompiled.
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar cc-bytecomp-unbound-variables nil)
|
||||
(defvar cc-bytecomp-original-functions nil)
|
||||
(defvar cc-bytecomp-original-properties nil)
|
||||
(defvar cc-bytecomp-loaded-files nil)
|
||||
(defvar cc-bytecomp-environment-set nil)
|
||||
|
||||
(defmacro cc-bytecomp-debug-msg (&rest args)
|
||||
;;`(message ,@args)
|
||||
)
|
||||
|
||||
(defun cc-bytecomp-setup-environment ()
|
||||
;; Eval'ed during compilation to setup variables, functions etc
|
||||
;; declared with `cc-bytecomp-defvar' et al.
|
||||
(if (not load-in-progress)
|
||||
;; Look at `load-in-progress' to tell whether we're called
|
||||
;; directly in the file being compiled or just from some file
|
||||
;; being loaded during compilation.
|
||||
(let (p)
|
||||
(if cc-bytecomp-environment-set
|
||||
(error "Byte compilation environment already set - \
|
||||
perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere"))
|
||||
(setq p cc-bytecomp-unbound-variables)
|
||||
(while p
|
||||
(if (not (boundp (car p)))
|
||||
(progn
|
||||
(eval `(defvar ,(car p)))
|
||||
(set (car p) (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name (car p)))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Covered variable %s"
|
||||
(car p))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-functions)
|
||||
(while p
|
||||
(let ((fun (car (car p)))
|
||||
(temp-macro (car (cdr (car p)))))
|
||||
(if (not (fboundp fun))
|
||||
(if temp-macro
|
||||
(progn
|
||||
(eval `(defmacro ,fun ,@temp-macro))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Bound macro %s" fun))
|
||||
(fset fun (intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name fun))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Covered function %s" fun))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-properties)
|
||||
(while p
|
||||
(let ((sym (car (car (car p))))
|
||||
(prop (cdr (car (car p))))
|
||||
(tempdef (car (cdr (car p)))))
|
||||
(put sym prop tempdef)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Bound property %s for %s to %s"
|
||||
prop sym tempdef))
|
||||
(setq p (cdr p)))
|
||||
(setq cc-bytecomp-environment-set t)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Done"))))
|
||||
|
||||
(defun cc-bytecomp-restore-environment ()
|
||||
;; Eval'ed during compilation to restore variables, functions etc
|
||||
;; declared with `cc-bytecomp-defvar' et al.
|
||||
(if (not load-in-progress)
|
||||
(let (p)
|
||||
(setq p cc-bytecomp-unbound-variables)
|
||||
(while p
|
||||
(let ((var (car p)))
|
||||
(if (boundp var)
|
||||
(if (eq (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name var)))
|
||||
(symbol-value var))
|
||||
(progn
|
||||
(makunbound var)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Unbound variable %s"
|
||||
var))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring variable %s"
|
||||
var))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-functions)
|
||||
(while p
|
||||
(let ((fun (car (car p)))
|
||||
(temp-macro (car (cdr (car p))))
|
||||
(def (car (cdr (cdr (car p))))))
|
||||
(if (fboundp fun)
|
||||
(if (eq (or temp-macro
|
||||
(intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name fun))))
|
||||
(symbol-function fun))
|
||||
(if (eq def 'unbound)
|
||||
(progn
|
||||
(fmakunbound fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Unbound function %s"
|
||||
fun))
|
||||
(fset fun def)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored function %s"
|
||||
fun))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring function %s"
|
||||
fun))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-properties)
|
||||
(while p
|
||||
(let ((sym (car (car (car p))))
|
||||
(prop (cdr (car (car p))))
|
||||
(tempdef (car (cdr (car p))))
|
||||
(origdef (cdr (cdr (car p)))))
|
||||
(if (eq (get sym prop) tempdef)
|
||||
(progn
|
||||
(put sym prop origdef)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored property %s for %s to %s"
|
||||
prop sym origdef))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring property %s for %s"
|
||||
prop sym)))
|
||||
(setq p (cdr p)))
|
||||
(setq cc-bytecomp-environment-set nil)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Done"))))
|
||||
|
||||
(eval
|
||||
;; This eval is to avoid byte compilation of the function below.
|
||||
;; There's some bug in XEmacs 21.4.6 that can cause it to dump core
|
||||
;; here otherwise. My theory is that `cc-bytecomp-load' might be
|
||||
;; redefined recursively during the `load' inside it, and if it in
|
||||
;; that case is byte compiled then the byte interpreter gets
|
||||
;; confused. I haven't succeeded in isolating the bug, though. /mast
|
||||
|
||||
'(defun cc-bytecomp-load (cc-part)
|
||||
;; Eval'ed during compilation to load a CC Mode file from the source
|
||||
;; directory (assuming it's the same as the compiled file
|
||||
;; destination dir).
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(progn
|
||||
(cc-bytecomp-restore-environment)
|
||||
(let ((load-path
|
||||
(cons (file-name-directory byte-compile-dest-file)
|
||||
load-path))
|
||||
(cc-file (concat cc-part ".el")))
|
||||
(if (member cc-file cc-bytecomp-loaded-files)
|
||||
()
|
||||
(setq cc-bytecomp-loaded-files
|
||||
(cons cc-file cc-bytecomp-loaded-files))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-load: Loading %S" cc-file)
|
||||
(load cc-file nil t t)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-load: Loaded %S" cc-file)))
|
||||
(cc-bytecomp-setup-environment)
|
||||
t))))
|
||||
|
||||
(defmacro cc-require (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but compile in a `require'. Don't use within
|
||||
`eval-when-compile'.
|
||||
|
||||
Having cyclic cc-require's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
(require ,cc-part)))
|
||||
|
||||
(defmacro cc-provide (feature)
|
||||
"A replacement for the `provide' form that restores the environment
|
||||
after the compilation. Don't use within `eval-when-compile'."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(provide ,feature)))
|
||||
|
||||
(defmacro cc-load (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation. Don't use outside `eval-when-compile' or
|
||||
`eval-and-compile'.
|
||||
|
||||
Having cyclic cc-load's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
`(or (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-load ,cc-part))
|
||||
(load ,cc-part nil t nil)))
|
||||
|
||||
(defmacro cc-require-when-compile (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but do a compile time `require' otherwise. Don't
|
||||
use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-is-compiling))
|
||||
(if (or (not load-in-progress)
|
||||
(not (featurep ,cc-part)))
|
||||
(cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
(require ,cc-part))))
|
||||
|
||||
(defmacro cc-external-require (feature)
|
||||
"Do a `require' of an external package.
|
||||
This restores and sets up the compilation environment before and
|
||||
afterwards. Don't use within `eval-when-compile'."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(require ,feature)
|
||||
(eval-when-compile (cc-bytecomp-setup-environment))))
|
||||
|
||||
(defun cc-bytecomp-is-compiling ()
|
||||
"Return non-nil if eval'ed during compilation. Don't use outside
|
||||
`eval-when-compile'."
|
||||
(and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file)))
|
||||
|
||||
(defmacro cc-bytecomp-defvar (var)
|
||||
"Binds the symbol as a variable during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (boundp ',var)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: %s bound already as variable" ',var)
|
||||
(if (not (memq ',var cc-bytecomp-unbound-variables))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: Saving %s (as unbound)" ',var)
|
||||
(setq cc-bytecomp-unbound-variables
|
||||
(cons ',var cc-bytecomp-unbound-variables))))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(not load-in-progress))
|
||||
(progn
|
||||
(defvar ,var)
|
||||
(set ',var (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name ',var))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: Covered variable %s" ',var))))))
|
||||
|
||||
(defmacro cc-bytecomp-defun (fun)
|
||||
"Bind the symbol as a function during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'.
|
||||
|
||||
If the symbol already is bound as a function, it will keep that
|
||||
definition. That means that this macro will not shut up warnings
|
||||
about incorrect number of arguments. It's dangerous to try to replace
|
||||
existing functions since the byte compiler might need the definition
|
||||
at compile time, e.g. for macros and inline functions."
|
||||
`(eval-when-compile
|
||||
(if (fboundp ',fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: %s bound already as function" ',fun)
|
||||
(if (not (assq ',fun cc-bytecomp-original-functions))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: Saving %s (as unbound)" ',fun)
|
||||
(setq cc-bytecomp-original-functions
|
||||
(cons (list ',fun nil 'unbound)
|
||||
cc-bytecomp-original-functions))))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(not load-in-progress))
|
||||
(progn
|
||||
(fset ',fun (intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name ',fun))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: Covered function %s" ',fun))))))
|
||||
|
||||
(put 'cc-bytecomp-defmacro 'lisp-indent-function 'defun)
|
||||
(defmacro cc-bytecomp-defmacro (fun &rest temp-macro)
|
||||
"Bind the symbol as a macro during compilation (and evaluation) of the
|
||||
file. Don't use outside `eval-when-compile'."
|
||||
`(let ((orig-fun (assq ',fun cc-bytecomp-original-functions)))
|
||||
(if (not orig-fun)
|
||||
(setq orig-fun
|
||||
(list ',fun
|
||||
nil
|
||||
(if (fboundp ',fun)
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Saving %s" ',fun)
|
||||
(symbol-function ',fun))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Saving %s as unbound" ',fun)
|
||||
'unbound))
|
||||
cc-bytecomp-original-functions
|
||||
(cons orig-fun cc-bytecomp-original-functions)))
|
||||
(defmacro ,fun ,@temp-macro)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Bound macro %s" ',fun)
|
||||
(setcar (cdr orig-fun) (symbol-function ',fun))))
|
||||
|
||||
(defmacro cc-bytecomp-put (symbol propname value)
|
||||
"Set a property on a symbol during compilation (and evaluation) of
|
||||
the file. Don't use outside `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-put: Saving property %s for %s with value %s"
|
||||
,propname ,symbol (get ,symbol ,propname))
|
||||
(setq cc-bytecomp-original-properties
|
||||
(cons (cons (cons ,symbol ,propname)
|
||||
(cons ,value (get ,symbol ,propname)))
|
||||
cc-bytecomp-original-properties))))
|
||||
(put ,symbol ,propname ,value)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-put: Bound property %s for %s to %s"
|
||||
,propname ,symbol ,value)))
|
||||
|
||||
(defmacro cc-bytecomp-obsolete-var (symbol)
|
||||
"Suppress warnings that the given symbol is an obsolete variable.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (get ',symbol 'byte-obsolete-variable)
|
||||
(cc-bytecomp-put ',symbol 'byte-obsolete-variable nil)
|
||||
;; This avoids a superfluous compiler warning
|
||||
;; about calling `get' for effect.
|
||||
t)))
|
||||
|
||||
(defun cc-bytecomp-ignore-obsolete (form)
|
||||
;; Wraps a call to `byte-compile-obsolete' that suppresses the warning.
|
||||
(let ((byte-compile-warnings
|
||||
(delq 'obsolete (append byte-compile-warnings nil))))
|
||||
(byte-compile-obsolete form)))
|
||||
|
||||
(defmacro cc-bytecomp-obsolete-fun (symbol)
|
||||
"Suppress warnings that the given symbol is an obsolete function.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (eq (get ',symbol 'byte-compile) 'byte-compile-obsolete)
|
||||
(cc-bytecomp-put ',symbol 'byte-compile
|
||||
'cc-bytecomp-ignore-obsolete)
|
||||
;; This avoids a superfluous compiler warning
|
||||
;; about calling `get' for effect.
|
||||
t)))
|
||||
|
||||
(defmacro cc-bytecomp-boundp (symbol)
|
||||
"Return non-nil if the given symbol is bound as a variable outside
|
||||
the compilation. This is the same as using `boundp' but additionally
|
||||
exclude any variables that have been bound during compilation with
|
||||
`cc-bytecomp-defvar'."
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(memq (car (cdr symbol)) cc-bytecomp-unbound-variables))
|
||||
nil
|
||||
`(boundp ,symbol)))
|
||||
|
||||
(defmacro cc-bytecomp-fboundp (symbol)
|
||||
"Return non-nil if the given symbol is bound as a function outside
|
||||
the compilation. This is the same as using `fboundp' but additionally
|
||||
exclude any functions that have been bound during compilation with
|
||||
`cc-bytecomp-defun'."
|
||||
(let (fun-elem)
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(setq fun-elem (assq (car (cdr symbol))
|
||||
cc-bytecomp-original-functions))
|
||||
(eq (elt fun-elem 2) 'unbound))
|
||||
nil
|
||||
`(fboundp ,symbol))))
|
||||
|
||||
|
||||
(provide 'cc-bytecomp)
|
||||
|
||||
;;; arch-tag: 2d71b3ad-57b0-4b13-abd3-ab836e08f975
|
||||
;;; cc-bytecomp.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-bytecomp.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-bytecomp.elc
Normal file
Binary file not shown.
4235
site-lisp/cc-mode/5.31.2/cc-cmds.el
Normal file
4235
site-lisp/cc-mode/5.31.2/cc-cmds.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-cmds.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-cmds.elc
Normal file
Binary file not shown.
166
site-lisp/cc-mode/5.31.2/cc-compat.el
Normal file
166
site-lisp/cc-mode/5.31.2/cc-compat.el
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1994-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Boring old c-mode.el (BOCM) is confusion and brain melt. cc-mode.el
|
||||
;; is clarity of thought and purity of chi. If you are still unwilling
|
||||
;; to accept enlightenment, this might help, or it may prolong your
|
||||
;; agony.
|
||||
;;
|
||||
;; To use, add the following to your c-mode-hook:
|
||||
;;
|
||||
;; (require 'cc-compat)
|
||||
;; (c-set-style "BOCM")
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-vars)
|
||||
(cc-require 'cc-styles)
|
||||
(cc-require 'cc-engine)
|
||||
|
||||
|
||||
;; In case c-mode.el isn't loaded
|
||||
(defvar c-indent-level 2
|
||||
"*Indentation of C statements with respect to containing block.")
|
||||
(defvar c-brace-imaginary-offset 0
|
||||
"*Imagined indentation of a C open brace that actually follows a statement.")
|
||||
(defvar c-brace-offset 0
|
||||
"*Extra indentation for braces, compared with other text in same context.")
|
||||
(defvar c-argdecl-indent 5
|
||||
"*Indentation level of declarations of C function arguments.")
|
||||
(defvar c-label-offset -2
|
||||
"*Offset of C label lines and case statements relative to usual indentation.")
|
||||
(defvar c-continued-statement-offset 2
|
||||
"*Extra indent for lines not starting new statements.")
|
||||
(defvar c-continued-brace-offset 0
|
||||
"*Extra indent for substatements that start with open-braces.
|
||||
This is in addition to c-continued-statement-offset.")
|
||||
|
||||
|
||||
|
||||
;; these offsets are taken by brute force testing c-mode.el, since
|
||||
;; there's no logic to what it does.
|
||||
(let* ((offsets '(c-offsets-alist .
|
||||
((defun-block-intro . cc-block-intro-offset)
|
||||
(statement-block-intro . cc-block-intro-offset)
|
||||
(defun-open . 0)
|
||||
(class-open . 0)
|
||||
(inline-open . c-brace-offset)
|
||||
(block-open . c-brace-offset)
|
||||
(block-close . cc-block-close-offset)
|
||||
(brace-list-open . c-brace-offset)
|
||||
(substatement-open . cc-substatement-open-offset)
|
||||
(substatement . c-continued-statement-offset)
|
||||
(knr-argdecl-intro . c-argdecl-indent)
|
||||
(case-label . c-label-offset)
|
||||
(access-label . c-label-offset)
|
||||
(label . c-label-offset)
|
||||
))))
|
||||
(c-add-style "BOCM" offsets))
|
||||
|
||||
|
||||
(defun cc-block-intro-offset (langelem)
|
||||
;; taken directly from calculate-c-indent confusion
|
||||
(save-excursion
|
||||
(c-backward-syntactic-ws)
|
||||
(if (eq (char-before) ?{)
|
||||
(forward-char -1)
|
||||
(goto-char (cdr langelem)))
|
||||
(let* ((curcol (save-excursion
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage
|
||||
;; If no previous statement, indent it relative to line
|
||||
;; brace is on. For open brace in column zero, don't let
|
||||
;; statement start there too. If c-indent-level is zero,
|
||||
;; use c-brace-offset + c-continued-statement-offset
|
||||
;; instead. For open-braces not the first thing in a line,
|
||||
;; add in c-brace-imaginary-offset.
|
||||
(+ (if (and (bolp) (zerop c-indent-level))
|
||||
(+ c-brace-offset c-continued-statement-offset)
|
||||
c-indent-level)
|
||||
;; Move back over whitespace before the openbrace. If
|
||||
;; openbrace is not first nonwhite thing on the line,
|
||||
;; add the c-brace-imaginary-offset.
|
||||
(progn (skip-chars-backward " \t")
|
||||
(if (bolp) 0 c-brace-imaginary-offset))
|
||||
;; If the openbrace is preceded by a parenthesized exp,
|
||||
;; move to the beginning of that; possibly a different
|
||||
;; line
|
||||
(progn
|
||||
(if (eq (char-before) ?\))
|
||||
(c-forward-sexp -1))
|
||||
;; Get initial indentation of the line we are on.
|
||||
(current-indentation)))))
|
||||
(- bocm-lossage curcol))))
|
||||
|
||||
|
||||
(defun cc-block-close-offset (langelem)
|
||||
(save-excursion
|
||||
(let* ((here (point))
|
||||
bracep
|
||||
(curcol (progn
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage (progn
|
||||
(goto-char (cdr langelem))
|
||||
(if (eq (char-after) ?{)
|
||||
(setq bracep t)
|
||||
(goto-char here)
|
||||
(beginning-of-line)
|
||||
(backward-up-list 1)
|
||||
(forward-char 1)
|
||||
(c-forward-syntactic-ws))
|
||||
(current-column))))
|
||||
(- bocm-lossage curcol
|
||||
(if bracep 0 c-indent-level)))))
|
||||
|
||||
|
||||
(defun cc-substatement-open-offset (langelem)
|
||||
(+ c-continued-statement-offset c-continued-brace-offset))
|
||||
|
||||
|
||||
(cc-provide 'cc-compat)
|
||||
|
||||
;;; arch-tag: 564dab2f-e6ad-499c-a4a3-fedec3ecc192
|
||||
;;; cc-compat.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-compat.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-compat.elc
Normal file
Binary file not shown.
2035
site-lisp/cc-mode/5.31.2/cc-defs.el
Normal file
2035
site-lisp/cc-mode/5.31.2/cc-defs.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-defs.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-defs.elc
Normal file
Binary file not shown.
8943
site-lisp/cc-mode/5.31.2/cc-engine.el
Normal file
8943
site-lisp/cc-mode/5.31.2/cc-engine.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-engine.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-engine.elc
Normal file
Binary file not shown.
141
site-lisp/cc-mode/5.31.2/cc-fix.el
Normal file
141
site-lisp/cc-mode/5.31.2/cc-fix.el
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
;;; cc-fix.el --- compatibility library for old (X)Emacs versions
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Authors: 2003- Alan Mackenzie
|
||||
;; 1998- Martin Stjernholm
|
||||
;; 1997-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 03-Jul-1997 (as cc-mode-19.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is necessary in order to run CC Mode in older (X)Emacs
|
||||
;; versions. It's not needed at all for the latest versions of Emacs
|
||||
;; and XEmacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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)))
|
||||
|
||||
;; Silence the compiler (in case this file is compiled by other
|
||||
;; Emacsen even though it isn't used by them).
|
||||
(cc-bytecomp-obsolete-fun byte-code-function-p)
|
||||
(cc-bytecomp-defun regexp-opt-depth)
|
||||
|
||||
(cc-external-require 'advice)
|
||||
|
||||
;; Emacs 20.n doesn't have the macros push and pop. Here're the Emacs 21
|
||||
;; definitions.
|
||||
(or (fboundp 'push)
|
||||
(defmacro push (newelt listname)
|
||||
"Add NEWELT to the list stored in the symbol LISTNAME.
|
||||
This is equivalent to (setq LISTNAME (cons NEWELT LISTNAME)).
|
||||
LISTNAME must be a symbol."
|
||||
(list 'setq listname
|
||||
(list 'cons newelt listname))))
|
||||
|
||||
(or (fboundp 'pop)
|
||||
(defmacro pop (listname)
|
||||
"Return the first element of LISTNAME's value, and remove it from the list.
|
||||
LISTNAME must be a symbol whose value is a list.
|
||||
If the value is nil, `pop' returns nil but does not actually
|
||||
change the list."
|
||||
(list 'prog1 (list 'car listname)
|
||||
(list 'setq listname (list 'cdr listname)))))
|
||||
|
||||
|
||||
(if (/= (regexp-opt-depth "\\(\\(\\)\\)") 2)
|
||||
(progn
|
||||
;; Emacs 21.1 has a buggy regexp-opt-depth which prevents CC
|
||||
;; Mode building. Those in Emacs 21.[23] are not entirely
|
||||
;; accurate. The following definition comes from Emacs's
|
||||
;; regexp-opt.el CVS version 1.25 and is believed to be a
|
||||
;; rigorously correct implementation.
|
||||
(defconst regexp-opt-not-groupie*-re
|
||||
(let* ((harmless-ch "[^\\\\[]")
|
||||
(esc-pair-not-lp "\\\\[^(]")
|
||||
(class-harmless-ch "[^][]")
|
||||
(class-lb-harmless "[^]:]")
|
||||
(class-lb-colon-maybe-charclass ":\\([a-z]+:]\\)?")
|
||||
(class-lb (concat "\\[\\(" class-lb-harmless
|
||||
"\\|" class-lb-colon-maybe-charclass "\\)"))
|
||||
(class
|
||||
(concat "\\[^?]?"
|
||||
"\\(" class-harmless-ch
|
||||
"\\|" class-lb "\\)*"
|
||||
"\\[?]")) ; special handling for bare [ at end of re
|
||||
(shy-lp "\\\\(\\?:"))
|
||||
(concat "\\(" harmless-ch "\\|" esc-pair-not-lp
|
||||
"\\|" class "\\|" shy-lp "\\)*"))
|
||||
"Matches any part of a regular expression EXCEPT for non-shy \"\\\\(\"s")
|
||||
|
||||
(defun regexp-opt-depth (regexp)
|
||||
"Return the depth of REGEXP.
|
||||
This means the number of regexp grouping constructs (parenthesised expressions)
|
||||
in REGEXP."
|
||||
(save-match-data
|
||||
;; Hack to signal an error if REGEXP does not have balanced
|
||||
;; parentheses.
|
||||
(string-match regexp "")
|
||||
;; Count the number of open parentheses in REGEXP.
|
||||
(let ((count 0) start)
|
||||
(while
|
||||
(progn
|
||||
(string-match regexp-opt-not-groupie*-re regexp start)
|
||||
(setq start ( + (match-end 0) 2)) ; +2 for "\\(" after match-end.
|
||||
(<= start (length regexp)))
|
||||
(setq count (1+ count)))
|
||||
count)))
|
||||
))
|
||||
|
||||
;; Some XEmacs versions have a bug in which font-lock-compile-keywords
|
||||
;; overwrites the variable font-lock-keywords with its result. This causes
|
||||
;; havoc when what the function is compiling is font-lock-SYNTACTIC-keywords,
|
||||
;; hence....
|
||||
(eval-after-load "font-lock"
|
||||
'(when (let (font-lock-keywords)
|
||||
(font-lock-compile-keywords '("\\<\\>"))
|
||||
font-lock-keywords) ; did the previous call foul this up?
|
||||
(defun font-lock-compile-keywords (keywords)
|
||||
"Compile KEYWORDS (a list) and return the list of compiled keywords.
|
||||
Each keyword has the form (MATCHER HIGHLIGHT ...). See `font-lock-keywords'."
|
||||
(if (eq (car-safe keywords) t)
|
||||
keywords
|
||||
(cons t (mapcar 'font-lock-compile-keyword keywords))))
|
||||
(defadvice font-lock-fontify-keywords-region (before c-compile-font-lock-keywords
|
||||
activate preactivate)
|
||||
(unless (eq (car-safe font-lock-keywords) t)
|
||||
(setq font-lock-keywords
|
||||
(font-lock-compile-keywords font-lock-keywords))))
|
||||
))
|
||||
|
||||
|
||||
(cc-provide 'cc-fix)
|
||||
;;; cc-fix.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-fix.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-fix.elc
Normal file
Binary file not shown.
2368
site-lisp/cc-mode/5.31.2/cc-fonts.el
Normal file
2368
site-lisp/cc-mode/5.31.2/cc-fonts.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-fonts.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-fonts.elc
Normal file
Binary file not shown.
219
site-lisp/cc-mode/5.31.2/cc-guess.el
Normal file
219
site-lisp/cc-mode/5.31.2/cc-guess.el
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
;;; cc-guess.el --- guess indentation values by scanning existing code
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Author: 1994-1995 Barry A. Warsaw
|
||||
;; Maintainer: Unmaintained
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This file contains routines that help guess the cc-mode style in a
|
||||
;; particular region/buffer. It is provided for example and
|
||||
;; experimentation only. It is not supported in anyway. Note that
|
||||
;; style guessing is lossy!
|
||||
;;
|
||||
;; The way this is intended to be run is for you to mark a region of
|
||||
;; code to guess the style of, then run the command, `cc-guess-region'.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-engine)
|
||||
|
||||
|
||||
(defvar cc-guessed-style nil
|
||||
"Currently guessed style.")
|
||||
|
||||
(defvar cc-guess-delta-accumulator nil)
|
||||
;; Accumulated sampled indent information. Information is represented
|
||||
;; in a list. Each element in it has following structure:
|
||||
;;
|
||||
;; (syntactic-symbol ((indentation-delta1 . number-of-times1)
|
||||
;; (indentation-delta2 . number-of-times2)
|
||||
;; ...))
|
||||
;;
|
||||
;; This structure is built by `cc-guess-accumulate-delta'.
|
||||
;;
|
||||
;; Here we call the pair (indentation-delta1 . number-of-times1) a
|
||||
;; counter. `cc-guess-sort-delta-accumulator' sorts the order of
|
||||
;; counters by number-of-times.
|
||||
|
||||
(defconst cc-guess-conversions
|
||||
'((c . c-lineup-C-comments)
|
||||
(inher-cont . c-lineup-multi-inher)
|
||||
(string . -1000)
|
||||
(comment-intro . c-lineup-comment)
|
||||
(arglist-cont-nonempty . c-lineup-arglist)
|
||||
(arglist-close . c-lineup-close-paren)
|
||||
(cpp-macro . -1000)))
|
||||
|
||||
|
||||
(defun cc-guess (&optional accumulate)
|
||||
"Apply `cc-guess-region' on the whole current buffer.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "P")
|
||||
(cc-guess-region (point-min) (point-max) accumulate))
|
||||
|
||||
(defun cc-guess-install ()
|
||||
"Set the indentation style from the last guessed style (`cc-guessed-style')."
|
||||
(interactive)
|
||||
(setq c-offsets-alist (cc-guess-merge-styles cc-guessed-style
|
||||
c-offsets-alist)))
|
||||
|
||||
(defun cc-guess-region (start end &optional accumulate)
|
||||
"Set the indentation style by examining the indentation in a region of code.
|
||||
Every line of code in the region is examined and the indentation
|
||||
values of the various syntactic symbols in `c-offset-alist' are
|
||||
guessed. Frequencies of use are taken into account, so minor
|
||||
inconsistencies in the indentation style shouldn't produce wrong
|
||||
guesses.
|
||||
|
||||
The guessed style is put into `cc-guessed-style'. It's also merged
|
||||
into `c-offsets-alist'. Guessed offsets takes precedence over
|
||||
existing ones on `c-offsets-alist'.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch.
|
||||
|
||||
Note that the larger the region to guess in, the slower the guessing."
|
||||
(interactive "r\nP")
|
||||
(let ((delta-accumulator (when accumulate cc-guess-delta-accumulator))
|
||||
(reporter (when (fboundp 'make-progress-reporter)
|
||||
(make-progress-reporter "Sampling Indentation " start end))))
|
||||
;;
|
||||
;; Sampling stage
|
||||
;;
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
(while (< (point) end)
|
||||
(c-save-buffer-state
|
||||
((syntax (c-guess-basic-syntax))
|
||||
(relpos (car (cdr (car syntax))))
|
||||
(symbol (car (car syntax))))
|
||||
;; TBD: for now I can't guess indentation when more than 1
|
||||
;; symbol is on the list, nor for symbols without relpos's
|
||||
;;
|
||||
;; I think it is too stricted for ((topmost-intro) (comment-intro)).
|
||||
;; -- Masatake
|
||||
(unless (or ; (/= 1 (length syntax))
|
||||
(not (numberp relpos))
|
||||
(eq (line-beginning-position)
|
||||
(line-end-position)))
|
||||
(setq delta-accumulator (cc-guess-accumulate-delta
|
||||
delta-accumulator
|
||||
symbol
|
||||
(- (progn (back-to-indentation)
|
||||
(current-column) )
|
||||
(save-excursion
|
||||
(goto-char relpos)
|
||||
(current-column)))))))
|
||||
(when reporter (progress-reporter-update reporter (point)))
|
||||
(forward-line 1)))
|
||||
(when reporter (progress-reporter-done reporter))
|
||||
;;
|
||||
;; Guessing stage
|
||||
;;
|
||||
(setq delta-accumulator (cc-guess-sort-delta-accumulator
|
||||
delta-accumulator)
|
||||
cc-guess-delta-accumulator delta-accumulator)
|
||||
(let* ((typical-style (cc-guess-make-style delta-accumulator))
|
||||
(merged-style (cc-guess-merge-styles
|
||||
(copy-list cc-guess-conversions)
|
||||
typical-style)))
|
||||
(setq cc-guessed-style merged-style
|
||||
c-offsets-alist (cc-guess-merge-styles
|
||||
merged-style
|
||||
c-offsets-alist)))))
|
||||
|
||||
(defun cc-guess-accumulate-delta (accumulator symbol delta)
|
||||
;; Added SYMBOL and DELTA to ACCUMULATOR. See
|
||||
;; `cc-guess-delta-accumulator' about the structure of ACCUMULATOR.
|
||||
(let* ((entry (assoc symbol accumulator))
|
||||
(counters (cdr entry))
|
||||
counter)
|
||||
(if entry
|
||||
(progn
|
||||
(setq counter (assoc delta counters))
|
||||
(if counter
|
||||
(setcdr counter (1+ (cdr counter)))
|
||||
(setq counters (cons (cons delta 1) counters))
|
||||
(setcdr entry counters))
|
||||
accumulator)
|
||||
(cons (cons symbol (cons (cons delta 1) nil)) accumulator))))
|
||||
|
||||
(defun cc-guess-sort-delta-accumulator (accumulator)
|
||||
;; Sort the each element of ACCUMULATOR by the number-of-times. See
|
||||
;; `cc-guess-delta-accumulator' for more details.
|
||||
(mapcar
|
||||
(lambda (entry)
|
||||
(let ((symbol (car entry))
|
||||
(counters (cdr entry)))
|
||||
(cons symbol (sort counters
|
||||
(lambda (a b)
|
||||
(if (> (cdr a) (cdr b))
|
||||
t
|
||||
(and
|
||||
(eq (cdr a) (cdr b))
|
||||
(< (car a) (car b)))))))))
|
||||
accumulator))
|
||||
|
||||
(defun cc-guess-make-style (accumulator)
|
||||
;; Throw away the rare cases in accumulator and make a style structure.
|
||||
(mapcar
|
||||
(lambda (entry)
|
||||
(cons (car entry)
|
||||
(car (car (cdr entry)))))
|
||||
accumulator))
|
||||
|
||||
(defun cc-guess-merge-styles (strong weak)
|
||||
;; Merge two styles into one. When two styles has the same symbol
|
||||
;; entry, give STRONG priority over WEAK.
|
||||
(mapc
|
||||
(lambda (weak-elt)
|
||||
(unless (assoc (car weak-elt) strong)
|
||||
(setq strong (cons weak-elt strong))))
|
||||
weak)
|
||||
strong)
|
||||
|
||||
(defun cc-guess-view-style ()
|
||||
"Show `cc-guessed-style'."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Indentation Guessing Result*"
|
||||
(pp cc-guessed-style)))
|
||||
|
||||
|
||||
(cc-provide 'cc-guess)
|
||||
;;; cc-guess.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-guess.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-guess.elc
Normal file
Binary file not shown.
2905
site-lisp/cc-mode/5.31.2/cc-langs.el
Normal file
2905
site-lisp/cc-mode/5.31.2/cc-langs.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-langs.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-langs.elc
Normal file
Binary file not shown.
160
site-lisp/cc-mode/5.31.2/cc-lobotomy.el
Normal file
160
site-lisp/cc-mode/5.31.2/cc-lobotomy.el
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
;;; cc-lobotomy.el --- excise portions of cc-mode's brain... for speed
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2005 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: 1995 Barry A. Warsaw
|
||||
;; Maintainer: Unmaintained
|
||||
;; Created: March 1995, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Every effort has been made to improve the performance of
|
||||
;; cc-mode. However, due to the nature of the C, C++, and Objective-C
|
||||
;; language definitions, a trade-off is often required between
|
||||
;; accuracy of construct recognition and speed. I believe it is always
|
||||
;; best to be correct, and that the mode is currently fast enough for
|
||||
;; most normal usage. Others disagree. I have no intention of
|
||||
;; including these hacks in the main distribution. When cc-mode
|
||||
;; version 5 comes out, it will include a rewritten indentation engine
|
||||
;; so that performance will be greatly improved automatically. This
|
||||
;; was not included in this release of version 4 so that Emacs 18
|
||||
;; could still be supported. Note that this implies that cc-mode
|
||||
;; version 5 will *not* work on Emacs 18!
|
||||
;;
|
||||
;; To use, see the variable cc-lobotomy-pith-list and the function
|
||||
;; cc-lobotomize. The variable contains a good explanation of the
|
||||
;; speed/accuracy trade-offs for each option. Set it to what you'd
|
||||
;; like, and call cc-lobotomy in your c-mode-hook.
|
||||
;;
|
||||
;; This will redefine certain cc-mode functions and affect all cc-mode
|
||||
;; buffers globally.
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-engine)
|
||||
(cc-require 'cc-cmds)
|
||||
|
||||
|
||||
(defvar cc-lobotomy-pith-list ()
|
||||
"*List of things to dumb-ify to speed up cc-mode. Note that each
|
||||
incurs a penalty in correct identification of certain code constructs.
|
||||
Possible values to put on this list:
|
||||
|
||||
'literal -- `c-in-literal' is lobotomized. This will significantly
|
||||
speed up parsing over large lists of cpp macros, as seen
|
||||
for instance in header files. The penalty is that you
|
||||
cannot put the `#' character as the first non-whitespace
|
||||
character on a line inside other multi-line literals
|
||||
(i.e. comments or strings)
|
||||
|
||||
'class -- `c-narrow-out-enclosing-class' and `c-search-uplist for
|
||||
classkey' are lobotomized. This speeds up some
|
||||
indenting inside and around class and struct
|
||||
definitions. The penalty is that elements inside of
|
||||
classes and structs may not indent correctly.
|
||||
|
||||
'lists -- `c-inside-bracelist-p' is lobotomized. This speeds up
|
||||
indenting inside and around brace lists (e.g. aggregate
|
||||
initializers, enum lists, etc.). The penalty is that
|
||||
elements inside these lists may not indent correctly.")
|
||||
|
||||
(defun cc-lobotomize ()
|
||||
"Perform lobotomies on cc-mode as described in `cc-lobotomy-pith-list'."
|
||||
(let (pithedp)
|
||||
(if (memq 'literal cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-in-literal 'cc-in-literal-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if (memq 'class cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-narrow-out-enclosing-class
|
||||
'cc-narrow-out-enclosing-class-lobotomized)
|
||||
(fset 'c-search-uplist-for-classkey
|
||||
'cc-search-uplist-for-classkey-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if (memq 'lists cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-inside-bracelist-p 'cc-inside-bracelist-p-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if pithedp
|
||||
(add-hook 'c-prepare-bug-report-hooks 'cc-lobo-bug-report-blurb))
|
||||
))
|
||||
|
||||
|
||||
;; This is a faster version of c-in-literal. It trades speed for one
|
||||
;; approximation, namely that within other literals, the `#' character
|
||||
;; cannot be the first non-whitespace on a line. This only happens if
|
||||
;; detect-cpp is non-nil, which isn't very often.
|
||||
(defun cc-in-literal-lobotomized (&optional lim detect-cpp)
|
||||
;; first check the cache
|
||||
(if (and (vectorp c-in-literal-cache)
|
||||
(= (point) (aref c-in-literal-cache 0)))
|
||||
(aref c-in-literal-cache 1)
|
||||
;; quickly check for cpp macro. this breaks if the `#' character
|
||||
;; appears as the first non-whitespace on a line inside another
|
||||
;; literal.
|
||||
(let* (state
|
||||
(char-at-boi (char-after (c-point 'boi)))
|
||||
(rtn (cond
|
||||
((and detect-cpp char-at-boi (= char-at-boi ?#))
|
||||
'pound)
|
||||
((nth 3 (setq state (save-excursion
|
||||
(parse-partial-sexp
|
||||
(or lim (c-point 'bod))
|
||||
(point)))))
|
||||
'string)
|
||||
((nth 4 state) (if (nth 7 state) 'c++ 'c))
|
||||
(t nil))))
|
||||
;; cache this result if the cache is enabled
|
||||
(if (not c-in-literal-cache)
|
||||
(setq c-in-literal-cache (vector (point) rtn)))
|
||||
rtn)))
|
||||
|
||||
(defun cc-narrow-out-enclosing-class-lobotomized (dummy1 dummy2) nil)
|
||||
|
||||
(defun cc-search-uplist-for-classkey-lobotomized (dummy) nil)
|
||||
|
||||
(defun cc-inside-bracelist-p-lobotomized (dummy1 dummy2) nil)
|
||||
|
||||
(defun cc-lobo-bug-report-blurb ()
|
||||
(insert
|
||||
"\nYou are using cc-lobotomy.el. You realize that by doing\n"
|
||||
"so you have already made the decision to trade off accuracy\n"
|
||||
"for speed? Don't set your hopes too high that your problem\n"
|
||||
"will be fixed.\n\n"))
|
||||
|
||||
|
||||
(cc-provide 'cc-lobotomy)
|
||||
;;; cc-lobotomy.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-lobotomy.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-lobotomy.elc
Normal file
Binary file not shown.
425
site-lisp/cc-mode/5.31.2/cc-menus.el
Normal file
425
site-lisp/cc-mode/5.31.2/cc-menus.el
Normal file
|
|
@ -0,0 +1,425 @@
|
|||
;;; cc-menus.el --- imenu support for CC Mode
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1992-1999 Barry A. Warsaw
|
||||
;; 1987 Dave Detlefs and Stewart Clamen
|
||||
;; 1985 Richard M. Stallman
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 22-Apr-1997 (split from cc-mode.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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)
|
||||
|
||||
;; The things referenced in imenu, which we don't require.
|
||||
(cc-bytecomp-defvar imenu-case-fold-search)
|
||||
(cc-bytecomp-defvar imenu-generic-expression)
|
||||
(cc-bytecomp-defvar imenu-create-index-function)
|
||||
(cc-bytecomp-defun imenu-progress-message)
|
||||
|
||||
|
||||
;; imenu integration
|
||||
(defvar cc-imenu-c-prototype-macro-regexp nil
|
||||
"RE matching macro names used to conditionally specify function prototypes.
|
||||
|
||||
For example:
|
||||
|
||||
#ifdef __STDC__
|
||||
#define _P(x) x
|
||||
#else
|
||||
#define _P(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
int main _P( (int argc, char *argv[]) )
|
||||
|
||||
A sample value might look like: `\\(_P\\|_PROTO\\)'.")
|
||||
|
||||
(defvar cc-imenu-c++-generic-expression
|
||||
`(
|
||||
;; Try to match ::operator definitions first. Otherwise `X::operator new ()'
|
||||
;; will be incorrectly recognised as function `new ()' because the regexps
|
||||
;; work by backtracking from the end of the definition.
|
||||
(nil
|
||||
,(concat
|
||||
"^\\<.*"
|
||||
"[^" c-alnum "_:<>~]" ; match any non-identifier char
|
||||
; (note: this can be `\n')
|
||||
"\\("
|
||||
"\\([" c-alnum "_:<>~]*::\\)?" ; match an operator
|
||||
"operator\\>[ \t]*"
|
||||
"\\(()\\|[^(]*\\)" ; special case for `()' operator
|
||||
"\\)"
|
||||
|
||||
"[ \t]*([^)]*)[ \t]*[^ \t;]" ; followed by ws, arg list,
|
||||
; require something other than
|
||||
; a `;' after the (...) to
|
||||
; avoid prototypes. Can't
|
||||
; catch cases with () inside
|
||||
; the parentheses surrounding
|
||||
; the parameters. e.g.:
|
||||
; `int foo(int a=bar()) {...}'
|
||||
) 1)
|
||||
;; Special case to match a line like `main() {}'
|
||||
;; e.g. no return type, not even on the previous line.
|
||||
(nil
|
||||
,(concat
|
||||
"^"
|
||||
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
|
||||
"[ \t]*(" ; see above, BUT
|
||||
"[ \t]*\\([^ \t(*][^)]*\\)?)" ; the arg list must not start
|
||||
"[ \t]*[^ \t;(]" ; with an asterisk or parentheses
|
||||
) 1)
|
||||
;; General function name regexp
|
||||
(nil
|
||||
,(concat
|
||||
"^\\<" ; line MUST start with word char
|
||||
"[^()]*" ; no parentheses before
|
||||
"[^" c-alnum "_:<>~]" ; match any non-identifier char
|
||||
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
|
||||
"\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list
|
||||
"\\([ \t\n]\\|\\\\\n\\)*\\([^ \t\n(*][^)]*\\)?)" ; must not start
|
||||
"\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]" ; with an asterisk or parentheses
|
||||
) 1)
|
||||
;; Special case for definitions using phony prototype macros like:
|
||||
;; `int main _PROTO( (int argc,char *argv[]) )'.
|
||||
;; This case is only included if cc-imenu-c-prototype-macro-regexp is set.
|
||||
;; Only supported in c-code, so no `:<>~' chars in function name!
|
||||
,@(if cc-imenu-c-prototype-macro-regexp
|
||||
`((nil
|
||||
,(concat
|
||||
"^\\<.*" ; line MUST start with word char
|
||||
"[^" c-alnum "_]" ; match any non-identifier char
|
||||
"\\([" c-alpha "_][" c-alnum "_]*\\)" ; match function name
|
||||
"[ \t]*" ; whitespace before macro name
|
||||
cc-imenu-c-prototype-macro-regexp
|
||||
"[ \t]*(" ; ws followed by first paren.
|
||||
"[ \t]*([^)]*)[ \t]*)[ \t]*[^ \t;]" ; see above
|
||||
) 1)))
|
||||
;; Class definitions
|
||||
("Class"
|
||||
,(concat
|
||||
"^" ; beginning of line is required
|
||||
"\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a `template <...>'
|
||||
"\\(class\\|struct\\)[ \t]+"
|
||||
"\\(" ; the string we want to get
|
||||
"[" c-alnum "_]+" ; class name
|
||||
"\\(<[^>]+>\\)?" ; possibly explicitly specialized
|
||||
"\\)"
|
||||
"\\([ \t\n]\\|\\\\\n\\)*[:{]"
|
||||
) 3))
|
||||
"Imenu generic expression for C++ mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar cc-imenu-c-generic-expression
|
||||
cc-imenu-c++-generic-expression
|
||||
"Imenu generic expression for C mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar cc-imenu-java-generic-expression
|
||||
`((nil
|
||||
,(concat
|
||||
"[" c-alpha "_][\]\[." c-alnum "_]+[ \t\n\r]+" ; type spec
|
||||
"\\([" c-alpha "_][" c-alnum "_]+\\)" ; method name
|
||||
"[ \t\n\r]*"
|
||||
;; An argument list that is either empty or contains at least
|
||||
;; two identifiers with only space between them. This avoids
|
||||
;; matching e.g. "else if (foo)".
|
||||
(concat "([ \t\n\r]*"
|
||||
"\\([\]\[.," c-alnum "_]+"
|
||||
"[ \t\n\r]+"
|
||||
"[\]\[.," c-alnum "_]"
|
||||
"[\]\[.," c-alnum "_ \t\n\r]*"
|
||||
"\\)?)")
|
||||
"[.," c-alnum "_ \t\n\r]*"
|
||||
"{"
|
||||
) 1))
|
||||
"Imenu generic expression for Java mode. See `imenu-generic-expression'.")
|
||||
|
||||
;; *Warning for cc-mode developers*
|
||||
;;
|
||||
;; `cc-imenu-objc-generic-expression' elements depend on
|
||||
;; `cc-imenu-c++-generic-expression'. So if you change this
|
||||
;; expression, you need to change following variables,
|
||||
;; `cc-imenu-objc-generic-expression-*-index',
|
||||
;; too. `cc-imenu-objc-function' uses these *-index variables, in
|
||||
;; order to know where the each regexp *group \\(foobar\\)* elements
|
||||
;; are started.
|
||||
;;
|
||||
;; *-index variables are initialized during `cc-imenu-objc-generic-expression'
|
||||
;; being initialized.
|
||||
;;
|
||||
|
||||
;; Internal variables
|
||||
(defvar cc-imenu-objc-generic-expression-noreturn-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-general-func-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-proto-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-objc-base-index nil)
|
||||
|
||||
(defvar cc-imenu-objc-generic-expression
|
||||
(concat
|
||||
;;
|
||||
;; For C
|
||||
;;
|
||||
;; > Special case to match a line like `main() {}'
|
||||
;; > e.g. no return type, not even on the previous line.
|
||||
;; Pick a token by (match-string 1)
|
||||
(car (cdr (nth 1 cc-imenu-c++-generic-expression))) ; -> index += 2
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-noreturn-index 1) "")
|
||||
"\\|"
|
||||
;; > General function name regexp
|
||||
;; Pick a token by (match-string 3)
|
||||
(car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 5
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "")
|
||||
;; > Special case for definitions using phony prototype macros like:
|
||||
;; > `int main _PROTO( (int argc,char *argv[]) )'.
|
||||
;; Pick a token by (match-string 8)
|
||||
(if cc-imenu-c-prototype-macro-regexp
|
||||
(concat
|
||||
"\\|"
|
||||
(car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "")
|
||||
)
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 8) "")
|
||||
"") ; -> index += 0
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-proto-index 8) "")
|
||||
;;
|
||||
;; For Objective-C
|
||||
;; Pick a token by (match-string 8 or 9)
|
||||
;;
|
||||
"\\|\\("
|
||||
"^[-+][:" c-alnum "()*_<>\n\t ]*[;{]" ; Methods
|
||||
"\\|"
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*:"
|
||||
"\\|"
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*([" c-alnum "_]+)"
|
||||
"\\|"
|
||||
;; For NSObject, NSProxy and Object... They don't have super class.
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*.*$"
|
||||
"\\|"
|
||||
"^@implementation[\t ]+[" c-alnum "_]+[\t ]*([" c-alnum "_]+)"
|
||||
"\\|"
|
||||
"^@implementation[\t ]+[" c-alnum "_]+"
|
||||
"\\|"
|
||||
"^@protocol[\t ]+[" c-alnum "_]+" "\\)")
|
||||
"Imenu generic expression for ObjC mode. See `imenu-generic-expression'.")
|
||||
|
||||
|
||||
;; Imenu support for objective-c uses functions.
|
||||
(defsubst cc-imenu-objc-method-to-selector (method)
|
||||
"Return the objc selector style string of METHOD.
|
||||
Example:
|
||||
- perform: (SEL)aSelector withObject: object1 withObject: object2; /* METHOD */
|
||||
=>
|
||||
-perform:withObject:withObject:withObject: /* selector */"
|
||||
(let ((return "") ; String to be returned
|
||||
(p 0) ; Current scanning position in METHOD
|
||||
(pmax (length method)) ;
|
||||
char ; Current scanning target
|
||||
(betweenparen 0) ; CHAR is in parentheses.
|
||||
argreq ; An argument is required.
|
||||
inargvar) ; position of CHAR is in an argument variable.
|
||||
(while (< p pmax)
|
||||
(setq char (aref method p)
|
||||
p (1+ p))
|
||||
(cond
|
||||
;; Is CHAR part of a objc token?
|
||||
((and (not inargvar) ; Ignore if CHAR is part of an argument variable.
|
||||
(eq 0 betweenparen) ; Ignore if CHAR is in parentheses.
|
||||
(or (and (<= ?a char) (<= char ?z))
|
||||
(and (<= ?A char) (<= char ?Z))
|
||||
(and (<= ?0 char) (<= char ?9))
|
||||
(= ?_ char)))
|
||||
(if argreq
|
||||
(setq inargvar t
|
||||
argreq nil)
|
||||
(setq return (concat return (char-to-string char)))))
|
||||
;; Or a white space?
|
||||
((and inargvar (or (eq ?\ char) (eq ?\n char))
|
||||
(setq inargvar nil)))
|
||||
;; Or a method separator?
|
||||
;; If a method separator, the next token will be an argument variable.
|
||||
((eq ?: char)
|
||||
(setq argreq t
|
||||
return (concat return (char-to-string char))))
|
||||
;; Or an open parentheses?
|
||||
((eq ?\( char)
|
||||
(setq betweenparen (1+ betweenparen)))
|
||||
;; Or a close parentheses?
|
||||
((eq ?\) char)
|
||||
(setq betweenparen (1- betweenparen)))))
|
||||
return))
|
||||
|
||||
(defun cc-imenu-objc-remove-white-space (str)
|
||||
"Remove all spaces and tabs from STR."
|
||||
(let ((return "")
|
||||
(p 0)
|
||||
(max (length str))
|
||||
char)
|
||||
(while (< p max)
|
||||
(setq char (aref str p))
|
||||
(setq p (1+ p))
|
||||
(if (or (= char ?\ ) (= char ?\t))
|
||||
()
|
||||
(setq return (concat return (char-to-string char)))))
|
||||
return))
|
||||
|
||||
(defun cc-imenu-objc-function ()
|
||||
"imenu supports for objc-mode."
|
||||
(let (methodlist
|
||||
clist
|
||||
;;
|
||||
;; OBJC, Cnoreturn, Cgeneralfunc, Cproto are constants.
|
||||
;;
|
||||
;; *Warning for developers*
|
||||
;; These constants depend on `cc-imenu-c++-generic-expression'.
|
||||
;;
|
||||
(OBJC cc-imenu-objc-generic-expression-objc-base-index)
|
||||
;; Special case to match a line like `main() {}'
|
||||
(Cnoreturn cc-imenu-objc-generic-expression-noreturn-index)
|
||||
;; General function name regexp
|
||||
(Cgeneralfunc cc-imenu-objc-generic-expression-general-func-index)
|
||||
;; Special case for definitions using phony prototype macros like:
|
||||
(Cproto cc-imenu-objc-generic-expression-proto-index)
|
||||
langnum
|
||||
;;
|
||||
(classcount 0)
|
||||
toplist
|
||||
stupid
|
||||
str
|
||||
str2
|
||||
(intflen (length "@interface"))
|
||||
(implen (length "@implementation"))
|
||||
(prtlen (length "@protocol"))
|
||||
(func
|
||||
;;
|
||||
;; Does this emacs has buffer-substring-no-properties?
|
||||
;;
|
||||
(if (fboundp 'buffer-substring-no-properties)
|
||||
'buffer-substring-no-properties
|
||||
'buffer-substring)))
|
||||
(goto-char (point-max))
|
||||
(imenu-progress-message stupid 0)
|
||||
;;
|
||||
(while (re-search-backward cc-imenu-objc-generic-expression nil t)
|
||||
(imenu-progress-message stupid)
|
||||
(setq langnum (if (match-beginning OBJC)
|
||||
OBJC
|
||||
(cond
|
||||
((match-beginning Cproto) Cproto)
|
||||
((match-beginning Cgeneralfunc) Cgeneralfunc)
|
||||
((match-beginning Cnoreturn) Cnoreturn))))
|
||||
(setq str (funcall func (match-beginning langnum) (match-end langnum)))
|
||||
;;
|
||||
(cond
|
||||
;;
|
||||
;; C
|
||||
;;
|
||||
((not (eq langnum OBJC))
|
||||
(setq clist (cons (cons str (match-beginning langnum)) clist)))
|
||||
;;
|
||||
;; ObjC
|
||||
;;
|
||||
;; An instance Method
|
||||
((eq (aref str 0) ?-)
|
||||
(setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
|
||||
(setq methodlist (cons (cons str
|
||||
(match-beginning langnum))
|
||||
methodlist)))
|
||||
;; A factory Method
|
||||
((eq (aref str 0) ?+)
|
||||
(setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
|
||||
(setq methodlist (cons (cons str
|
||||
(match-beginning langnum))
|
||||
methodlist)))
|
||||
;; Interface or implementation or protocol
|
||||
((eq (aref str 0) ?@)
|
||||
(setq classcount (1+ classcount))
|
||||
(cond
|
||||
((and (> (length str) implen)
|
||||
(string= (substring str 0 implen) "@implementation"))
|
||||
(setq str (substring str implen)
|
||||
str2 "@implementation"))
|
||||
((string= (substring str 0 intflen) "@interface")
|
||||
(setq str (substring str intflen)
|
||||
str2 "@interface"))
|
||||
((string= (substring str 0 prtlen) "@protocol")
|
||||
(setq str (substring str prtlen)
|
||||
str2 "@protocol")))
|
||||
(setq str (cc-imenu-objc-remove-white-space str))
|
||||
(setq methodlist (cons (cons str2
|
||||
(match-beginning langnum))
|
||||
methodlist))
|
||||
(setq toplist (cons nil (cons (cons str
|
||||
methodlist) toplist))
|
||||
methodlist nil))))
|
||||
;;
|
||||
(imenu-progress-message stupid 100)
|
||||
(if (eq (car toplist) nil)
|
||||
(setq toplist (cdr toplist)))
|
||||
|
||||
;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
|
||||
(if (< classcount 2)
|
||||
(let ((classname (car (car toplist)))
|
||||
(p (cdr (car (cdr (car toplist)))))
|
||||
last)
|
||||
(setq toplist (cons (cons classname p) (cdr (cdr (car toplist)))))
|
||||
;; Add C lang token
|
||||
(if clist
|
||||
(progn
|
||||
(setq last toplist)
|
||||
(while (cdr last)
|
||||
(setq last (cdr last)))
|
||||
(setcdr last clist))))
|
||||
;; Add C lang tokens as a sub menu
|
||||
(if clist
|
||||
(setq toplist (cons (cons "C" clist) toplist))))
|
||||
;;
|
||||
toplist
|
||||
))
|
||||
|
||||
;(defvar cc-imenu-pike-generic-expression
|
||||
; ())
|
||||
; FIXME: Please contribute one!
|
||||
|
||||
(defun cc-imenu-init (mode-generic-expression
|
||||
&optional mode-create-index-function)
|
||||
(setq imenu-generic-expression mode-generic-expression
|
||||
imenu-case-fold-search nil)
|
||||
(when mode-create-index-function
|
||||
(setq imenu-create-index-function mode-create-index-function)))
|
||||
|
||||
|
||||
(cc-provide 'cc-menus)
|
||||
|
||||
;;; arch-tag: f6b60933-91f0-4145-ab44-70ca6d1b919b
|
||||
;;; cc-menus.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-menus.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-menus.elc
Normal file
Binary file not shown.
1248
site-lisp/cc-mode/5.31.2/cc-mode.el
Normal file
1248
site-lisp/cc-mode/5.31.2/cc-mode.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-mode.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-mode.elc
Normal file
Binary file not shown.
6935
site-lisp/cc-mode/5.31.2/cc-mode.texi
Normal file
6935
site-lisp/cc-mode/5.31.2/cc-mode.texi
Normal file
File diff suppressed because it is too large
Load diff
647
site-lisp/cc-mode/5.31.2/cc-styles.el
Normal file
647
site-lisp/cc-mode/5.31.2/cc-styles.el
Normal file
|
|
@ -0,0 +1,647 @@
|
|||
;;; cc-styles.el --- support for styles in CC Mode
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1992-1999 Barry A. Warsaw
|
||||
;; 1987 Dave Detlefs and Stewart Clamen
|
||||
;; 1985 Richard M. Stallman
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 22-Apr-1997 (split from cc-mode.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-vars)
|
||||
(cc-require 'cc-align)
|
||||
;; cc-align is only indirectly required: Styles added with
|
||||
;; `c-add-style' often contains references to functions defined there.
|
||||
|
||||
;; Silence the compiler.
|
||||
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
|
||||
(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
|
||||
|
||||
|
||||
(defvar c-style-alist
|
||||
'(("gnu"
|
||||
(c-basic-offset . 2)
|
||||
(c-comment-only-line-offset . (0 . 0))
|
||||
(c-hanging-braces-alist . ((substatement-open before after)))
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 5)
|
||||
(substatement-open . +)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-case-open . +)
|
||||
(statement-cont . +)
|
||||
(arglist-intro . c-lineup-arglist-intro-after-paren)
|
||||
(arglist-close . c-lineup-arglist)
|
||||
(inline-open . 0)
|
||||
(brace-list-open . +)))
|
||||
(c-special-indent-hook . c-gnu-impose-minimum)
|
||||
(c-block-comment-prefix . ""))
|
||||
|
||||
("k&r"
|
||||
(c-basic-offset . 5)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("bsd"
|
||||
(c-basic-offset . 8)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . +)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +)
|
||||
(inline-open . 0)
|
||||
(inexpr-class . 0))))
|
||||
|
||||
("stroustrup"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("whitesmith"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
;; It's obvious that the CC Mode way of choosing anchor positions
|
||||
;; doesn't fit this style at all. :P
|
||||
(c-offsets-alist . ((defun-open . +)
|
||||
(defun-close . c-lineup-whitesmith-in-block)
|
||||
(defun-block-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(class-open . +)
|
||||
(class-close . +)
|
||||
(inline-open . +)
|
||||
(inline-close . c-lineup-whitesmith-in-block)
|
||||
(knr-argdecl-intro . +)
|
||||
(block-open . 0) ; Get indentation from `statement' instead.
|
||||
(block-close . c-lineup-whitesmith-in-block)
|
||||
(brace-list-open . +)
|
||||
(brace-list-close . c-lineup-whitesmith-in-block)
|
||||
(brace-list-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(brace-list-entry . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(brace-entry-open . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(statement . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(statement-block-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(substatement-open . +)
|
||||
(substatement-label . +)
|
||||
(label . 0)
|
||||
(arglist-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(arglist-cont . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(arglist-cont-nonempty . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(arglist-close . c-lineup-whitesmith-in-block)
|
||||
(inclass . c-lineup-whitesmith-in-block)
|
||||
(extern-lang-open . +)
|
||||
(namespace-open . +)
|
||||
(module-open . +)
|
||||
(composition-open . +)
|
||||
(extern-lang-close . +)
|
||||
(namespace-close . +)
|
||||
(module-close . +)
|
||||
(composition-close . +)
|
||||
(inextern-lang . c-lineup-whitesmith-in-block)
|
||||
(innamespace . c-lineup-whitesmith-in-block)
|
||||
(inmodule . c-lineup-whitesmith-in-block)
|
||||
(incomposition . c-lineup-whitesmith-in-block)
|
||||
(inexpr-class . 0))))
|
||||
|
||||
("ellemtel"
|
||||
(c-basic-offset . 3)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((substatement-open before after)))
|
||||
(c-offsets-alist . ((topmost-intro . 0)
|
||||
(substatement . +)
|
||||
(substatement-open . 0)
|
||||
(case-label . +)
|
||||
(access-label . -)
|
||||
(inclass . ++)
|
||||
(inline-open . 0))))
|
||||
|
||||
("linux"
|
||||
(c-basic-offset . 8)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((brace-list-open)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)))
|
||||
(c-cleanup-list . (brace-else-brace))
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("python"
|
||||
(indent-tabs-mode . t)
|
||||
(fill-column . 78)
|
||||
(c-basic-offset . 8)
|
||||
(c-offsets-alist . ((substatement-open . 0)
|
||||
(inextern-lang . 0)
|
||||
(arglist-intro . +)
|
||||
(knr-argdecl-intro . +)))
|
||||
(c-hanging-braces-alist . ((brace-list-open)
|
||||
(brace-list-intro)
|
||||
(brace-list-close)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)))
|
||||
(c-block-comment-prefix . ""))
|
||||
|
||||
("java"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . (0 . 0))
|
||||
;; the following preserves Javadoc starter lines
|
||||
(c-offsets-alist . ((inline-open . 0)
|
||||
(topmost-intro-cont . +)
|
||||
(statement-block-intro . +)
|
||||
(knr-argdecl-intro . 5)
|
||||
(substatement-open . +)
|
||||
(substatement-label . +)
|
||||
(label . +)
|
||||
(statement-case-open . +)
|
||||
(statement-cont . +)
|
||||
(arglist-intro . c-lineup-arglist-intro-after-paren)
|
||||
(arglist-close . c-lineup-arglist)
|
||||
(access-label . 0)
|
||||
(inher-cont . c-lineup-java-inher)
|
||||
(func-decl-cont . c-lineup-java-throws))))
|
||||
|
||||
;; awk style exists primarily for auto-newline settings. Otherwise it's
|
||||
;; pretty much like k&r.
|
||||
("awk"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((defun-open after)
|
||||
(defun-close . c-snug-1line-defun-close)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)))
|
||||
(c-hanging-semi&comma-criteria . nil)
|
||||
(c-cleanup-list . nil) ; You might want one-liner-defun here.
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
)
|
||||
"Styles of indentation.
|
||||
Elements of this alist are of the form:
|
||||
|
||||
(STYLE-STRING [BASE-STYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
|
||||
|
||||
where STYLE-STRING is a short descriptive string used to select a
|
||||
style, VARIABLE is any Emacs variable, and VALUE is the intended value
|
||||
for that variable when using the selected style.
|
||||
|
||||
Optional BASE-STYLE if present, is a string and must follow
|
||||
STYLE-STRING. BASE-STYLE names a style that this style inherits from.
|
||||
By default, all styles inherit from the \"user\" style, which is
|
||||
computed at run time. Style loops generate errors.
|
||||
|
||||
Two variables are treated specially. When VARIABLE is
|
||||
`c-offsets-alist', the VALUE is a list containing elements of the
|
||||
form:
|
||||
|
||||
(SYNTACTIC-SYMBOL . OFFSET)
|
||||
|
||||
as described in `c-offsets-alist'. These are passed directly to
|
||||
`c-set-offset' so there is no need to set every syntactic symbol in
|
||||
your style, only those that are different from the default.
|
||||
|
||||
When VARIABLE is `c-special-indent-hook', its VALUE is added to
|
||||
`c-special-indent-hook' using `add-hook'. If VALUE is a list, each
|
||||
element of the list is added with `add-hook'.
|
||||
|
||||
Do not change this variable directly. Use the function `c-add-style'
|
||||
to add new styles or modify existing styles (it is not a good idea to
|
||||
modify existing styles -- you should create a new style that inherits
|
||||
the existing style.")
|
||||
|
||||
|
||||
;; Functions that manipulate styles
|
||||
(defun c-set-style-1 (conscell dont-override)
|
||||
;; Set the style for one variable
|
||||
(let ((attr (car conscell))
|
||||
(val (cdr conscell)))
|
||||
(cond
|
||||
;; first special variable
|
||||
((eq attr 'c-offsets-alist)
|
||||
(let ((offsets (cond ((eq dont-override t)
|
||||
c-offsets-alist)
|
||||
(dont-override
|
||||
(default-value 'c-offsets-alist)))))
|
||||
(mapcar (lambda (langentry)
|
||||
(let ((langelem (car langentry))
|
||||
(offset (cdr langentry)))
|
||||
(unless (assq langelem offsets)
|
||||
(c-set-offset langelem offset))))
|
||||
val)))
|
||||
;; second special variable
|
||||
((eq attr 'c-special-indent-hook)
|
||||
;; Maybe we should ignore dont-override here and always add new
|
||||
;; hooks?
|
||||
(unless (cond ((eq dont-override t)
|
||||
c-special-indent-hook)
|
||||
(dont-override
|
||||
(default-value 'c-special-indent-hook)))
|
||||
(if (listp val)
|
||||
(mapcar (lambda (func)
|
||||
(add-hook 'c-special-indent-hook func t t))
|
||||
val)
|
||||
(add-hook 'c-special-indent-hook val t t))))
|
||||
;; all other variables
|
||||
(t (when (or (not dont-override)
|
||||
(not (memq attr c-style-variables))
|
||||
(eq (if (eq dont-override t)
|
||||
(symbol-value attr)
|
||||
(default-value attr))
|
||||
'set-from-style))
|
||||
(set attr val)
|
||||
;; Must update a number of other variables if
|
||||
;; c-comment-prefix-regexp is set.
|
||||
(if (eq attr 'c-comment-prefix-regexp)
|
||||
(c-setup-paragraph-variables)))))))
|
||||
|
||||
(defun c-get-style-variables (style basestyles)
|
||||
;; Return all variables in a style by resolving inheritances.
|
||||
(if (not style)
|
||||
(copy-alist c-fallback-style)
|
||||
(let ((vars (cdr (or (assoc (downcase style) c-style-alist)
|
||||
(assoc (upcase style) c-style-alist)
|
||||
(assoc style c-style-alist)
|
||||
(progn
|
||||
(c-benign-error "Undefined style: %s" style)
|
||||
nil)))))
|
||||
(let ((base (and (stringp (car-safe vars))
|
||||
(prog1
|
||||
(downcase (car vars))
|
||||
(setq vars (cdr vars))))))
|
||||
(if (memq base basestyles)
|
||||
(c-benign-error "Style loop detected: %s in %s" base basestyles)
|
||||
(nconc (c-get-style-variables base (cons base basestyles))
|
||||
(copy-alist vars)))))))
|
||||
|
||||
(defvar c-set-style-history nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun c-set-style (stylename &optional dont-override)
|
||||
"Set the current buffer to use the style STYLENAME.
|
||||
STYLENAME, a string, must be an existing CC Mode style - These are contained
|
||||
in the variable `c-style-alist'.
|
||||
|
||||
The variable `c-indentation-style' will get set to STYLENAME.
|
||||
|
||||
\"Setting the style\" is done by setting CC Mode's \"style variables\" to the
|
||||
values indicated by the pertinent entry in `c-style-alist'. Other variables
|
||||
might get set too.
|
||||
|
||||
If DONT-OVERRIDE is neither nil nor t, style variables whose default values
|
||||
have been set (more precisely, whose default values are not the symbol
|
||||
`set-from-style') will not be changed. This avoids overriding global settings
|
||||
done in ~/.emacs. It is useful to call c-set-style from a mode hook in this
|
||||
way.
|
||||
|
||||
If DONT-OVERRIDE is t, style variables that already have values (i.e., whose
|
||||
values are not the symbol `set-from-style') will not be overridden. CC Mode
|
||||
calls c-set-style internally in this way whilst initializing a buffer; if
|
||||
cc-set-style is called like this from anywhere else, it will usually behave as
|
||||
a null operation."
|
||||
(interactive
|
||||
(list (let ((completion-ignore-case t)
|
||||
(prompt (format "Which %s indentation style? "
|
||||
mode-name)))
|
||||
(completing-read prompt c-style-alist nil t nil
|
||||
'c-set-style-history
|
||||
c-indentation-style))))
|
||||
(or c-buffer-is-cc-mode
|
||||
(error "Buffer %s is not a CC Mode buffer (c-set-style)" (buffer-name)))
|
||||
(or (stringp stylename)
|
||||
(error "Argument to c-set-style was not a string"))
|
||||
(c-initialize-builtin-style)
|
||||
(let ((vars (c-get-style-variables stylename nil)))
|
||||
(unless dont-override
|
||||
;; Since we always add to c-special-indent-hook we must reset it
|
||||
;; first, or else the hooks from the preceding style will
|
||||
;; remain. This is not necessary for c-offsets-alist, since
|
||||
;; c-get-style-variables contains every valid offset type in the
|
||||
;; fallback entry.
|
||||
(setq c-special-indent-hook
|
||||
(default-value 'c-special-indent-hook)))
|
||||
(mapcar (lambda (elem)
|
||||
(c-set-style-1 elem dont-override))
|
||||
;; Need to go through the variables backwards when we
|
||||
;; don't override any settings.
|
||||
(if (eq dont-override t) (nreverse vars) vars)))
|
||||
(setq c-indentation-style stylename)
|
||||
(c-keep-region-active))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-add-style (style description &optional set-p)
|
||||
"Adds a style to `c-style-alist', or updates an existing one.
|
||||
STYLE is a string identifying the style to add or update. DESCRIPTION
|
||||
is an association list describing the style and must be of the form:
|
||||
|
||||
([BASESTYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
|
||||
|
||||
See the variable `c-style-alist' for the semantics of BASESTYLE,
|
||||
VARIABLE and VALUE. This function also sets the current style to
|
||||
STYLE using `c-set-style' if the optional SET-P flag is non-nil."
|
||||
(interactive
|
||||
(let ((stylename (completing-read "Style to add: " c-style-alist
|
||||
nil nil nil 'c-set-style-history))
|
||||
(descr (eval-minibuffer "Style description: ")))
|
||||
(list stylename descr
|
||||
(y-or-n-p "Set the style too? "))))
|
||||
(setq style (downcase style))
|
||||
(let ((s (assoc style c-style-alist)))
|
||||
(if s
|
||||
(setcdr s (copy-alist description)) ; replace
|
||||
(setq c-style-alist (cons (cons style description) c-style-alist))))
|
||||
(and set-p (c-set-style style)))
|
||||
|
||||
|
||||
(defvar c-read-offset-history nil)
|
||||
|
||||
(defun c-read-offset (langelem)
|
||||
;; read new offset value for LANGELEM from minibuffer. return a
|
||||
;; legal value only
|
||||
(let* ((oldoff (cdr-safe (or (assq langelem c-offsets-alist)
|
||||
(assq langelem (get 'c-offsets-alist
|
||||
'c-stylevar-fallback)))))
|
||||
(symname (symbol-name langelem))
|
||||
(defstr (format "(default %s): " oldoff))
|
||||
(errmsg (concat "Offset must be int, func, var, vector, list, "
|
||||
"or [+,-,++,--,*,/] "
|
||||
defstr))
|
||||
(prompt (concat symname " offset " defstr))
|
||||
(keymap (make-sparse-keymap))
|
||||
(minibuffer-completion-table obarray)
|
||||
(minibuffer-completion-predicate 'fboundp)
|
||||
offset input)
|
||||
;; In principle completing-read is used here, but SPC is unbound
|
||||
;; to make it less annoying to enter lists.
|
||||
(set-keymap-parent keymap minibuffer-local-completion-map)
|
||||
(define-key keymap " " 'self-insert-command)
|
||||
(while (not offset)
|
||||
(setq input (read-from-minibuffer prompt nil keymap t
|
||||
'c-read-offset-history
|
||||
(format "%s" oldoff)))
|
||||
(if (c-valid-offset input)
|
||||
(setq offset input)
|
||||
;; error, but don't signal one, keep trying
|
||||
;; to read an input value
|
||||
(ding)
|
||||
(setq prompt errmsg)))
|
||||
offset))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-set-offset (symbol offset &optional ignored)
|
||||
"Change the value of a syntactic element symbol in `c-offsets-alist'.
|
||||
SYMBOL is the syntactic element symbol to change and OFFSET is the new
|
||||
offset for that syntactic element. The optional argument is not used
|
||||
and exists only for compatibility reasons."
|
||||
(interactive
|
||||
(let* ((langelem
|
||||
(intern (completing-read
|
||||
(concat "Syntactic symbol to change"
|
||||
(if current-prefix-arg " or add" "")
|
||||
": ")
|
||||
(mapcar
|
||||
#'(lambda (langelem)
|
||||
(cons (format "%s" (car langelem)) nil))
|
||||
(get 'c-offsets-alist 'c-stylevar-fallback))
|
||||
nil (not current-prefix-arg)
|
||||
;; initial contents tries to be the last element
|
||||
;; on the syntactic analysis list for the current
|
||||
;; line
|
||||
(and c-buffer-is-cc-mode
|
||||
(c-save-buffer-state
|
||||
((syntax (c-guess-basic-syntax))
|
||||
(len (length syntax))
|
||||
(ic (format "%s" (car (nth (1- len) syntax)))))
|
||||
(cons ic 0)))
|
||||
)))
|
||||
(offset (c-read-offset langelem)))
|
||||
(list langelem offset current-prefix-arg)))
|
||||
;; sanity check offset
|
||||
(if (c-valid-offset offset)
|
||||
(let ((entry (assq symbol c-offsets-alist)))
|
||||
(if entry
|
||||
(setcdr entry offset)
|
||||
(if (assq symbol (get 'c-offsets-alist 'c-stylevar-fallback))
|
||||
(setq c-offsets-alist (cons (cons symbol offset)
|
||||
c-offsets-alist))
|
||||
(c-benign-error "%s is not a valid syntactic symbol" symbol))))
|
||||
(c-benign-error "Invalid indentation setting for symbol %s: %S"
|
||||
symbol offset))
|
||||
(c-keep-region-active))
|
||||
|
||||
|
||||
(defun c-setup-paragraph-variables ()
|
||||
"Fix things up for paragraph recognition and filling inside comments and
|
||||
strings by incorporating the values of `c-comment-prefix-regexp',
|
||||
`sentence-end', `paragraph-start' and `paragraph-separate' in the relevant
|
||||
variables."
|
||||
|
||||
(interactive)
|
||||
(or c-buffer-is-cc-mode
|
||||
(error "Buffer %s is not a CC Mode buffer (c-setup-paragraph-variables)"
|
||||
(buffer-name)))
|
||||
;; Set up the values for use in comments.
|
||||
(setq c-current-comment-prefix
|
||||
(if (listp c-comment-prefix-regexp)
|
||||
(cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
|
||||
(assoc 'other c-comment-prefix-regexp)))
|
||||
c-comment-prefix-regexp))
|
||||
|
||||
(let ((comment-line-prefix
|
||||
(concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
|
||||
|
||||
(setq paragraph-start (concat comment-line-prefix
|
||||
c-paragraph-start
|
||||
"\\|"
|
||||
page-delimiter)
|
||||
paragraph-separate (concat comment-line-prefix
|
||||
c-paragraph-separate
|
||||
"\\|"
|
||||
page-delimiter)
|
||||
paragraph-ignore-fill-prefix t
|
||||
adaptive-fill-mode t
|
||||
adaptive-fill-regexp
|
||||
(concat comment-line-prefix
|
||||
(if (default-value 'adaptive-fill-regexp)
|
||||
(concat "\\("
|
||||
(default-value 'adaptive-fill-regexp)
|
||||
"\\)")
|
||||
"")))
|
||||
|
||||
(when (boundp 'adaptive-fill-first-line-regexp)
|
||||
;; XEmacs adaptive fill mode doesn't have this.
|
||||
(make-local-variable 'adaptive-fill-first-line-regexp)
|
||||
(setq adaptive-fill-first-line-regexp
|
||||
(concat "\\`" comment-line-prefix
|
||||
;; Maybe we should incorporate the old value here,
|
||||
;; but then we have to do all sorts of kludges to
|
||||
;; deal with the \` and \' it probably contains.
|
||||
"\\'"))))
|
||||
|
||||
;; Set up the values for use in strings. These are the default
|
||||
;; paragraph-start/separate values, enhanced to accept escaped EOLs as
|
||||
;; whitespace. Used in c-beginning/end-of-sentence-in-string in cc-cmds.
|
||||
(setq c-string-par-start
|
||||
;;(concat "\\(" (default-value 'paragraph-start) "\\)\\|[ \t]*\\\\$"))
|
||||
"\f\\|[ \t]*\\\\?$")
|
||||
(setq c-string-par-separate
|
||||
;;(concat "\\(" (default-value 'paragraph-separate) "\\)\\|[ \t]*\\\\$"))
|
||||
"[ \t\f]*\\\\?$")
|
||||
(setq c-sentence-end-with-esc-eol
|
||||
(concat "\\(\\(" (c-default-value-sentence-end) "\\)"
|
||||
;; N.B.: "$" would be illegal when not enclosed like "\\($\\)".
|
||||
"\\|" "[.?!][]\"')}]* ?\\\\\\($\\)[ \t\n]*"
|
||||
"\\)")))
|
||||
|
||||
|
||||
;; Helper for setting up Filladapt mode. It's not used by CC Mode itself.
|
||||
|
||||
(cc-bytecomp-defvar filladapt-token-table)
|
||||
(cc-bytecomp-defvar filladapt-token-match-table)
|
||||
(cc-bytecomp-defvar filladapt-token-conversion-table)
|
||||
|
||||
(defun c-setup-filladapt ()
|
||||
"Convenience function to configure Kyle E. Jones' Filladapt mode for
|
||||
CC Mode by making sure the proper entries are present on
|
||||
`filladapt-token-table', `filladapt-token-match-table', and
|
||||
`filladapt-token-conversion-table'. This is intended to be used on
|
||||
`c-mode-common-hook' or similar."
|
||||
;; This function is intended to be used explicitly by the end user
|
||||
;; only.
|
||||
|
||||
;; The default configuration already handles C++ comments, but we
|
||||
;; need to add handling of C block comments. A new filladapt token
|
||||
;; `c-comment' is added for that.
|
||||
(let (p)
|
||||
(setq p filladapt-token-table)
|
||||
(while (and p (not (eq (car-safe (cdr-safe (car-safe p))) 'c-comment)))
|
||||
(setq p (cdr-safe p)))
|
||||
(if p
|
||||
(setcar (car p) c-current-comment-prefix)
|
||||
(setq filladapt-token-table
|
||||
(append (list (car filladapt-token-table)
|
||||
(list c-current-comment-prefix 'c-comment))
|
||||
(cdr filladapt-token-table)))))
|
||||
(unless (assq 'c-comment filladapt-token-match-table)
|
||||
(setq filladapt-token-match-table
|
||||
(append '((c-comment c-comment))
|
||||
filladapt-token-match-table)))
|
||||
(unless (assq 'c-comment filladapt-token-conversion-table)
|
||||
(setq filladapt-token-conversion-table
|
||||
(append '((c-comment . exact))
|
||||
filladapt-token-conversion-table))))
|
||||
|
||||
|
||||
(defun c-initialize-builtin-style ()
|
||||
;; Dynamically append the default value of most variables. This is
|
||||
;; crucial because future c-set-style calls will always reset the
|
||||
;; variables first to the `cc-mode' style before instituting the new
|
||||
;; style. Only do this once!
|
||||
(unless (get 'c-initialize-builtin-style 'is-run)
|
||||
(put 'c-initialize-builtin-style 'is-run t)
|
||||
;;(c-initialize-cc-mode)
|
||||
(unless (assoc "user" c-style-alist)
|
||||
(let ((vars c-style-variables) var val uservars)
|
||||
(while vars
|
||||
(setq var (car vars)
|
||||
val (symbol-value var)
|
||||
vars (cdr vars))
|
||||
(cond ((eq var 'c-offsets-alist)
|
||||
(or (null val)
|
||||
(setq uservars (cons (cons 'c-offsets-alist val)
|
||||
uservars))))
|
||||
((not (eq val 'set-from-style))
|
||||
(setq uservars (cons (cons var val)
|
||||
uservars)))))
|
||||
(c-add-style "user" uservars)))
|
||||
(unless (assoc "cc-mode" c-style-alist)
|
||||
(c-add-style "cc-mode" '("user")))
|
||||
(if c-style-variables-are-local-p
|
||||
(c-make-styles-buffer-local))))
|
||||
|
||||
(defun c-make-styles-buffer-local (&optional this-buf-only-p)
|
||||
"Make all CC Mode style variables buffer local.
|
||||
If `this-buf-only-p' is non-nil, the style variables will be made
|
||||
buffer local only in the current buffer. Otherwise they'll be made
|
||||
permanently buffer local in any buffer that changes their values.
|
||||
|
||||
The buffer localness of the style variables are normally controlled
|
||||
with the variable `c-style-variables-are-local-p', so there's seldom
|
||||
any reason to call this function directly."
|
||||
|
||||
;; style variables
|
||||
(let ((func (if this-buf-only-p
|
||||
'make-local-variable
|
||||
'make-variable-buffer-local))
|
||||
(varsyms (cons 'c-indentation-style (copy-alist c-style-variables))))
|
||||
(delq 'c-special-indent-hook varsyms)
|
||||
(mapcar func varsyms)
|
||||
;; Hooks must be handled specially
|
||||
(if this-buf-only-p
|
||||
(make-local-hook 'c-special-indent-hook)
|
||||
(make-variable-buffer-local 'c-special-indent-hook)
|
||||
(setq c-style-variables-are-local-p t))
|
||||
))
|
||||
|
||||
|
||||
|
||||
(cc-provide 'cc-styles)
|
||||
|
||||
;;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
|
||||
;;; cc-styles.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-styles.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-styles.elc
Normal file
Binary file not shown.
312
site-lisp/cc-mode/5.31.2/cc-subword.el
Normal file
312
site-lisp/cc-mode/5.31.2/cc-subword.el
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
;;; cc-subword.el --- Handling capitalized subwords in a nomenclature
|
||||
|
||||
;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Masatake YAMATO
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This package provides `subword' oriented commands and a minor mode
|
||||
;; (`c-subword-mode') that substitutes the common word handling
|
||||
;; functions with them.
|
||||
|
||||
;; In spite of GNU Coding Standards, it is popular to name a symbol by
|
||||
;; mixing uppercase and lowercase letters, e.g. "GtkWidget",
|
||||
;; "EmacsFrameClass", "NSGraphicsContext", etc. Here we call these
|
||||
;; mixed case symbols `nomenclatures'. Also, each capitalized (or
|
||||
;; completely uppercase) part of a nomenclature is called a `subword'.
|
||||
;; Here are some examples:
|
||||
|
||||
;; Nomenclature Subwords
|
||||
;; ===========================================================
|
||||
;; GtkWindow => "Gtk" and "Window"
|
||||
;; EmacsFrameClass => "Emacs", "Frame" and "Class"
|
||||
;; NSGraphicsContext => "NS", "Graphics" and "Context"
|
||||
|
||||
;; The subword oriented commands defined in this package recognize
|
||||
;; subwords in a nomenclature to move between them and to edit them as
|
||||
;; words.
|
||||
|
||||
;; In the minor mode, all common key bindings for word oriented
|
||||
;; commands are overridden by the subword oriented commands:
|
||||
|
||||
;; Key Word oriented command Subword oriented command
|
||||
;; ============================================================
|
||||
;; M-f `forward-word' `c-forward-subword'
|
||||
;; M-b `backward-word' `c-backward-subword'
|
||||
;; M-@ `mark-word' `c-mark-subword'
|
||||
;; M-d `kill-word' `c-kill-subword'
|
||||
;; M-DEL `backward-kill-word' `c-backward-kill-subword'
|
||||
;; M-t `transpose-words' `c-transpose-subwords'
|
||||
;; M-c `capitalize-word' `c-capitalize-subword'
|
||||
;; M-u `upcase-word' `c-upcase-subword'
|
||||
;; M-l `downcase-word' `c-downcase-subword'
|
||||
;;
|
||||
;; Note: If you have changed the key bindings for the word oriented
|
||||
;; commands in your .emacs or a similar place, the keys you've changed
|
||||
;; to are also used for the corresponding subword oriented commands.
|
||||
|
||||
;; To make the mode turn on automatically, put the following code in
|
||||
;; your .emacs:
|
||||
;;
|
||||
;; (add-hook 'c-mode-common-hook
|
||||
;; (lambda () (c-subword-mode 1)))
|
||||
;;
|
||||
|
||||
;; Acknowledgment:
|
||||
;; The regular expressions to detect subwords are mostly based on
|
||||
;; the old `c-forward-into-nomenclature' originally contributed by
|
||||
;; Terry_Glanfield dot Southern at rxuk dot xerox dot com.
|
||||
|
||||
;; TODO: ispell-word and subword oriented C-w in isearch.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-cmds)
|
||||
|
||||
;; Don't complain about the `define-minor-mode' form if it isn't defined.
|
||||
(cc-bytecomp-defvar c-subword-mode)
|
||||
|
||||
;;; Autoload directives must be on the top level, so we construct an
|
||||
;;; autoload form instead.
|
||||
;;;###autoload (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t)
|
||||
|
||||
(if (not (fboundp 'define-minor-mode))
|
||||
(defun c-subword-mode ()
|
||||
"(Missing) mode enabling subword movement and editing keys.
|
||||
This mode is not (yet) available in this version of (X)Emacs. Sorry! If
|
||||
you really want it, please send a request to <bug-gnu-emacs@gnu.org>,
|
||||
telling us which (X)Emacs version you're using."
|
||||
(interactive)
|
||||
(error
|
||||
"c-subword-mode is not (yet) available in this version of (X)Emacs. Sorry!"))
|
||||
|
||||
(defvar c-subword-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(substitute-key-definition 'forward-word
|
||||
'c-forward-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'backward-word
|
||||
'c-backward-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'mark-word
|
||||
'c-mark-subword
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'kill-word
|
||||
'c-kill-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'backward-kill-word
|
||||
'c-backward-kill-subword
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'transpose-words
|
||||
'c-transpose-subwords
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'capitalize-word
|
||||
'c-capitalize-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'upcase-word
|
||||
'c-upcase-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'downcase-word
|
||||
'c-downcase-subword
|
||||
map global-map)
|
||||
map)
|
||||
"Keymap used in command `c-subword-mode' minor mode.")
|
||||
|
||||
(define-minor-mode c-subword-mode
|
||||
"Mode enabling subword movement and editing keys.
|
||||
In spite of GNU Coding Standards, it is popular to name a symbol by
|
||||
mixing uppercase and lowercase letters, e.g. \"GtkWidget\",
|
||||
\"EmacsFrameClass\", \"NSGraphicsContext\", etc. Here we call these
|
||||
mixed case symbols `nomenclatures'. Also, each capitalized (or
|
||||
completely uppercase) part of a nomenclature is called a `subword'.
|
||||
Here are some examples:
|
||||
|
||||
Nomenclature Subwords
|
||||
===========================================================
|
||||
GtkWindow => \"Gtk\" and \"Window\"
|
||||
EmacsFrameClass => \"Emacs\", \"Frame\" and \"Class\"
|
||||
NSGraphicsContext => \"NS\", \"Graphics\" and \"Context\"
|
||||
|
||||
The subword oriented commands activated in this minor mode recognize
|
||||
subwords in a nomenclature to move between subwords and to edit them
|
||||
as words.
|
||||
|
||||
\\{c-subword-mode-map}"
|
||||
nil
|
||||
nil
|
||||
c-subword-mode-map
|
||||
(c-update-modeline))
|
||||
|
||||
)
|
||||
|
||||
(defun c-forward-subword (&optional arg)
|
||||
"Do the same as `forward-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `forward-word'."
|
||||
(interactive "p")
|
||||
(unless arg (setq arg 1))
|
||||
(c-keep-region-active)
|
||||
(cond
|
||||
((< 0 arg)
|
||||
(dotimes (i arg (point))
|
||||
(c-forward-subword-internal)))
|
||||
((> 0 arg)
|
||||
(dotimes (i (- arg) (point))
|
||||
(c-backward-subword-internal)))
|
||||
(t
|
||||
(point))))
|
||||
|
||||
(defun c-backward-subword (&optional arg)
|
||||
"Do the same as `backward-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `backward-word'."
|
||||
(interactive "p")
|
||||
(c-forward-subword (- (or arg 1))))
|
||||
|
||||
(defun c-mark-subword (arg)
|
||||
"Do the same as `mark-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `mark-word'."
|
||||
;; This code is almost copied from `mark-word' in GNU Emacs.
|
||||
(interactive "p")
|
||||
(cond ((and (eq last-command this-command) (mark t))
|
||||
(set-mark
|
||||
(save-excursion
|
||||
(goto-char (mark))
|
||||
(c-forward-subword arg)
|
||||
(point))))
|
||||
(t
|
||||
(push-mark
|
||||
(save-excursion
|
||||
(c-forward-subword arg)
|
||||
(point))
|
||||
nil t))))
|
||||
|
||||
(defun c-kill-subword (arg)
|
||||
"Do the same as `kill-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `kill-word'."
|
||||
(interactive "p")
|
||||
(kill-region (point) (c-forward-subword arg)))
|
||||
|
||||
(defun c-backward-kill-subword (arg)
|
||||
"Do the same as `backward-kill-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `backward-kill-word'."
|
||||
(interactive "p")
|
||||
(c-kill-subword (- arg)))
|
||||
|
||||
(defun c-transpose-subwords (arg)
|
||||
"Do the same as `transpose-words' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `transpose-words'."
|
||||
(interactive "*p")
|
||||
(transpose-subr 'c-forward-subword arg))
|
||||
|
||||
(defun c-capitalize-subword (arg)
|
||||
"Do the same as `capitalize-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `capitalize-word'."
|
||||
(interactive "p")
|
||||
(let ((count (abs arg))
|
||||
(direction (if (< 0 arg) 1 -1)))
|
||||
(dotimes (i count)
|
||||
(when (re-search-forward
|
||||
(concat "[" c-alpha "]")
|
||||
nil t)
|
||||
(goto-char (match-beginning 0)))
|
||||
(let* ((p (point))
|
||||
(pp (1+ p))
|
||||
(np (c-forward-subword direction)))
|
||||
(upcase-region p pp)
|
||||
(downcase-region pp np)
|
||||
(goto-char np)))))
|
||||
|
||||
(defun c-downcase-subword (arg)
|
||||
"Do the same as `downcase-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `downcase-word'."
|
||||
(interactive "p")
|
||||
(downcase-region (point) (c-forward-subword arg)))
|
||||
|
||||
(defun c-upcase-subword (arg)
|
||||
"Do the same as `upcase-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `upcase-word'."
|
||||
(interactive "p")
|
||||
(upcase-region (point) (c-forward-subword arg)))
|
||||
|
||||
|
||||
;;
|
||||
;; Internal functions
|
||||
;;
|
||||
(defun c-forward-subword-internal ()
|
||||
(if (and
|
||||
(save-excursion
|
||||
(let ((case-fold-search nil))
|
||||
(re-search-forward
|
||||
(concat "\\W*\\(\\([" c-upper "]*\\W?\\)[" c-lower c-digit "]*\\)")
|
||||
nil t)))
|
||||
(> (match-end 0) (point))) ; So we don't get stuck at a
|
||||
; "word-constituent" which isn't c-upper,
|
||||
; c-lower or c-digit
|
||||
(goto-char
|
||||
(cond
|
||||
((< 1 (- (match-end 2) (match-beginning 2)))
|
||||
(1- (match-end 2)))
|
||||
(t
|
||||
(match-end 0))))
|
||||
(forward-word 1)))
|
||||
|
||||
|
||||
(defun c-backward-subword-internal ()
|
||||
(if (save-excursion
|
||||
(let ((case-fold-search nil))
|
||||
(re-search-backward
|
||||
(concat
|
||||
"\\(\\(\\W\\|[" c-lower c-digit "]\\)\\([" c-upper "]+\\W*\\)"
|
||||
"\\|\\W\\w+\\)")
|
||||
nil t)))
|
||||
(goto-char
|
||||
(cond
|
||||
((and (match-end 3)
|
||||
(< 1 (- (match-end 3) (match-beginning 3)))
|
||||
(not (eq (point) (match-end 3))))
|
||||
(1- (match-end 3)))
|
||||
(t
|
||||
(1+ (match-beginning 0)))))
|
||||
(backward-word 1)))
|
||||
|
||||
|
||||
(cc-provide 'cc-subword)
|
||||
|
||||
;;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3
|
||||
;;; cc-subword.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/cc-subword.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-subword.elc
Normal file
Binary file not shown.
1637
site-lisp/cc-mode/5.31.2/cc-vars.el
Normal file
1637
site-lisp/cc-mode/5.31.2/cc-vars.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.2/cc-vars.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/cc-vars.elc
Normal file
Binary file not shown.
400
site-lisp/cc-mode/5.31.2/csharp-mode-0.5.0.el
Normal file
400
site-lisp/cc-mode/5.31.2/csharp-mode-0.5.0.el
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
;;; csharp-mode.el --- C# mode derived mode
|
||||
|
||||
;; Author: 2005 Dylan R. E. Moonfire
|
||||
;; Maintainer: Dylan R. E. Moonfire <contact@mfgames.com>
|
||||
;; Created: Feburary 2005
|
||||
;; Modified: December 2005
|
||||
;; Version: 0.5.0
|
||||
;; Keywords: c# languages oop
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is a separate mode to implement the C# constructs and
|
||||
;; font-locking. It is based on the java-mode example from cc-mode.
|
||||
;;
|
||||
;; Note: The interface used in this file requires CC Mode 5.30 or
|
||||
;; later.
|
||||
|
||||
;;; Bugs:
|
||||
;;
|
||||
;; Literal strings @"" do not fontify correctly.
|
||||
;;
|
||||
;; Method names are not fontified if you have an attribute before it.
|
||||
;;
|
||||
;; This code doesn't seem to work when you compile it, then
|
||||
;; load/require in the emacs file. You will get an error (error
|
||||
;; "`c-lang-defconst' must be used in a file") which happens because
|
||||
;; cc-mode doesn't think it is in a buffer while loading directly
|
||||
;; from the init. However, if you call it based on a file extension,
|
||||
;; it works properly. Interestingly enough, this doesn't happen if
|
||||
;; you don't byte-compile cc-mode.
|
||||
|
||||
;;; .emacs (don't put in (require 'csharp-mode))
|
||||
;; (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
|
||||
;; (setq auto-mode-alist
|
||||
;; (append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
|
||||
|
||||
;;; Versions:
|
||||
;;
|
||||
;; 0.1.0 - Initial release.
|
||||
;; 0.2.0 - Fixed the identification on the "enum" keyword.
|
||||
;; - Fixed the font-lock on the "base" keyword
|
||||
;; 0.3.0 - Added a regex to fontify attributes. It isn't the
|
||||
;; the best method, but it handles single-like attributes
|
||||
;; well.
|
||||
;; - Got "super" not to fontify as a keyword.
|
||||
;; - Got extending classes and interfaces to fontify as something.
|
||||
;; 0.4.0 - Removed the attribute matching because it broke more than
|
||||
;; it fixed.
|
||||
;; - Corrected a bug with namespace not being properly identified
|
||||
;; and treating the class level as an inner object, which screwed
|
||||
;; up formatting.
|
||||
;; - Added "partial" to the keywords.
|
||||
;; 0.5.0 - Found bugs with compiled cc-mode and loading from init files.
|
||||
;; - Updated the eval-when-compile to code to let the mode be
|
||||
;; compiled.
|
||||
|
||||
;;; Code:
|
||||
(require 'cc-mode)
|
||||
|
||||
;; These are only required at compile time to get the sources for the
|
||||
;; language constants. (The cc-fonts require and the font-lock
|
||||
;; related constants could additionally be put inside an
|
||||
;; (eval-after-load "font-lock" ...) but then some trickery is
|
||||
;; necessary to get them compiled.)
|
||||
(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-mode" nil t)
|
||||
(load "cc-fonts" nil t)
|
||||
(load "cc-langs" nil t)))
|
||||
|
||||
(eval-and-compile
|
||||
;; Make our mode known to the language constant system. Use Java
|
||||
;; mode as the fallback for the constants we don't change here.
|
||||
;; This needs to be done also at compile time since the language
|
||||
;; constants are evaluated then.
|
||||
(c-add-language 'csharp-mode 'java-mode))
|
||||
|
||||
;; TODO
|
||||
;; Defines our constant for finding attributes.
|
||||
;;(defconst csharp-attribute-regex "\\[\\([XmlType]+\\)(")
|
||||
;;(defconst csharp-attribute-regex "\\[\\(.\\)")
|
||||
|
||||
;; Java uses a series of regexes to change the font-lock for class
|
||||
;; references. The problem comes in because Java uses Pascal (leading
|
||||
;; space in names, SomeClass) for class and package names, but
|
||||
;; Camel-casing (initial lowercase, upper case in words,
|
||||
;; i.e. someVariable) for variables. The notation suggested by EMCA is
|
||||
;; to use Pasacal notation for everything, except inner variables. So,
|
||||
;; the regex and formatting actually produces very wrong results.
|
||||
;;(error (byte-compile-dest-file))
|
||||
;;(error (c-get-current-file))
|
||||
(c-lang-defconst c-opt-after-id-concat-key
|
||||
csharp (if (c-lang-const c-opt-identifier-concat-key)
|
||||
(c-lang-const c-symbol-start)))
|
||||
|
||||
(c-lang-defconst c-basic-matchers-before
|
||||
csharp `(
|
||||
;; Font-lock the attributes by searching for the
|
||||
;; appropriate regex and marking it as TODO.
|
||||
;;,`(,(concat "\\(" csharp-attribute-regex "\\)")
|
||||
;; 0 font-lock-function-name-face)
|
||||
|
||||
;; Put a warning face on the opener of unclosed strings that
|
||||
;; can't span lines. Later font
|
||||
;; lock packages have a `font-lock-syntactic-face-function' for
|
||||
;; this, but it doesn't give the control we want since any
|
||||
;; fontification done inside the function will be
|
||||
;; unconditionally overridden.
|
||||
,(c-make-font-lock-search-function
|
||||
;; Match a char before the string starter to make
|
||||
;; `c-skip-comments-and-strings' work correctly.
|
||||
(concat ".\\(" c-string-limit-regexp "\\)")
|
||||
'((c-font-lock-invalid-string)))
|
||||
|
||||
;; Fontify keyword constants.
|
||||
,@(when (c-lang-const c-constant-kwds)
|
||||
(let ((re (c-make-keywords-re nil
|
||||
(c-lang-const c-constant-kwds))))
|
||||
`((eval . (list ,(concat "\\<\\(" re "\\)\\>")
|
||||
1 c-constant-face-name)))))
|
||||
|
||||
;; Fontify all keywords except the primitive types.
|
||||
,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp))
|
||||
1 font-lock-keyword-face)
|
||||
|
||||
;; Fontify leading identifiers in fully qualified names like
|
||||
;; "Foo.Bar".
|
||||
,@(when (c-lang-const c-opt-identifier-concat-key)
|
||||
`((,(byte-compile
|
||||
`(lambda (limit)
|
||||
(while (re-search-forward
|
||||
,(concat "\\(\\<" ; 1
|
||||
"\\(" (c-lang-const c-symbol-key)
|
||||
"\\)" ; 2
|
||||
"[ \t\n\r\f\v]*"
|
||||
(c-lang-const
|
||||
c-opt-identifier-concat-key)
|
||||
"[ \t\n\r\f\v]*"
|
||||
"\\)"
|
||||
"\\("
|
||||
(c-lang-const
|
||||
c-opt-after-id-concat-key)
|
||||
"\\)")
|
||||
limit t)
|
||||
(unless (progn
|
||||
(goto-char (match-beginning 0))
|
||||
(c-skip-comments-and-strings limit))
|
||||
(or (get-text-property (match-beginning 2) 'face)
|
||||
(c-put-font-lock-face (match-beginning 2)
|
||||
(match-end 2)
|
||||
c-reference-face-name))
|
||||
(goto-char (match-end 1)))))))))
|
||||
))
|
||||
|
||||
;; C# does not allow a leading qualifier operator. It also doesn't
|
||||
;; allow the ".*" construct of Java. So, we redo this regex without
|
||||
;; the "\\|\\*" regex.
|
||||
(c-lang-defconst c-identifier-key
|
||||
csharp (concat "\\(" (c-lang-const c-symbol-key) "\\)" ; 1
|
||||
(concat "\\("
|
||||
"[ \t\n\r\f\v]*"
|
||||
(c-lang-const c-opt-identifier-concat-key)
|
||||
"[ \t\n\r\f\v]*"
|
||||
(concat "\\("
|
||||
"\\(" (c-lang-const c-symbol-key) "\\)"
|
||||
"\\)")
|
||||
"\\)*")))
|
||||
|
||||
;; C# has a few rules that are slightly different than Java for
|
||||
;; operators. This also removed the Java's "super" and replaces it
|
||||
;; with the C#'s "base".
|
||||
(c-lang-defconst c-operators
|
||||
csharp `((prefix "base")))
|
||||
|
||||
;; C#, unlike Java, does use CPP prefixes for the regions and other directives.
|
||||
(c-lang-defconst c-opt-cpp-prefix
|
||||
csharp "\\s *#\\s *")
|
||||
|
||||
;; C# uses the following assignment operators
|
||||
(c-lang-defconst c-assignment-operators
|
||||
csharp '("=" "*=" "/=" "%=" "+=" "-=" ">>=" "<<=" "&=" "^=" "|="))
|
||||
|
||||
;; This defines the primative types for C#
|
||||
(c-lang-defconst c-primitive-type-kwds
|
||||
;; ECMA-344, S8
|
||||
csharp '("object" "string" "sbyte" "short" "int" "long" "byte"
|
||||
"ushort" "uint" "ulong" "float" "double" "bool" "char"
|
||||
"decimal" "void"))
|
||||
|
||||
;; The keywords that define that the following is a type, such as a
|
||||
;; class definition.
|
||||
(c-lang-defconst c-type-prefix-kwds
|
||||
;; ECMA-344, S?
|
||||
csharp '("class" "interface" "enum" "struct"))
|
||||
|
||||
;; Type modifier keywords. They appear anywhere in types, but modifiy
|
||||
;; instead create one.
|
||||
(c-lang-defconst c-type-modifier-kwds
|
||||
;; EMCA-344, S?
|
||||
csharp '("readonly" "const"))
|
||||
|
||||
;; Structures that are similiar to classes.
|
||||
(c-lang-defconst c-class-decl-kwds
|
||||
;; EMCA-344, S?
|
||||
csharp '("class" "interface"))
|
||||
|
||||
;; The various modifiers used for class and method descriptions.
|
||||
(c-lang-defconst c-modifier-kwds
|
||||
csharp '("public" "partial" "private" "const" "abstract"
|
||||
"protected" "ref" "out" "static" "virtual"
|
||||
"override" "params" "internal"))
|
||||
|
||||
;; We don't use the protection level stuff because it breaks the
|
||||
;; method indenting. Not sure why, though.
|
||||
(c-lang-defconst c-protection-kwds
|
||||
csharp nil)
|
||||
|
||||
;; Define the keywords that can have something following after them.
|
||||
(c-lang-defconst c-type-list-kwds
|
||||
csharp '("struct" "class" "interface" "is" "as"
|
||||
"delegate" "event"))
|
||||
|
||||
;; This allows the classes after the : in the class declartion to be
|
||||
;; fontified.
|
||||
(c-lang-defconst c-typeless-decl-kwds
|
||||
csharp '(":"))
|
||||
|
||||
;; Sets up the enum to handle the list properly
|
||||
(c-lang-defconst c-brace-list-decl-kwds
|
||||
csharp '("enum"))
|
||||
|
||||
;; We need to remove Java's package keyword
|
||||
(c-lang-defconst c-ref-list-kwds
|
||||
csharp '("using" "namespace"))
|
||||
|
||||
;; Follow-on blocks that don't require a brace
|
||||
(c-lang-defconst c-block-stmt-2-kwds
|
||||
csharp '("for" "if" "switch" "while" "catch" "foreach"
|
||||
"checked" "unchecked" "lock"))
|
||||
|
||||
;; Statements that break out of braces
|
||||
(c-lang-defconst c-simple-stmt-kwds
|
||||
csharp '("return" "continue" "break" "throw" "goto"))
|
||||
|
||||
;; Statements that allow a label
|
||||
;; TODO?
|
||||
(c-lang-defconst c-before-label-kwds
|
||||
csharp nil)
|
||||
|
||||
;; Constant keywords
|
||||
(c-lang-defconst c-constant-kwds
|
||||
csharp '("true" "false" "null"))
|
||||
|
||||
;; Keywords that start "primary expressions."
|
||||
(c-lang-defconst c-primary-expr-kwds
|
||||
csharp '("this" "base"))
|
||||
|
||||
;; We need to treat namespace as an outer block to class indenting
|
||||
;; works properly.
|
||||
(c-lang-defconst c-other-block-decl-kwds
|
||||
csharp '("namespace"))
|
||||
|
||||
;; We need to include the "as" for the foreach
|
||||
(c-lang-defconst c-other-kwds
|
||||
csharp '("in" "sizeof" "typeof"))
|
||||
|
||||
(c-lang-defconst c-overloadable-operators
|
||||
;; EMCA-344, S14.2.1
|
||||
csharp '("+" "-" "*" "/" "%" "&" "|" "^"
|
||||
"<<" ">>" "==" "!=" ">" "<" ">=" "<="))
|
||||
|
||||
;; No cpp in this language, but there's still a "sharppragma" directive to
|
||||
;; fontify. (The definitions for the extra keywords above are enough
|
||||
;; to incorporate them into the fontification regexps for types and
|
||||
;; keywords, so no additional font-lock patterns are required.)
|
||||
(c-lang-defconst c-cpp-matchers
|
||||
csharp (cons
|
||||
;; Use the eval form for `font-lock-keywords' to be able to use
|
||||
;; the `c-preprocessor-face-name' variable that maps to a
|
||||
;; suitable face depending on the (X)Emacs version.
|
||||
'(eval . (list "^\\s *\\(sharppragma\\)\\>\\(.*\\)"
|
||||
(list 1 c-preprocessor-face-name)
|
||||
'(2 font-lock-string-face)))
|
||||
;; There are some other things in `c-cpp-matchers' besides the
|
||||
;; preprocessor support, so include it.
|
||||
(c-lang-const c-cpp-matchers)))
|
||||
|
||||
(defcustom csharp-font-lock-extra-types nil
|
||||
"*List of extra types (aside from the type keywords) to recognize in C# mode.
|
||||
Each list item should be a regexp matching a single identifier.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-1 (c-lang-const c-matchers-1 csharp)
|
||||
"Minimal highlighting for C# mode.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-2 (c-lang-const c-matchers-2 csharp)
|
||||
"Fast normal highlighting for C# mode.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-3 (c-lang-const c-matchers-3 csharp)
|
||||
"Accurate normal highlighting for C# mode.")
|
||||
|
||||
(defvar csharp-font-lock-keywords csharp-font-lock-keywords-3
|
||||
"Default expressions to highlight in C# mode.")
|
||||
|
||||
(defvar csharp-mode-syntax-table nil
|
||||
"Syntax table used in csharp-mode buffers.")
|
||||
(or csharp-mode-syntax-table
|
||||
(setq csharp-mode-syntax-table
|
||||
(funcall (c-lang-const c-make-mode-syntax-table csharp))))
|
||||
|
||||
(defvar csharp-mode-abbrev-table nil
|
||||
"Abbreviation table used in csharp-mode buffers.")
|
||||
(c-define-abbrev-table 'csharp-mode-abbrev-table
|
||||
;; Keywords that if they occur first on a line might alter the
|
||||
;; syntactic context, and which therefore should trig reindentation
|
||||
;; when they are completed.
|
||||
'(("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 csharp-mode-map (let ((map (c-make-inherited-keymap)))
|
||||
;; Add bindings which are only useful for C#
|
||||
map)
|
||||
"Keymap used in csharp-mode buffers.")
|
||||
|
||||
;;(easy-menu-define csharp-menu csharp-mode-map "C# Mode Commands"
|
||||
;; ;; Can use `csharp' as the language for `c-mode-menu'
|
||||
;; ;; since its definition covers any language. In
|
||||
;; ;; this case the language is used to adapt to the
|
||||
;; ;; nonexistence of a cpp pass and thus removing some
|
||||
;; ;; irrelevant menu alternatives.
|
||||
;; (cons "C#" (c-lang-const c-mode-menu csharp)))
|
||||
|
||||
;;; Autoload mode trigger
|
||||
(add-to-list 'auto-mode-alist '("\\.cs" . csharp-mode))
|
||||
|
||||
;; Custom variables
|
||||
(defcustom csharp-mode-hook nil
|
||||
"*Hook called by `csharp-mode'."
|
||||
:type 'hook
|
||||
:group 'c)
|
||||
|
||||
;;; The entry point into the mode
|
||||
(defun csharp-mode ()
|
||||
"Major mode for editing C# (pronounced \"see sharp\") code.
|
||||
This is a simple example of a separate mode derived from CC Mode to
|
||||
support a language with syntax similar to C/C++/ObjC/Java/IDL/Pike.
|
||||
|
||||
The hook `c-mode-common-hook' is run with no args at mode
|
||||
initialization, then `csharp-mode-hook'.
|
||||
|
||||
Key bindings:
|
||||
\\{csharp-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(c-initialize-cc-mode t)
|
||||
(set-syntax-table csharp-mode-syntax-table)
|
||||
(setq major-mode 'csharp-mode
|
||||
mode-name "C#"
|
||||
local-abbrev-table csharp-mode-abbrev-table
|
||||
abbrev-mode t)
|
||||
(use-local-map c-mode-map)
|
||||
;; `c-init-language-vars' is a macro that is expanded at compile
|
||||
;; time to a large `setq' with all the language variables and their
|
||||
;; customized values for our language.
|
||||
(c-init-language-vars csharp-mode)
|
||||
;; `c-common-init' initializes most of the components of a CC Mode
|
||||
;; buffer, including setup of the mode menu, font-lock, etc.
|
||||
;; There's also a lower level routine `c-basic-common-init' that
|
||||
;; only makes the necessary initialization to get the syntactic
|
||||
;; analysis and similar things working.
|
||||
(c-common-init 'csharp-mode)
|
||||
;;(easy-menu-add csharp-menu)
|
||||
(run-hooks 'c-mode-common-hook)
|
||||
(run-hooks 'csharp-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
(provide 'csharp-mode)
|
||||
|
||||
;;; csharp-mode.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.2/elc/cc-align.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-align.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-awk.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-awk.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-bytecomp.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-bytecomp.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-cmds.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-cmds.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-compat.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-compat.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-defs.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-defs.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-engine.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-engine.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-fix.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-fix.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-fonts.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-fonts.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-guess.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-guess.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-langs.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-langs.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-lobotomy.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-lobotomy.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-menus.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-menus.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-mode.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-mode.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-styles.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-styles.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-subword.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-subword.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/cc-vars.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/cc-vars.elc
Normal file
Binary file not shown.
BIN
site-lisp/cc-mode/5.31.2/elc/csharp-mode-0.5.0.elc
Normal file
BIN
site-lisp/cc-mode/5.31.2/elc/csharp-mode-0.5.0.elc
Normal file
Binary file not shown.
340
site-lisp/cc-mode/5.31.3/COPYING
Normal file
340
site-lisp/cc-mode/5.31.3/COPYING
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
42
site-lisp/cc-mode/5.31.3/MANIFEST
Normal file
42
site-lisp/cc-mode/5.31.3/MANIFEST
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
Manifest for CC Mode 5.31
|
||||
|
||||
You should have received the following files in this distribution:
|
||||
|
||||
MANIFEST: This file.
|
||||
|
||||
README: Quick intro into how to get CC Mode up and running.
|
||||
|
||||
NEWS: A list of the user visible changes in each version.
|
||||
|
||||
cc-align.el, cc-awk.el, cc-cmds.el, cc-defs.el, cc-engine.el,
|
||||
cc-fonts.el, cc-langs.el, cc-menus.el, cc-mode.el, cc-styles.el,
|
||||
cc-subword.el, cc-vars.el: The source code.
|
||||
|
||||
cc-compat.el: Helps ease the transition from c-mode.el (BOCM) to
|
||||
the new indentation engine. This is provided for your convenience
|
||||
only, and is unguaranteed and unsupported.
|
||||
|
||||
cc-fix.el: (previously named cc-mode-19.el). Detects and corrects
|
||||
bugs in various older (X)Emacs versions.
|
||||
|
||||
cc-guess.el: Experiments in style guessing. This is provided for
|
||||
your convenience only, and is unguaranteed and unsupported.
|
||||
|
||||
cc-lobotomy.el: Performance vs. accuracy trade-offs. May not
|
||||
work, yadda, yadda.
|
||||
|
||||
cc-bytecomp.el: Contains helpers used during byte compiling to
|
||||
ensure that there's no mixup with earler versions of CC Mode which
|
||||
might be loaded.
|
||||
|
||||
cc-mode.texi: The latest CC Mode Texinfo manual.
|
||||
|
||||
ANNOUNCEMENT: Release announcement as it appeared on various
|
||||
forums.
|
||||
|
||||
Note that of the above files, the following are distributed with Emacs
|
||||
and XEmacs:
|
||||
|
||||
cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-compat.el,
|
||||
cc-defs.el, cc-engine.el, cc-fonts.el, cc-langs.el, cc-menus.el,
|
||||
cc-mode.el, cc-styles.el, cc-subword.el, cc-vars.el, cc-mode.texi
|
||||
1065
site-lisp/cc-mode/5.31.3/NEWS
Normal file
1065
site-lisp/cc-mode/5.31.3/NEWS
Normal file
File diff suppressed because it is too large
Load diff
123
site-lisp/cc-mode/5.31.3/README
Normal file
123
site-lisp/cc-mode/5.31.3/README
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
README for CC Mode 5.31
|
||||
Current maintainers: Martin Stjernholm and Alan Mackenzie
|
||||
Contact address : bug-cc-mode@gnu.org
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
The canonical web location for all knowledge CC Mode is:
|
||||
|
||||
<http://cc-mode.sourceforge.net/>
|
||||
|
||||
Please read the cc-mode.texi manual for details on using CC Mode.
|
||||
This is available on-line from:
|
||||
|
||||
<http://cc-mode.sourceforge.net/cc-mode.html>
|
||||
|
||||
As of this writing (November 18, 2005), CC Mode currently works
|
||||
out of the box with XEmacs versions 21.4 and later, and with Emacs
|
||||
versions 20.4 and later, 21.x and 22.x. (It will very likely work
|
||||
with later versions too, when they become available.)
|
||||
|
||||
Note that with CC Mode 5.31, we have finally dropped support for
|
||||
Emacs 19.34 and XEmacs 19.15. CC Mode 5.31 _won't_ work with
|
||||
these old versions. Upgrade them now!
|
||||
|
||||
Currently, the new Subword Mode doesn't work in Emacs 20.n.
|
||||
|
||||
MORE INFORMATION
|
||||
|
||||
Check out the CC Mode web site for the latest information,
|
||||
updates, tips, installation and compatibility notes, etc. on using
|
||||
CC Mode. The installation instructions given below are an excerpt
|
||||
of the on-line instructions. If you have problems installing CC
|
||||
Mode, please check out the URL above before submitting a bug
|
||||
report. Thanks!
|
||||
|
||||
The MANIFEST file contains a description of all the files you
|
||||
should have gotten with this distribution.
|
||||
|
||||
MANUALS
|
||||
|
||||
Preformatted versions of the manual in DVI, PostScript, and Info,
|
||||
are all available at the CC Mode web page. The Info manual has
|
||||
two variants, one for GNU Emacs, the other for XEmacs - the only
|
||||
differences between them are the targets of some cross references
|
||||
within the manual.
|
||||
|
||||
To build the manual yourself, you will need Texinfo 4.7 or later.
|
||||
Simply type:
|
||||
|
||||
% makeinfo cc-mode.texi # For GNU Emacs
|
||||
or
|
||||
% makeinfo -DXEMACS cc-mode.texi # For XEmacs
|
||||
|
||||
To make the DVI version, type:
|
||||
|
||||
% texi2dvi cc-mode.texi
|
||||
|
||||
INSTALLATION
|
||||
|
||||
Here is a quick guide for installing CC Mode. For the latest
|
||||
information on installing CC Mode, please see the CC Mode web site
|
||||
given above.
|
||||
|
||||
Byte Compiling
|
||||
|
||||
It is highly recommended that you byte-compile CC Mode for
|
||||
performance reasons. Running CC Mode non-byte-compiled is not
|
||||
supported.
|
||||
|
||||
You can compile CC Mode in the same way as any other package. To
|
||||
compile it from a running (X)Emacs session:
|
||||
|
||||
M-0 M-x byte-recompile-directory RET /path/to/cc-mode RET
|
||||
|
||||
To compile CC Mode from the shell:
|
||||
|
||||
% cd /path/to/cc-mode
|
||||
% $(EMACS) -batch -no-site-file -q -f batch-byte-compile cc-*.el
|
||||
|
||||
where $(EMACS) is either emacs or xemacs depending on the flavor
|
||||
you use. Note that the byte compiled files from one version of
|
||||
(X)Emacs are likely not to work on a different version - compile
|
||||
them fresh when you upgrade your (X)Emacs version.
|
||||
|
||||
Installing
|
||||
|
||||
Put the compiled files somewhere (X)Emacs will find them, i.e. in
|
||||
some path that's in the load-path variable. You must make sure
|
||||
they are found before any CC Mode files which are distributed with
|
||||
(X)Emacs. A directory has higher precendence than all directories
|
||||
after it in the load-path list.
|
||||
|
||||
If you're going to be using AWK Mode, insert the following line
|
||||
into your .emacs or init.el file:
|
||||
|
||||
(autoload 'awk-mode "cc-mode" nil t)
|
||||
|
||||
This will cause (X)Emacs to use the new AWK Mode for AWK files,
|
||||
rather than the older mode contained in the file awk-mode.elc.
|
||||
(See also the note below under "Compatibility Issues".)
|
||||
|
||||
To test that you have things set up correctly, visit a C file and
|
||||
then type:
|
||||
|
||||
M-x c-version RET
|
||||
=> Using CC Mode version 5.XX
|
||||
|
||||
where XX is the correct minor revision number.
|
||||
|
||||
Compatibility Issues
|
||||
|
||||
CC Mode should work fine with most versions of Emacs and XEmacs
|
||||
which aren't ancient (see the introduction above).
|
||||
|
||||
If you're using AWK, you can verify that you've got Emacs set up
|
||||
to use CC Mode for AWK files by displaying the mode documentation
|
||||
string with C-h m from an AWK buffer. The current mode's doc
|
||||
string contains "to submit a problem report, enter `C-c C-b'" near
|
||||
the top of the doc string where the obsolete awk-mode.el has "This
|
||||
is much like C mode except ....".
|
||||
|
||||
For more details about interactions with different packages, see
|
||||
the CC Mode web page.
|
||||
1273
site-lisp/cc-mode/5.31.3/cc-align.el
Normal file
1273
site-lisp/cc-mode/5.31.3/cc-align.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-align.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-align.elc
Normal file
Binary file not shown.
1015
site-lisp/cc-mode/5.31.3/cc-awk.el
Normal file
1015
site-lisp/cc-mode/5.31.3/cc-awk.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-awk.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-awk.elc
Normal file
Binary file not shown.
440
site-lisp/cc-mode/5.31.3/cc-bytecomp.el
Normal file
440
site-lisp/cc-mode/5.31.3/cc-bytecomp.el
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
;;; cc-bytecomp.el --- compile time setup for proper compilation
|
||||
|
||||
;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
;; Foundation, Inc.
|
||||
|
||||
;; Author: Martin Stjernholm
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 15-Jul-2000
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is used to ensure that the CC Mode files are correctly
|
||||
;; compiled regardless the environment (e.g. if an older CC Mode with
|
||||
;; outdated macros are loaded during compilation). It also provides
|
||||
;; features to defeat the compiler warnings for selected symbols.
|
||||
;;
|
||||
;; There's really nothing CC Mode specific here; this functionality
|
||||
;; ought to be provided by the byte compilers or some accompanying
|
||||
;; library. To use it from some package "foo.el", begin by putting
|
||||
;; the following blurb at the top of the file:
|
||||
;;
|
||||
;; (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))
|
||||
;;
|
||||
;; This (unfortunately rather clumsy) form will ensure that the
|
||||
;; cc-bytecomp.el in the same directory as foo.el is loaded during
|
||||
;; byte compilation of the latter.
|
||||
;;
|
||||
;; At the end of foo.el there should normally be a "(provide 'foo)".
|
||||
;; Replace it with "(cc-provide 'foo)"; that is necessary to restore
|
||||
;; the environment after the byte compilation. If you don't have a
|
||||
;; `provide' at the end, you have to add the following as the very
|
||||
;; last form in the file:
|
||||
;;
|
||||
;; (eval-when-compile (cc-bytecomp-restore-environment))
|
||||
;;
|
||||
;; Now everything is set to use the various functions and macros in
|
||||
;; this package.
|
||||
;;
|
||||
;; If your package is split into several files, you should use
|
||||
;; `cc-require', `cc-require-when-compile' or `cc-load' to load them.
|
||||
;; That ensures that the files in the same directory always are
|
||||
;; loaded, to avoid mixup with other versions of them that might exist
|
||||
;; elsewhere in the load path.
|
||||
;;
|
||||
;; To suppress byte compiler warnings, use the macros
|
||||
;; `cc-bytecomp-defun', `cc-bytecomp-defvar',
|
||||
;; `cc-bytecomp-obsolete-fun', and `cc-bytecomp-obsolete-var'.
|
||||
;;
|
||||
;; This file is not used at all after the package has been byte
|
||||
;; compiled. It is however necessary when running uncompiled.
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar cc-bytecomp-unbound-variables nil)
|
||||
(defvar cc-bytecomp-original-functions nil)
|
||||
(defvar cc-bytecomp-original-properties nil)
|
||||
(defvar cc-bytecomp-loaded-files nil)
|
||||
(defvar cc-bytecomp-environment-set nil)
|
||||
|
||||
(defmacro cc-bytecomp-debug-msg (&rest args)
|
||||
;;`(message ,@args)
|
||||
)
|
||||
|
||||
(defun cc-bytecomp-setup-environment ()
|
||||
;; Eval'ed during compilation to setup variables, functions etc
|
||||
;; declared with `cc-bytecomp-defvar' et al.
|
||||
(if (not load-in-progress)
|
||||
;; Look at `load-in-progress' to tell whether we're called
|
||||
;; directly in the file being compiled or just from some file
|
||||
;; being loaded during compilation.
|
||||
(let (p)
|
||||
(if cc-bytecomp-environment-set
|
||||
(error "Byte compilation environment already set - \
|
||||
perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere"))
|
||||
(setq p cc-bytecomp-unbound-variables)
|
||||
(while p
|
||||
(if (not (boundp (car p)))
|
||||
(progn
|
||||
(eval `(defvar ,(car p)))
|
||||
(set (car p) (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name (car p)))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Covered variable %s"
|
||||
(car p))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-functions)
|
||||
(while p
|
||||
(let ((fun (car (car p)))
|
||||
(temp-macro (car (cdr (car p)))))
|
||||
(if (not (fboundp fun))
|
||||
(if temp-macro
|
||||
(progn
|
||||
(eval `(defmacro ,fun ,@temp-macro))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Bound macro %s" fun))
|
||||
(fset fun (intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name fun))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Covered function %s" fun))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-properties)
|
||||
(while p
|
||||
(let ((sym (car (car (car p))))
|
||||
(prop (cdr (car (car p))))
|
||||
(tempdef (car (cdr (car p)))))
|
||||
(put sym prop tempdef)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Bound property %s for %s to %s"
|
||||
prop sym tempdef))
|
||||
(setq p (cdr p)))
|
||||
(setq cc-bytecomp-environment-set t)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-setup-environment: Done"))))
|
||||
|
||||
(defun cc-bytecomp-restore-environment ()
|
||||
;; Eval'ed during compilation to restore variables, functions etc
|
||||
;; declared with `cc-bytecomp-defvar' et al.
|
||||
(if (not load-in-progress)
|
||||
(let (p)
|
||||
(setq p cc-bytecomp-unbound-variables)
|
||||
(while p
|
||||
(let ((var (car p)))
|
||||
(if (boundp var)
|
||||
(if (eq (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name var)))
|
||||
(symbol-value var))
|
||||
(progn
|
||||
(makunbound var)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Unbound variable %s"
|
||||
var))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring variable %s"
|
||||
var))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-functions)
|
||||
(while p
|
||||
(let ((fun (car (car p)))
|
||||
(temp-macro (car (cdr (car p))))
|
||||
(def (car (cdr (cdr (car p))))))
|
||||
(if (fboundp fun)
|
||||
(if (eq (or temp-macro
|
||||
(intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name fun))))
|
||||
(symbol-function fun))
|
||||
(if (eq def 'unbound)
|
||||
(progn
|
||||
(fmakunbound fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Unbound function %s"
|
||||
fun))
|
||||
(fset fun def)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored function %s"
|
||||
fun))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring function %s"
|
||||
fun))))
|
||||
(setq p (cdr p)))
|
||||
(setq p cc-bytecomp-original-properties)
|
||||
(while p
|
||||
(let ((sym (car (car (car p))))
|
||||
(prop (cdr (car (car p))))
|
||||
(tempdef (car (cdr (car p))))
|
||||
(origdef (cdr (cdr (car p)))))
|
||||
(if (eq (get sym prop) tempdef)
|
||||
(progn
|
||||
(put sym prop origdef)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Restored property %s for %s to %s"
|
||||
prop sym origdef))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Not restoring property %s for %s"
|
||||
prop sym)))
|
||||
(setq p (cdr p)))
|
||||
(setq cc-bytecomp-environment-set nil)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-restore-environment: Done"))))
|
||||
|
||||
(eval
|
||||
;; This eval is to avoid byte compilation of the function below.
|
||||
;; There's some bug in XEmacs 21.4.6 that can cause it to dump core
|
||||
;; here otherwise. My theory is that `cc-bytecomp-load' might be
|
||||
;; redefined recursively during the `load' inside it, and if it in
|
||||
;; that case is byte compiled then the byte interpreter gets
|
||||
;; confused. I haven't succeeded in isolating the bug, though. /mast
|
||||
|
||||
'(defun cc-bytecomp-load (cc-part)
|
||||
;; Eval'ed during compilation to load a CC Mode file from the source
|
||||
;; directory (assuming it's the same as the compiled file
|
||||
;; destination dir).
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(progn
|
||||
(cc-bytecomp-restore-environment)
|
||||
(let ((load-path
|
||||
(cons (file-name-directory byte-compile-dest-file)
|
||||
load-path))
|
||||
(cc-file (concat cc-part ".el")))
|
||||
(if (member cc-file cc-bytecomp-loaded-files)
|
||||
()
|
||||
(setq cc-bytecomp-loaded-files
|
||||
(cons cc-file cc-bytecomp-loaded-files))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-load: Loading %S" cc-file)
|
||||
(load cc-file nil t t)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-load: Loaded %S" cc-file)))
|
||||
(cc-bytecomp-setup-environment)
|
||||
t))))
|
||||
|
||||
(defmacro cc-require (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but compile in a `require'. Don't use within
|
||||
`eval-when-compile'.
|
||||
|
||||
Having cyclic cc-require's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
(require ,cc-part)))
|
||||
|
||||
(defmacro cc-provide (feature)
|
||||
"A replacement for the `provide' form that restores the environment
|
||||
after the compilation. Don't use within `eval-when-compile'."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(provide ,feature)))
|
||||
|
||||
(defmacro cc-load (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation. Don't use outside `eval-when-compile' or
|
||||
`eval-and-compile'.
|
||||
|
||||
Having cyclic cc-load's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
`(or (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-load ,cc-part))
|
||||
(load ,cc-part nil t nil)))
|
||||
|
||||
(defmacro cc-require-when-compile (cc-part)
|
||||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but do a compile time `require' otherwise. Don't
|
||||
use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-is-compiling))
|
||||
(if (or (not load-in-progress)
|
||||
(not (featurep ,cc-part)))
|
||||
(cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
(require ,cc-part))))
|
||||
|
||||
(defmacro cc-external-require (feature)
|
||||
"Do a `require' of an external package.
|
||||
This restores and sets up the compilation environment before and
|
||||
afterwards. Don't use within `eval-when-compile'."
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(require ,feature)
|
||||
(eval-when-compile (cc-bytecomp-setup-environment))))
|
||||
|
||||
(defun cc-bytecomp-is-compiling ()
|
||||
"Return non-nil if eval'ed during compilation. Don't use outside
|
||||
`eval-when-compile'."
|
||||
(and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file)))
|
||||
|
||||
(defmacro cc-bytecomp-defvar (var)
|
||||
"Binds the symbol as a variable during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (boundp ',var)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: %s bound already as variable" ',var)
|
||||
(if (not (memq ',var cc-bytecomp-unbound-variables))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: Saving %s (as unbound)" ',var)
|
||||
(setq cc-bytecomp-unbound-variables
|
||||
(cons ',var cc-bytecomp-unbound-variables))))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(not load-in-progress))
|
||||
(progn
|
||||
(defvar ,var)
|
||||
(set ',var (intern (concat "cc-bytecomp-ignore-var:"
|
||||
(symbol-name ',var))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defvar: Covered variable %s" ',var))))))
|
||||
|
||||
(defmacro cc-bytecomp-defun (fun)
|
||||
"Bind the symbol as a function during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'.
|
||||
|
||||
If the symbol already is bound as a function, it will keep that
|
||||
definition. That means that this macro will not shut up warnings
|
||||
about incorrect number of arguments. It's dangerous to try to replace
|
||||
existing functions since the byte compiler might need the definition
|
||||
at compile time, e.g. for macros and inline functions."
|
||||
`(eval-when-compile
|
||||
(if (fboundp ',fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: %s bound already as function" ',fun)
|
||||
(if (not (assq ',fun cc-bytecomp-original-functions))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: Saving %s (as unbound)" ',fun)
|
||||
(setq cc-bytecomp-original-functions
|
||||
(cons (list ',fun nil 'unbound)
|
||||
cc-bytecomp-original-functions))))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(not load-in-progress))
|
||||
(progn
|
||||
(fset ',fun (intern (concat "cc-bytecomp-ignore-fun:"
|
||||
(symbol-name ',fun))))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defun: Covered function %s" ',fun))))))
|
||||
|
||||
(put 'cc-bytecomp-defmacro 'lisp-indent-function 'defun)
|
||||
(defmacro cc-bytecomp-defmacro (fun &rest temp-macro)
|
||||
"Bind the symbol as a macro during compilation (and evaluation) of the
|
||||
file. Don't use outside `eval-when-compile'."
|
||||
`(let ((orig-fun (assq ',fun cc-bytecomp-original-functions)))
|
||||
(if (not orig-fun)
|
||||
(setq orig-fun
|
||||
(list ',fun
|
||||
nil
|
||||
(if (fboundp ',fun)
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Saving %s" ',fun)
|
||||
(symbol-function ',fun))
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Saving %s as unbound" ',fun)
|
||||
'unbound))
|
||||
cc-bytecomp-original-functions
|
||||
(cons orig-fun cc-bytecomp-original-functions)))
|
||||
(defmacro ,fun ,@temp-macro)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-defmacro: Bound macro %s" ',fun)
|
||||
(setcar (cdr orig-fun) (symbol-function ',fun))))
|
||||
|
||||
(defmacro cc-bytecomp-put (symbol propname value)
|
||||
"Set a property on a symbol during compilation (and evaluation) of
|
||||
the file. Don't use outside `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties))
|
||||
(progn
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-put: Saving property %s for %s with value %s"
|
||||
,propname ,symbol (get ,symbol ,propname))
|
||||
(setq cc-bytecomp-original-properties
|
||||
(cons (cons (cons ,symbol ,propname)
|
||||
(cons ,value (get ,symbol ,propname)))
|
||||
cc-bytecomp-original-properties))))
|
||||
(put ,symbol ,propname ,value)
|
||||
(cc-bytecomp-debug-msg
|
||||
"cc-bytecomp-put: Bound property %s for %s to %s"
|
||||
,propname ,symbol ,value)))
|
||||
|
||||
(defmacro cc-bytecomp-obsolete-var (symbol)
|
||||
"Suppress warnings that the given symbol is an obsolete variable.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (get ',symbol 'byte-obsolete-variable)
|
||||
(cc-bytecomp-put ',symbol 'byte-obsolete-variable nil)
|
||||
;; This avoids a superfluous compiler warning
|
||||
;; about calling `get' for effect.
|
||||
t)))
|
||||
|
||||
(defun cc-bytecomp-ignore-obsolete (form)
|
||||
;; Wraps a call to `byte-compile-obsolete' that suppresses the warning.
|
||||
(let ((byte-compile-warnings
|
||||
(delq 'obsolete (append byte-compile-warnings nil))))
|
||||
(byte-compile-obsolete form)))
|
||||
|
||||
(defmacro cc-bytecomp-obsolete-fun (symbol)
|
||||
"Suppress warnings that the given symbol is an obsolete function.
|
||||
Don't use within `eval-when-compile'."
|
||||
`(eval-when-compile
|
||||
(if (eq (get ',symbol 'byte-compile) 'byte-compile-obsolete)
|
||||
(cc-bytecomp-put ',symbol 'byte-compile
|
||||
'cc-bytecomp-ignore-obsolete)
|
||||
;; This avoids a superfluous compiler warning
|
||||
;; about calling `get' for effect.
|
||||
t)))
|
||||
|
||||
(defmacro cc-bytecomp-boundp (symbol)
|
||||
"Return non-nil if the given symbol is bound as a variable outside
|
||||
the compilation. This is the same as using `boundp' but additionally
|
||||
exclude any variables that have been bound during compilation with
|
||||
`cc-bytecomp-defvar'."
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(memq (car (cdr symbol)) cc-bytecomp-unbound-variables))
|
||||
nil
|
||||
`(boundp ,symbol)))
|
||||
|
||||
(defmacro cc-bytecomp-fboundp (symbol)
|
||||
"Return non-nil if the given symbol is bound as a function outside
|
||||
the compilation. This is the same as using `fboundp' but additionally
|
||||
exclude any functions that have been bound during compilation with
|
||||
`cc-bytecomp-defun'."
|
||||
(let (fun-elem)
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(setq fun-elem (assq (car (cdr symbol))
|
||||
cc-bytecomp-original-functions))
|
||||
(eq (elt fun-elem 2) 'unbound))
|
||||
nil
|
||||
`(fboundp ,symbol))))
|
||||
|
||||
|
||||
(provide 'cc-bytecomp)
|
||||
|
||||
;;; arch-tag: 2d71b3ad-57b0-4b13-abd3-ab836e08f975
|
||||
;;; cc-bytecomp.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-bytecomp.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-bytecomp.elc
Normal file
Binary file not shown.
4237
site-lisp/cc-mode/5.31.3/cc-cmds.el
Normal file
4237
site-lisp/cc-mode/5.31.3/cc-cmds.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-cmds.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-cmds.elc
Normal file
Binary file not shown.
166
site-lisp/cc-mode/5.31.3/cc-compat.el
Normal file
166
site-lisp/cc-mode/5.31.3/cc-compat.el
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
|
||||
;; Foundation, Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1994-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Boring old c-mode.el (BOCM) is confusion and brain melt. cc-mode.el
|
||||
;; is clarity of thought and purity of chi. If you are still unwilling
|
||||
;; to accept enlightenment, this might help, or it may prolong your
|
||||
;; agony.
|
||||
;;
|
||||
;; To use, add the following to your c-mode-hook:
|
||||
;;
|
||||
;; (require 'cc-compat)
|
||||
;; (c-set-style "BOCM")
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-vars)
|
||||
(cc-require 'cc-styles)
|
||||
(cc-require 'cc-engine)
|
||||
|
||||
|
||||
;; In case c-mode.el isn't loaded
|
||||
(defvar c-indent-level 2
|
||||
"*Indentation of C statements with respect to containing block.")
|
||||
(defvar c-brace-imaginary-offset 0
|
||||
"*Imagined indentation of a C open brace that actually follows a statement.")
|
||||
(defvar c-brace-offset 0
|
||||
"*Extra indentation for braces, compared with other text in same context.")
|
||||
(defvar c-argdecl-indent 5
|
||||
"*Indentation level of declarations of C function arguments.")
|
||||
(defvar c-label-offset -2
|
||||
"*Offset of C label lines and case statements relative to usual indentation.")
|
||||
(defvar c-continued-statement-offset 2
|
||||
"*Extra indent for lines not starting new statements.")
|
||||
(defvar c-continued-brace-offset 0
|
||||
"*Extra indent for substatements that start with open-braces.
|
||||
This is in addition to c-continued-statement-offset.")
|
||||
|
||||
|
||||
|
||||
;; these offsets are taken by brute force testing c-mode.el, since
|
||||
;; there's no logic to what it does.
|
||||
(let* ((offsets '(c-offsets-alist .
|
||||
((defun-block-intro . cc-block-intro-offset)
|
||||
(statement-block-intro . cc-block-intro-offset)
|
||||
(defun-open . 0)
|
||||
(class-open . 0)
|
||||
(inline-open . c-brace-offset)
|
||||
(block-open . c-brace-offset)
|
||||
(block-close . cc-block-close-offset)
|
||||
(brace-list-open . c-brace-offset)
|
||||
(substatement-open . cc-substatement-open-offset)
|
||||
(substatement . c-continued-statement-offset)
|
||||
(knr-argdecl-intro . c-argdecl-indent)
|
||||
(case-label . c-label-offset)
|
||||
(access-label . c-label-offset)
|
||||
(label . c-label-offset)
|
||||
))))
|
||||
(c-add-style "BOCM" offsets))
|
||||
|
||||
|
||||
(defun cc-block-intro-offset (langelem)
|
||||
;; taken directly from calculate-c-indent confusion
|
||||
(save-excursion
|
||||
(c-backward-syntactic-ws)
|
||||
(if (eq (char-before) ?{)
|
||||
(forward-char -1)
|
||||
(goto-char (cdr langelem)))
|
||||
(let* ((curcol (save-excursion
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage
|
||||
;; If no previous statement, indent it relative to line
|
||||
;; brace is on. For open brace in column zero, don't let
|
||||
;; statement start there too. If c-indent-level is zero,
|
||||
;; use c-brace-offset + c-continued-statement-offset
|
||||
;; instead. For open-braces not the first thing in a line,
|
||||
;; add in c-brace-imaginary-offset.
|
||||
(+ (if (and (bolp) (zerop c-indent-level))
|
||||
(+ c-brace-offset c-continued-statement-offset)
|
||||
c-indent-level)
|
||||
;; Move back over whitespace before the openbrace. If
|
||||
;; openbrace is not first nonwhite thing on the line,
|
||||
;; add the c-brace-imaginary-offset.
|
||||
(progn (skip-chars-backward " \t")
|
||||
(if (bolp) 0 c-brace-imaginary-offset))
|
||||
;; If the openbrace is preceded by a parenthesized exp,
|
||||
;; move to the beginning of that; possibly a different
|
||||
;; line
|
||||
(progn
|
||||
(if (eq (char-before) ?\))
|
||||
(c-forward-sexp -1))
|
||||
;; Get initial indentation of the line we are on.
|
||||
(current-indentation)))))
|
||||
(- bocm-lossage curcol))))
|
||||
|
||||
|
||||
(defun cc-block-close-offset (langelem)
|
||||
(save-excursion
|
||||
(let* ((here (point))
|
||||
bracep
|
||||
(curcol (progn
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage (progn
|
||||
(goto-char (cdr langelem))
|
||||
(if (eq (char-after) ?{)
|
||||
(setq bracep t)
|
||||
(goto-char here)
|
||||
(beginning-of-line)
|
||||
(backward-up-list 1)
|
||||
(forward-char 1)
|
||||
(c-forward-syntactic-ws))
|
||||
(current-column))))
|
||||
(- bocm-lossage curcol
|
||||
(if bracep 0 c-indent-level)))))
|
||||
|
||||
|
||||
(defun cc-substatement-open-offset (langelem)
|
||||
(+ c-continued-statement-offset c-continued-brace-offset))
|
||||
|
||||
|
||||
(cc-provide 'cc-compat)
|
||||
|
||||
;;; arch-tag: 564dab2f-e6ad-499c-a4a3-fedec3ecc192
|
||||
;;; cc-compat.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-compat.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-compat.elc
Normal file
Binary file not shown.
2040
site-lisp/cc-mode/5.31.3/cc-defs.el
Normal file
2040
site-lisp/cc-mode/5.31.3/cc-defs.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-defs.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-defs.elc
Normal file
Binary file not shown.
8943
site-lisp/cc-mode/5.31.3/cc-engine.el
Normal file
8943
site-lisp/cc-mode/5.31.3/cc-engine.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-engine.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-engine.elc
Normal file
Binary file not shown.
143
site-lisp/cc-mode/5.31.3/cc-fix.el
Normal file
143
site-lisp/cc-mode/5.31.3/cc-fix.el
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
;;; cc-fix.el --- compatibility library for old (X)Emacs versions
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
|
||||
;; Foundation, Inc.
|
||||
|
||||
;; Authors: 2003- Alan Mackenzie
|
||||
;; 1998- Martin Stjernholm
|
||||
;; 1997-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 03-Jul-1997 (as cc-mode-19.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file is necessary in order to run CC Mode in older (X)Emacs
|
||||
;; versions. It's not needed at all for the latest versions of Emacs
|
||||
;; and XEmacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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)))
|
||||
|
||||
;; Silence the compiler (in case this file is compiled by other
|
||||
;; Emacsen even though it isn't used by them).
|
||||
(cc-bytecomp-obsolete-fun byte-code-function-p)
|
||||
(cc-bytecomp-defun regexp-opt-depth)
|
||||
|
||||
(cc-external-require 'advice)
|
||||
|
||||
;; Emacs 20.n doesn't have the macros push and pop. Here're the Emacs 21
|
||||
;; definitions.
|
||||
(or (fboundp 'push)
|
||||
(defmacro push (newelt listname)
|
||||
"Add NEWELT to the list stored in the symbol LISTNAME.
|
||||
This is equivalent to (setq LISTNAME (cons NEWELT LISTNAME)).
|
||||
LISTNAME must be a symbol."
|
||||
(list 'setq listname
|
||||
(list 'cons newelt listname))))
|
||||
|
||||
(or (fboundp 'pop)
|
||||
(defmacro pop (listname)
|
||||
"Return the first element of LISTNAME's value, and remove it from the list.
|
||||
LISTNAME must be a symbol whose value is a list.
|
||||
If the value is nil, `pop' returns nil but does not actually
|
||||
change the list."
|
||||
(list 'prog1 (list 'car listname)
|
||||
(list 'setq listname (list 'cdr listname)))))
|
||||
|
||||
|
||||
(if (/= (regexp-opt-depth "\\(\\(\\)\\)") 2)
|
||||
(progn
|
||||
;; Emacs 21.1 has a buggy regexp-opt-depth which prevents CC
|
||||
;; Mode building. Those in Emacs 21.[23] are not entirely
|
||||
;; accurate. The following definition comes from Emacs's
|
||||
;; regexp-opt.el CVS version 1.25 and is believed to be a
|
||||
;; rigorously correct implementation.
|
||||
(defconst regexp-opt-not-groupie*-re
|
||||
(let* ((harmless-ch "[^\\\\[]")
|
||||
(esc-pair-not-lp "\\\\[^(]")
|
||||
(class-harmless-ch "[^][]")
|
||||
(class-lb-harmless "[^]:]")
|
||||
(class-lb-colon-maybe-charclass ":\\([a-z]+:]\\)?")
|
||||
(class-lb (concat "\\[\\(" class-lb-harmless
|
||||
"\\|" class-lb-colon-maybe-charclass "\\)"))
|
||||
(class
|
||||
(concat "\\[^?]?"
|
||||
"\\(" class-harmless-ch
|
||||
"\\|" class-lb "\\)*"
|
||||
"\\[?]")) ; special handling for bare [ at end of re
|
||||
(shy-lp "\\\\(\\?:"))
|
||||
(concat "\\(" harmless-ch "\\|" esc-pair-not-lp
|
||||
"\\|" class "\\|" shy-lp "\\)*"))
|
||||
"Matches any part of a regular expression EXCEPT for non-shy \"\\\\(\"s")
|
||||
|
||||
(defun regexp-opt-depth (regexp)
|
||||
"Return the depth of REGEXP.
|
||||
This means the number of regexp grouping constructs (parenthesised expressions)
|
||||
in REGEXP."
|
||||
(save-match-data
|
||||
;; Hack to signal an error if REGEXP does not have balanced
|
||||
;; parentheses.
|
||||
(string-match regexp "")
|
||||
;; Count the number of open parentheses in REGEXP.
|
||||
(let ((count 0) start)
|
||||
(while
|
||||
(progn
|
||||
(string-match regexp-opt-not-groupie*-re regexp start)
|
||||
(setq start ( + (match-end 0) 2)) ; +2 for "\\(" after match-end.
|
||||
(<= start (length regexp)))
|
||||
(setq count (1+ count)))
|
||||
count)))
|
||||
))
|
||||
|
||||
;; Some XEmacs versions have a bug in which font-lock-compile-keywords
|
||||
;; overwrites the variable font-lock-keywords with its result. This causes
|
||||
;; havoc when what the function is compiling is font-lock-SYNTACTIC-keywords,
|
||||
;; hence....
|
||||
(eval-after-load "font-lock"
|
||||
'(when (and (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS
|
||||
; to make the call to f-l-c-k throw an error.
|
||||
(let (font-lock-keywords)
|
||||
(font-lock-compile-keywords '("\\<\\>"))
|
||||
font-lock-keywords)) ; did the previous call foul this up?
|
||||
(defun font-lock-compile-keywords (keywords)
|
||||
"Compile KEYWORDS (a list) and return the list of compiled keywords.
|
||||
Each keyword has the form (MATCHER HIGHLIGHT ...). See `font-lock-keywords'."
|
||||
(if (eq (car-safe keywords) t)
|
||||
keywords
|
||||
(cons t (mapcar 'font-lock-compile-keyword keywords))))
|
||||
(defadvice font-lock-fontify-keywords-region (before c-compile-font-lock-keywords
|
||||
activate preactivate)
|
||||
(unless (eq (car-safe font-lock-keywords) t)
|
||||
(setq font-lock-keywords
|
||||
(font-lock-compile-keywords font-lock-keywords))))
|
||||
))
|
||||
|
||||
|
||||
(cc-provide 'cc-fix)
|
||||
;;; cc-fix.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-fix.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-fix.elc
Normal file
Binary file not shown.
2368
site-lisp/cc-mode/5.31.3/cc-fonts.el
Normal file
2368
site-lisp/cc-mode/5.31.3/cc-fonts.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-fonts.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-fonts.elc
Normal file
Binary file not shown.
219
site-lisp/cc-mode/5.31.3/cc-guess.el
Normal file
219
site-lisp/cc-mode/5.31.3/cc-guess.el
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
;;; cc-guess.el --- guess indentation values by scanning existing code
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
|
||||
;; Foundation, Inc.
|
||||
|
||||
;; Author: 1994-1995 Barry A. Warsaw
|
||||
;; Maintainer: Unmaintained
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This file contains routines that help guess the cc-mode style in a
|
||||
;; particular region/buffer. It is provided for example and
|
||||
;; experimentation only. It is not supported in anyway. Note that
|
||||
;; style guessing is lossy!
|
||||
;;
|
||||
;; The way this is intended to be run is for you to mark a region of
|
||||
;; code to guess the style of, then run the command, `cc-guess-region'.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-engine)
|
||||
|
||||
|
||||
(defvar cc-guessed-style nil
|
||||
"Currently guessed style.")
|
||||
|
||||
(defvar cc-guess-delta-accumulator nil)
|
||||
;; Accumulated sampled indent information. Information is represented
|
||||
;; in a list. Each element in it has following structure:
|
||||
;;
|
||||
;; (syntactic-symbol ((indentation-delta1 . number-of-times1)
|
||||
;; (indentation-delta2 . number-of-times2)
|
||||
;; ...))
|
||||
;;
|
||||
;; This structure is built by `cc-guess-accumulate-delta'.
|
||||
;;
|
||||
;; Here we call the pair (indentation-delta1 . number-of-times1) a
|
||||
;; counter. `cc-guess-sort-delta-accumulator' sorts the order of
|
||||
;; counters by number-of-times.
|
||||
|
||||
(defconst cc-guess-conversions
|
||||
'((c . c-lineup-C-comments)
|
||||
(inher-cont . c-lineup-multi-inher)
|
||||
(string . -1000)
|
||||
(comment-intro . c-lineup-comment)
|
||||
(arglist-cont-nonempty . c-lineup-arglist)
|
||||
(arglist-close . c-lineup-close-paren)
|
||||
(cpp-macro . -1000)))
|
||||
|
||||
|
||||
(defun cc-guess (&optional accumulate)
|
||||
"Apply `cc-guess-region' on the whole current buffer.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch."
|
||||
(interactive "P")
|
||||
(cc-guess-region (point-min) (point-max) accumulate))
|
||||
|
||||
(defun cc-guess-install ()
|
||||
"Set the indentation style from the last guessed style (`cc-guessed-style')."
|
||||
(interactive)
|
||||
(setq c-offsets-alist (cc-guess-merge-styles cc-guessed-style
|
||||
c-offsets-alist)))
|
||||
|
||||
(defun cc-guess-region (start end &optional accumulate)
|
||||
"Set the indentation style by examining the indentation in a region of code.
|
||||
Every line of code in the region is examined and the indentation
|
||||
values of the various syntactic symbols in `c-offset-alist' are
|
||||
guessed. Frequencies of use are taken into account, so minor
|
||||
inconsistencies in the indentation style shouldn't produce wrong
|
||||
guesses.
|
||||
|
||||
The guessed style is put into `cc-guessed-style'. It's also merged
|
||||
into `c-offsets-alist'. Guessed offsets takes precedence over
|
||||
existing ones on `c-offsets-alist'.
|
||||
|
||||
If given a prefix argument (or if the optional argument ACCUMULATE is
|
||||
non-nil) then the previous guess is extended, otherwise a new guess is
|
||||
made from scratch.
|
||||
|
||||
Note that the larger the region to guess in, the slower the guessing."
|
||||
(interactive "r\nP")
|
||||
(let ((delta-accumulator (when accumulate cc-guess-delta-accumulator))
|
||||
(reporter (when (fboundp 'make-progress-reporter)
|
||||
(make-progress-reporter "Sampling Indentation " start end))))
|
||||
;;
|
||||
;; Sampling stage
|
||||
;;
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
(while (< (point) end)
|
||||
(c-save-buffer-state
|
||||
((syntax (c-guess-basic-syntax))
|
||||
(relpos (car (cdr (car syntax))))
|
||||
(symbol (car (car syntax))))
|
||||
;; TBD: for now I can't guess indentation when more than 1
|
||||
;; symbol is on the list, nor for symbols without relpos's
|
||||
;;
|
||||
;; I think it is too stricted for ((topmost-intro) (comment-intro)).
|
||||
;; -- Masatake
|
||||
(unless (or ; (/= 1 (length syntax))
|
||||
(not (numberp relpos))
|
||||
(eq (line-beginning-position)
|
||||
(line-end-position)))
|
||||
(setq delta-accumulator (cc-guess-accumulate-delta
|
||||
delta-accumulator
|
||||
symbol
|
||||
(- (progn (back-to-indentation)
|
||||
(current-column) )
|
||||
(save-excursion
|
||||
(goto-char relpos)
|
||||
(current-column)))))))
|
||||
(when reporter (progress-reporter-update reporter (point)))
|
||||
(forward-line 1)))
|
||||
(when reporter (progress-reporter-done reporter))
|
||||
;;
|
||||
;; Guessing stage
|
||||
;;
|
||||
(setq delta-accumulator (cc-guess-sort-delta-accumulator
|
||||
delta-accumulator)
|
||||
cc-guess-delta-accumulator delta-accumulator)
|
||||
(let* ((typical-style (cc-guess-make-style delta-accumulator))
|
||||
(merged-style (cc-guess-merge-styles
|
||||
(copy-list cc-guess-conversions)
|
||||
typical-style)))
|
||||
(setq cc-guessed-style merged-style
|
||||
c-offsets-alist (cc-guess-merge-styles
|
||||
merged-style
|
||||
c-offsets-alist)))))
|
||||
|
||||
(defun cc-guess-accumulate-delta (accumulator symbol delta)
|
||||
;; Added SYMBOL and DELTA to ACCUMULATOR. See
|
||||
;; `cc-guess-delta-accumulator' about the structure of ACCUMULATOR.
|
||||
(let* ((entry (assoc symbol accumulator))
|
||||
(counters (cdr entry))
|
||||
counter)
|
||||
(if entry
|
||||
(progn
|
||||
(setq counter (assoc delta counters))
|
||||
(if counter
|
||||
(setcdr counter (1+ (cdr counter)))
|
||||
(setq counters (cons (cons delta 1) counters))
|
||||
(setcdr entry counters))
|
||||
accumulator)
|
||||
(cons (cons symbol (cons (cons delta 1) nil)) accumulator))))
|
||||
|
||||
(defun cc-guess-sort-delta-accumulator (accumulator)
|
||||
;; Sort the each element of ACCUMULATOR by the number-of-times. See
|
||||
;; `cc-guess-delta-accumulator' for more details.
|
||||
(mapcar
|
||||
(lambda (entry)
|
||||
(let ((symbol (car entry))
|
||||
(counters (cdr entry)))
|
||||
(cons symbol (sort counters
|
||||
(lambda (a b)
|
||||
(if (> (cdr a) (cdr b))
|
||||
t
|
||||
(and
|
||||
(eq (cdr a) (cdr b))
|
||||
(< (car a) (car b)))))))))
|
||||
accumulator))
|
||||
|
||||
(defun cc-guess-make-style (accumulator)
|
||||
;; Throw away the rare cases in accumulator and make a style structure.
|
||||
(mapcar
|
||||
(lambda (entry)
|
||||
(cons (car entry)
|
||||
(car (car (cdr entry)))))
|
||||
accumulator))
|
||||
|
||||
(defun cc-guess-merge-styles (strong weak)
|
||||
;; Merge two styles into one. When two styles has the same symbol
|
||||
;; entry, give STRONG priority over WEAK.
|
||||
(mapc
|
||||
(lambda (weak-elt)
|
||||
(unless (assoc (car weak-elt) strong)
|
||||
(setq strong (cons weak-elt strong))))
|
||||
weak)
|
||||
strong)
|
||||
|
||||
(defun cc-guess-view-style ()
|
||||
"Show `cc-guessed-style'."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Indentation Guessing Result*"
|
||||
(pp cc-guessed-style)))
|
||||
|
||||
|
||||
(cc-provide 'cc-guess)
|
||||
;;; cc-guess.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-guess.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-guess.elc
Normal file
Binary file not shown.
2905
site-lisp/cc-mode/5.31.3/cc-langs.el
Normal file
2905
site-lisp/cc-mode/5.31.3/cc-langs.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-langs.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-langs.elc
Normal file
Binary file not shown.
161
site-lisp/cc-mode/5.31.3/cc-lobotomy.el
Normal file
161
site-lisp/cc-mode/5.31.3/cc-lobotomy.el
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
;;; cc-lobotomy.el --- excise portions of cc-mode's brain... for speed
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2005, 2006 Free Software Foundation,
|
||||
;; Inc.
|
||||
|
||||
;; Author: 1995 Barry A. Warsaw
|
||||
;; Maintainer: Unmaintained
|
||||
;; Created: March 1995, split from cc-mode.el
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Every effort has been made to improve the performance of
|
||||
;; cc-mode. However, due to the nature of the C, C++, and Objective-C
|
||||
;; language definitions, a trade-off is often required between
|
||||
;; accuracy of construct recognition and speed. I believe it is always
|
||||
;; best to be correct, and that the mode is currently fast enough for
|
||||
;; most normal usage. Others disagree. I have no intention of
|
||||
;; including these hacks in the main distribution. When cc-mode
|
||||
;; version 5 comes out, it will include a rewritten indentation engine
|
||||
;; so that performance will be greatly improved automatically. This
|
||||
;; was not included in this release of version 4 so that Emacs 18
|
||||
;; could still be supported. Note that this implies that cc-mode
|
||||
;; version 5 will *not* work on Emacs 18!
|
||||
;;
|
||||
;; To use, see the variable cc-lobotomy-pith-list and the function
|
||||
;; cc-lobotomize. The variable contains a good explanation of the
|
||||
;; speed/accuracy trade-offs for each option. Set it to what you'd
|
||||
;; like, and call cc-lobotomy in your c-mode-hook.
|
||||
;;
|
||||
;; This will redefine certain cc-mode functions and affect all cc-mode
|
||||
;; buffers globally.
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-engine)
|
||||
(cc-require 'cc-cmds)
|
||||
|
||||
|
||||
(defvar cc-lobotomy-pith-list ()
|
||||
"*List of things to dumb-ify to speed up cc-mode. Note that each
|
||||
incurs a penalty in correct identification of certain code constructs.
|
||||
Possible values to put on this list:
|
||||
|
||||
'literal -- `c-in-literal' is lobotomized. This will significantly
|
||||
speed up parsing over large lists of cpp macros, as seen
|
||||
for instance in header files. The penalty is that you
|
||||
cannot put the `#' character as the first non-whitespace
|
||||
character on a line inside other multi-line literals
|
||||
(i.e. comments or strings)
|
||||
|
||||
'class -- `c-narrow-out-enclosing-class' and `c-search-uplist for
|
||||
classkey' are lobotomized. This speeds up some
|
||||
indenting inside and around class and struct
|
||||
definitions. The penalty is that elements inside of
|
||||
classes and structs may not indent correctly.
|
||||
|
||||
'lists -- `c-inside-bracelist-p' is lobotomized. This speeds up
|
||||
indenting inside and around brace lists (e.g. aggregate
|
||||
initializers, enum lists, etc.). The penalty is that
|
||||
elements inside these lists may not indent correctly.")
|
||||
|
||||
(defun cc-lobotomize ()
|
||||
"Perform lobotomies on cc-mode as described in `cc-lobotomy-pith-list'."
|
||||
(let (pithedp)
|
||||
(if (memq 'literal cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-in-literal 'cc-in-literal-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if (memq 'class cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-narrow-out-enclosing-class
|
||||
'cc-narrow-out-enclosing-class-lobotomized)
|
||||
(fset 'c-search-uplist-for-classkey
|
||||
'cc-search-uplist-for-classkey-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if (memq 'lists cc-lobotomy-pith-list)
|
||||
(progn
|
||||
(fset 'c-inside-bracelist-p 'cc-inside-bracelist-p-lobotomized)
|
||||
(setq pithedp t)))
|
||||
(if pithedp
|
||||
(add-hook 'c-prepare-bug-report-hooks 'cc-lobo-bug-report-blurb))
|
||||
))
|
||||
|
||||
|
||||
;; This is a faster version of c-in-literal. It trades speed for one
|
||||
;; approximation, namely that within other literals, the `#' character
|
||||
;; cannot be the first non-whitespace on a line. This only happens if
|
||||
;; detect-cpp is non-nil, which isn't very often.
|
||||
(defun cc-in-literal-lobotomized (&optional lim detect-cpp)
|
||||
;; first check the cache
|
||||
(if (and (vectorp c-in-literal-cache)
|
||||
(= (point) (aref c-in-literal-cache 0)))
|
||||
(aref c-in-literal-cache 1)
|
||||
;; quickly check for cpp macro. this breaks if the `#' character
|
||||
;; appears as the first non-whitespace on a line inside another
|
||||
;; literal.
|
||||
(let* (state
|
||||
(char-at-boi (char-after (c-point 'boi)))
|
||||
(rtn (cond
|
||||
((and detect-cpp char-at-boi (= char-at-boi ?#))
|
||||
'pound)
|
||||
((nth 3 (setq state (save-excursion
|
||||
(parse-partial-sexp
|
||||
(or lim (c-point 'bod))
|
||||
(point)))))
|
||||
'string)
|
||||
((nth 4 state) (if (nth 7 state) 'c++ 'c))
|
||||
(t nil))))
|
||||
;; cache this result if the cache is enabled
|
||||
(if (not c-in-literal-cache)
|
||||
(setq c-in-literal-cache (vector (point) rtn)))
|
||||
rtn)))
|
||||
|
||||
(defun cc-narrow-out-enclosing-class-lobotomized (dummy1 dummy2) nil)
|
||||
|
||||
(defun cc-search-uplist-for-classkey-lobotomized (dummy) nil)
|
||||
|
||||
(defun cc-inside-bracelist-p-lobotomized (dummy1 dummy2) nil)
|
||||
|
||||
(defun cc-lobo-bug-report-blurb ()
|
||||
(insert
|
||||
"\nYou are using cc-lobotomy.el. You realize that by doing\n"
|
||||
"so you have already made the decision to trade off accuracy\n"
|
||||
"for speed? Don't set your hopes too high that your problem\n"
|
||||
"will be fixed.\n\n"))
|
||||
|
||||
|
||||
(cc-provide 'cc-lobotomy)
|
||||
;;; cc-lobotomy.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-lobotomy.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-lobotomy.elc
Normal file
Binary file not shown.
425
site-lisp/cc-mode/5.31.3/cc-menus.el
Normal file
425
site-lisp/cc-mode/5.31.3/cc-menus.el
Normal file
|
|
@ -0,0 +1,425 @@
|
|||
;;; cc-menus.el --- imenu support for CC Mode
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
|
||||
;; Foundation, Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1992-1999 Barry A. Warsaw
|
||||
;; 1987 Dave Detlefs and Stewart Clamen
|
||||
;; 1985 Richard M. Stallman
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 22-Apr-1997 (split from cc-mode.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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)
|
||||
|
||||
;; The things referenced in imenu, which we don't require.
|
||||
(cc-bytecomp-defvar imenu-case-fold-search)
|
||||
(cc-bytecomp-defvar imenu-generic-expression)
|
||||
(cc-bytecomp-defvar imenu-create-index-function)
|
||||
(cc-bytecomp-defun imenu-progress-message)
|
||||
|
||||
|
||||
;; imenu integration
|
||||
(defvar cc-imenu-c-prototype-macro-regexp nil
|
||||
"RE matching macro names used to conditionally specify function prototypes.
|
||||
|
||||
For example:
|
||||
|
||||
#ifdef __STDC__
|
||||
#define _P(x) x
|
||||
#else
|
||||
#define _P(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
int main _P( (int argc, char *argv[]) )
|
||||
|
||||
A sample value might look like: `\\(_P\\|_PROTO\\)'.")
|
||||
|
||||
(defvar cc-imenu-c++-generic-expression
|
||||
`(
|
||||
;; Try to match ::operator definitions first. Otherwise `X::operator new ()'
|
||||
;; will be incorrectly recognised as function `new ()' because the regexps
|
||||
;; work by backtracking from the end of the definition.
|
||||
(nil
|
||||
,(concat
|
||||
"^\\<.*"
|
||||
"[^" c-alnum "_:<>~]" ; match any non-identifier char
|
||||
; (note: this can be `\n')
|
||||
"\\("
|
||||
"\\([" c-alnum "_:<>~]*::\\)?" ; match an operator
|
||||
"operator\\>[ \t]*"
|
||||
"\\(()\\|[^(]*\\)" ; special case for `()' operator
|
||||
"\\)"
|
||||
|
||||
"[ \t]*([^)]*)[ \t]*[^ \t;]" ; followed by ws, arg list,
|
||||
; require something other than
|
||||
; a `;' after the (...) to
|
||||
; avoid prototypes. Can't
|
||||
; catch cases with () inside
|
||||
; the parentheses surrounding
|
||||
; the parameters. e.g.:
|
||||
; `int foo(int a=bar()) {...}'
|
||||
) 1)
|
||||
;; Special case to match a line like `main() {}'
|
||||
;; e.g. no return type, not even on the previous line.
|
||||
(nil
|
||||
,(concat
|
||||
"^"
|
||||
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
|
||||
"[ \t]*(" ; see above, BUT
|
||||
"[ \t]*\\([^ \t(*][^)]*\\)?)" ; the arg list must not start
|
||||
"[ \t]*[^ \t;(]" ; with an asterisk or parentheses
|
||||
) 1)
|
||||
;; General function name regexp
|
||||
(nil
|
||||
,(concat
|
||||
"^\\<" ; line MUST start with word char
|
||||
"[^()]*" ; no parentheses before
|
||||
"[^" c-alnum "_:<>~]" ; match any non-identifier char
|
||||
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
|
||||
"\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list
|
||||
"\\([ \t\n]\\|\\\\\n\\)*\\([^ \t\n(*][^)]*\\)?)" ; must not start
|
||||
"\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]" ; with an asterisk or parentheses
|
||||
) 1)
|
||||
;; Special case for definitions using phony prototype macros like:
|
||||
;; `int main _PROTO( (int argc,char *argv[]) )'.
|
||||
;; This case is only included if cc-imenu-c-prototype-macro-regexp is set.
|
||||
;; Only supported in c-code, so no `:<>~' chars in function name!
|
||||
,@(if cc-imenu-c-prototype-macro-regexp
|
||||
`((nil
|
||||
,(concat
|
||||
"^\\<.*" ; line MUST start with word char
|
||||
"[^" c-alnum "_]" ; match any non-identifier char
|
||||
"\\([" c-alpha "_][" c-alnum "_]*\\)" ; match function name
|
||||
"[ \t]*" ; whitespace before macro name
|
||||
cc-imenu-c-prototype-macro-regexp
|
||||
"[ \t]*(" ; ws followed by first paren.
|
||||
"[ \t]*([^)]*)[ \t]*)[ \t]*[^ \t;]" ; see above
|
||||
) 1)))
|
||||
;; Class definitions
|
||||
("Class"
|
||||
,(concat
|
||||
"^" ; beginning of line is required
|
||||
"\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a `template <...>'
|
||||
"\\(class\\|struct\\)[ \t]+"
|
||||
"\\(" ; the string we want to get
|
||||
"[" c-alnum "_]+" ; class name
|
||||
"\\(<[^>]+>\\)?" ; possibly explicitly specialized
|
||||
"\\)"
|
||||
"\\([ \t\n]\\|\\\\\n\\)*[:{]"
|
||||
) 3))
|
||||
"Imenu generic expression for C++ mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar cc-imenu-c-generic-expression
|
||||
cc-imenu-c++-generic-expression
|
||||
"Imenu generic expression for C mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar cc-imenu-java-generic-expression
|
||||
`((nil
|
||||
,(concat
|
||||
"[" c-alpha "_][\]\[." c-alnum "_]+[ \t\n\r]+" ; type spec
|
||||
"\\([" c-alpha "_][" c-alnum "_]+\\)" ; method name
|
||||
"[ \t\n\r]*"
|
||||
;; An argument list that is either empty or contains at least
|
||||
;; two identifiers with only space between them. This avoids
|
||||
;; matching e.g. "else if (foo)".
|
||||
(concat "([ \t\n\r]*"
|
||||
"\\([\]\[.," c-alnum "_]+"
|
||||
"[ \t\n\r]+"
|
||||
"[\]\[.," c-alnum "_]"
|
||||
"[\]\[.," c-alnum "_ \t\n\r]*"
|
||||
"\\)?)")
|
||||
"[.," c-alnum "_ \t\n\r]*"
|
||||
"{"
|
||||
) 1))
|
||||
"Imenu generic expression for Java mode. See `imenu-generic-expression'.")
|
||||
|
||||
;; *Warning for cc-mode developers*
|
||||
;;
|
||||
;; `cc-imenu-objc-generic-expression' elements depend on
|
||||
;; `cc-imenu-c++-generic-expression'. So if you change this
|
||||
;; expression, you need to change following variables,
|
||||
;; `cc-imenu-objc-generic-expression-*-index',
|
||||
;; too. `cc-imenu-objc-function' uses these *-index variables, in
|
||||
;; order to know where the each regexp *group \\(foobar\\)* elements
|
||||
;; are started.
|
||||
;;
|
||||
;; *-index variables are initialized during `cc-imenu-objc-generic-expression'
|
||||
;; being initialized.
|
||||
;;
|
||||
|
||||
;; Internal variables
|
||||
(defvar cc-imenu-objc-generic-expression-noreturn-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-general-func-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-proto-index nil)
|
||||
(defvar cc-imenu-objc-generic-expression-objc-base-index nil)
|
||||
|
||||
(defvar cc-imenu-objc-generic-expression
|
||||
(concat
|
||||
;;
|
||||
;; For C
|
||||
;;
|
||||
;; > Special case to match a line like `main() {}'
|
||||
;; > e.g. no return type, not even on the previous line.
|
||||
;; Pick a token by (match-string 1)
|
||||
(car (cdr (nth 1 cc-imenu-c++-generic-expression))) ; -> index += 2
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-noreturn-index 1) "")
|
||||
"\\|"
|
||||
;; > General function name regexp
|
||||
;; Pick a token by (match-string 3)
|
||||
(car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 5
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "")
|
||||
;; > Special case for definitions using phony prototype macros like:
|
||||
;; > `int main _PROTO( (int argc,char *argv[]) )'.
|
||||
;; Pick a token by (match-string 8)
|
||||
(if cc-imenu-c-prototype-macro-regexp
|
||||
(concat
|
||||
"\\|"
|
||||
(car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "")
|
||||
)
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 8) "")
|
||||
"") ; -> index += 0
|
||||
(prog2 (setq cc-imenu-objc-generic-expression-proto-index 8) "")
|
||||
;;
|
||||
;; For Objective-C
|
||||
;; Pick a token by (match-string 8 or 9)
|
||||
;;
|
||||
"\\|\\("
|
||||
"^[-+][:" c-alnum "()*_<>\n\t ]*[;{]" ; Methods
|
||||
"\\|"
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*:"
|
||||
"\\|"
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*([" c-alnum "_]+)"
|
||||
"\\|"
|
||||
;; For NSObject, NSProxy and Object... They don't have super class.
|
||||
"^@interface[\t ]+[" c-alnum "_]+[\t ]*.*$"
|
||||
"\\|"
|
||||
"^@implementation[\t ]+[" c-alnum "_]+[\t ]*([" c-alnum "_]+)"
|
||||
"\\|"
|
||||
"^@implementation[\t ]+[" c-alnum "_]+"
|
||||
"\\|"
|
||||
"^@protocol[\t ]+[" c-alnum "_]+" "\\)")
|
||||
"Imenu generic expression for ObjC mode. See `imenu-generic-expression'.")
|
||||
|
||||
|
||||
;; Imenu support for objective-c uses functions.
|
||||
(defsubst cc-imenu-objc-method-to-selector (method)
|
||||
"Return the objc selector style string of METHOD.
|
||||
Example:
|
||||
- perform: (SEL)aSelector withObject: object1 withObject: object2; /* METHOD */
|
||||
=>
|
||||
-perform:withObject:withObject:withObject: /* selector */"
|
||||
(let ((return "") ; String to be returned
|
||||
(p 0) ; Current scanning position in METHOD
|
||||
(pmax (length method)) ;
|
||||
char ; Current scanning target
|
||||
(betweenparen 0) ; CHAR is in parentheses.
|
||||
argreq ; An argument is required.
|
||||
inargvar) ; position of CHAR is in an argument variable.
|
||||
(while (< p pmax)
|
||||
(setq char (aref method p)
|
||||
p (1+ p))
|
||||
(cond
|
||||
;; Is CHAR part of a objc token?
|
||||
((and (not inargvar) ; Ignore if CHAR is part of an argument variable.
|
||||
(eq 0 betweenparen) ; Ignore if CHAR is in parentheses.
|
||||
(or (and (<= ?a char) (<= char ?z))
|
||||
(and (<= ?A char) (<= char ?Z))
|
||||
(and (<= ?0 char) (<= char ?9))
|
||||
(= ?_ char)))
|
||||
(if argreq
|
||||
(setq inargvar t
|
||||
argreq nil)
|
||||
(setq return (concat return (char-to-string char)))))
|
||||
;; Or a white space?
|
||||
((and inargvar (or (eq ?\ char) (eq ?\n char))
|
||||
(setq inargvar nil)))
|
||||
;; Or a method separator?
|
||||
;; If a method separator, the next token will be an argument variable.
|
||||
((eq ?: char)
|
||||
(setq argreq t
|
||||
return (concat return (char-to-string char))))
|
||||
;; Or an open parentheses?
|
||||
((eq ?\( char)
|
||||
(setq betweenparen (1+ betweenparen)))
|
||||
;; Or a close parentheses?
|
||||
((eq ?\) char)
|
||||
(setq betweenparen (1- betweenparen)))))
|
||||
return))
|
||||
|
||||
(defun cc-imenu-objc-remove-white-space (str)
|
||||
"Remove all spaces and tabs from STR."
|
||||
(let ((return "")
|
||||
(p 0)
|
||||
(max (length str))
|
||||
char)
|
||||
(while (< p max)
|
||||
(setq char (aref str p))
|
||||
(setq p (1+ p))
|
||||
(if (or (= char ?\ ) (= char ?\t))
|
||||
()
|
||||
(setq return (concat return (char-to-string char)))))
|
||||
return))
|
||||
|
||||
(defun cc-imenu-objc-function ()
|
||||
"imenu supports for objc-mode."
|
||||
(let (methodlist
|
||||
clist
|
||||
;;
|
||||
;; OBJC, Cnoreturn, Cgeneralfunc, Cproto are constants.
|
||||
;;
|
||||
;; *Warning for developers*
|
||||
;; These constants depend on `cc-imenu-c++-generic-expression'.
|
||||
;;
|
||||
(OBJC cc-imenu-objc-generic-expression-objc-base-index)
|
||||
;; Special case to match a line like `main() {}'
|
||||
(Cnoreturn cc-imenu-objc-generic-expression-noreturn-index)
|
||||
;; General function name regexp
|
||||
(Cgeneralfunc cc-imenu-objc-generic-expression-general-func-index)
|
||||
;; Special case for definitions using phony prototype macros like:
|
||||
(Cproto cc-imenu-objc-generic-expression-proto-index)
|
||||
langnum
|
||||
;;
|
||||
(classcount 0)
|
||||
toplist
|
||||
stupid
|
||||
str
|
||||
str2
|
||||
(intflen (length "@interface"))
|
||||
(implen (length "@implementation"))
|
||||
(prtlen (length "@protocol"))
|
||||
(func
|
||||
;;
|
||||
;; Does this emacs has buffer-substring-no-properties?
|
||||
;;
|
||||
(if (fboundp 'buffer-substring-no-properties)
|
||||
'buffer-substring-no-properties
|
||||
'buffer-substring)))
|
||||
(goto-char (point-max))
|
||||
(imenu-progress-message stupid 0)
|
||||
;;
|
||||
(while (re-search-backward cc-imenu-objc-generic-expression nil t)
|
||||
(imenu-progress-message stupid)
|
||||
(setq langnum (if (match-beginning OBJC)
|
||||
OBJC
|
||||
(cond
|
||||
((match-beginning Cproto) Cproto)
|
||||
((match-beginning Cgeneralfunc) Cgeneralfunc)
|
||||
((match-beginning Cnoreturn) Cnoreturn))))
|
||||
(setq str (funcall func (match-beginning langnum) (match-end langnum)))
|
||||
;;
|
||||
(cond
|
||||
;;
|
||||
;; C
|
||||
;;
|
||||
((not (eq langnum OBJC))
|
||||
(setq clist (cons (cons str (match-beginning langnum)) clist)))
|
||||
;;
|
||||
;; ObjC
|
||||
;;
|
||||
;; An instance Method
|
||||
((eq (aref str 0) ?-)
|
||||
(setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
|
||||
(setq methodlist (cons (cons str
|
||||
(match-beginning langnum))
|
||||
methodlist)))
|
||||
;; A factory Method
|
||||
((eq (aref str 0) ?+)
|
||||
(setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
|
||||
(setq methodlist (cons (cons str
|
||||
(match-beginning langnum))
|
||||
methodlist)))
|
||||
;; Interface or implementation or protocol
|
||||
((eq (aref str 0) ?@)
|
||||
(setq classcount (1+ classcount))
|
||||
(cond
|
||||
((and (> (length str) implen)
|
||||
(string= (substring str 0 implen) "@implementation"))
|
||||
(setq str (substring str implen)
|
||||
str2 "@implementation"))
|
||||
((string= (substring str 0 intflen) "@interface")
|
||||
(setq str (substring str intflen)
|
||||
str2 "@interface"))
|
||||
((string= (substring str 0 prtlen) "@protocol")
|
||||
(setq str (substring str prtlen)
|
||||
str2 "@protocol")))
|
||||
(setq str (cc-imenu-objc-remove-white-space str))
|
||||
(setq methodlist (cons (cons str2
|
||||
(match-beginning langnum))
|
||||
methodlist))
|
||||
(setq toplist (cons nil (cons (cons str
|
||||
methodlist) toplist))
|
||||
methodlist nil))))
|
||||
;;
|
||||
(imenu-progress-message stupid 100)
|
||||
(if (eq (car toplist) nil)
|
||||
(setq toplist (cdr toplist)))
|
||||
|
||||
;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
|
||||
(if (< classcount 2)
|
||||
(let ((classname (car (car toplist)))
|
||||
(p (cdr (car (cdr (car toplist)))))
|
||||
last)
|
||||
(setq toplist (cons (cons classname p) (cdr (cdr (car toplist)))))
|
||||
;; Add C lang token
|
||||
(if clist
|
||||
(progn
|
||||
(setq last toplist)
|
||||
(while (cdr last)
|
||||
(setq last (cdr last)))
|
||||
(setcdr last clist))))
|
||||
;; Add C lang tokens as a sub menu
|
||||
(if clist
|
||||
(setq toplist (cons (cons "C" clist) toplist))))
|
||||
;;
|
||||
toplist
|
||||
))
|
||||
|
||||
;(defvar cc-imenu-pike-generic-expression
|
||||
; ())
|
||||
; FIXME: Please contribute one!
|
||||
|
||||
(defun cc-imenu-init (mode-generic-expression
|
||||
&optional mode-create-index-function)
|
||||
(setq imenu-generic-expression mode-generic-expression
|
||||
imenu-case-fold-search nil)
|
||||
(when mode-create-index-function
|
||||
(setq imenu-create-index-function mode-create-index-function)))
|
||||
|
||||
|
||||
(cc-provide 'cc-menus)
|
||||
|
||||
;;; arch-tag: f6b60933-91f0-4145-ab44-70ca6d1b919b
|
||||
;;; cc-menus.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-menus.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-menus.elc
Normal file
Binary file not shown.
1305
site-lisp/cc-mode/5.31.3/cc-mode.el
Normal file
1305
site-lisp/cc-mode/5.31.3/cc-mode.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-mode.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-mode.elc
Normal file
Binary file not shown.
6937
site-lisp/cc-mode/5.31.3/cc-mode.texi
Normal file
6937
site-lisp/cc-mode/5.31.3/cc-mode.texi
Normal file
File diff suppressed because it is too large
Load diff
647
site-lisp/cc-mode/5.31.3/cc-styles.el
Normal file
647
site-lisp/cc-mode/5.31.3/cc-styles.el
Normal file
|
|
@ -0,0 +1,647 @@
|
|||
;;; cc-styles.el --- support for styles in CC Mode
|
||||
|
||||
;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
|
||||
;; Foundation, Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1992-1999 Barry A. Warsaw
|
||||
;; 1987 Dave Detlefs and Stewart Clamen
|
||||
;; 1985 Richard M. Stallman
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: 22-Apr-1997 (split from cc-mode.el)
|
||||
;; Version: See cc-mode.el
|
||||
;; Keywords: c languages oop
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-vars)
|
||||
(cc-require 'cc-align)
|
||||
;; cc-align is only indirectly required: Styles added with
|
||||
;; `c-add-style' often contains references to functions defined there.
|
||||
|
||||
;; Silence the compiler.
|
||||
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
|
||||
(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
|
||||
|
||||
|
||||
(defvar c-style-alist
|
||||
'(("gnu"
|
||||
(c-basic-offset . 2)
|
||||
(c-comment-only-line-offset . (0 . 0))
|
||||
(c-hanging-braces-alist . ((substatement-open before after)))
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 5)
|
||||
(substatement-open . +)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-case-open . +)
|
||||
(statement-cont . +)
|
||||
(arglist-intro . c-lineup-arglist-intro-after-paren)
|
||||
(arglist-close . c-lineup-arglist)
|
||||
(inline-open . 0)
|
||||
(brace-list-open . +)))
|
||||
(c-special-indent-hook . c-gnu-impose-minimum)
|
||||
(c-block-comment-prefix . ""))
|
||||
|
||||
("k&r"
|
||||
(c-basic-offset . 5)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("bsd"
|
||||
(c-basic-offset . 8)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . +)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +)
|
||||
(inline-open . 0)
|
||||
(inexpr-class . 0))))
|
||||
|
||||
("stroustrup"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("whitesmith"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
;; It's obvious that the CC Mode way of choosing anchor positions
|
||||
;; doesn't fit this style at all. :P
|
||||
(c-offsets-alist . ((defun-open . +)
|
||||
(defun-close . c-lineup-whitesmith-in-block)
|
||||
(defun-block-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(class-open . +)
|
||||
(class-close . +)
|
||||
(inline-open . +)
|
||||
(inline-close . c-lineup-whitesmith-in-block)
|
||||
(knr-argdecl-intro . +)
|
||||
(block-open . 0) ; Get indentation from `statement' instead.
|
||||
(block-close . c-lineup-whitesmith-in-block)
|
||||
(brace-list-open . +)
|
||||
(brace-list-close . c-lineup-whitesmith-in-block)
|
||||
(brace-list-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(brace-list-entry . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(brace-entry-open . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(statement . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(statement-block-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(substatement-open . +)
|
||||
(substatement-label . +)
|
||||
(label . 0)
|
||||
(arglist-intro . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(arglist-cont . (add c-lineup-after-whitesmith-blocks
|
||||
c-indent-multi-line-block))
|
||||
(arglist-cont-nonempty . (add c-lineup-whitesmith-in-block
|
||||
c-indent-multi-line-block))
|
||||
(arglist-close . c-lineup-whitesmith-in-block)
|
||||
(inclass . c-lineup-whitesmith-in-block)
|
||||
(extern-lang-open . +)
|
||||
(namespace-open . +)
|
||||
(module-open . +)
|
||||
(composition-open . +)
|
||||
(extern-lang-close . +)
|
||||
(namespace-close . +)
|
||||
(module-close . +)
|
||||
(composition-close . +)
|
||||
(inextern-lang . c-lineup-whitesmith-in-block)
|
||||
(innamespace . c-lineup-whitesmith-in-block)
|
||||
(inmodule . c-lineup-whitesmith-in-block)
|
||||
(incomposition . c-lineup-whitesmith-in-block)
|
||||
(inexpr-class . 0))))
|
||||
|
||||
("ellemtel"
|
||||
(c-basic-offset . 3)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((substatement-open before after)))
|
||||
(c-offsets-alist . ((topmost-intro . 0)
|
||||
(substatement . +)
|
||||
(substatement-open . 0)
|
||||
(case-label . +)
|
||||
(access-label . -)
|
||||
(inclass . ++)
|
||||
(inline-open . 0))))
|
||||
|
||||
("linux"
|
||||
(c-basic-offset . 8)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((brace-list-open)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)))
|
||||
(c-cleanup-list . (brace-else-brace))
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
("python"
|
||||
(indent-tabs-mode . t)
|
||||
(fill-column . 78)
|
||||
(c-basic-offset . 8)
|
||||
(c-offsets-alist . ((substatement-open . 0)
|
||||
(inextern-lang . 0)
|
||||
(arglist-intro . +)
|
||||
(knr-argdecl-intro . +)))
|
||||
(c-hanging-braces-alist . ((brace-list-open)
|
||||
(brace-list-intro)
|
||||
(brace-list-close)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)))
|
||||
(c-block-comment-prefix . ""))
|
||||
|
||||
("java"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . (0 . 0))
|
||||
;; the following preserves Javadoc starter lines
|
||||
(c-offsets-alist . ((inline-open . 0)
|
||||
(topmost-intro-cont . +)
|
||||
(statement-block-intro . +)
|
||||
(knr-argdecl-intro . 5)
|
||||
(substatement-open . +)
|
||||
(substatement-label . +)
|
||||
(label . +)
|
||||
(statement-case-open . +)
|
||||
(statement-cont . +)
|
||||
(arglist-intro . c-lineup-arglist-intro-after-paren)
|
||||
(arglist-close . c-lineup-arglist)
|
||||
(access-label . 0)
|
||||
(inher-cont . c-lineup-java-inher)
|
||||
(func-decl-cont . c-lineup-java-throws))))
|
||||
|
||||
;; awk style exists primarily for auto-newline settings. Otherwise it's
|
||||
;; pretty much like k&r.
|
||||
("awk"
|
||||
(c-basic-offset . 4)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist . ((defun-open after)
|
||||
(defun-close . c-snug-1line-defun-close)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)))
|
||||
(c-hanging-semi&comma-criteria . nil)
|
||||
(c-cleanup-list . nil) ; You might want one-liner-defun here.
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(statement-cont . +))))
|
||||
|
||||
)
|
||||
"Styles of indentation.
|
||||
Elements of this alist are of the form:
|
||||
|
||||
(STYLE-STRING [BASE-STYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
|
||||
|
||||
where STYLE-STRING is a short descriptive string used to select a
|
||||
style, VARIABLE is any Emacs variable, and VALUE is the intended value
|
||||
for that variable when using the selected style.
|
||||
|
||||
Optional BASE-STYLE if present, is a string and must follow
|
||||
STYLE-STRING. BASE-STYLE names a style that this style inherits from.
|
||||
By default, all styles inherit from the \"user\" style, which is
|
||||
computed at run time. Style loops generate errors.
|
||||
|
||||
Two variables are treated specially. When VARIABLE is
|
||||
`c-offsets-alist', the VALUE is a list containing elements of the
|
||||
form:
|
||||
|
||||
(SYNTACTIC-SYMBOL . OFFSET)
|
||||
|
||||
as described in `c-offsets-alist'. These are passed directly to
|
||||
`c-set-offset' so there is no need to set every syntactic symbol in
|
||||
your style, only those that are different from the default.
|
||||
|
||||
When VARIABLE is `c-special-indent-hook', its VALUE is added to
|
||||
`c-special-indent-hook' using `add-hook'. If VALUE is a list, each
|
||||
element of the list is added with `add-hook'.
|
||||
|
||||
Do not change this variable directly. Use the function `c-add-style'
|
||||
to add new styles or modify existing styles (it is not a good idea to
|
||||
modify existing styles -- you should create a new style that inherits
|
||||
the existing style.")
|
||||
|
||||
|
||||
;; Functions that manipulate styles
|
||||
(defun c-set-style-1 (conscell dont-override)
|
||||
;; Set the style for one variable
|
||||
(let ((attr (car conscell))
|
||||
(val (cdr conscell)))
|
||||
(cond
|
||||
;; first special variable
|
||||
((eq attr 'c-offsets-alist)
|
||||
(let ((offsets (cond ((eq dont-override t)
|
||||
c-offsets-alist)
|
||||
(dont-override
|
||||
(default-value 'c-offsets-alist)))))
|
||||
(mapcar (lambda (langentry)
|
||||
(let ((langelem (car langentry))
|
||||
(offset (cdr langentry)))
|
||||
(unless (assq langelem offsets)
|
||||
(c-set-offset langelem offset))))
|
||||
val)))
|
||||
;; second special variable
|
||||
((eq attr 'c-special-indent-hook)
|
||||
;; Maybe we should ignore dont-override here and always add new
|
||||
;; hooks?
|
||||
(unless (cond ((eq dont-override t)
|
||||
c-special-indent-hook)
|
||||
(dont-override
|
||||
(default-value 'c-special-indent-hook)))
|
||||
(if (listp val)
|
||||
(mapcar (lambda (func)
|
||||
(add-hook 'c-special-indent-hook func t t))
|
||||
val)
|
||||
(add-hook 'c-special-indent-hook val t t))))
|
||||
;; all other variables
|
||||
(t (when (or (not dont-override)
|
||||
(not (memq attr c-style-variables))
|
||||
(eq (if (eq dont-override t)
|
||||
(symbol-value attr)
|
||||
(default-value attr))
|
||||
'set-from-style))
|
||||
(set attr val)
|
||||
;; Must update a number of other variables if
|
||||
;; c-comment-prefix-regexp is set.
|
||||
(if (eq attr 'c-comment-prefix-regexp)
|
||||
(c-setup-paragraph-variables)))))))
|
||||
|
||||
(defun c-get-style-variables (style basestyles)
|
||||
;; Return all variables in a style by resolving inheritances.
|
||||
(if (not style)
|
||||
(copy-alist c-fallback-style)
|
||||
(let ((vars (cdr (or (assoc (downcase style) c-style-alist)
|
||||
(assoc (upcase style) c-style-alist)
|
||||
(assoc style c-style-alist)
|
||||
(progn
|
||||
(c-benign-error "Undefined style: %s" style)
|
||||
nil)))))
|
||||
(let ((base (and (stringp (car-safe vars))
|
||||
(prog1
|
||||
(downcase (car vars))
|
||||
(setq vars (cdr vars))))))
|
||||
(if (memq base basestyles)
|
||||
(c-benign-error "Style loop detected: %s in %s" base basestyles)
|
||||
(nconc (c-get-style-variables base (cons base basestyles))
|
||||
(copy-alist vars)))))))
|
||||
|
||||
(defvar c-set-style-history nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun c-set-style (stylename &optional dont-override)
|
||||
"Set the current buffer to use the style STYLENAME.
|
||||
STYLENAME, a string, must be an existing CC Mode style - These are contained
|
||||
in the variable `c-style-alist'.
|
||||
|
||||
The variable `c-indentation-style' will get set to STYLENAME.
|
||||
|
||||
\"Setting the style\" is done by setting CC Mode's \"style variables\" to the
|
||||
values indicated by the pertinent entry in `c-style-alist'. Other variables
|
||||
might get set too.
|
||||
|
||||
If DONT-OVERRIDE is neither nil nor t, style variables whose default values
|
||||
have been set (more precisely, whose default values are not the symbol
|
||||
`set-from-style') will not be changed. This avoids overriding global settings
|
||||
done in ~/.emacs. It is useful to call c-set-style from a mode hook in this
|
||||
way.
|
||||
|
||||
If DONT-OVERRIDE is t, style variables that already have values (i.e., whose
|
||||
values are not the symbol `set-from-style') will not be overridden. CC Mode
|
||||
calls c-set-style internally in this way whilst initializing a buffer; if
|
||||
cc-set-style is called like this from anywhere else, it will usually behave as
|
||||
a null operation."
|
||||
(interactive
|
||||
(list (let ((completion-ignore-case t)
|
||||
(prompt (format "Which %s indentation style? "
|
||||
mode-name)))
|
||||
(completing-read prompt c-style-alist nil t nil
|
||||
'c-set-style-history
|
||||
c-indentation-style))))
|
||||
(or c-buffer-is-cc-mode
|
||||
(error "Buffer %s is not a CC Mode buffer (c-set-style)" (buffer-name)))
|
||||
(or (stringp stylename)
|
||||
(error "Argument to c-set-style was not a string"))
|
||||
(c-initialize-builtin-style)
|
||||
(let ((vars (c-get-style-variables stylename nil)))
|
||||
(unless dont-override
|
||||
;; Since we always add to c-special-indent-hook we must reset it
|
||||
;; first, or else the hooks from the preceding style will
|
||||
;; remain. This is not necessary for c-offsets-alist, since
|
||||
;; c-get-style-variables contains every valid offset type in the
|
||||
;; fallback entry.
|
||||
(setq c-special-indent-hook
|
||||
(default-value 'c-special-indent-hook)))
|
||||
(mapcar (lambda (elem)
|
||||
(c-set-style-1 elem dont-override))
|
||||
;; Need to go through the variables backwards when we
|
||||
;; don't override any settings.
|
||||
(if (eq dont-override t) (nreverse vars) vars)))
|
||||
(setq c-indentation-style stylename)
|
||||
(c-keep-region-active))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-add-style (style description &optional set-p)
|
||||
"Adds a style to `c-style-alist', or updates an existing one.
|
||||
STYLE is a string identifying the style to add or update. DESCRIPTION
|
||||
is an association list describing the style and must be of the form:
|
||||
|
||||
([BASESTYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
|
||||
|
||||
See the variable `c-style-alist' for the semantics of BASESTYLE,
|
||||
VARIABLE and VALUE. This function also sets the current style to
|
||||
STYLE using `c-set-style' if the optional SET-P flag is non-nil."
|
||||
(interactive
|
||||
(let ((stylename (completing-read "Style to add: " c-style-alist
|
||||
nil nil nil 'c-set-style-history))
|
||||
(descr (eval-minibuffer "Style description: ")))
|
||||
(list stylename descr
|
||||
(y-or-n-p "Set the style too? "))))
|
||||
(setq style (downcase style))
|
||||
(let ((s (assoc style c-style-alist)))
|
||||
(if s
|
||||
(setcdr s (copy-alist description)) ; replace
|
||||
(setq c-style-alist (cons (cons style description) c-style-alist))))
|
||||
(and set-p (c-set-style style)))
|
||||
|
||||
|
||||
(defvar c-read-offset-history nil)
|
||||
|
||||
(defun c-read-offset (langelem)
|
||||
;; read new offset value for LANGELEM from minibuffer. return a
|
||||
;; legal value only
|
||||
(let* ((oldoff (cdr-safe (or (assq langelem c-offsets-alist)
|
||||
(assq langelem (get 'c-offsets-alist
|
||||
'c-stylevar-fallback)))))
|
||||
(symname (symbol-name langelem))
|
||||
(defstr (format "(default %s): " oldoff))
|
||||
(errmsg (concat "Offset must be int, func, var, vector, list, "
|
||||
"or [+,-,++,--,*,/] "
|
||||
defstr))
|
||||
(prompt (concat symname " offset " defstr))
|
||||
(keymap (make-sparse-keymap))
|
||||
(minibuffer-completion-table obarray)
|
||||
(minibuffer-completion-predicate 'fboundp)
|
||||
offset input)
|
||||
;; In principle completing-read is used here, but SPC is unbound
|
||||
;; to make it less annoying to enter lists.
|
||||
(set-keymap-parent keymap minibuffer-local-completion-map)
|
||||
(define-key keymap " " 'self-insert-command)
|
||||
(while (not offset)
|
||||
(setq input (read-from-minibuffer prompt nil keymap t
|
||||
'c-read-offset-history
|
||||
(format "%s" oldoff)))
|
||||
(if (c-valid-offset input)
|
||||
(setq offset input)
|
||||
;; error, but don't signal one, keep trying
|
||||
;; to read an input value
|
||||
(ding)
|
||||
(setq prompt errmsg)))
|
||||
offset))
|
||||
|
||||
;;;###autoload
|
||||
(defun c-set-offset (symbol offset &optional ignored)
|
||||
"Change the value of a syntactic element symbol in `c-offsets-alist'.
|
||||
SYMBOL is the syntactic element symbol to change and OFFSET is the new
|
||||
offset for that syntactic element. The optional argument is not used
|
||||
and exists only for compatibility reasons."
|
||||
(interactive
|
||||
(let* ((langelem
|
||||
(intern (completing-read
|
||||
(concat "Syntactic symbol to change"
|
||||
(if current-prefix-arg " or add" "")
|
||||
": ")
|
||||
(mapcar
|
||||
#'(lambda (langelem)
|
||||
(cons (format "%s" (car langelem)) nil))
|
||||
(get 'c-offsets-alist 'c-stylevar-fallback))
|
||||
nil (not current-prefix-arg)
|
||||
;; initial contents tries to be the last element
|
||||
;; on the syntactic analysis list for the current
|
||||
;; line
|
||||
(and c-buffer-is-cc-mode
|
||||
(c-save-buffer-state
|
||||
((syntax (c-guess-basic-syntax))
|
||||
(len (length syntax))
|
||||
(ic (format "%s" (car (nth (1- len) syntax)))))
|
||||
(cons ic 0)))
|
||||
)))
|
||||
(offset (c-read-offset langelem)))
|
||||
(list langelem offset current-prefix-arg)))
|
||||
;; sanity check offset
|
||||
(if (c-valid-offset offset)
|
||||
(let ((entry (assq symbol c-offsets-alist)))
|
||||
(if entry
|
||||
(setcdr entry offset)
|
||||
(if (assq symbol (get 'c-offsets-alist 'c-stylevar-fallback))
|
||||
(setq c-offsets-alist (cons (cons symbol offset)
|
||||
c-offsets-alist))
|
||||
(c-benign-error "%s is not a valid syntactic symbol" symbol))))
|
||||
(c-benign-error "Invalid indentation setting for symbol %s: %S"
|
||||
symbol offset))
|
||||
(c-keep-region-active))
|
||||
|
||||
|
||||
(defun c-setup-paragraph-variables ()
|
||||
"Fix things up for paragraph recognition and filling inside comments and
|
||||
strings by incorporating the values of `c-comment-prefix-regexp',
|
||||
`sentence-end', `paragraph-start' and `paragraph-separate' in the relevant
|
||||
variables."
|
||||
|
||||
(interactive)
|
||||
(or c-buffer-is-cc-mode
|
||||
(error "Buffer %s is not a CC Mode buffer (c-setup-paragraph-variables)"
|
||||
(buffer-name)))
|
||||
;; Set up the values for use in comments.
|
||||
(setq c-current-comment-prefix
|
||||
(if (listp c-comment-prefix-regexp)
|
||||
(cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
|
||||
(assoc 'other c-comment-prefix-regexp)))
|
||||
c-comment-prefix-regexp))
|
||||
|
||||
(let ((comment-line-prefix
|
||||
(concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
|
||||
|
||||
(setq paragraph-start (concat comment-line-prefix
|
||||
c-paragraph-start
|
||||
"\\|"
|
||||
page-delimiter)
|
||||
paragraph-separate (concat comment-line-prefix
|
||||
c-paragraph-separate
|
||||
"\\|"
|
||||
page-delimiter)
|
||||
paragraph-ignore-fill-prefix t
|
||||
adaptive-fill-mode t
|
||||
adaptive-fill-regexp
|
||||
(concat comment-line-prefix
|
||||
(if (default-value 'adaptive-fill-regexp)
|
||||
(concat "\\("
|
||||
(default-value 'adaptive-fill-regexp)
|
||||
"\\)")
|
||||
"")))
|
||||
|
||||
(when (boundp 'adaptive-fill-first-line-regexp)
|
||||
;; XEmacs adaptive fill mode doesn't have this.
|
||||
(make-local-variable 'adaptive-fill-first-line-regexp)
|
||||
(setq adaptive-fill-first-line-regexp
|
||||
(concat "\\`" comment-line-prefix
|
||||
;; Maybe we should incorporate the old value here,
|
||||
;; but then we have to do all sorts of kludges to
|
||||
;; deal with the \` and \' it probably contains.
|
||||
"\\'"))))
|
||||
|
||||
;; Set up the values for use in strings. These are the default
|
||||
;; paragraph-start/separate values, enhanced to accept escaped EOLs as
|
||||
;; whitespace. Used in c-beginning/end-of-sentence-in-string in cc-cmds.
|
||||
(setq c-string-par-start
|
||||
;;(concat "\\(" (default-value 'paragraph-start) "\\)\\|[ \t]*\\\\$"))
|
||||
"\f\\|[ \t]*\\\\?$")
|
||||
(setq c-string-par-separate
|
||||
;;(concat "\\(" (default-value 'paragraph-separate) "\\)\\|[ \t]*\\\\$"))
|
||||
"[ \t\f]*\\\\?$")
|
||||
(setq c-sentence-end-with-esc-eol
|
||||
(concat "\\(\\(" (c-default-value-sentence-end) "\\)"
|
||||
;; N.B.: "$" would be illegal when not enclosed like "\\($\\)".
|
||||
"\\|" "[.?!][]\"')}]* ?\\\\\\($\\)[ \t\n]*"
|
||||
"\\)")))
|
||||
|
||||
|
||||
;; Helper for setting up Filladapt mode. It's not used by CC Mode itself.
|
||||
|
||||
(cc-bytecomp-defvar filladapt-token-table)
|
||||
(cc-bytecomp-defvar filladapt-token-match-table)
|
||||
(cc-bytecomp-defvar filladapt-token-conversion-table)
|
||||
|
||||
(defun c-setup-filladapt ()
|
||||
"Convenience function to configure Kyle E. Jones' Filladapt mode for
|
||||
CC Mode by making sure the proper entries are present on
|
||||
`filladapt-token-table', `filladapt-token-match-table', and
|
||||
`filladapt-token-conversion-table'. This is intended to be used on
|
||||
`c-mode-common-hook' or similar."
|
||||
;; This function is intended to be used explicitly by the end user
|
||||
;; only.
|
||||
|
||||
;; The default configuration already handles C++ comments, but we
|
||||
;; need to add handling of C block comments. A new filladapt token
|
||||
;; `c-comment' is added for that.
|
||||
(let (p)
|
||||
(setq p filladapt-token-table)
|
||||
(while (and p (not (eq (car-safe (cdr-safe (car-safe p))) 'c-comment)))
|
||||
(setq p (cdr-safe p)))
|
||||
(if p
|
||||
(setcar (car p) c-current-comment-prefix)
|
||||
(setq filladapt-token-table
|
||||
(append (list (car filladapt-token-table)
|
||||
(list c-current-comment-prefix 'c-comment))
|
||||
(cdr filladapt-token-table)))))
|
||||
(unless (assq 'c-comment filladapt-token-match-table)
|
||||
(setq filladapt-token-match-table
|
||||
(append '((c-comment c-comment))
|
||||
filladapt-token-match-table)))
|
||||
(unless (assq 'c-comment filladapt-token-conversion-table)
|
||||
(setq filladapt-token-conversion-table
|
||||
(append '((c-comment . exact))
|
||||
filladapt-token-conversion-table))))
|
||||
|
||||
|
||||
(defun c-initialize-builtin-style ()
|
||||
;; Dynamically append the default value of most variables. This is
|
||||
;; crucial because future c-set-style calls will always reset the
|
||||
;; variables first to the `cc-mode' style before instituting the new
|
||||
;; style. Only do this once!
|
||||
(unless (get 'c-initialize-builtin-style 'is-run)
|
||||
(put 'c-initialize-builtin-style 'is-run t)
|
||||
;;(c-initialize-cc-mode)
|
||||
(unless (assoc "user" c-style-alist)
|
||||
(let ((vars c-style-variables) var val uservars)
|
||||
(while vars
|
||||
(setq var (car vars)
|
||||
val (symbol-value var)
|
||||
vars (cdr vars))
|
||||
(cond ((eq var 'c-offsets-alist)
|
||||
(or (null val)
|
||||
(setq uservars (cons (cons 'c-offsets-alist val)
|
||||
uservars))))
|
||||
((not (eq val 'set-from-style))
|
||||
(setq uservars (cons (cons var val)
|
||||
uservars)))))
|
||||
(c-add-style "user" uservars)))
|
||||
(unless (assoc "cc-mode" c-style-alist)
|
||||
(c-add-style "cc-mode" '("user")))
|
||||
(if c-style-variables-are-local-p
|
||||
(c-make-styles-buffer-local))))
|
||||
|
||||
(defun c-make-styles-buffer-local (&optional this-buf-only-p)
|
||||
"Make all CC Mode style variables buffer local.
|
||||
If `this-buf-only-p' is non-nil, the style variables will be made
|
||||
buffer local only in the current buffer. Otherwise they'll be made
|
||||
permanently buffer local in any buffer that changes their values.
|
||||
|
||||
The buffer localness of the style variables are normally controlled
|
||||
with the variable `c-style-variables-are-local-p', so there's seldom
|
||||
any reason to call this function directly."
|
||||
|
||||
;; style variables
|
||||
(let ((func (if this-buf-only-p
|
||||
'make-local-variable
|
||||
'make-variable-buffer-local))
|
||||
(varsyms (cons 'c-indentation-style (copy-alist c-style-variables))))
|
||||
(delq 'c-special-indent-hook varsyms)
|
||||
(mapcar func varsyms)
|
||||
;; Hooks must be handled specially
|
||||
(if this-buf-only-p
|
||||
(make-local-hook 'c-special-indent-hook)
|
||||
(make-variable-buffer-local 'c-special-indent-hook)
|
||||
(setq c-style-variables-are-local-p t))
|
||||
))
|
||||
|
||||
|
||||
|
||||
(cc-provide 'cc-styles)
|
||||
|
||||
;;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
|
||||
;;; cc-styles.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-styles.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-styles.elc
Normal file
Binary file not shown.
312
site-lisp/cc-mode/5.31.3/cc-subword.el
Normal file
312
site-lisp/cc-mode/5.31.3/cc-subword.el
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
;;; cc-subword.el --- Handling capitalized subwords in a nomenclature
|
||||
|
||||
;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Masatake YAMATO
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This package provides `subword' oriented commands and a minor mode
|
||||
;; (`c-subword-mode') that substitutes the common word handling
|
||||
;; functions with them.
|
||||
|
||||
;; In spite of GNU Coding Standards, it is popular to name a symbol by
|
||||
;; mixing uppercase and lowercase letters, e.g. "GtkWidget",
|
||||
;; "EmacsFrameClass", "NSGraphicsContext", etc. Here we call these
|
||||
;; mixed case symbols `nomenclatures'. Also, each capitalized (or
|
||||
;; completely uppercase) part of a nomenclature is called a `subword'.
|
||||
;; Here are some examples:
|
||||
|
||||
;; Nomenclature Subwords
|
||||
;; ===========================================================
|
||||
;; GtkWindow => "Gtk" and "Window"
|
||||
;; EmacsFrameClass => "Emacs", "Frame" and "Class"
|
||||
;; NSGraphicsContext => "NS", "Graphics" and "Context"
|
||||
|
||||
;; The subword oriented commands defined in this package recognize
|
||||
;; subwords in a nomenclature to move between them and to edit them as
|
||||
;; words.
|
||||
|
||||
;; In the minor mode, all common key bindings for word oriented
|
||||
;; commands are overridden by the subword oriented commands:
|
||||
|
||||
;; Key Word oriented command Subword oriented command
|
||||
;; ============================================================
|
||||
;; M-f `forward-word' `c-forward-subword'
|
||||
;; M-b `backward-word' `c-backward-subword'
|
||||
;; M-@ `mark-word' `c-mark-subword'
|
||||
;; M-d `kill-word' `c-kill-subword'
|
||||
;; M-DEL `backward-kill-word' `c-backward-kill-subword'
|
||||
;; M-t `transpose-words' `c-transpose-subwords'
|
||||
;; M-c `capitalize-word' `c-capitalize-subword'
|
||||
;; M-u `upcase-word' `c-upcase-subword'
|
||||
;; M-l `downcase-word' `c-downcase-subword'
|
||||
;;
|
||||
;; Note: If you have changed the key bindings for the word oriented
|
||||
;; commands in your .emacs or a similar place, the keys you've changed
|
||||
;; to are also used for the corresponding subword oriented commands.
|
||||
|
||||
;; To make the mode turn on automatically, put the following code in
|
||||
;; your .emacs:
|
||||
;;
|
||||
;; (add-hook 'c-mode-common-hook
|
||||
;; (lambda () (c-subword-mode 1)))
|
||||
;;
|
||||
|
||||
;; Acknowledgment:
|
||||
;; The regular expressions to detect subwords are mostly based on
|
||||
;; the old `c-forward-into-nomenclature' originally contributed by
|
||||
;; Terry_Glanfield dot Southern at rxuk dot xerox dot com.
|
||||
|
||||
;; TODO: ispell-word and subword oriented C-w in isearch.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(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 'cc-cmds)
|
||||
|
||||
;; Don't complain about the `define-minor-mode' form if it isn't defined.
|
||||
(cc-bytecomp-defvar c-subword-mode)
|
||||
|
||||
;;; Autoload directives must be on the top level, so we construct an
|
||||
;;; autoload form instead.
|
||||
;;;###autoload (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t)
|
||||
|
||||
(if (not (fboundp 'define-minor-mode))
|
||||
(defun c-subword-mode ()
|
||||
"(Missing) mode enabling subword movement and editing keys.
|
||||
This mode is not (yet) available in this version of (X)Emacs. Sorry! If
|
||||
you really want it, please send a request to <bug-gnu-emacs@gnu.org>,
|
||||
telling us which (X)Emacs version you're using."
|
||||
(interactive)
|
||||
(error
|
||||
"c-subword-mode is not (yet) available in this version of (X)Emacs. Sorry!"))
|
||||
|
||||
(defvar c-subword-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(substitute-key-definition 'forward-word
|
||||
'c-forward-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'backward-word
|
||||
'c-backward-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'mark-word
|
||||
'c-mark-subword
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'kill-word
|
||||
'c-kill-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'backward-kill-word
|
||||
'c-backward-kill-subword
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'transpose-words
|
||||
'c-transpose-subwords
|
||||
map global-map)
|
||||
|
||||
(substitute-key-definition 'capitalize-word
|
||||
'c-capitalize-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'upcase-word
|
||||
'c-upcase-subword
|
||||
map global-map)
|
||||
(substitute-key-definition 'downcase-word
|
||||
'c-downcase-subword
|
||||
map global-map)
|
||||
map)
|
||||
"Keymap used in command `c-subword-mode' minor mode.")
|
||||
|
||||
(define-minor-mode c-subword-mode
|
||||
"Mode enabling subword movement and editing keys.
|
||||
In spite of GNU Coding Standards, it is popular to name a symbol by
|
||||
mixing uppercase and lowercase letters, e.g. \"GtkWidget\",
|
||||
\"EmacsFrameClass\", \"NSGraphicsContext\", etc. Here we call these
|
||||
mixed case symbols `nomenclatures'. Also, each capitalized (or
|
||||
completely uppercase) part of a nomenclature is called a `subword'.
|
||||
Here are some examples:
|
||||
|
||||
Nomenclature Subwords
|
||||
===========================================================
|
||||
GtkWindow => \"Gtk\" and \"Window\"
|
||||
EmacsFrameClass => \"Emacs\", \"Frame\" and \"Class\"
|
||||
NSGraphicsContext => \"NS\", \"Graphics\" and \"Context\"
|
||||
|
||||
The subword oriented commands activated in this minor mode recognize
|
||||
subwords in a nomenclature to move between subwords and to edit them
|
||||
as words.
|
||||
|
||||
\\{c-subword-mode-map}"
|
||||
nil
|
||||
nil
|
||||
c-subword-mode-map
|
||||
(c-update-modeline))
|
||||
|
||||
)
|
||||
|
||||
(defun c-forward-subword (&optional arg)
|
||||
"Do the same as `forward-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `forward-word'."
|
||||
(interactive "p")
|
||||
(unless arg (setq arg 1))
|
||||
(c-keep-region-active)
|
||||
(cond
|
||||
((< 0 arg)
|
||||
(dotimes (i arg (point))
|
||||
(c-forward-subword-internal)))
|
||||
((> 0 arg)
|
||||
(dotimes (i (- arg) (point))
|
||||
(c-backward-subword-internal)))
|
||||
(t
|
||||
(point))))
|
||||
|
||||
(defun c-backward-subword (&optional arg)
|
||||
"Do the same as `backward-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `backward-word'."
|
||||
(interactive "p")
|
||||
(c-forward-subword (- (or arg 1))))
|
||||
|
||||
(defun c-mark-subword (arg)
|
||||
"Do the same as `mark-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `mark-word'."
|
||||
;; This code is almost copied from `mark-word' in GNU Emacs.
|
||||
(interactive "p")
|
||||
(cond ((and (eq last-command this-command) (mark t))
|
||||
(set-mark
|
||||
(save-excursion
|
||||
(goto-char (mark))
|
||||
(c-forward-subword arg)
|
||||
(point))))
|
||||
(t
|
||||
(push-mark
|
||||
(save-excursion
|
||||
(c-forward-subword arg)
|
||||
(point))
|
||||
nil t))))
|
||||
|
||||
(defun c-kill-subword (arg)
|
||||
"Do the same as `kill-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `kill-word'."
|
||||
(interactive "p")
|
||||
(kill-region (point) (c-forward-subword arg)))
|
||||
|
||||
(defun c-backward-kill-subword (arg)
|
||||
"Do the same as `backward-kill-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `backward-kill-word'."
|
||||
(interactive "p")
|
||||
(c-kill-subword (- arg)))
|
||||
|
||||
(defun c-transpose-subwords (arg)
|
||||
"Do the same as `transpose-words' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `transpose-words'."
|
||||
(interactive "*p")
|
||||
(transpose-subr 'c-forward-subword arg))
|
||||
|
||||
(defun c-capitalize-subword (arg)
|
||||
"Do the same as `capitalize-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `capitalize-word'."
|
||||
(interactive "p")
|
||||
(let ((count (abs arg))
|
||||
(direction (if (< 0 arg) 1 -1)))
|
||||
(dotimes (i count)
|
||||
(when (re-search-forward
|
||||
(concat "[" c-alpha "]")
|
||||
nil t)
|
||||
(goto-char (match-beginning 0)))
|
||||
(let* ((p (point))
|
||||
(pp (1+ p))
|
||||
(np (c-forward-subword direction)))
|
||||
(upcase-region p pp)
|
||||
(downcase-region pp np)
|
||||
(goto-char np)))))
|
||||
|
||||
(defun c-downcase-subword (arg)
|
||||
"Do the same as `downcase-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `downcase-word'."
|
||||
(interactive "p")
|
||||
(downcase-region (point) (c-forward-subword arg)))
|
||||
|
||||
(defun c-upcase-subword (arg)
|
||||
"Do the same as `upcase-word' but on subwords.
|
||||
See the command `c-subword-mode' for a description of subwords.
|
||||
Optional argument ARG is the same as for `upcase-word'."
|
||||
(interactive "p")
|
||||
(upcase-region (point) (c-forward-subword arg)))
|
||||
|
||||
|
||||
;;
|
||||
;; Internal functions
|
||||
;;
|
||||
(defun c-forward-subword-internal ()
|
||||
(if (and
|
||||
(save-excursion
|
||||
(let ((case-fold-search nil))
|
||||
(re-search-forward
|
||||
(concat "\\W*\\(\\([" c-upper "]*\\W?\\)[" c-lower c-digit "]*\\)")
|
||||
nil t)))
|
||||
(> (match-end 0) (point))) ; So we don't get stuck at a
|
||||
; "word-constituent" which isn't c-upper,
|
||||
; c-lower or c-digit
|
||||
(goto-char
|
||||
(cond
|
||||
((< 1 (- (match-end 2) (match-beginning 2)))
|
||||
(1- (match-end 2)))
|
||||
(t
|
||||
(match-end 0))))
|
||||
(forward-word 1)))
|
||||
|
||||
|
||||
(defun c-backward-subword-internal ()
|
||||
(if (save-excursion
|
||||
(let ((case-fold-search nil))
|
||||
(re-search-backward
|
||||
(concat
|
||||
"\\(\\(\\W\\|[" c-lower c-digit "]\\)\\([" c-upper "]+\\W*\\)"
|
||||
"\\|\\W\\w+\\)")
|
||||
nil t)))
|
||||
(goto-char
|
||||
(cond
|
||||
((and (match-end 3)
|
||||
(< 1 (- (match-end 3) (match-beginning 3)))
|
||||
(not (eq (point) (match-end 3))))
|
||||
(1- (match-end 3)))
|
||||
(t
|
||||
(1+ (match-beginning 0)))))
|
||||
(backward-word 1)))
|
||||
|
||||
|
||||
(cc-provide 'cc-subword)
|
||||
|
||||
;;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3
|
||||
;;; cc-subword.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/cc-subword.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-subword.elc
Normal file
Binary file not shown.
1637
site-lisp/cc-mode/5.31.3/cc-vars.el
Normal file
1637
site-lisp/cc-mode/5.31.3/cc-vars.el
Normal file
File diff suppressed because it is too large
Load diff
BIN
site-lisp/cc-mode/5.31.3/cc-vars.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/cc-vars.elc
Normal file
Binary file not shown.
400
site-lisp/cc-mode/5.31.3/csharp-mode-0.5.0.el
Normal file
400
site-lisp/cc-mode/5.31.3/csharp-mode-0.5.0.el
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
;;; csharp-mode.el --- C# mode derived mode
|
||||
|
||||
;; Author: 2005 Dylan R. E. Moonfire
|
||||
;; Maintainer: Dylan R. E. Moonfire <contact@mfgames.com>
|
||||
;; Created: Feburary 2005
|
||||
;; Modified: December 2005
|
||||
;; Version: 0.5.0
|
||||
;; Keywords: c# languages oop
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is a separate mode to implement the C# constructs and
|
||||
;; font-locking. It is based on the java-mode example from cc-mode.
|
||||
;;
|
||||
;; Note: The interface used in this file requires CC Mode 5.30 or
|
||||
;; later.
|
||||
|
||||
;;; Bugs:
|
||||
;;
|
||||
;; Literal strings @"" do not fontify correctly.
|
||||
;;
|
||||
;; Method names are not fontified if you have an attribute before it.
|
||||
;;
|
||||
;; This code doesn't seem to work when you compile it, then
|
||||
;; load/require in the emacs file. You will get an error (error
|
||||
;; "`c-lang-defconst' must be used in a file") which happens because
|
||||
;; cc-mode doesn't think it is in a buffer while loading directly
|
||||
;; from the init. However, if you call it based on a file extension,
|
||||
;; it works properly. Interestingly enough, this doesn't happen if
|
||||
;; you don't byte-compile cc-mode.
|
||||
|
||||
;;; .emacs (don't put in (require 'csharp-mode))
|
||||
;; (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
|
||||
;; (setq auto-mode-alist
|
||||
;; (append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
|
||||
|
||||
;;; Versions:
|
||||
;;
|
||||
;; 0.1.0 - Initial release.
|
||||
;; 0.2.0 - Fixed the identification on the "enum" keyword.
|
||||
;; - Fixed the font-lock on the "base" keyword
|
||||
;; 0.3.0 - Added a regex to fontify attributes. It isn't the
|
||||
;; the best method, but it handles single-like attributes
|
||||
;; well.
|
||||
;; - Got "super" not to fontify as a keyword.
|
||||
;; - Got extending classes and interfaces to fontify as something.
|
||||
;; 0.4.0 - Removed the attribute matching because it broke more than
|
||||
;; it fixed.
|
||||
;; - Corrected a bug with namespace not being properly identified
|
||||
;; and treating the class level as an inner object, which screwed
|
||||
;; up formatting.
|
||||
;; - Added "partial" to the keywords.
|
||||
;; 0.5.0 - Found bugs with compiled cc-mode and loading from init files.
|
||||
;; - Updated the eval-when-compile to code to let the mode be
|
||||
;; compiled.
|
||||
|
||||
;;; Code:
|
||||
(require 'cc-mode)
|
||||
|
||||
;; These are only required at compile time to get the sources for the
|
||||
;; language constants. (The cc-fonts require and the font-lock
|
||||
;; related constants could additionally be put inside an
|
||||
;; (eval-after-load "font-lock" ...) but then some trickery is
|
||||
;; necessary to get them compiled.)
|
||||
(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-mode" nil t)
|
||||
(load "cc-fonts" nil t)
|
||||
(load "cc-langs" nil t)))
|
||||
|
||||
(eval-and-compile
|
||||
;; Make our mode known to the language constant system. Use Java
|
||||
;; mode as the fallback for the constants we don't change here.
|
||||
;; This needs to be done also at compile time since the language
|
||||
;; constants are evaluated then.
|
||||
(c-add-language 'csharp-mode 'java-mode))
|
||||
|
||||
;; TODO
|
||||
;; Defines our constant for finding attributes.
|
||||
;;(defconst csharp-attribute-regex "\\[\\([XmlType]+\\)(")
|
||||
;;(defconst csharp-attribute-regex "\\[\\(.\\)")
|
||||
|
||||
;; Java uses a series of regexes to change the font-lock for class
|
||||
;; references. The problem comes in because Java uses Pascal (leading
|
||||
;; space in names, SomeClass) for class and package names, but
|
||||
;; Camel-casing (initial lowercase, upper case in words,
|
||||
;; i.e. someVariable) for variables. The notation suggested by EMCA is
|
||||
;; to use Pasacal notation for everything, except inner variables. So,
|
||||
;; the regex and formatting actually produces very wrong results.
|
||||
;;(error (byte-compile-dest-file))
|
||||
;;(error (c-get-current-file))
|
||||
(c-lang-defconst c-opt-after-id-concat-key
|
||||
csharp (if (c-lang-const c-opt-identifier-concat-key)
|
||||
(c-lang-const c-symbol-start)))
|
||||
|
||||
(c-lang-defconst c-basic-matchers-before
|
||||
csharp `(
|
||||
;; Font-lock the attributes by searching for the
|
||||
;; appropriate regex and marking it as TODO.
|
||||
;;,`(,(concat "\\(" csharp-attribute-regex "\\)")
|
||||
;; 0 font-lock-function-name-face)
|
||||
|
||||
;; Put a warning face on the opener of unclosed strings that
|
||||
;; can't span lines. Later font
|
||||
;; lock packages have a `font-lock-syntactic-face-function' for
|
||||
;; this, but it doesn't give the control we want since any
|
||||
;; fontification done inside the function will be
|
||||
;; unconditionally overridden.
|
||||
,(c-make-font-lock-search-function
|
||||
;; Match a char before the string starter to make
|
||||
;; `c-skip-comments-and-strings' work correctly.
|
||||
(concat ".\\(" c-string-limit-regexp "\\)")
|
||||
'((c-font-lock-invalid-string)))
|
||||
|
||||
;; Fontify keyword constants.
|
||||
,@(when (c-lang-const c-constant-kwds)
|
||||
(let ((re (c-make-keywords-re nil
|
||||
(c-lang-const c-constant-kwds))))
|
||||
`((eval . (list ,(concat "\\<\\(" re "\\)\\>")
|
||||
1 c-constant-face-name)))))
|
||||
|
||||
;; Fontify all keywords except the primitive types.
|
||||
,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp))
|
||||
1 font-lock-keyword-face)
|
||||
|
||||
;; Fontify leading identifiers in fully qualified names like
|
||||
;; "Foo.Bar".
|
||||
,@(when (c-lang-const c-opt-identifier-concat-key)
|
||||
`((,(byte-compile
|
||||
`(lambda (limit)
|
||||
(while (re-search-forward
|
||||
,(concat "\\(\\<" ; 1
|
||||
"\\(" (c-lang-const c-symbol-key)
|
||||
"\\)" ; 2
|
||||
"[ \t\n\r\f\v]*"
|
||||
(c-lang-const
|
||||
c-opt-identifier-concat-key)
|
||||
"[ \t\n\r\f\v]*"
|
||||
"\\)"
|
||||
"\\("
|
||||
(c-lang-const
|
||||
c-opt-after-id-concat-key)
|
||||
"\\)")
|
||||
limit t)
|
||||
(unless (progn
|
||||
(goto-char (match-beginning 0))
|
||||
(c-skip-comments-and-strings limit))
|
||||
(or (get-text-property (match-beginning 2) 'face)
|
||||
(c-put-font-lock-face (match-beginning 2)
|
||||
(match-end 2)
|
||||
c-reference-face-name))
|
||||
(goto-char (match-end 1)))))))))
|
||||
))
|
||||
|
||||
;; C# does not allow a leading qualifier operator. It also doesn't
|
||||
;; allow the ".*" construct of Java. So, we redo this regex without
|
||||
;; the "\\|\\*" regex.
|
||||
(c-lang-defconst c-identifier-key
|
||||
csharp (concat "\\(" (c-lang-const c-symbol-key) "\\)" ; 1
|
||||
(concat "\\("
|
||||
"[ \t\n\r\f\v]*"
|
||||
(c-lang-const c-opt-identifier-concat-key)
|
||||
"[ \t\n\r\f\v]*"
|
||||
(concat "\\("
|
||||
"\\(" (c-lang-const c-symbol-key) "\\)"
|
||||
"\\)")
|
||||
"\\)*")))
|
||||
|
||||
;; C# has a few rules that are slightly different than Java for
|
||||
;; operators. This also removed the Java's "super" and replaces it
|
||||
;; with the C#'s "base".
|
||||
(c-lang-defconst c-operators
|
||||
csharp `((prefix "base")))
|
||||
|
||||
;; C#, unlike Java, does use CPP prefixes for the regions and other directives.
|
||||
(c-lang-defconst c-opt-cpp-prefix
|
||||
csharp "\\s *#\\s *")
|
||||
|
||||
;; C# uses the following assignment operators
|
||||
(c-lang-defconst c-assignment-operators
|
||||
csharp '("=" "*=" "/=" "%=" "+=" "-=" ">>=" "<<=" "&=" "^=" "|="))
|
||||
|
||||
;; This defines the primative types for C#
|
||||
(c-lang-defconst c-primitive-type-kwds
|
||||
;; ECMA-344, S8
|
||||
csharp '("object" "string" "sbyte" "short" "int" "long" "byte"
|
||||
"ushort" "uint" "ulong" "float" "double" "bool" "char"
|
||||
"decimal" "void"))
|
||||
|
||||
;; The keywords that define that the following is a type, such as a
|
||||
;; class definition.
|
||||
(c-lang-defconst c-type-prefix-kwds
|
||||
;; ECMA-344, S?
|
||||
csharp '("class" "interface" "enum" "struct"))
|
||||
|
||||
;; Type modifier keywords. They appear anywhere in types, but modifiy
|
||||
;; instead create one.
|
||||
(c-lang-defconst c-type-modifier-kwds
|
||||
;; EMCA-344, S?
|
||||
csharp '("readonly" "const"))
|
||||
|
||||
;; Structures that are similiar to classes.
|
||||
(c-lang-defconst c-class-decl-kwds
|
||||
;; EMCA-344, S?
|
||||
csharp '("class" "interface"))
|
||||
|
||||
;; The various modifiers used for class and method descriptions.
|
||||
(c-lang-defconst c-modifier-kwds
|
||||
csharp '("public" "partial" "private" "const" "abstract"
|
||||
"protected" "ref" "out" "static" "virtual"
|
||||
"override" "params" "internal"))
|
||||
|
||||
;; We don't use the protection level stuff because it breaks the
|
||||
;; method indenting. Not sure why, though.
|
||||
(c-lang-defconst c-protection-kwds
|
||||
csharp nil)
|
||||
|
||||
;; Define the keywords that can have something following after them.
|
||||
(c-lang-defconst c-type-list-kwds
|
||||
csharp '("struct" "class" "interface" "is" "as"
|
||||
"delegate" "event"))
|
||||
|
||||
;; This allows the classes after the : in the class declartion to be
|
||||
;; fontified.
|
||||
(c-lang-defconst c-typeless-decl-kwds
|
||||
csharp '(":"))
|
||||
|
||||
;; Sets up the enum to handle the list properly
|
||||
(c-lang-defconst c-brace-list-decl-kwds
|
||||
csharp '("enum"))
|
||||
|
||||
;; We need to remove Java's package keyword
|
||||
(c-lang-defconst c-ref-list-kwds
|
||||
csharp '("using" "namespace"))
|
||||
|
||||
;; Follow-on blocks that don't require a brace
|
||||
(c-lang-defconst c-block-stmt-2-kwds
|
||||
csharp '("for" "if" "switch" "while" "catch" "foreach"
|
||||
"checked" "unchecked" "lock"))
|
||||
|
||||
;; Statements that break out of braces
|
||||
(c-lang-defconst c-simple-stmt-kwds
|
||||
csharp '("return" "continue" "break" "throw" "goto"))
|
||||
|
||||
;; Statements that allow a label
|
||||
;; TODO?
|
||||
(c-lang-defconst c-before-label-kwds
|
||||
csharp nil)
|
||||
|
||||
;; Constant keywords
|
||||
(c-lang-defconst c-constant-kwds
|
||||
csharp '("true" "false" "null"))
|
||||
|
||||
;; Keywords that start "primary expressions."
|
||||
(c-lang-defconst c-primary-expr-kwds
|
||||
csharp '("this" "base"))
|
||||
|
||||
;; We need to treat namespace as an outer block to class indenting
|
||||
;; works properly.
|
||||
(c-lang-defconst c-other-block-decl-kwds
|
||||
csharp '("namespace"))
|
||||
|
||||
;; We need to include the "as" for the foreach
|
||||
(c-lang-defconst c-other-kwds
|
||||
csharp '("in" "sizeof" "typeof"))
|
||||
|
||||
(c-lang-defconst c-overloadable-operators
|
||||
;; EMCA-344, S14.2.1
|
||||
csharp '("+" "-" "*" "/" "%" "&" "|" "^"
|
||||
"<<" ">>" "==" "!=" ">" "<" ">=" "<="))
|
||||
|
||||
;; No cpp in this language, but there's still a "sharppragma" directive to
|
||||
;; fontify. (The definitions for the extra keywords above are enough
|
||||
;; to incorporate them into the fontification regexps for types and
|
||||
;; keywords, so no additional font-lock patterns are required.)
|
||||
(c-lang-defconst c-cpp-matchers
|
||||
csharp (cons
|
||||
;; Use the eval form for `font-lock-keywords' to be able to use
|
||||
;; the `c-preprocessor-face-name' variable that maps to a
|
||||
;; suitable face depending on the (X)Emacs version.
|
||||
'(eval . (list "^\\s *\\(sharppragma\\)\\>\\(.*\\)"
|
||||
(list 1 c-preprocessor-face-name)
|
||||
'(2 font-lock-string-face)))
|
||||
;; There are some other things in `c-cpp-matchers' besides the
|
||||
;; preprocessor support, so include it.
|
||||
(c-lang-const c-cpp-matchers)))
|
||||
|
||||
(defcustom csharp-font-lock-extra-types nil
|
||||
"*List of extra types (aside from the type keywords) to recognize in C# mode.
|
||||
Each list item should be a regexp matching a single identifier.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-1 (c-lang-const c-matchers-1 csharp)
|
||||
"Minimal highlighting for C# mode.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-2 (c-lang-const c-matchers-2 csharp)
|
||||
"Fast normal highlighting for C# mode.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-3 (c-lang-const c-matchers-3 csharp)
|
||||
"Accurate normal highlighting for C# mode.")
|
||||
|
||||
(defvar csharp-font-lock-keywords csharp-font-lock-keywords-3
|
||||
"Default expressions to highlight in C# mode.")
|
||||
|
||||
(defvar csharp-mode-syntax-table nil
|
||||
"Syntax table used in csharp-mode buffers.")
|
||||
(or csharp-mode-syntax-table
|
||||
(setq csharp-mode-syntax-table
|
||||
(funcall (c-lang-const c-make-mode-syntax-table csharp))))
|
||||
|
||||
(defvar csharp-mode-abbrev-table nil
|
||||
"Abbreviation table used in csharp-mode buffers.")
|
||||
(c-define-abbrev-table 'csharp-mode-abbrev-table
|
||||
;; Keywords that if they occur first on a line might alter the
|
||||
;; syntactic context, and which therefore should trig reindentation
|
||||
;; when they are completed.
|
||||
'(("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 csharp-mode-map (let ((map (c-make-inherited-keymap)))
|
||||
;; Add bindings which are only useful for C#
|
||||
map)
|
||||
"Keymap used in csharp-mode buffers.")
|
||||
|
||||
;;(easy-menu-define csharp-menu csharp-mode-map "C# Mode Commands"
|
||||
;; ;; Can use `csharp' as the language for `c-mode-menu'
|
||||
;; ;; since its definition covers any language. In
|
||||
;; ;; this case the language is used to adapt to the
|
||||
;; ;; nonexistence of a cpp pass and thus removing some
|
||||
;; ;; irrelevant menu alternatives.
|
||||
;; (cons "C#" (c-lang-const c-mode-menu csharp)))
|
||||
|
||||
;;; Autoload mode trigger
|
||||
(add-to-list 'auto-mode-alist '("\\.cs" . csharp-mode))
|
||||
|
||||
;; Custom variables
|
||||
(defcustom csharp-mode-hook nil
|
||||
"*Hook called by `csharp-mode'."
|
||||
:type 'hook
|
||||
:group 'c)
|
||||
|
||||
;;; The entry point into the mode
|
||||
(defun csharp-mode ()
|
||||
"Major mode for editing C# (pronounced \"see sharp\") code.
|
||||
This is a simple example of a separate mode derived from CC Mode to
|
||||
support a language with syntax similar to C/C++/ObjC/Java/IDL/Pike.
|
||||
|
||||
The hook `c-mode-common-hook' is run with no args at mode
|
||||
initialization, then `csharp-mode-hook'.
|
||||
|
||||
Key bindings:
|
||||
\\{csharp-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(c-initialize-cc-mode t)
|
||||
(set-syntax-table csharp-mode-syntax-table)
|
||||
(setq major-mode 'csharp-mode
|
||||
mode-name "C#"
|
||||
local-abbrev-table csharp-mode-abbrev-table
|
||||
abbrev-mode t)
|
||||
(use-local-map c-mode-map)
|
||||
;; `c-init-language-vars' is a macro that is expanded at compile
|
||||
;; time to a large `setq' with all the language variables and their
|
||||
;; customized values for our language.
|
||||
(c-init-language-vars csharp-mode)
|
||||
;; `c-common-init' initializes most of the components of a CC Mode
|
||||
;; buffer, including setup of the mode menu, font-lock, etc.
|
||||
;; There's also a lower level routine `c-basic-common-init' that
|
||||
;; only makes the necessary initialization to get the syntactic
|
||||
;; analysis and similar things working.
|
||||
(c-common-init 'csharp-mode)
|
||||
;;(easy-menu-add csharp-menu)
|
||||
(run-hooks 'c-mode-common-hook)
|
||||
(run-hooks 'csharp-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
(provide 'csharp-mode)
|
||||
|
||||
;;; csharp-mode.el ends here
|
||||
BIN
site-lisp/cc-mode/5.31.3/csharp-mode-0.5.0.elc
Normal file
BIN
site-lisp/cc-mode/5.31.3/csharp-mode-0.5.0.elc
Normal file
Binary file not shown.
454
site-lisp/cc-mode/5.31.3/csharp-mode-0.6.0.el
Normal file
454
site-lisp/cc-mode/5.31.3/csharp-mode-0.6.0.el
Normal file
|
|
@ -0,0 +1,454 @@
|
|||
;;; csharp-mode.el --- C# mode derived mode
|
||||
|
||||
;; Author: 2005 Dylan R. E. Moonfire
|
||||
;; Maintainer: Dylan R. E. Moonfire <contact@mfgames.com>
|
||||
;; Created: Feburary 2005
|
||||
;; Modified: December 2005
|
||||
;; Version: 0.6.0
|
||||
;; Keywords: c# languages oop
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is a separate mode to implement the C# constructs and
|
||||
;; font-locking. It is based on the java-mode example from cc-mode.
|
||||
;;
|
||||
;; Note: The interface used in this file requires CC Mode 5.30 or
|
||||
;; later.
|
||||
|
||||
;;; Bugs:
|
||||
;;
|
||||
;; Literal strings @"" do not fontify correctly.
|
||||
;;
|
||||
;; Method names are not fontified if you have an attribute before it.
|
||||
;;
|
||||
;; This code doesn't seem to work when you compile it, then
|
||||
;; load/require in the emacs file. You will get an error (error
|
||||
;; "`c-lang-defconst' must be used in a file") which happens because
|
||||
;; cc-mode doesn't think it is in a buffer while loading directly
|
||||
;; from the init. However, if you call it based on a file extension,
|
||||
;; it works properly. Interestingly enough, this doesn't happen if
|
||||
;; you don't byte-compile cc-mode.
|
||||
|
||||
;;; .emacs (don't put in (require 'csharp-mode))
|
||||
;; (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
|
||||
;; (setq auto-mode-alist
|
||||
;; (append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
|
||||
|
||||
;;; Versions:
|
||||
;;
|
||||
;; 0.1.0 - Initial release.
|
||||
;; 0.2.0 - Fixed the identification on the "enum" keyword.
|
||||
;; - Fixed the font-lock on the "base" keyword
|
||||
;; 0.3.0 - Added a regex to fontify attributes. It isn't the
|
||||
;; the best method, but it handles single-like attributes
|
||||
;; well.
|
||||
;; - Got "super" not to fontify as a keyword.
|
||||
;; - Got extending classes and interfaces to fontify as something.
|
||||
;; 0.4.0 - Removed the attribute matching because it broke more than
|
||||
;; it fixed.
|
||||
;; - Corrected a bug with namespace not being properly identified
|
||||
;; and treating the class level as an inner object, which screwed
|
||||
;; up formatting.
|
||||
;; - Added "partial" to the keywords.
|
||||
;; 0.5.0 - Found bugs with compiled cc-mode and loading from init files.
|
||||
;; - Updated the eval-when-compile to code to let the mode be
|
||||
;; compiled.
|
||||
;; 0.6.0 - Added the c-filter-ops patch for 5.31.1 which made that
|
||||
;; function in cc-langs.el unavailable.
|
||||
;; - Added a csharp-lineup-region for indention #region and
|
||||
;; #endregion block differently.
|
||||
|
||||
;; This is a copy of the function in cc-mode which is used to handle
|
||||
;; the eval-when-compile which is needed during other times.
|
||||
(defun c-filter-ops (ops opgroup-filter op-filter &optional xlate)
|
||||
;; See cc-langs.el, a direct copy.
|
||||
(unless (listp (car-safe ops))
|
||||
(setq ops (list ops)))
|
||||
(cond ((eq opgroup-filter t)
|
||||
(setq opgroup-filter (lambda (opgroup) t)))
|
||||
((not (functionp opgroup-filter))
|
||||
(setq opgroup-filter `(lambda (opgroup)
|
||||
(memq opgroup ',opgroup-filter)))))
|
||||
(cond ((eq op-filter t)
|
||||
(setq op-filter (lambda (op) t)))
|
||||
((stringp op-filter)
|
||||
(setq op-filter `(lambda (op)
|
||||
(string-match ,op-filter op)))))
|
||||
(unless xlate
|
||||
(setq xlate 'identity))
|
||||
(c-with-syntax-table (c-lang-const c-mode-syntax-table)
|
||||
(delete-duplicates
|
||||
(mapcan (lambda (opgroup)
|
||||
(when (if (symbolp (car opgroup))
|
||||
(when (funcall opgroup-filter (car opgroup))
|
||||
(setq opgroup (cdr opgroup))
|
||||
t)
|
||||
t)
|
||||
(mapcan (lambda (op)
|
||||
(when (funcall op-filter op)
|
||||
(let ((res (funcall xlate op)))
|
||||
(if (listp res) res (list res)))))
|
||||
opgroup)))
|
||||
ops)
|
||||
:test 'equal)))
|
||||
|
||||
;; This inserts the bulk of the code.
|
||||
(require 'cc-mode)
|
||||
|
||||
;; These are only required at compile time to get the sources for the
|
||||
;; language constants. (The cc-fonts require and the font-lock
|
||||
;; related constants could additionally be put inside an
|
||||
;; (eval-after-load "font-lock" ...) but then some trickery is
|
||||
;; necessary to get them compiled.)
|
||||
(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-mode" nil t)
|
||||
(load "cc-fonts" nil t)
|
||||
(load "cc-langs" nil t)))
|
||||
|
||||
(eval-and-compile
|
||||
;; Make our mode known to the language constant system. Use Java
|
||||
;; mode as the fallback for the constants we don't change here.
|
||||
;; This needs to be done also at compile time since the language
|
||||
;; constants are evaluated then.
|
||||
(c-add-language 'csharp-mode 'java-mode))
|
||||
|
||||
;; Indention: csharp-mode follows normal indention rules except for
|
||||
;; when indenting the #region and #endregion blocks. This function
|
||||
;; defines a custom indention to indent the #region blocks as normal
|
||||
;; text.
|
||||
;;
|
||||
;; To use this indenting just put the following in your emacs file:
|
||||
;; (c-set-offset 'cpp-macro 'csharp-lineup-region)
|
||||
(defun csharp-lineup-region (langelem)
|
||||
"Indent all #region and #endregion blocks inline with code while
|
||||
retaining normal column-zero indention for #if and the other
|
||||
processing blocks."
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(if (re-search-forward "#\\(end\\)?region" (c-point 'eol) [0]) 0 [0])))
|
||||
|
||||
;; TODO
|
||||
;; Defines our constant for finding attributes.
|
||||
;;(defconst csharp-attribute-regex "\\[\\([XmlType]+\\)(")
|
||||
;;(defconst csharp-attribute-regex "\\[\\(.\\)")
|
||||
|
||||
;; Java uses a series of regexes to change the font-lock for class
|
||||
;; references. The problem comes in because Java uses Pascal (leading
|
||||
;; space in names, SomeClass) for class and package names, but
|
||||
;; Camel-casing (initial lowercase, upper case in words,
|
||||
;; i.e. someVariable) for variables. The notation suggested by EMCA is
|
||||
;; to use Pasacal notation for everything, except inner variables. So,
|
||||
;; the regex and formatting actually produces very wrong results.
|
||||
;;(error (byte-compile-dest-file))
|
||||
;;(error (c-get-current-file))
|
||||
(c-lang-defconst c-opt-after-id-concat-key
|
||||
csharp (if (c-lang-const c-opt-identifier-concat-key)
|
||||
(c-lang-const c-symbol-start)))
|
||||
|
||||
(c-lang-defconst c-basic-matchers-before
|
||||
csharp `(
|
||||
;; Font-lock the attributes by searching for the
|
||||
;; appropriate regex and marking it as TODO.
|
||||
;;,`(,(concat "\\(" csharp-attribute-regex "\\)")
|
||||
;; 0 font-lock-function-name-face)
|
||||
|
||||
;; Put a warning face on the opener of unclosed strings that
|
||||
;; can't span lines. Later font
|
||||
;; lock packages have a `font-lock-syntactic-face-function' for
|
||||
;; this, but it doesn't give the control we want since any
|
||||
;; fontification done inside the function will be
|
||||
;; unconditionally overridden.
|
||||
,(c-make-font-lock-search-function
|
||||
;; Match a char before the string starter to make
|
||||
;; `c-skip-comments-and-strings' work correctly.
|
||||
(concat ".\\(" c-string-limit-regexp "\\)")
|
||||
'((c-font-lock-invalid-string)))
|
||||
|
||||
;; Fontify keyword constants.
|
||||
,@(when (c-lang-const c-constant-kwds)
|
||||
(let ((re (c-make-keywords-re nil
|
||||
(c-lang-const c-constant-kwds))))
|
||||
`((eval . (list ,(concat "\\<\\(" re "\\)\\>")
|
||||
1 c-constant-face-name)))))
|
||||
|
||||
;; Fontify all keywords except the primitive types.
|
||||
,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp))
|
||||
1 font-lock-keyword-face)
|
||||
|
||||
;; Fontify leading identifiers in fully qualified names like
|
||||
;; "Foo.Bar".
|
||||
,@(when (c-lang-const c-opt-identifier-concat-key)
|
||||
`((,(byte-compile
|
||||
`(lambda (limit)
|
||||
(while (re-search-forward
|
||||
,(concat "\\(\\<" ; 1
|
||||
"\\(" (c-lang-const c-symbol-key)
|
||||
"\\)" ; 2
|
||||
"[ \t\n\r\f\v]*"
|
||||
(c-lang-const
|
||||
c-opt-identifier-concat-key)
|
||||
"[ \t\n\r\f\v]*"
|
||||
"\\)"
|
||||
"\\("
|
||||
(c-lang-const
|
||||
c-opt-after-id-concat-key)
|
||||
"\\)")
|
||||
limit t)
|
||||
(unless (progn
|
||||
(goto-char (match-beginning 0))
|
||||
(c-skip-comments-and-strings limit))
|
||||
(or (get-text-property (match-beginning 2) 'face)
|
||||
(c-put-font-lock-face (match-beginning 2)
|
||||
(match-end 2)
|
||||
c-reference-face-name))
|
||||
(goto-char (match-end 1)))))))))
|
||||
))
|
||||
|
||||
;; C# does not allow a leading qualifier operator. It also doesn't
|
||||
;; allow the ".*" construct of Java. So, we redo this regex without
|
||||
;; the "\\|\\*" regex.
|
||||
(c-lang-defconst c-identifier-key
|
||||
csharp (concat "\\(" (c-lang-const c-symbol-key) "\\)" ; 1
|
||||
(concat "\\("
|
||||
"[ \t\n\r\f\v]*"
|
||||
(c-lang-const c-opt-identifier-concat-key)
|
||||
"[ \t\n\r\f\v]*"
|
||||
(concat "\\("
|
||||
"\\(" (c-lang-const c-symbol-key) "\\)"
|
||||
"\\)")
|
||||
"\\)*")))
|
||||
|
||||
;; C# has a few rules that are slightly different than Java for
|
||||
;; operators. This also removed the Java's "super" and replaces it
|
||||
;; with the C#'s "base".
|
||||
(c-lang-defconst c-operators
|
||||
csharp `((prefix "base")))
|
||||
|
||||
;; C#, unlike Java, does use CPP prefixes for the regions and other
|
||||
;; directives.
|
||||
(c-lang-defconst c-opt-cpp-prefix
|
||||
csharp "\\s *#\\s *")
|
||||
|
||||
;; C# uses the following assignment operators
|
||||
(c-lang-defconst c-assignment-operators
|
||||
csharp '("=" "*=" "/=" "%=" "+=" "-=" ">>=" "<<=" "&=" "^=" "|="))
|
||||
|
||||
;; This defines the primative types for C#
|
||||
(c-lang-defconst c-primitive-type-kwds
|
||||
;; ECMA-344, S8
|
||||
csharp '("object" "string" "sbyte" "short" "int" "long" "byte"
|
||||
"ushort" "uint" "ulong" "float" "double" "bool" "char"
|
||||
"decimal" "void"))
|
||||
|
||||
;; The keywords that define that the following is a type, such as a
|
||||
;; class definition.
|
||||
(c-lang-defconst c-type-prefix-kwds
|
||||
;; ECMA-344, S?
|
||||
csharp '("class" "interface" "enum" "struct"))
|
||||
|
||||
;; Type modifier keywords. They appear anywhere in types, but modifiy
|
||||
;; instead create one.
|
||||
(c-lang-defconst c-type-modifier-kwds
|
||||
;; EMCA-344, S?
|
||||
csharp '("readonly" "const"))
|
||||
|
||||
;; Structures that are similiar to classes.
|
||||
(c-lang-defconst c-class-decl-kwds
|
||||
;; EMCA-344, S?
|
||||
csharp '("class" "interface"))
|
||||
|
||||
;; The various modifiers used for class and method descriptions.
|
||||
(c-lang-defconst c-modifier-kwds
|
||||
csharp '("public" "partial" "private" "const" "abstract"
|
||||
"protected" "ref" "out" "static" "virtual"
|
||||
"override" "params" "internal"))
|
||||
|
||||
;; We don't use the protection level stuff because it breaks the
|
||||
;; method indenting. Not sure why, though.
|
||||
(c-lang-defconst c-protection-kwds
|
||||
csharp nil)
|
||||
|
||||
;; Define the keywords that can have something following after them.
|
||||
(c-lang-defconst c-type-list-kwds
|
||||
csharp '("struct" "class" "interface" "is" "as"
|
||||
"delegate" "event"))
|
||||
|
||||
;; This allows the classes after the : in the class declartion to be
|
||||
;; fontified.
|
||||
(c-lang-defconst c-typeless-decl-kwds
|
||||
csharp '(":"))
|
||||
|
||||
;; Sets up the enum to handle the list properly
|
||||
(c-lang-defconst c-brace-list-decl-kwds
|
||||
csharp '("enum"))
|
||||
|
||||
;; We need to remove Java's package keyword
|
||||
(c-lang-defconst c-ref-list-kwds
|
||||
csharp '("using" "namespace"))
|
||||
|
||||
;; Follow-on blocks that don't require a brace
|
||||
(c-lang-defconst c-block-stmt-2-kwds
|
||||
csharp '("for" "if" "switch" "while" "catch" "foreach"
|
||||
"checked" "unchecked" "lock"))
|
||||
|
||||
;; Statements that break out of braces
|
||||
(c-lang-defconst c-simple-stmt-kwds
|
||||
csharp '("return" "continue" "break" "throw" "goto"))
|
||||
|
||||
;; Statements that allow a label
|
||||
;; TODO?
|
||||
(c-lang-defconst c-before-label-kwds
|
||||
csharp nil)
|
||||
|
||||
;; Constant keywords
|
||||
(c-lang-defconst c-constant-kwds
|
||||
csharp '("true" "false" "null"))
|
||||
|
||||
;; Keywords that start "primary expressions."
|
||||
(c-lang-defconst c-primary-expr-kwds
|
||||
csharp '("this" "base"))
|
||||
|
||||
;; We need to treat namespace as an outer block to class indenting
|
||||
;; works properly.
|
||||
(c-lang-defconst c-other-block-decl-kwds
|
||||
csharp '("namespace"))
|
||||
|
||||
;; We need to include the "as" for the foreach
|
||||
(c-lang-defconst c-other-kwds
|
||||
csharp '("in" "sizeof" "typeof"))
|
||||
|
||||
(c-lang-defconst c-overloadable-operators
|
||||
;; EMCA-344, S14.2.1
|
||||
csharp '("+" "-" "*" "/" "%" "&" "|" "^"
|
||||
"<<" ">>" "==" "!=" ">" "<" ">=" "<="))
|
||||
|
||||
;; No cpp in this language, but there's still a "sharppragma" directive to
|
||||
;; fontify. (The definitions for the extra keywords above are enough
|
||||
;; to incorporate them into the fontification regexps for types and
|
||||
;; keywords, so no additional font-lock patterns are required.)
|
||||
(c-lang-defconst c-cpp-matchers
|
||||
csharp (cons
|
||||
;; Use the eval form for `font-lock-keywords' to be able to use
|
||||
;; the `c-preprocessor-face-name' variable that maps to a
|
||||
;; suitable face depending on the (X)Emacs version.
|
||||
'(eval . (list "^\\s *\\(sharppragma\\)\\>\\(.*\\)"
|
||||
(list 1 c-preprocessor-face-name)
|
||||
'(2 font-lock-string-face)))
|
||||
;; There are some other things in `c-cpp-matchers' besides the
|
||||
;; preprocessor support, so include it.
|
||||
(c-lang-const c-cpp-matchers)))
|
||||
|
||||
(defcustom csharp-font-lock-extra-types nil
|
||||
"*List of extra types (aside from the type keywords) to recognize in C# mode.
|
||||
Each list item should be a regexp matching a single identifier.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-1 (c-lang-const c-matchers-1 csharp)
|
||||
"Minimal highlighting for C# mode.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-2 (c-lang-const c-matchers-2 csharp)
|
||||
"Fast normal highlighting for C# mode.")
|
||||
|
||||
(defconst csharp-font-lock-keywords-3 (c-lang-const c-matchers-3 csharp)
|
||||
"Accurate normal highlighting for C# mode.")
|
||||
|
||||
(defvar csharp-font-lock-keywords csharp-font-lock-keywords-3
|
||||
"Default expressions to highlight in C# mode.")
|
||||
|
||||
(defvar csharp-mode-syntax-table nil
|
||||
"Syntax table used in csharp-mode buffers.")
|
||||
(or csharp-mode-syntax-table
|
||||
(setq csharp-mode-syntax-table
|
||||
(funcall (c-lang-const c-make-mode-syntax-table csharp))))
|
||||
|
||||
(defvar csharp-mode-abbrev-table nil
|
||||
"Abbreviation table used in csharp-mode buffers.")
|
||||
(c-define-abbrev-table 'csharp-mode-abbrev-table
|
||||
;; Keywords that if they occur first on a line might alter the
|
||||
;; syntactic context, and which therefore should trig reindentation
|
||||
;; when they are completed.
|
||||
'(("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 csharp-mode-map (let ((map (c-make-inherited-keymap)))
|
||||
;; Add bindings which are only useful for C#
|
||||
map)
|
||||
"Keymap used in csharp-mode buffers.")
|
||||
|
||||
;;(easy-menu-define csharp-menu csharp-mode-map "C# Mode Commands"
|
||||
;; ;; Can use `csharp' as the language for `c-mode-menu'
|
||||
;; ;; since its definition covers any language. In
|
||||
;; ;; this case the language is used to adapt to the
|
||||
;; ;; nonexistence of a cpp pass and thus removing some
|
||||
;; ;; irrelevant menu alternatives.
|
||||
;; (cons "C#" (c-lang-const c-mode-menu csharp)))
|
||||
|
||||
;;; Autoload mode trigger
|
||||
(add-to-list 'auto-mode-alist '("\\.cs" . csharp-mode))
|
||||
|
||||
;; Custom variables
|
||||
(defcustom csharp-mode-hook nil
|
||||
"*Hook called by `csharp-mode'."
|
||||
:type 'hook
|
||||
:group 'c)
|
||||
|
||||
;;; The entry point into the mode
|
||||
(defun csharp-mode ()
|
||||
"Major mode for editing C# (pronounced \"see sharp\") code.
|
||||
This is a simple example of a separate mode derived from CC Mode to
|
||||
support a language with syntax similar to C/C++/ObjC/Java/IDL/Pike.
|
||||
|
||||
The hook `c-mode-common-hook' is run with no args at mode
|
||||
initialization, then `csharp-mode-hook'.
|
||||
|
||||
Key bindings:
|
||||
\\{csharp-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(c-initialize-cc-mode t)
|
||||
(set-syntax-table csharp-mode-syntax-table)
|
||||
(setq major-mode 'csharp-mode
|
||||
mode-name "C#"
|
||||
local-abbrev-table csharp-mode-abbrev-table
|
||||
abbrev-mode t)
|
||||
(use-local-map c-mode-map)
|
||||
;; `c-init-language-vars' is a macro that is expanded at compile
|
||||
;; time to a large `setq' with all the language variables and their
|
||||
;; customized values for our language.
|
||||
(c-init-language-vars csharp-mode)
|
||||
;; `c-common-init' initializes most of the components of a CC Mode
|
||||
;; buffer, including setup of the mode menu, font-lock, etc.
|
||||
;; There's also a lower level routine `c-basic-common-init' that
|
||||
;; only makes the necessary initialization to get the syntactic
|
||||
;; analysis and similar things working.
|
||||
(c-common-init 'csharp-mode)
|
||||
;;(easy-menu-add csharp-menu)
|
||||
(run-hooks 'c-mode-common-hook)
|
||||
(run-hooks 'csharp-mode-hook)
|
||||
(c-update-modeline))
|
||||
|
||||
|
||||
(provide 'csharp-mode)
|
||||
|
||||
;;; csharp-mode.el ends here
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue