1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

adding third-party gnuplot-mode to util directory

This commit is contained in:
Eric Schulte 2009-08-03 10:41:45 -06:00
parent e247c0d7f3
commit 96c8457208
28 changed files with 17833 additions and 1 deletions

View File

@ -49,7 +49,10 @@
;; other versions of htmlize can cause export problems
(load (expand-file-name "htmlize.el" util-dir))
;; the newest version of inf-ruby.el is required by org-babel-ruby.el
(load (expand-file-name "inf-ruby.el" util-dir)))
(load (expand-file-name "inf-ruby.el" util-dir))
;; gnuplot mode
(load (expand-file-name "gnuplot.el"
(expand-file-name "gnuplot-mode.0.6.0" util-dir))))
;; language specific files
(add-to-list 'load-path (expand-file-name "langs" (file-name-directory (or load-file-name buffer-file-name))))

View 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) 19yy <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) 19yy 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.

View File

@ -0,0 +1,224 @@
May 17 2002 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5r
* handle continuation lines better
* C-c C-c now for comment region, C-c C-o for GUI
* trim gnuplot buffer + customize vble controlling max buffer
length
* Altered Makefile.in to install .el files along with .elc
files
May 30 2001 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5q
* added font-lock bindings for words associated with plotting
Apr 15 2001 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5p
* fixed the fix for the serious bug in how speedbar and
gnuplot-mode interact. In the words of Bullwinkle, "This
time for sure!"
Jan 4 2001 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5n
* fixed a serious bug in how speedbar and gnuplot-mode
interact
Nov 29 2000 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5m
* much better algorithm for determining gnuplot version number
* add colorization and gui support for new commands in 3.8.
* gui support for emf term.
* gui support for new "set style" syntax.
Nov 16 2000 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5l
* support for pm3d in gnuplot-gui and in plot options
insertions menu.
* mentioned pm3d in gpelcard.
* `gnuplot-negate-option' works with new syntax
Sep 22 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5k
* make `gnuplot-send-line-and-forward' skip over blank and
comment lines as suggested by <SE>.
* Jan 10 2000 Bound C-c C-j to `gnuplot-forward-script-line'.
Sep 9 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5j
* Do a more robust check for the gnuplot process before
killing the gnuplot buffer, as suggested by <SE>.
Sep 2 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5i
* Once again changed how `comint-process-echos' gets set.
Maybe I got it right this time?
* Also fixed certain situations where the info file did not
get properly loaded (insertion with info toggle on and info
button in GUI).
Aug 15 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5h
* Added `gnuplot-determine-gnuplot-version' so that the
gnuplot version number and `comint-process-echos' actually
get set correctly. Actually, the first time something is
plotted, the echoing might not work, but the second time it
will.
May 27 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5g
* fixed a bug in XEmacs in the font-locking rules for comments
and strings
* figure out what version of gnuplot is being run by reading
the Gnuplot start-up message and set
gnuplot-echo-command-line-flag appropriately
* fixed a bug which made gnuplot-mode fail when font-lock was
not a feature
May 15 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5f
* include pgnuplot.c and installation instructions for Windows
95 and 98
* allow user to defer parsing info file so that gnuplot-mode
starts up faster
Apr 6 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5e
* drop gnuplot-which-highlight variable but still make sure
colorization works under emacs, xemacs, font-lock, and
hilit19
* insert a space at the end of a unique completion
* fixed completion in file widget in GUI
* primitive support for plot, splot, fit in gui.
* rewrote a lot of GUI code
Mar 21 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5d
* use installation materials provided by Lars Hecking,
maintainer of gnuplot itself
* added some GUI support for hidden3d
* various improvements to the types alists used by the GUI
* improved various document strings and the bug reporter function
Feb 15 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5c
* update copyright information and gpelcard.tex
Jan 28 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5b
* fixed a bug in gnuplot-kill-gnuplot-buffer
* fixed a bug in gnuplot-plot-from-comint
* fixed the description of the gnuplot-faces customization group
Jan 23 1999 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5a
* send file to gnuplot now uses the "load" command
* can plot scripts from the comint buffer using
gnuplot-plot-from-comint or
gnuplot-save-and-plot-from-comint.
* C-d in comint buffer is more graceful
Dec 27 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.5
* preliminary version of interactive graphical system for
setting command arguments
* make changes to insertion menu and to gnuplot-insert
function to accomodate GUI system
* made gnuplot-negate-option function and bound it to C-c C-n
* replace kw-compl with a simple completion function
* transparent icons in toolbar
* move toolbar code into gnuplot.el
Dec 15 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4f
* defcustom all the insertion submenus
* added gnuplot-insertion-menu-flag
* Makefile now knows how to determine which version of
info-look to compile
Dec 13 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4e
* deal with the many versions of info-look in the Makefile
* drop install-gnuplot
* break insertions menu up into several variables and put
menubar initialization into a function
Dec 9 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4d
* added function gnuplot-setup-info-look and hook variable
gnuplot-info-hook to handle situation of different versions
of the info file.
Nov 30 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4c
* fixed frame behavior
* fixed comint highlighting behavior
* added :link to defgroup. added "[:]" to range insertions
* fixed behavior of filename insertion function
* added more :link's to the defgroup
* edited Makefile and README file in the distribution, added
dot.el to the distribution to suppress compile-time
warnings
Nov 21 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4b
* Fix bug in line plotting function when line is empty
* Add toolbar for XEmacs and file gnuplot-toolbar.el
* Allow display of gnuplot process in a separate frame
Nov 18 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4a
* clean up useless buffers left lying around by info-look
* Fix font-lock rules so that quoted words and the text
surrounding them are correctly highlighted
* Fix font-lock rules for plot and splot
* Added function `gnuplot-send-line-and-forward' and bound it to
C-c C-v. Mention this in gpelcard
Nov 14 1998 Bruce Ravel <ravel@phys.washington.edu>
* gnuplot.el: Version 0.4
* Added info-look to distribution. It was taken from the emacs
20.2 installation and one small change was made to allow
it compile under XEmacs.
* Use info-look for info interface. With this the gnuplot-mode
user interface to the gnuplot info file does not change
but the interior code is much cleaner and I get to use an
already invented wheel. One nice feature is that the help
function is completely independent of the version number of
gnuplot as long as the index in the gnuplot.info file is
called "General Index". Also `gnuplot-keywords' (which is
used for help, keyword-completion, and hilit19 highlighting)
is now generated automatically the first time gnuplot mode
is invoked.
* Changed default of `gnuplot-show-help-flag' to nil.
Earlier versions (taken from gnuplot.el file)
0.1 Jun 25 1998 Finished with initial release.
0.2 Sep 4 1998 Added filename insertion, indentation, and
colorization/completion in comint buffer. <BR>
0.2a Sep 11 1998 made `indent-line-function' buffer-local (whoops!)
and fixed some stuff in the installation script <BR>
0.3 Sep 12 1998 include insertions menu <BR>
0.3a Sep 14 1998 fixed bug finding info file if missing, fixed bug
starting font-lock, fixed bug re overwriting files in
installation script <BR>
0.3b Sep 15 1998 Added (require 'info) to `(eval-and-compile' clause,
Added (kill-all-local-variables) to `gnuplot-mode', altered order
of:-
(provide 'gnuplot)
;; any final chores before leaving
(run-hooks 'gnuplot-load-hook)
at the end of the file in case something in the load hook
requires gnuplot (oh not that old one again...), added
`gnuplot-comint-setup-hook', corrected `gnuplot-mark-active'
which caused an error to be raised by (mark) when the mark
was inactive <DB> Some changes to font-lock rules <LB>&<BR>

View File

@ -0,0 +1,45 @@
To install gnuplot-mode:
1. At the command line:
> configure
> make
If you use XEmacs, do "make EMACS=xemacs" (or change the EMACS
variable to "xemacs" in the Makefile, the run "make").
If "configure" doesn't work for you, the file "Makefile.dst" can be
used. In that case do, "make -f Makefile.dst".
2. Move the .elc files to a place where emacs can find them, for
example /usr/share/emacs/site-lisp or your personal emacs
directory.
3. Insert the contents of the `dotemacs' file into your .emacs file
or system start-up file to enable gnuplot mode.
4. The function `gnuplot-info-lookup-symbol' looks at the Gnuplot
info file that comes with this package or that can be made from
the Gnuplot distribution. For that function to work, the file
gnuplot.info must be placed somewhere where info can find it, for
example /usr/info. A line like this in your .emacs allows you to
put gnuplot.info any place convenient:
(add-to-list 'Info-default-directory-list "/path/to/file")
The "configure; make" sequence may not work on all systems,
particularly Win32 systems. The long-winded way of making the .elc
gpelcard.ps files is to edit each of the .el files with emacs and do
`M-x byte-compile-file'. Then "latex gpelcard.tex" and
"dvips gpelcard.dvi".
You will need to follow the instructions contained in the file
Win9x/INSTALL.Win9x to get gnuplot working with Emacs on a Windows 95
or 98 machine.
Problems? Contact gnuplot-mode's author Bruce Ravel
<ravel@phys.washington.edu>

View File

@ -0,0 +1,83 @@
## set this variable to "xemacs" if you use XEmacs
EMACS = emacs
## You will probably not need to change anything below this line
BYTE = $(EMACS) -batch -q -no-site-file -l dot.el -f batch-byte-compile
.PHONY: all default clean
default:
$(MAKE) info-look.elc gnuplot.elc gnuplot-gui.elc
gnuplot.elc: gnuplot.el
$(BYTE) gnuplot.el
gnuplot-gui.elc: gnuplot-gui.el
$(BYTE) gnuplot-gui.el
## There are many possibilities for info-look:
##
## EMACS version use
## -----------------------------------------
## Emacs or XEmacs 19 info-look.20.2.el
## Emacs 20.2 or less info-look.20.2.el
## Emacs 20.3 nothing
## XEmacs 20+ info-look.20.3.el
##
## want to use my modified version even if 20.2 is installed because a
## bug is fixed
##
## the first 6 lines attempt to ascertain the version number of
## $(EMACS), then multiply by 100 to convert it to an integer for the
## sake of the integer comparisons in the following lines. Is this a
## hassle, or what?!
##
MESSAGE = compiling info-look for $(EMACS) $$vnum
info-look.elc: info-look.20.2.el info-look.20.3.el
@if [ $(EMACS) = "emacs" ]; \
then vnum=`emacs --version | grep 'Emacs [12]' | awk '{print $$3}'`; \
else vnum=`xemacs --version | grep 'Emacs [12]' | awk '{print $$2}'`; \
fi; \
vn=`echo "$$vnum" | awk 'BEGIN{FS="."}{print $$1 "." $$2}'`; \
version=`echo "$$vn" | awk '{print 100*$$1}'`; \
if [ $(EMACS) = "emacs" -a $$version -ge 2030 ]; \
then echo "no need to compile info-look for $(EMACS) $$vnum"; \
else echo "$(MESSAGE)"; \
fi; \
if [ $(EMACS) = "emacs" -a $$version -lt 2030 ]; \
then cp -v info-look.20.2.el info-look.el; \
elif [ $(EMACS) = "xemacs" -a $$version -ge 2000 ]; \
then cp -v info-look.20.3.el info-look.el; \
elif [ $(EMACS) = "xemacs" -a $$version -lt 2000 ]; \
then cp -v info-look.20.2.el info-look.el; \
fi ;\
if [ ! \( $(EMACS) = "emacs" -a $$version -ge 2030 \) ]; \
then $(BYTE) info-look.el; fi;
gpelcard.ps: gpelcard.dvi
dvips -o gpelcard.ps gpelcard.dvi
gpelcard.dvi: gpelcard.tex
latex gpelcard.tex
all:
$(MAKE) gnuplot.elc info-look.elc gnuplot-gui.elc gpelcard.ps
clean:
rm -f *.elc info-look.el gpelcard.dvi gpelcard.log gpelcard.aux
##----------------------------------------------------------------------
## old stuff:
## from the `all' and `default' targets:
# gnuplot-toolbar.elc kw-compl.elc
#kw-compl.elc: kw-compl.el
# $(BYTE) kw-compl.el
## only make this for XEmacs
#gnuplot-toolbar.elc: gnuplot-toolbar.el
# if [ $(EMACS) = "xemacs" ]; then $(BYTE) gnuplot-toolbar.el; fi

View File

@ -0,0 +1,151 @@
#
# Makefile.in for gnuplot-mode
#
# Based on original Makefile
# by Lars Hecking <lhecking@nmrc.ucc.ie> 1999-02-25
#
# Modified to install .el files along with .elc files
# BR May 17 2002
SHELL = /bin/sh
prefix = @prefix@
datadir = @datadir@
lispdir = @lispdir@
srcdir = @srcdir@
subdir = lisp
top_builddir = .
top_srcdir = @top_srcdir@
@SET_MAKE@
EMACS = @EMACS@
MAKEINFO = @MAKEINFO@
LATEX = latex
DVIPS = dvips
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
VPATH = @srcdir@
# Command to byte-compile
BYTEC = $(EMACS) -batch -q -no-site-file -l $(srcdir)/dot.el -f batch-byte-compile
ELCS = info-look.elc gnuplot.elc gnuplot-gui.elc
DIST_COMMON = ChangeLog Makefile.dst Makefile.in README aclocal.m4 configure \
configure.in
EXTRA_DIST = dot.el dotemacs gnuplot-gui.el gnuplot.el gnuplot.el.old \
gpelcard.tex info-look.20.2.el info-look.20.3.el
DISTFILES = $(DIST_COMMON) $(EXTRA_DIST)
default: $(ELCS)
gnuplot.elc: gnuplot.el
test "$(srcdir)" = "$(top_builddir)" || cp $(srcdir)/gnuplot.el .
$(BYTEC) gnuplot.el
gnuplot-gui.elc: gnuplot.elc gnuplot-gui.el
test "$(srcdir)" = "$(top_builddir)" || cp $(srcdir)/gnuplot-gui.el .
$(BYTEC) gnuplot-gui.el
## There are many possibilities for info-look:
##
## EMACS version use
## -----------------------------------------
## Emacs or XEmacs 19 info-look.20.2.el
## Emacs 20.2 or less info-look.20.2.el
## Emacs 20.3 nothing
## XEmacs 20+ info-look.20.3.el
##
## want to use my modified version even if 20.2 is installed because a
## bug is fixed
##
## the first 6 lines attempt to ascertain the version number of
## $(EMACS), then multiply by 100 to convert it to an integer for the
## sake of the integer comparisons in the following lines. Is this a
## hassle, or what?!
##
MESSAGE = compiling info-look for $(EMACS) $$vnum
info-look.elc: info-look.20.2.el info-look.20.3.el
@if [ $(EMACS) = "emacs" ]; \
then vnum=`emacs --version | grep 'Emacs [12]' | awk '{print $$3}'`; \
else vnum=`xemacs --version | grep 'Emacs [12]' | awk '{print $$2}'`; \
fi; \
vn=`echo "$$vnum" | awk 'BEGIN{FS="."}{print $$1 "." $$2}'`; \
version=`echo "$$vn" | awk '{print 100*$$1}'`; \
if [ $(EMACS) = "emacs" -a $$version -ge 2030 ]; \
then echo "no need to compile info-look for $(EMACS) $$vnum"; \
else echo "$(MESSAGE)"; \
fi; \
if [ $(EMACS) = "emacs" -a $$version -lt 2030 ]; \
then echo Using info-look.20.2.el; \
cp $(srcdir)/info-look.20.2.el info-look.el; \
elif [ $(EMACS) = "xemacs" -a $$version -ge 2000 ]; \
then echo Using info-look.20.3.el; \
cp $(srcdir)/info-look.20.3.el info-look.el; \
elif [ $(EMACS) = "xemacs" -a $$version -lt 2000 ]; \
then echo Using info-look.20.2.el; \
cp $(srcdir)/info-look.20.2.el info-look.el; \
fi ;\
if [ ! \( $(EMACS) = "emacs" -a $$version -ge 2030 \) ]; \
then $(BYTEC) info-look.el; fi;
ps: gpelcard.ps
gpelcard.ps: gpelcard.dvi
$(DVIPS) -o gpelcard.ps gpelcard.dvi
gpelcard.dvi: gpelcard.tex
$(LATEX) $(srcdir)/gpelcard.tex
all: gnuplot.elc info-look.elc gnuplot-gui.elc
install:
mkinstalldirs $(lispdir)
@for p in *.el *.elc; do \
echo " $(INSTALL_DATA) $$p $(lispdir)/$$p"; \
$(INSTALL_DATA) $$p $(lispdir)/$$p; \
done
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lisp
distdir: $(DISTFILES)
distdir=`cd $(distdir) && pwd`
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
.PHONY: tags distdir info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
clean:
-rm -f *.elc info-look.el gpelcard.ps gpelcard.dvi gpelcard.log \
gpelcard.aux
test "$(srcdir)" = "$(top_builddir)" || rm -f gnuplot.el gnuplot-gui.el
distclean: clean
rm -f Makefile config.status config.log config.cache
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,127 @@
This directory contains files for running Gnuplot from within emacs.
This package was assembled by Bruce Ravel <ravel@phys.washington.edu>.
See http://feff.phys.washington.edu/~ravel/gnuplot/ for the latest.
Contents
========
README this file
INSTALL thorough installation instructions
ChangeLog a log of changes by version number
gnuplot.el gnuplot mode for emacs
gnuplot-gui.el a GUI for setting command arguments interactively
info-look.20.2.el programmer's interface to info files, old version
info-look.20.3.el programmer's interface to info files, new version
dot.el a short lisp file used by the Makefile
gnuplot.info info version of gnuplot 3.6 help
gpelcard.tex quick reference card for gnuplot mode (latex)
gpelcard.ps
dotemacs example .emacs lines for enabling gnuplot mode
Makefile.in \
Makefile.dst \
aclocal.m4 \ files inherited from the gnuplot distribution
configure } for making gnuplot-mode
configure.in /
install-sh /
mkinstalldirs /
Win9x/INSTALL.Win9x Extra installation instructions for Windows 95/98
Win9x/pgnuplot.c Program required to run gnuplot from Emacs
Soon gnuplot-mode will be included with the gnuplot 3.7 distribution.
The installation instructions for the free-standing distribution have
been modified to be consistent with that.
Installation
============
1. Unpack the gnuplot.tar.gz and cd to the gnuplot directory.
2. Type "configure". If configure doesn't work for you, see note 7
below.
3. Run "make". If you use XEmacs, run "make EMACS=xemacs" (or change
the EMACS variable to "xemacs" in the Makefile, the run "make").
4. Move the lisp files to the system site_lisp directory if you are
installing as root. If you are installing as a normal user move
the .elc files to a place where emacs, i.e. your personal emacs
directory.
5. Insert the contents of the `dotemacs' file into your .emacs file
or into the system's emacs start-up file to enable gnuplot mode.
6. The function `gnuplot-info-lookup-symbol' looks at the Gnuplot
info file that comes with this package or that can be made from
the Gnuplot distribution. For that function to work, the file
gnuplot.info must be placed somewhere where info can find it, for
example /usr/info. A line like this in your .emacs allows you to
put gnuplot.info any place convenient:
(add-to-list 'Info-default-directory-list "/path/to/file")
Wouldn't it be //great// if Emacs had some kind of systematized package
installing facility? I think so, too! Oh well....
NOTES
=====
1. gnuplot-mode is designed for use with version 3.7 of gnuplot. It
should work very well with any of the 3.6 beta versions. Only some
of the specialized features will not work with version 3.5 -- the
GUI interface to setting command arguments is an example.
2. To use gnuplot-mode with Emacs on Windows 95 or 98 see the
instructions in the directory Win9x.
3. The installation materials used by gnuplot-mode come from the
gnuplot distribution.
4. If "configure" doesn't work for you, the file "Makefile.dst" can be
used. In that case do, "make -f Makefile.dst" and carry on from
there.
5. If you do not have the custom library installed, you will get
several harmless warnings when compiling gnuplot.el. Most of
gnuplot-mode will work even without the custom library installed.
6. The file info-look.el provides the on-line help functionality.
Without it, things like on-line help and keyword completion will
not work. Using a tool that is a standard part of Emacs is a good
idea, but this one gets complicated. This file became part of
Emacs with version 20. It changed between 20.2 and 20.3. And it
does not come with XEmacs. What's more, the version from 20.2 has
a bug and the newer version does not work with Emacs 19. So, this
distribution comes with two versions of info-look.el, the version
from Emacs 20.2 patched to work correctly and the version from
Emacs 20.3. Here's what happens when you run make:
a. If you use Emacs 19 or XEmacs 19, then the Makefile will
compile the 20.2 version.
b. If you use Emacs 20.2 or lower, the Makefile will compile the
20.2 version.
c. If you use XEmacs 20 or higher, the Makefile will compile the
20.3 version.
d. If you use Emacs 20.3 or higher, the Makefile won't compile any
version.
7. The gnuplot-mode distribution comes with the version of the gnuplot
info file that gets made by gnuplot 3.7. Use it rather than the
old one. If you really must use the older info file, see the
document string for the variable `gnuplot-info-hook'. If you
already have the info file installed on your computer, you will not
need the one that comes with gnuplot-mode.
8. The interactive graphical graphical interface to setting command
arguments contained in gnuplot-gui.el is experimental. It is
incomplete and may make mistakes. Hopefully, you will find it
useful. It *requires* that you are using a version of emacs with
the widget library installed or that you have installed it
yourself. Version numbers in the 20's of Emacs and XEmacs ship
with the widget library. For version numbers in the 19's, it can
be obtained at http://www.dina.kvl.dk/~abraham/custom/

View File

@ -0,0 +1,138 @@
Time-stamp: <1999-05-15 11:29:23 bruce>
This file describes how to install gnuplot-mode on a Windows 95 or 98
system so that you may use Gnuplot from within Emacs.
Gnuplot-mode was written by Bruce Ravel <ravel@phys.washington.edu>.
Contact him with any questions or comments regarding gnuplot-mode.
For questions or comments regarding Emacs or Gnuplot, contact the
authors of those programs.
------O------
Gnuplot-mode and Gnuplot can be used with Emacs on a Windows 95 or 98
system, although a small amount of additional effort will be required
to get everything working.
The best solution is to install a sufficiently recent version of
Gnuplot which includes the ability to run as a child process (as of
May 15 1999 there is no such version). A more complete description of
this is attached to the end of this document. Recent versions of
Gnuplot can be found at ftp://ftp.gnuplot.vt.edu/pub/gnuplot/
If you install a very recent version of gnuplot which includes the
ability to run as a child process, then the installation
instructions for gnuplot-mode are much simpler. After following
the normal installation instructions, just add the following line
to your Emacs initialization file:
(add-hook 'gnuplot-load-hook
'(lambda ()
(setq gnuplot-program
"c:/path/to/pgnuplot/pgnuplot.exe")))
Replace "c:/path/to/pgnuplot/pgnuplot.exe" with the full path to
pgnuplot on your computer.
You can make gnuplot work even with an older version of Gnuplot for
Windows by following these steps:
1. Edit the file pgnuplot.c so that the variable FULLPATH at line 5
is pointing at the actual location of the Gnuplot executable on
your computer.
2. Using any C compiler, compile pgnuplot.c to pgnuplot.exe
3. Byte-compile gnuplot.el and gnuplot-gui.el as described in the
INSTALL file in the main gnuplot-mode directory. Make sure the
.elc files a placed in a location where Emacs knows to look,
i.e. in its load-path. You can add new directories to the
load-path by placing the following line near the top of your
Emacs initialization file (.emacs or _emacs):
(setq load-path (append (list "c:/path/to/lisp/files")
load-path))
4. Add these lines to your Emacs initialization file (.emacs or
_emacs):
(autoload 'gnuplot-mode "gnuplot"
"gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot"
"open a buffer in gnuplot-mode" t)
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode))
auto-mode-alist))
(global-set-key [(f9)] 'gnuplot-make-buffer)
(add-hook 'gnuplot-load-hook
'(lambda ()
(setq gnuplot-program
"c:/path/to/pgnuplot/pgnuplot.exe")))
The last line is very important. It tells Emacs to launch
pgnuplot.exe as its subprocess rather than Gnuplot itself. The
first four lines are explained in the comments near the
beginning of gnuplot.el.
Replace "c:/path/to/pgnuplot/pgnuplot.exe" with the full path to
pgnuplot on your computer.
------O------
Resources:
Emacs for Windows NT/9x:
http://www.cs.washington.edu/homes/voelker/ntemacs.html
The Gnuplot distribution site (includes Windows executables):
ftp://ftp.gnuplot.vt.edu/pub/gnuplot/
The gnuplot-mode homepage:
http://feff.phys.washington.edu/~ravel/gnuplot/
Cygwin, Unix tools for Windows NT/9x:
http://sourceware.cygnus.com/cygwin/
------O------
What follows are the comments of the author of pgnuplot.c,
Hans-Bernhard Broeker, describing the function and need for this
program.
Thu, 11 Feb 1999
Here's the tiny program I came up with to fix the single most
annoying problem specific to the Windows version of gnuplot: lack
of support for piping commands into it via STDIN.
For those who don't know the context: Windows GUI programs like
wgnuplot do not have any access to the usual I/O channels stdin and
stdout. So the usual method to allow gnuplot to run as a child
application, being controlled via a command stream by another one
(i.e. the classical 'popen("gnuplot", "w");' method), can not work
on Windoze.
It's implemented as a separate Win32 console application (that's a
different kind of program, which cannot display GUI windows, but
does have STDIN/STDOUT channels). This program will get hold of a
running wgnuplot (or start one itself, passing on any command line
arguments), and deliver each character it sees on its own standard
input stream as a keypress message to the command window of
wgnuplot.
Effectively, this makes 'pgnuplot.exe' an almost 100% complete
replacement of wgnuplot.exe, as far as starting the program is
concerned, but adding the stdin capabilities. A different way of
seeing it is as a prototype of a general application that wants to
run wgnuplot as a child process.

View File

@ -0,0 +1,101 @@
#include <windows.h>
/* You MUST change the value of FULLPATH to the actual location of the
* gnuplot executable on your computer. */
#define FULLPATH "e:/prg/gp36/gp37hbb/wgnuplot.exe"
#define WINDOWNAME "gnuplot"
#define PARENTCLASS "wgnuplot_parent"
#define TEXTCLASS "wgnuplot_text"
#define GRAPHWINDOW "gnuplot graph"
#define GRAPHCLASS "wgnuplot_graph"
int main (int argc, char *argv[])
{
/* Customize this path if needed */
char *d, buf[80];
HWND hwnd_parent;
HWND hwnd_text;
BOOL startedWgnuplotMyself = FALSE;
/* First, try to find if there is an instance of gnuplot
* running, already. If so, use that. */
hwnd_parent = FindWindow(PARENTCLASS, WINDOWNAME);
if ( ! hwnd_parent) {
/* None there, so start one: load gnuplot (minimized in order to
* show only the graphic window). Pass all command line arguments
* on to wgnuplot, by concatting the wgnuplot full path name and
* the given arguments, building up a new, usable command line:
*/
char *cmdline = strdup (FULLPATH);
while (*(++argv)) {
/* Puzzle together a working from the given arguments. To account
* for possible spaces in arguments, we'll have to put double quotes
* around each of them:
*/
/* FIXME: doesn't check for out of memory */
cmdline = realloc(cmdline, strlen(cmdline)+3+strlen(argv[0]));
strcat(cmdline, " \"");
strcat(cmdline, *argv);
strcat(cmdline, "\"");
}
if (WinExec(cmdline, SW_SHOWMINNOACTIVE) < 32) {
printf("Can't load gnuplot\n");
exit(EXIT_FAILURE);
}
startedWgnuplotMyself = TRUE;
/* wait for the gnuplot window */
/* FIXME: is this necessary? As documented, WinExec shouldn't return
* until wgnuplot first calls GetMessage(). By then, the window should
* be there, shouldn't it?
*/
Sleep(1000);
hwnd_parent = FindWindow(PARENTCLASS, WINDOWNAME);
}
if ( ! hwnd_parent) {
/* Still no gnuplot window? Problem! */
printf("Can't find the gnuplot window");
exit(EXIT_FAILURE);
}
/* find the child text window */
hwnd_text = FindWindowEx(hwnd_parent, NULL, "wgnuplot_text", NULL );
if (isatty(fileno(stdin))) {
/* Do not try to read from stdin if it hasn't been redirected
* (i.e., it should read from a pipe or a file) */
exit(EXIT_SUCCESS);
}
/* wait for commands on stdin, and pass them on to the wgnuplot text
* window */
do {
d = fgets(buf, sizeof(buf), stdin);
if (NULL == d) {
if (startedWgnuplotMyself) {
/* close gnuplot cleanly: */
strcpy (buf, "exit");
d = buf;
startedWgnuplotMyself = FALSE;
} else {
break;
}
}
while(*d) {
PostMessage(hwnd_text, WM_CHAR, *d, 1L);
d++;
}
} while (NULL != d);
/* Just in case stdin didn't have a terminating newline, add one: */
PostMessage(hwnd_text, WM_CHAR, '\n', 1L);
return EXIT_SUCCESS;
}

46
util/gnuplot-mode.0.6.0/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,46 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# serial 1
AC_DEFUN(AM_PATH_LISPDIR,
[# If set to t, that means we are running in a shell under Emacs.
# If you have an Emacs named "t", then use the full path.
test "$EMACS" = t && EMACS=
AC_PATH_PROGS(EMACS, emacs xemacs, no)
if test $EMACS != "no"; then
AC_MSG_CHECKING([where .elc files should go])
dnl Set default value
lispdir="\$(datadir)/emacs/site-lisp"
emacs_flavor=`echo "$EMACS" | sed -e 's,^.*/,,'`
if test "x$prefix" = "xNONE"; then
if test -d $ac_default_prefix/share/$emacs_flavor/site-lisp; then
lispdir="\$(prefix)/share/$emacs_flavor/site-lisp"
else
if test -d $ac_default_prefix/lib/$emacs_flavor/site-lisp; then
lispdir="\$(prefix)/lib/$emacs_flavor/site-lisp"
fi
fi
else
if test -d $prefix/share/$emacs_flavor/site-lisp; then
lispdir="\$(prefix)/share/$emacs_flavor/site-lisp"
else
if test -d $prefix/lib/$emacs_flavor/site-lisp; then
lispdir="\$(prefix)/lib/$emacs_flavor/site-lisp"
fi
fi
fi
AC_MSG_RESULT($lispdir)
fi
AC_SUBST(lispdir)])

View File

@ -0,0 +1,21 @@
(TeX-add-style-hook "gpelcard"
(function
(lambda ()
(LaTeX-add-environments
"Boxedminipage"
"SqBoxedminipage")
(TeX-add-symbols
"version"
"revised"
"file"
"key"
"variable"
"command"
"Star")
(TeX-run-style-hooks
"fancybox"
"latex2e"
"art10"
"article"
"twocolumn"))))

1002
util/gnuplot-mode.0.6.0/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
AC_INIT(dot.el)
AC_SET_MAKE
AC_PROG_INSTALL
AM_PATH_LISPDIR
EMACS=`basename $EMACS`
AC_PATH_PROG(MAKEINFO, makeinfo, no)
AC_OUTPUT(Makefile)

View File

@ -0,0 +1,7 @@
;; These are some lines to help compilation of gnuplot-mode proceed
;; with fewer warning messages
(setq load-path (append (list ".") load-path)
byte-compile-verbose nil
byte-compile-warnings nil)
(require 'font-lock)
(defun hilit-repaint-command (foo))

View File

@ -0,0 +1,21 @@
;;--------------------------------------------------------------------
;; Lines enabling gnuplot-mode
;; move the files gnuplot.el to someplace in your lisp load-path or
;; use a line like
;; (setq load-path (append (list "/path/to/gnuplot") load-path))
;; these lines enable the use of gnuplot mode
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)
;; this line automatically causes all files with the .gp extension to
;; be loaded into gnuplot mode
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))
;; This line binds the function-9 key so that it opens a buffer into
;; gnuplot mode
(global-set-key [(f9)] 'gnuplot-make-buffer)
;; end of line for gnuplot-mode
;;--------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
\relax

Binary file not shown.

View File

@ -0,0 +1,122 @@
This is pdfTeX, Version 3.14159-13d (Web2C 7.3.1) (format=pdflatex 2002.10.21) 13 DEC 2002 16:41
**gpelcard.tex
(gpelcard.tex[/var/lib/texmf/pdftex/config/pdftex.cfg]
LaTeX2e <1999/12/01> patch level 1
Babel <v3.6Z> and hyphenation patterns for american, french, german, ngerman, n
ohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 1999/09/10 v1.4a Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo
File: size10.clo 1999/09/10 v1.4a Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texmf/tex/latex/misc/fancybox.sty
Style option: `fancybox' v1.3 <1998/09/17> (tvz)
\@fancybox=\box26
\shadowsize=\dimen103
\@Sbox=\box27
\do@VerbBox=\toks14
\the@fancyput=\toks15
\this@fancyput=\toks16
\EndVerbatimTokens=\toks17
\Verbatim@Outfile=\write3
\Verbatim@Infile=\read1
) (gpelcard.aux)
\openout1 = `gpelcard.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 81.
LaTeX Font Info: ... okay on input line 81.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 81.
LaTeX Font Info: ... okay on input line 81.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 81.
LaTeX Font Info: ... okay on input line 81.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 81.
LaTeX Font Info: ... okay on input line 81.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 81.
LaTeX Font Info: ... okay on input line 81.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 81.
LaTeX Font Info: ... okay on input line 81.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <9> on input line 96.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 96.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 96.
Overfull \hbox (11.19182pt too wide) in paragraph at lines 115--149
[]
[]
Overfull \hbox (18.69722pt too wide) in paragraph at lines 171--172
[][]
[]
LaTeX Font Info: Try loading font information for OMS+cmr on input line 174.
(/usr/share/texmf/tex/latex/base/omscmr.fd
File: omscmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <8> not available
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 174.
Overfull \hbox (6.79999pt too wide) in paragraph at lines 206--207
[][]
[]
[1
[/var/lib/texmf/dvips/config/pdftex.map]]
Underfull \hbox (badness 1635) in paragraph at lines 332--336
\OT1/cmr/m/n/9 These vari-ables con-trol the \OT1/cmtt/m/n/9 Insertions \OT1/cm
r/m/n/9 pull-down
[]
Underfull \hbox (badness 1490) in paragraph at lines 398--398
[]\OT1/cmr/m/n/9 Non-nil means to dis-play a tool-bar if us-ing
[]
Underfull \hbox (badness 2253) in paragraph at lines 403--403
[]\OT1/cmr/m/n/9 Location of XEmacs tool-bar. Valid val-ues
[]
[2]
Underfull \hbox (badness 1087) in paragraph at lines 464--464
\OT1/cmr/m/n/9 in the ar-gu-ment set-ting frame. Italic on a
[]
Underfull \hbox (badness 1087) in paragraph at lines 468--468
\OT1/cmr/m/n/9 in the ar-gu-ment set-ting frame. Italic on a
[]
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 479.
[3
] (gpelcard.aux) )
Here is how much of TeX's memory you used:
443 strings out of 25631
4755 string characters out of 193578
61336 words of memory out of 384000
3464 multiletter control sequences out of 10000+15000
8390 words of font info for 31 fonts, out of 400000 for 1000
14 hyphenation exceptions out of 1000
23i,15n,19p,163b,382s stack positions out of 300i,100n,500p,50000b,4000s
<cmmi8.pfb><cmr10.pfb><cmmi9.pfb><cmsy8.pfb><cmtt8.pfb><cmr8.
pfb><cmsy9.pfb><cmbx9.pfb><cmbx12.pfb><cmtt9.pfb><cmcsc10.pfb><cmr9.pfb><cmr12.
pfb><lcirclew.pfb>
Output written on gpelcard.pdf (3 pages, 111074 bytes).

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,491 @@
%% Time-stamp: <2002/12/13 16:41:13 bruce>
%% This document is copyright (C) 1998-2002 Bruce Ravel <ravel@phys.washington.edu>
%% This page covers version 0.6.0 of gnuplot-mode.
%% This document is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% properly describing the software it documents.
%% Permission is granted to make and distribute copies of this
%% document in electronic form provided the copyright notice and this
%% permission are preserved on all copies.
\documentclass[twocolumn]{article}
\usepackage{fancybox}
\setlength{\parindent}{0truecm}
\setlength{\parskip}{1ex}
\setlength{\hoffset}{-0.5truecm}
\setlength{\voffset}{0truecm}
\setlength{\topmargin}{-2.5truecm}
\setlength{\marginparsep}{0truecm}
\setlength{\marginparwidth}{0truecm}
\setlength{\textheight}{25.5truecm}
\setlength{\textwidth}{17truecm}
\setlength{\oddsidemargin}{0truecm}
\setlength{\evensidemargin}{1.2truecm}
\setlength{\columnsep}{1.4truecm}
\newenvironment{Boxedminipage}%
{\begin{Sbox}\begin{minipage}}%
{\end{minipage}\end{Sbox}\Ovalbox{\TheSbox}}
\newenvironment{SqBoxedminipage}%
{\begin{Sbox}\begin{minipage}}%
{\end{minipage}\end{Sbox}\fbox{\TheSbox}}
\def\version{{0.6.0}}
\def\revised{{17 May, 2002}}
\def\file#1{{\texttt{`#1'}}}
\def\key#1{{\textrm \leavevmode\hbox{%
\raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
\vbox{\hrule\kern-0.4pt
\hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
\kern-0.4pt\hrule}%
\kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
\def\variable#1#2#3{{
\vspace{-0.2truecm}
\begin{flushright}
\begin{minipage}[h]{0.97\linewidth}
\vspace{-0.2truecm}
\textbf{#1}\hfill[\texttt{#2}]
\begin{flushright}
\begin{minipage}[h]{0.93\linewidth}
\vspace{-0.2truecm}
#3
\end{minipage}
\end{flushright}
\end{minipage}
\end{flushright}
}}
\def\command#1#2{{
\vspace{-0.2truecm}
\begin{flushright}
\begin{minipage}[h]{0.97\linewidth}
\vspace{-0.2truecm}
\textbf{#1}\hfill
\begin{flushright}
\begin{minipage}[h]{0.93\linewidth}
\vspace{-0.4truecm}
#2
\end{minipage}
\end{flushright}
\end{minipage}
\end{flushright}
}}
\def\Star{{$\star$}}
\begin{document}
\small
\thispagestyle{empty}
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
\vspace{0.01\textheight}
{\Large Quick Reference for}\\
\vspace{0.007\textheight}
{\Large gnuplot-mode}
\vspace{0.01\textheight}
\end{center}
\end{Boxedminipage}
\end{center}
\vspace{3ex}
This card describes the features of gnuplot-mode for Emacs.
Gnuplot-mode is intended for composing scripts for the
\textsc{gnuplot} plotting program. It offers functions for sending
commands or entire scripts to the \textsc{gnuplot} program as well as
various functions to aid in composing scripts. It works with any
version of \textsc{gnuplot} from 3.5 to 3.8. See the comments in the
file \file{gnuplot.el} for instructions on installing gnuplot-mode.
\vspace{2ex}
\begin{minipage}[h]{\linewidth}
\begin{center}
\centerline{{\large\textbf{gnuplot-mode key sequences}}}
\vspace{0.2ex}
\begin{tabular}[h]{cl}
\hline \hline
\\[-1ex]
\multicolumn{2}{l}{~\quad\textbf{Gnuplot-mode buffer}}\\[0.5ex]
\textrm{key} & \quad description \\
\hline
\texttt{C-c C-l} & send a line to gnuplot \\
\texttt{C-c C-v} & send a line and move forward 1 line\\
\texttt{C-c C-r} & send the region to gnuplot \\
\texttt{C-c C-b} & send the buffer to gnuplot \\
\texttt{C-c C-f} & send a file to gnuplot \\
& \\[-1.5ex]
\texttt{M-\key{tab}} & complete keyword at point \\
\texttt{C-c C-i} & insert filename at point \\
\texttt{C-c C-j} & jump to next statement \\
\texttt{C-c C-n} & negate set option at point \\
\texttt{C-c C-c} & comment region \\
\texttt{C-c C-o} & set arguments of command at point \\
\texttt{S-mouse-2} & set arguments of command under mouse \\
\texttt{C-c C-h} & get help from the gnuplot info file \\
\texttt{C-c C-e} & look at the gnuplot process buffer \\
& \\[-1.5ex]
\texttt{C-c C-k} & kill the gnuplot process \\
\texttt{C-c C-u} & submit a bug report about gnuplot-mode \\
\texttt{C-c C-z} & customize gnuplot-mode \\
\hline
\\[-1ex]
\multicolumn{2}{l}{~\quad\textbf{Gnuplot process buffer}}\\[0.5ex]
\textrm{key} & \quad description \\
\hline
\texttt{M-C-p} & plot script \\
\texttt{M-C-f} & load file containing script \\
\hline \hline
\end{tabular}
\end{center}
\end{minipage}
\vspace{4ex}
\centerline{{\large\textbf{Starting gnuplot-mode}}}
\vspace{2ex}
\command{M-x gnuplot-mode}{Start gnuplot-mode in the current buffer.}
%
\command{M-x gnuplot-make-buffer}{Open a new buffer in gnuplot-mode}
\vfill
\begin{Boxedminipage}{1.05\linewidth}
\begin{center}
\footnotesize{Gnuplot-mode homepage} \\
\scriptsize{%%
\texttt{http://feff.phys.washington.edu/\char126ravel/software/gnuplot-mode/}}
\end{center}
\end{Boxedminipage}
\begin{flushleft}
{\footnotesize
This page {\copyright} 1998-2002 Bruce Ravel \hfill revised \revised \\
\texttt{<ravel@phys.washington.edu>} \\ %% \hfill printed \today \\
This page covers version {\version} of gnuplot-mode.
Permission is granted to make and distribute copies of this quick
reference provided the copyright notice and this permission are
preserved on all copies.}
\end{flushleft}
%%\vfil
\pagebreak
\centerline{{\large\textbf{Setting up gnuplot-mode}}}
\vspace{2ex}
Put the lines in the box below in your \file{.emacs} file or in the
system wide start-up file to enable gnuplot-mode. The first two lines
make Emacs recognize the functions described in the ``Starting
gnuplot-mode'' section on this page. The third line causes Emacs to
put all files ending in \file{.gp} into gnuplot-mode. The final line
defines a hotkey -- in this case \key{F9} -- for starting
gnuplot-mode.
\begin{SqBoxedminipage}{\linewidth}
\begin{Verbatim}
(autoload 'gnuplot-mode "gnuplot"
"gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot"
"open a buffer in gnuplot mode" t)
(setq auto-mode-alist
(append '(("\\.gp$" . gnuplot-mode))
auto-mode-alist))
(global-set-key [(f9)] 'gnuplot-make-buffer)
\end{Verbatim}%%$
\end{SqBoxedminipage}
\vspace{4ex}
\begin{description}
\item[Using the gnuplot-process buffer] \hfill \\
The process buffer contains an active \textsc{gnuplot} command line
for interacting with \textsc{gnuplot} directly. The \texttt{M-C-p}
and \texttt{M-C-f} key sequences will plot using the contents of
the gnuplot script buffer.
\item[Using the GUI to set command arguments] \hfill \\
\texttt{C-c C-c} and \texttt{S-mouse-2} are used to invoke the
graphical tool for setting command arguments. Use text fields and
option menus to choose appropriate values. Menus and buttons are
activated with the middle mouse button. A few plot options may not
be fully supported.
\item[Customizing variables] \hfill \\
The graphical customization tool for variables can be invoked using
\texttt{C-c C-z}. Descriptions of the variables relevant to
gnuplot-mode can be obtained by using \texttt{gnuplot} as the
regular expression for \texttt{M-x apropos}.
\item[On-line help] \hfill \\
Keyword completion and on-line help require that the
\textsc{gnuplot} info file be available and that the info-look
package be installed. The info file can be made from the
documentation supplied with the \textsc{gnuplot} distribution and
the info-look package is a standard part of Emacs 20. Users of
XEmacs or Emacs 19 should download \file{info-look.el} from the
gnuplot-mode homepage.
\item[Using pm3d] \hfill \\
All features of the pm3d patch to \textsc{gnuplot} should be
available when using gnuplot-mode. One particularly useful feature
of pm3d is the ability to push a cursor position into the
clipboard. This is done by double-clicking \texttt{mouse-1} in the
plot window, then doing \texttt{M-x yank-clipboard-selection}
(usually bound to \texttt{mouse-2}) in the gnuplot script buffer.
\end{description}
\vfill
\pagebreak
%%% end of first column
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
{\large User configurable variables}
\end{center}
\end{Boxedminipage}
\end{center}
\variable{gnuplot-program}{gnuplot}{The name of the gnuplot
executable.}
%
\variable{gnuplot-process-name}{*gnuplot*}{The name of the gnuplot
process and process buffer.}
%
\variable{gnuplot-gnuplot-buffer}{plot.gp}{The name of the gnuplot
scratch buffer opened by \texttt{gnuplot-make-buffer}.}
%
%
\variable{gnuplot-display-process}{'window}{Determines how to display
the gnuplot process buffer, either 'frame, 'window, or nil}
%
\variable{gnuplot-info-display}{'window}{Determines how
`gnuplot-get-help' displays the info file, either 'frame, 'window,
or nil}
%
\variable{gnuplot-echo-command-line-flag}{t}{If lines that you send to
gnuplot from the gnuplot-mode buffer are not appearing at the
gnuplot prompt in the process buffer, set this to nil and restart
emacs.}
%
\variable{gnuplot-delay}{0.01}{Time in seconds to allow the gnuplot
display to update. Increase this number if the prompts and lines
are displayed out of order.}
%
\variable{gnuplot-quote-character}{'}{Quotation character used when
inserting a filename into the script (single, double, or no quote).}
\variable{gnuplot-buffer-max-size}{1000}{The maximum size in lines of
the gnuplot buffer. Excess lines are trimmed. 0 means to never trim.}
%%\vspace{1ex}
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
{\large Hook variables}
\end{center}
\end{Boxedminipage}
\end{center}
\variable{gnuplot-mode-hook}{nil}{Functions run when gnuplot minor
mode is entered.}
%
\variable{gnuplot-load-hook}{nil}{Functions run when gnuplot.el is
first loaded.}
%
\variable{gnuplot-after-plot-hook}{nil}{Functions run after gnuplot
plots an entire buffer. See the doc string for
\texttt{gnuplot-recently-sent}.}
%
\variable{gnuplot-comint-setup-hook}{nil}{Functions run after setting
up the gnuplot process buffer in comint mode.}
%
\variable{gnuplot-info-hook}{nil}{Functions run before setting up
info-look in the gnuplot-mode buffer.}
%
\vfill\eject
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
{\large Insertion variables}
\end{center}
\end{Boxedminipage}
\end{center}
\noindent These variables control the \texttt{Insertions} pull-down
menu, which can be used to insert \textsc{gnuplot} commands into the
script. The various sub-menu variables can be used to customize which
commands appear in the \texttt{Insertions} menu.
\vspace{2ex}
%
\variable{gnuplot-insertions-menu-flag}{t}{Non-nil means to display
the \texttt{Insertions} menu in the menubar.}
%
\variable{gnuplot-insertions-show-help-flag}{nil}{Non-nil means to
display help from info file when using the \texttt{Insertions}
menu.}
%
\variable{gnuplot-insertions-adornments}{\Star}{Contents of the
\texttt{adornments} sub-menu.}
%
\variable{gnuplot-insertions-plot-options}{\Star}{Contents of the
\texttt{plot-options} sub-menu.}
%
\variable{gnuplot-insertions-terminal}{\Star}{Contents of the
\texttt{terminal} sub-menu.}
%
\variable{gnuplot-insertions-x-axis}{\Star}{Contents of the \texttt{x
axis} sub-menu.}
%
\variable{gnuplot-insertions-x2-axis}{\Star}{Contents of the \texttt{x2
axis} sub-menu.}
%
\variable{gnuplot-insertions-y-axis}{\Star}{Contents of the \texttt{y
axis} sub-menu.}
%
\variable{gnuplot-insertions-y2-axis}{\Star}{Contents of the \texttt{y2
axis} sub-menu.}
%
\variable{gnuplot-insertions-z-axis}{\Star}{Contents of the \texttt{z
axis} sub-menu.}
%
\variable{gnuplot-insertions-parametric-plots}{\Star}{Contents of the
\texttt{parametric plots} sub-menu.}
%
\variable{gnuplot-insertions-polar-plots}{\Star}{Contents of the
\texttt{polar plots} sub-menu.}
%
\variable{gnuplot-insertions-surface-plots}{\Star}{Contents of the
\texttt{surface plots} sub-menu.}
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
{\large Toolbar variables}
\end{center}
\end{Boxedminipage}
\end{center}
\noindent These variables control the use and location of the
toolbar in XEmacs. The toolbar has buttons equivalent to the key
sequences \texttt{C-c C-l}, \texttt{C-c C-r}, \texttt{C-c C-b},
\texttt{C-c C-e}, and \texttt{C-c C-h}.
\vspace{2ex}
%
\variable{gnuplot-display-toolbar-flag}{nil}{Non-nil means to display
a toolbar if using XEmacs.}
%
\variable{gnuplot-use-toolbar}{left-toolbar}{Location of XEmacs
toolbar. Valid values are \texttt{left-toolbar},
\texttt{right-toolbar}, \texttt{top-toolbar}, \texttt{bottom-toolbar},
\texttt{default-toolbar} and nil.}
%
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
{\large Set Arguments}
\end{center}
\end{Boxedminipage}
\end{center}
\noindent These variables control the behavior of the graphical
interface to setting command arguments. \texttt{C-c C-c} with point
over a command or \texttt{S-mouse-2} with the mouse cursor over a
command will cause a small frame to pop open with which you can set
command arguments. Green button with bold text are bound to pup-up
menus --- use the mouse-2 to select an item from the menu. Grey fields
are for filling in strings or numbers. Hit the \textbf{[Set Options]}
button with \texttt{mouse-2} to insert command arguments into the
script. You can also use the \key{tab} key to move among the widgets
and \key{ret} to push the buttons.
\vspace{2ex}
%
\variable{gnuplot-gui-popup-flag}{nil}{When non-nil an argument
setting frame will pop open whenever the \texttt{Insertions} menu is
used.}
%
\variable{gnuplot-gui-plot-splot-fit-style}{'simple}{\texttt{'simple}
or \texttt{'complete} -- describes the extent of the list of
properties of for plot, splot, and fit in the GUI.}
%
\variable{gnuplot-gui-frame-plist}{\Star}{Property list of parameters
controlling the argument setting frame. Used by XEmacs.}
%
\variable{gnuplot-gui-frame-parameters}{\Star}{List of parameters
controlling the argument setting frame. Used by Emacs.}
%
\variable{gnuplot-gui-fontname-list}{\Star}{List of font available on your
computer to the terminal drivers.}
%
\begin{center}
\begin{Boxedminipage}{0.75\linewidth}
\begin{center}
{\large Faces}
\end{center}
\end{Boxedminipage}
\end{center}
\noindent These are various faces defined for use with gnuplot-mode.
\vspace{2ex}
%
\variable{gnuplot-prompt-face}{firebrick}{Color of gnuplot prompt (on a
light background) in process buffer. Bold and underlined on a
monochrome display.}
%
\variable{gnuplot-gui-menu-face}{dark olive green}{Color of menu
buttons (on a light background) in the argument setting frame.
Italic on a monochrome display.}
%
\variable{gnuplot-gui-button-face}{sienna}{Color of push buttons (on a
light background) in the argument setting frame. Italic on a
monochrome display.}
%
\variable{gnuplot-gui-label-face}{dark slate blue}{Color of buttons (on
a light background) used to set label lists in the argument setting
frame. Italic on a monochrome display.}
%
\vfill
\hrule
\vspace{0.5ex}
\begin{flushleft}
\footnotesize{Variables marked with {\Star} have default values that
are too long to print here.}
\end{flushleft}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@ -0,0 +1,527 @@
;;; info-look.el --- major-mode-sensitive Info index lookup facility.
;; An older version of this was known as libc.el.
;; Copyright (C) 1995, 1996, 1997 Ralph Schleicher.
;; Author: Ralph Schleicher <rs@purple.UL.BaWue.DE>
;; Keywords: help languages
;; This file is not part of GNU Emacs. (but is slightly modified from
;; a file that is a part of GNU Emacs -- see below)
;; 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; Bruce Ravel <ravel@phys.washington.edu> made two chanegs to this
;; file:
;; 1. Added a check for XEmacs
;; 2. Added (format "%s" (match-string 1)) in function
;; `info-lookup-make-completions' so that text properties are not
;; grabbed.
;;; Code:
(require 'info)
;; next two lines added by Bruce Ravel <ravel@phys.washington.edu> to
;; make this file compile properly under XEmacs.
(eval-and-compile
(if (string-match "XEmacs" emacs-version)
(require 'overlay)))
(defvar info-lookup-mode nil
"*Symbol of the current buffer's help mode.
Provide help according to the buffer's major mode if value is nil.
Automatically becomes buffer local when set in any fashion.")
(make-variable-buffer-local 'info-lookup-mode)
(defvar info-lookup-other-window-flag t
"*Non-nil means pop up the Info buffer in another window.")
(defvar info-lookup-highlight-face 'highlight
"*Face for highlighting looked up help items.
Setting this variable to nil disables highlighting.")
(defvar info-lookup-highlight-overlay nil
"Overlay object used for highlighting.")
(defvar info-lookup-history nil
"History of previous input lines.")
(defvar info-lookup-alist '((symbol . info-lookup-symbol-alist)
(file . info-lookup-file-alist))
"*Alist of known help topics.
Cons cells are of the form
(HELP-TOPIC . VARIABLE)
HELP-TOPIC is the symbol of a help topic.
VARIABLE is a variable storing HELP-TOPIC's public data.
Value is an alist with elements of the form
(HELP-MODE REGEXP IGNORE-CASE DOC-SPEC PARSE-RULE OTHER-MODES)
HELP-MODE is a mode's symbol.
REGEXP is a regular expression matching those help items whose
documentation can be looked up via DOC-SPEC.
IGNORE-CASE is non-nil if help items are case insensitive.
DOC-SPEC is a list of documentation specifications of the form
(INFO-NODE TRANS-FUNC PREFIX SUFFIX)
INFO-NODE is the name (including file name part) of an Info index.
TRANS-FUNC is a function translating index entries into help items;
nil means add only those index entries matching REGEXP, a string
means prepend string to the first word of all index entries.
PREFIX and SUFFIX are parts of a regular expression. If one of
them is non-nil then search the help item's Info node for the
first occurrence of the regular expression `PREFIX ITEM SUFFIX'.
ITEM will be highlighted with `info-lookup-highlight-face' if this
variable is not nil.
PARSE-RULE is either the symbol name of a function or a regular
expression for guessing the default help item at point. Fuzzy
regular expressions like \"[_a-zA-Z0-9]+\" do a better job if
there are no clear delimiters; do not try to write too complex
expressions. PARSE-RULE defaults to REGEXP.
OTHER-MODES is a list of cross references to other help modes.")
(defsubst info-lookup->topic-value (topic)
(symbol-value (cdr (assoc topic info-lookup-alist))))
(defsubst info-lookup->mode-value (topic mode)
(assoc mode (info-lookup->topic-value topic)))
(defsubst info-lookup->regexp (topic mode)
(nth 1 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->ignore-case (topic mode)
(nth 2 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->doc-spec (topic mode)
(nth 3 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->parse-rule (topic mode)
(nth 4 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->other-modes (topic mode)
(nth 5 (info-lookup->mode-value topic mode)))
(defvar info-lookup-cache nil
"Cache storing data maintained automatically by the program.
Value is an alist with cons cell of the form
(HELP-TOPIC . ((HELP-MODE INITIALIZED COMPLETIONS REFER-MODES) ...))
HELP-TOPIC is the symbol of a help topic.
HELP-MODE is a mode's symbol.
INITIALIZED is nil if HELP-MODE is uninitialized, t if
HELP-MODE is initialized, and `0' means HELP-MODE is
initialized but void.
COMPLETIONS is an alist of documented help items.
REFER-MODES is a list of other help modes to use.")
(defsubst info-lookup->cache (topic)
(or (assoc topic info-lookup-cache)
(car (setq info-lookup-cache
(cons (cons topic nil)
info-lookup-cache)))))
(defsubst info-lookup->topic-cache (topic)
(cdr (info-lookup->cache topic)))
(defsubst info-lookup->mode-cache (topic mode)
(assoc mode (info-lookup->topic-cache topic)))
(defsubst info-lookup->initialized (topic mode)
(nth 1 (info-lookup->mode-cache topic mode)))
(defsubst info-lookup->completions (topic mode)
(or (info-lookup->initialized topic mode)
(info-lookup-setup-mode topic mode))
(nth 2 (info-lookup->mode-cache topic mode)))
(defsubst info-lookup->refer-modes (topic mode)
(or (info-lookup->initialized topic mode)
(info-lookup-setup-mode topic mode))
(nth 3 (info-lookup->mode-cache topic mode)))
(defsubst info-lookup->all-modes (topic mode)
(cons mode (info-lookup->refer-modes topic mode)))
(defvar info-lookup-symbol-alist
'((autoconf-mode
"A[CM]_[_A-Z0-9]+" nil
(("(autoconf)Macro Index" "AC_"
"^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")
("(automake)Index" nil
"^[ \t]*`" "'"))
;; Autoconf symbols are M4 macros. Thus use M4's parser.
ignore
(m4-mode))
(bison-mode
"[:;|]\\|%\\([%{}]\\|[_a-z]+\\)\\|YY[_A-Z]+\\|yy[_a-z]+" nil
(("(bison)Index" nil
"`" "'"))
"[:;|]\\|%\\([%{}]\\|[_a-zA-Z][_a-zA-Z0-9]*\\)"
(c-mode))
(c-mode
"\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*" nil
(("(libc)Function Index" nil
"^[ \t]+- \\(Function\\|Macro\\): .*\\<" "\\>")
("(libc)Variable Index" nil
"^[ \t]+- \\(Variable\\|Macro\\): .*\\<" "\\>")
("(libc)Type Index" nil
"^[ \t]+- Data Type: \\<" "\\>")
("(termcap)Var Index" nil
"^[ \t]*`" "'"))
info-lookup-guess-c-symbol)
(m4-mode
"[_a-zA-Z][_a-zA-Z0-9]*" nil
(("(m4)Macro index"))
"[_a-zA-Z0-9]+")
(makefile-mode
"\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*" nil
(("(make)Name Index" nil
"^[ \t]*`" "'"))
"\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
(texinfo-mode
"@\\([a-zA-Z]+\\|[^a-zA-Z]\\)" nil
(("(texinfo)Command and Variable Index"
;; Ignore Emacs commands and prepend a `@'.
(lambda (item)
(if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item)
(concat "@" (match-string 1 item))))
"`" "'"))))
"*Alist of help specifications for symbol names.
See the documentation of the variable `info-lookup-alist' for more details.")
(defvar info-lookup-file-alist
'((c-mode
"[_a-zA-Z0-9./+-]+" nil
(("(libc)File Index"))))
"*Alist of help specifications for file names.
See the documentation of the variable `info-lookup-alist' for more details.")
;;;###autoload
(defun info-lookup-reset ()
"Throw away all cached data.
This command is useful if the user wants to start at the beginning without
quitting Emacs, for example, after some Info documents were updated on the
system."
(interactive)
(setq info-lookup-cache nil))
;;;###autoload
(defun info-lookup-symbol (symbol &optional mode)
"Display the documentation of a symbol.
If called interactively, SYMBOL will be read from the mini-buffer.
Prefix argument means unconditionally insert the default symbol name
into the mini-buffer so that it can be edited.
The default symbol is the one found at point."
(interactive
(info-lookup-interactive-arguments 'symbol))
(info-lookup 'symbol symbol mode))
;;;###autoload
(defun info-lookup-file (file &optional mode)
"Display the documentation of a file.
If called interactively, FILE will be read from the mini-buffer.
Prefix argument means unconditionally insert the default file name
into the mini-buffer so that it can be edited.
The default file name is the one found at point."
(interactive
(info-lookup-interactive-arguments 'file))
(info-lookup 'file file mode))
(defun info-lookup-interactive-arguments (topic)
"Return default value and help mode for help topic TOPIC."
(let* ((mode (if (info-lookup->mode-value
topic (or info-lookup-mode major-mode))
(or info-lookup-mode major-mode)
(info-lookup-change-mode topic)))
(completions (info-lookup->completions topic mode))
(default (info-lookup-guess-default topic mode))
(input (if (or current-prefix-arg (not (assoc default completions)))
default))
(completion-ignore-case (info-lookup->ignore-case topic mode))
(enable-recursive-minibuffers t)
(value (completing-read
(if (and default (not input))
(format "Describe %s (default %s): " topic default)
(format "Describe %s: " topic))
completions nil nil input 'info-lookup-history)))
(list (if (equal value "") default value) mode)))
(defun info-lookup-change-mode (topic)
(let* ((completions (mapcar (lambda (arg)
(cons (symbol-name (car arg)) (car arg)))
(info-lookup->topic-value topic)))
(mode (completing-read
(format "Use %s help mode: " topic)
completions nil t nil 'info-lookup-history)))
(or (setq mode (cdr (assoc mode completions)))
(error "No %s help available" topic))
(or (info-lookup->mode-value topic mode)
(error "No %s help available for `%s'" topic mode))
(setq info-lookup-mode mode)))
(defun info-lookup (topic item mode)
"Display the documentation of a help item."
(if (not mode)
(setq mode (or info-lookup-mode major-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s help available for `%s'" topic mode))
(let ((entry (or (assoc (if (info-lookup->ignore-case topic mode)
(downcase item) item)
(info-lookup->completions topic mode))
(error "Not documented as a %s: %s" topic (or item ""))))
(modes (info-lookup->all-modes topic mode))
(window (selected-window))
found doc-spec node prefix suffix)
(if (not info-lookup-other-window-flag)
(info)
(save-window-excursion (info))
(switch-to-buffer-other-window "*info*"))
(while (and (not found) modes)
(setq doc-spec (info-lookup->doc-spec topic (car modes)))
(while (and (not found) doc-spec)
(setq node (nth 0 (car doc-spec))
prefix (nth 2 (car doc-spec))
suffix (nth 3 (car doc-spec)))
(condition-case nil
(progn
(Info-goto-node node)
(Info-menu (or (cdr entry) item))
(setq found t)
(if (or prefix suffix)
(let ((case-fold-search
(info-lookup->ignore-case topic (car modes)))
(buffer-read-only nil))
(goto-char (point-min))
(re-search-forward
(concat prefix (regexp-quote item) suffix))
(goto-char (match-beginning 0))
(and window-system info-lookup-highlight-face
;; Search again for ITEM so that the first
;; occurence of ITEM will be highlighted.
(re-search-forward (regexp-quote item))
(let ((start (match-beginning 0))
(end (match-end 0)))
(if (overlayp info-lookup-highlight-overlay)
(move-overlay info-lookup-highlight-overlay
start end (current-buffer))
(setq info-lookup-highlight-overlay
(make-overlay start end))))
(overlay-put info-lookup-highlight-overlay
'face info-lookup-highlight-face)))))
(error nil))
(setq doc-spec (cdr doc-spec)))
(setq modes (cdr modes)))
;; Don't leave the Info buffer if the help item couldn't be looked up.
(if (and info-lookup-other-window-flag found)
(select-window window))))
(defun info-lookup-setup-mode (topic mode)
"Initialize the internal data structure."
(or (info-lookup->initialized topic mode)
(let (cell data (initialized 0) completions refer-modes)
(if (not (info-lookup->mode-value topic mode))
(message "No %s help available for `%s'" topic mode)
;; Recursively setup cross references.
;; But refer only to non-void modes.
(mapcar (lambda (arg)
(or (info-lookup->initialized topic arg)
(info-lookup-setup-mode topic arg))
(and (eq (info-lookup->initialized topic arg) t)
(setq refer-modes (cons arg refer-modes))))
(info-lookup->other-modes topic mode))
(setq refer-modes (nreverse refer-modes))
;; Build the full completion alist.
(setq completions
(nconc (info-lookup-make-completions topic mode)
(apply 'append
(mapcar (lambda (arg)
(info-lookup->completions topic arg))
refer-modes))))
(setq initialized t))
;; Update `info-lookup-cache'.
(setq cell (info-lookup->mode-cache topic mode)
data (list initialized completions refer-modes))
(if (not cell)
(setcdr (info-lookup->cache topic)
(cons (cons mode data) (info-lookup->topic-cache topic)))
(setcdr cell data))
initialized)))
(defun info-lookup-make-completions (topic mode)
"Create a unique alist from all index entries."
(condition-case nil
(let ((doc-spec (info-lookup->doc-spec topic mode))
(regexp (concat "^\\(" (info-lookup->regexp topic mode)
"\\)\\([ \t].*\\)?$"))
node trans entry item prefix result)
(save-window-excursion
(info)
(while doc-spec
(setq node (nth 0 (car doc-spec))
trans (cond ((eq (nth 1 (car doc-spec)) nil)
(lambda (arg)
(if (string-match regexp arg)
(match-string 1 arg))))
((stringp (nth 1 (car doc-spec)))
(setq prefix (nth 1 (car doc-spec)))
(lambda (arg)
(if (string-match "^\\([^: \t\n]+\\)" arg)
(concat prefix (match-string 1 arg)))))
(t (nth 1 (car doc-spec)))))
(message "Processing Info node \"%s\"..." node)
(Info-goto-node node)
(goto-char (point-min))
(and (search-forward "\n* Menu:" nil t)
(while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t)
;; Bruce Ravel added format
;; w/o format, this grabs text properties
(setq entry (format "%s" (match-string 1))
item (funcall trans entry))
(and (info-lookup->ignore-case topic mode)
(setq item (downcase item)))
(and (string-equal entry item)
(setq entry nil))
(or (assoc item result)
(setq result (cons (cons item entry) result)))))
(message "Processing Info node \"%s\"... done" node)
(setq doc-spec (cdr doc-spec)))
(Info-directory))
result)
(error nil)))
(defun info-lookup-guess-default (topic mode)
"Pick up default item at point (with favor to look back).
Return nil if there is nothing appropriate."
(let ((modes (info-lookup->all-modes topic mode))
(start (point)) guess whitespace)
(while (and (not guess) modes)
(setq guess (info-lookup-guess-default* topic (car modes))
modes (cdr modes))
(goto-char start))
;; Collapse whitespace characters.
(and guess (concat (delete nil (mapcar (lambda (ch)
(if (or (char-equal ch ? )
(char-equal ch ?\t)
(char-equal ch ?\n))
(if (not whitespace)
(setq whitespace ? ))
(setq whitespace nil) ch))
guess))))))
(defun info-lookup-guess-default* (topic mode)
(let ((case-fold-search (info-lookup->ignore-case topic mode))
(rule (or (info-lookup->parse-rule topic mode)
(info-lookup->regexp topic mode)))
(start (point)) end regexp subexp result)
(if (symbolp rule)
(setq result (funcall rule))
(if (consp rule)
(setq regexp (car rule)
subexp (cdr rule))
(setq regexp rule
subexp 0))
(skip-chars-backward " \t\n") (setq end (point))
(while (and (re-search-backward regexp nil t)
(looking-at regexp)
(>= (match-end 0) end))
(setq result (match-string subexp)))
(if (not result)
(progn
(goto-char start)
(skip-chars-forward " \t\n")
(and (looking-at regexp)
(setq result (match-string subexp))))))
result))
(defun info-lookup-guess-c-symbol ()
"Get the C symbol at point."
(condition-case nil
(progn
(backward-sexp)
(let ((start (point)) prefix name)
;; Test for a leading `struct', `union', or `enum' keyword
;; but ignore names like `foo_struct'.
(setq prefix (and (< (skip-chars-backward " \t\n") 0)
(< (skip-chars-backward "_a-zA-Z0-9") 0)
(looking-at "\\(struct\\|union\\|enum\\)\\s ")
(concat (match-string 1) " ")))
(goto-char start)
(and (looking-at "[_a-zA-Z][_a-zA-Z0-9]*")
(setq name (match-string 0)))
;; Caveat! Look forward if point is at `struct' etc.
(and (not prefix)
(or (string-equal name "struct")
(string-equal name "union")
(string-equal name "enum"))
(looking-at "[a-z]+\\s +\\([_a-zA-Z][_a-zA-Z0-9]*\\)")
(setq prefix (concat name " ")
name (match-string 1)))
(and (or prefix name)
(concat prefix name))))
(error nil)))
;;;###autoload
(defun info-complete-symbol (&optional mode)
"Perform completion on symbol preceding point."
(interactive)
(info-complete 'symbol
(or mode
(if (info-lookup->mode-value
'symbol (or info-lookup-mode major-mode))
(or info-lookup-mode major-mode)
(info-lookup-change-mode 'symbol)))))
;;;###autoload
(defun info-complete-file (&optional mode)
"Perform completion on file preceding point."
(interactive
(list (if (info-lookup->mode-value
'file (or info-lookup-mode major-mode))
(or info-lookup-mode major-mode)
(info-lookup-change-mode 'file))))
(info-complete 'file mode))
(defun info-complete (topic mode)
"Try to complete a help item."
(barf-if-buffer-read-only)
(if (not mode)
(setq mode (or info-lookup-mode major-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s completion available for `%s'" topic mode))
(let ((modes (info-lookup->all-modes topic mode))
(start (point)) try completion)
(while (and (not try) modes)
(setq mode (car modes)
modes (cdr modes)
try (info-lookup-guess-default* topic mode))
(goto-char start))
(and (not try)
(error "Found no %s to complete" topic))
(setq completion (try-completion
try (info-lookup->completions topic mode)))
(cond ((not completion)
(ding))
((stringp completion)
(delete-region (- start (length try)) start)
(insert completion)))))
(provide 'info-look)
;;; info-look.el ends here

View File

@ -0,0 +1,758 @@
;;; info-look.el --- major-mode-sensitive Info index lookup facility.
;; An older version of this was known as libc.el.
;; Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
;; Author: Ralph Schleicher <rs@purple.UL.BaWue.DE>
;; Keywords: help languages
;; 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Code:
(require 'info)
(eval-and-compile
(condition-case nil
(require 'custom)
(error
(defmacro defgroup (&rest arg)
nil)
(defmacro defcustom (symbol value doc &rest arg)
`(defvar ,symbol ,value ,doc ,@arg)))))
(defgroup info-lookup nil
"Major mode sensitive help agent."
:group 'help :group 'languages)
(defvar info-lookup-mode nil
"Symbol of the current buffer's help mode.
Help is provided according to the buffer's major mode if value is nil.
Automatically becomes buffer local when set in any fashion.")
(make-variable-buffer-local 'info-lookup-mode)
(defcustom info-lookup-other-window-flag t
"Non-nil means pop up the Info buffer in another window."
:group 'info-lookup :type 'boolean)
(defcustom info-lookup-highlight-face 'highlight
"Face for highlighting looked up help items.
Setting this variable to nil disables highlighting."
:group 'info-lookup :type 'face)
(defvar info-lookup-highlight-overlay nil
"Overlay object used for highlighting.")
(defcustom info-lookup-file-name-alist
'(("\\`configure\\.in\\'" . autoconf-mode)
("\\`aclocal\\.m4\\'" . autoconf-mode)
("\\`acsite\\.m4\\'" . autoconf-mode)
("\\`acinclude\\.m4\\'" . autoconf-mode))
"Alist of file names handled specially.
List elements are cons cells of the form
(REGEXP . MODE)
If a file name matches REGEXP, then use help mode MODE instead of the
buffer's major mode."
:group 'info-lookup :type '(repeat (cons (string :tag "Regexp")
(symbol :tag "Mode"))))
(defvar info-lookup-history nil
"History of previous input lines.")
(defvar info-lookup-alist nil
"Alist of known help topics.
Cons cells are of the form
(HELP-TOPIC . HELP-DATA)
HELP-TOPIC is the symbol of a help topic.
HELP-DATA is a HELP-TOPIC's public data set.
Value is an alist with elements of the form
(HELP-MODE REGEXP IGNORE-CASE DOC-SPEC PARSE-RULE OTHER-MODES)
HELP-MODE is a mode's symbol.
REGEXP is a regular expression matching those help items whose
documentation can be looked up via DOC-SPEC.
IGNORE-CASE is non-nil if help items are case insensitive.
DOC-SPEC is a list of documentation specifications of the form
(INFO-NODE TRANS-FUNC PREFIX SUFFIX)
INFO-NODE is the name (including file name part) of an Info index.
TRANS-FUNC is a function translating index entries into help items;
nil means add only those index entries matching REGEXP, a string
means prepend string to the first word of all index entries.
PREFIX and SUFFIX are parts of a regular expression. If one of
them is non-nil then search the help item's Info node for the
first occurrence of the regular expression `PREFIX ITEM SUFFIX'.
ITEM will be highlighted with `info-lookup-highlight-face' if this
variable is not nil.
PARSE-RULE is either the symbol name of a function or a regular
expression for guessing the default help item at point. Fuzzy
regular expressions like \"[_a-zA-Z0-9]+\" do a better job if
there are no clear delimiters; do not try to write too complex
expressions. PARSE-RULE defaults to REGEXP.
OTHER-MODES is a list of cross references to other help modes.")
(defsubst info-lookup->topic-value (topic)
(cdr (assoc topic info-lookup-alist)))
(defsubst info-lookup->mode-value (topic mode)
(assoc mode (info-lookup->topic-value topic)))
(defsubst info-lookup->regexp (topic mode)
(nth 1 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->ignore-case (topic mode)
(nth 2 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->doc-spec (topic mode)
(nth 3 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->parse-rule (topic mode)
(nth 4 (info-lookup->mode-value topic mode)))
(defsubst info-lookup->other-modes (topic mode)
(nth 5 (info-lookup->mode-value topic mode)))
(eval-and-compile
(mapcar (lambda (keyword)
(or (boundp keyword)
(set keyword keyword)))
'(:topic :mode :regexp :ignore-case
:doc-spec :parse-rule :other-modes)))
(defun info-lookup-add-help (&rest arg)
"Add or update a help specification.
Function arguments are one or more options of the form
KEYWORD ARGUMENT
KEYWORD is either `:topic', `:mode', `:regexp', `:ignore-case',
`:doc-spec', `:parse-rule', or `:other-modes'.
ARGUMENT has a value as explained in the documentation of the
variable `info-lookup-alist'.
If no topic or mode option has been specified, then the help topic defaults
to `symbol', and the help mode defaults to the current major mode."
(apply 'info-lookup-add-help* nil arg))
(defun info-lookup-maybe-add-help (&rest arg)
"Add a help specification iff no one is defined.
See the documentation of the function `info-lookup-add-help'
for more details."
(apply 'info-lookup-add-help* t arg))
(defun info-lookup-add-help* (maybe &rest arg)
(let (topic mode regexp ignore-case doc-spec
parse-rule other-modes keyword value)
(setq topic 'symbol
mode major-mode
regexp "\\w+")
(while arg
(setq keyword (car arg))
(or (symbolp keyword)
(error "Junk in argument list \"%S\"" arg))
(setq arg (cdr arg))
(and (null arg)
(error "Keyword \"%S\" is missing an argument" keyword))
(setq value (car arg)
arg (cdr arg))
(cond ((eq keyword :topic)
(setq topic value))
((eq keyword :mode)
(setq mode value))
((eq keyword :regexp)
(setq regexp value))
((eq keyword :ignore-case)
(setq ignore-case value))
((eq keyword :doc-spec)
(setq doc-spec value))
((eq keyword :parse-rule)
(setq parse-rule value))
((eq keyword :other-modes)
(setq other-modes value))
(t
(error "Unknown keyword \"%S\"" keyword))))
(or (and maybe (info-lookup->mode-value topic mode))
(let* ((data (list regexp ignore-case doc-spec parse-rule other-modes))
(topic-cell (or (assoc topic info-lookup-alist)
(car (setq info-lookup-alist
(cons (cons topic nil)
info-lookup-alist)))))
(mode-cell (assoc mode topic-cell)))
(if (null mode-cell)
(setcdr topic-cell (cons (cons mode data) (cdr topic-cell)))
(setcdr mode-cell data))))
nil))
(defvar info-lookup-cache nil
"Cache storing data maintained automatically by the program.
Value is an alist with cons cell of the form
(HELP-TOPIC . ((HELP-MODE INITIALIZED COMPLETIONS REFER-MODES) ...))
HELP-TOPIC is the symbol of a help topic.
HELP-MODE is a mode's symbol.
INITIALIZED is nil if HELP-MODE is uninitialized, t if
HELP-MODE is initialized, and `0' means HELP-MODE is
initialized but void.
COMPLETIONS is an alist of documented help items.
REFER-MODES is a list of other help modes to use.")
(defsubst info-lookup->cache (topic)
(or (assoc topic info-lookup-cache)
(car (setq info-lookup-cache
(cons (cons topic nil)
info-lookup-cache)))))
(defun info-lookup->topic-cache (topic)
(cdr (info-lookup->cache topic)))
(defun info-lookup->mode-cache (topic mode)
(assoc mode (info-lookup->topic-cache topic)))
(defun info-lookup->initialized (topic mode)
(nth 1 (info-lookup->mode-cache topic mode)))
(defun info-lookup->completions (topic mode)
(or (info-lookup->initialized topic mode)
(info-lookup-setup-mode topic mode))
(nth 2 (info-lookup->mode-cache topic mode)))
(defun info-lookup->refer-modes (topic mode)
(or (info-lookup->initialized topic mode)
(info-lookup-setup-mode topic mode))
(nth 3 (info-lookup->mode-cache topic mode)))
(defun info-lookup->all-modes (topic mode)
(cons mode (info-lookup->refer-modes topic mode)))
(defun info-lookup-quick-all-modes (topic mode)
(cons mode (info-lookup->other-modes topic mode)))
;;;###autoload
(defun info-lookup-reset ()
"Throw away all cached data.
This command is useful if the user wants to start at the beginning without
quitting Emacs, for example, after some Info documents were updated on the
system."
(interactive)
(setq info-lookup-cache nil))
;;;###autoload
(defun info-lookup-symbol (symbol &optional mode)
"Display the documentation of a symbol.
If called interactively, SYMBOL will be read from the mini-buffer.
Prefix argument means unconditionally insert the default symbol name
into the mini-buffer so that it can be edited.
The default symbol is the one found at point."
(interactive
(info-lookup-interactive-arguments 'symbol))
(info-lookup 'symbol symbol mode))
;;;###autoload
(defun info-lookup-file (file &optional mode)
"Display the documentation of a file.
If called interactively, FILE will be read from the mini-buffer.
Prefix argument means unconditionally insert the default file name
into the mini-buffer so that it can be edited.
The default file name is the one found at point."
(interactive
(info-lookup-interactive-arguments 'file))
(info-lookup 'file file mode))
(defun info-lookup-interactive-arguments (topic)
"Return default value and help mode for help topic TOPIC."
(let* ((mode (if (info-lookup->mode-value topic (info-lookup-select-mode))
info-lookup-mode
(info-lookup-change-mode topic)))
(completions (info-lookup->completions topic mode))
(default (info-lookup-guess-default topic mode))
(input (if (or current-prefix-arg (not (assoc default completions)))
default))
(completion-ignore-case (info-lookup->ignore-case topic mode))
(enable-recursive-minibuffers t)
(value (completing-read
(if (and default (not input))
(format "Describe %s (default %s): " topic default)
(format "Describe %s: " topic))
completions nil nil input 'info-lookup-history)))
(list (if (equal value "") default value) mode)))
(defun info-lookup-select-mode ()
(when (and (not info-lookup-mode) (buffer-file-name))
(let ((file-name (file-name-nondirectory (buffer-file-name)))
(file-name-alist info-lookup-file-name-alist))
(while (and (not info-lookup-mode) file-name-alist)
(when (string-match (caar file-name-alist) file-name)
(setq info-lookup-mode (cdar file-name-alist)))
(setq file-name-alist (cdr file-name-alist)))))
(or info-lookup-mode (setq info-lookup-mode major-mode)))
(defun info-lookup-change-mode (topic)
(let* ((completions (mapcar (lambda (arg)
(cons (symbol-name (car arg)) (car arg)))
(info-lookup->topic-value topic)))
(mode (completing-read
(format "Use %s help mode: " topic)
completions nil t nil 'info-lookup-history)))
(or (setq mode (cdr (assoc mode completions)))
(error "No %s help available" topic))
(or (info-lookup->mode-value topic mode)
(error "No %s help available for `%s'" topic mode))
(setq info-lookup-mode mode)))
(defun info-lookup (topic item mode)
"Display the documentation of a help item."
(or mode (setq mode (info-lookup-select-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s help available for `%s'" topic mode))
(let ((entry (or (assoc (if (info-lookup->ignore-case topic mode)
(downcase item) item)
(info-lookup->completions topic mode))
(error "Not documented as a %s: %s" topic (or item ""))))
(modes (info-lookup->all-modes topic mode))
(window (selected-window))
found doc-spec node prefix suffix doc-found)
(if (not info-lookup-other-window-flag)
(info)
(save-window-excursion (info))
(switch-to-buffer-other-window "*info*"))
(while (and (not found) modes)
(setq doc-spec (info-lookup->doc-spec topic (car modes)))
(while (and (not found) doc-spec)
(setq node (nth 0 (car doc-spec))
prefix (nth 2 (car doc-spec))
suffix (nth 3 (car doc-spec)))
(when (condition-case error-data
(progn
(Info-goto-node node)
(setq doc-found t))
(error
(message "Cannot access Info node %s" node)
(sit-for 1)
nil))
(condition-case nil
(progn
(Info-menu (or (cdr entry) item))
(setq found t)
(if (or prefix suffix)
(let ((case-fold-search
(info-lookup->ignore-case topic (car modes)))
(buffer-read-only nil))
(goto-char (point-min))
(re-search-forward
(concat prefix (regexp-quote item) suffix))
(goto-char (match-beginning 0))
(and window-system info-lookup-highlight-face
;; Search again for ITEM so that the first
;; occurence of ITEM will be highlighted.
(re-search-forward (regexp-quote item))
(let ((start (match-beginning 0))
(end (match-end 0)))
(if (overlayp info-lookup-highlight-overlay)
(move-overlay info-lookup-highlight-overlay
start end (current-buffer))
(setq info-lookup-highlight-overlay
(make-overlay start end))))
(overlay-put info-lookup-highlight-overlay
'face info-lookup-highlight-face)))))
(error nil)))
(setq doc-spec (cdr doc-spec)))
(setq modes (cdr modes)))
(or doc-found
(error "Info documentation for lookup was not found"))
;; Don't leave the Info buffer if the help item couldn't be looked up.
(if (and info-lookup-other-window-flag found)
(select-window window))))
(defun info-lookup-setup-mode (topic mode)
"Initialize the internal data structure."
(or (info-lookup->initialized topic mode)
(let (cell data (initialized 0) completions refer-modes)
(if (not (info-lookup->mode-value topic mode))
(message "No %s help available for `%s'" topic mode)
;; Recursively setup cross references.
;; But refer only to non-void modes.
(mapcar (lambda (arg)
(or (info-lookup->initialized topic arg)
(info-lookup-setup-mode topic arg))
(and (eq (info-lookup->initialized topic arg) t)
(setq refer-modes (cons arg refer-modes))))
(info-lookup->other-modes topic mode))
(setq refer-modes (nreverse refer-modes))
;; Build the full completion alist.
(setq completions
(nconc (info-lookup-make-completions topic mode)
(apply 'append
(mapcar (lambda (arg)
(info-lookup->completions topic arg))
refer-modes))))
(setq initialized t))
;; Update `info-lookup-cache'.
(setq cell (info-lookup->mode-cache topic mode)
data (list initialized completions refer-modes))
(if (not cell)
(setcdr (info-lookup->cache topic)
(cons (cons mode data) (info-lookup->topic-cache topic)))
(setcdr cell data))
initialized)))
(defun info-lookup-make-completions (topic mode)
"Create a unique alist from all index entries."
(let ((doc-spec (info-lookup->doc-spec topic mode))
(regexp (concat "^\\(" (info-lookup->regexp topic mode)
"\\)\\([ \t].*\\)?$"))
node trans entry item prefix result doc-found
(buffer (get-buffer-create " temp-info-look")))
(with-current-buffer buffer
(Info-mode))
(while doc-spec
(setq node (nth 0 (car doc-spec))
trans (cond ((eq (nth 1 (car doc-spec)) nil)
(lambda (arg)
(if (string-match regexp arg)
(match-string 1 arg))))
((stringp (nth 1 (car doc-spec)))
(setq prefix (nth 1 (car doc-spec)))
(lambda (arg)
(if (string-match "^\\([^: \t\n]+\\)" arg)
(concat prefix (match-string 1 arg)))))
(t (nth 1 (car doc-spec)))))
(with-current-buffer buffer
(message "Processing Info node `%s'..." node)
(when (condition-case error-data
(progn
(Info-goto-node node)
(setq doc-found t))
(error
(message "Cannot access Info node `%s'" node)
(sit-for 1)
nil))
(condition-case nil
(progn
(goto-char (point-min))
(and (search-forward "\n* Menu:" nil t)
(while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t)
(setq entry (match-string 1)
item (funcall trans entry))
(and (info-lookup->ignore-case topic mode)
(setq item (downcase item)))
(and (string-equal entry item)
(setq entry nil))
(or (assoc item result)
(setq result (cons (cons item entry) result))))))
(error nil))))
(message "Processing Info node `%s'...done" node)
(setq doc-spec (cdr doc-spec)))
(or doc-found
(error "Info documentation for lookup was not found"))
result))
(defun info-lookup-guess-default (topic mode)
"Pick up default item at point (with favor to look back).
Return nil if there is nothing appropriate."
(let ((modes (info-lookup->all-modes topic mode))
(start (point)) guess whitespace)
(while (and (not guess) modes)
(setq guess (info-lookup-guess-default* topic (car modes))
modes (cdr modes))
(goto-char start))
;; Collapse whitespace characters.
(and guess (concat (delete nil (mapcar (lambda (ch)
(if (or (char-equal ch ? )
(char-equal ch ?\t)
(char-equal ch ?\n))
(if (not whitespace)
(setq whitespace ? ))
(setq whitespace nil) ch))
guess))))))
(defun info-lookup-guess-default* (topic mode)
(let ((case-fold-search (info-lookup->ignore-case topic mode))
(rule (or (info-lookup->parse-rule topic mode)
(info-lookup->regexp topic mode)))
(start (point)) end regexp subexp result)
(if (symbolp rule)
(setq result (funcall rule))
(if (consp rule)
(setq regexp (car rule)
subexp (cdr rule))
(setq regexp rule
subexp 0))
(skip-chars-backward " \t\n") (setq end (point))
(while (and (re-search-backward regexp nil t)
(looking-at regexp)
(>= (match-end 0) end))
(setq result (match-string subexp)))
(if (not result)
(progn
(goto-char start)
(skip-chars-forward " \t\n")
(and (looking-at regexp)
(setq result (match-string subexp))))))
result))
(defun info-lookup-guess-c-symbol ()
"Get the C symbol at point."
(condition-case nil
(progn
(backward-sexp)
(let ((start (point)) prefix name)
;; Test for a leading `struct', `union', or `enum' keyword
;; but ignore names like `foo_struct'.
(setq prefix (and (< (skip-chars-backward " \t\n") 0)
(< (skip-chars-backward "_a-zA-Z0-9") 0)
(looking-at "\\(struct\\|union\\|enum\\)\\s ")
(concat (match-string 1) " ")))
(goto-char start)
(and (looking-at "[_a-zA-Z][_a-zA-Z0-9]*")
(setq name (match-string 0)))
;; Caveat! Look forward if point is at `struct' etc.
(and (not prefix)
(or (string-equal name "struct")
(string-equal name "union")
(string-equal name "enum"))
(looking-at "[a-z]+\\s +\\([_a-zA-Z][_a-zA-Z0-9]*\\)")
(setq prefix (concat name " ")
name (match-string 1)))
(and (or prefix name)
(concat prefix name))))
(error nil)))
;;;###autoload
(defun info-complete-symbol (&optional mode)
"Perform completion on symbol preceding point."
(interactive)
(info-complete 'symbol
(or mode
(if (info-lookup->mode-value
'symbol (info-lookup-select-mode))
info-lookup-mode
(info-lookup-change-mode 'symbol)))))
;;;###autoload
(defun info-complete-file (&optional mode)
"Perform completion on file preceding point."
(interactive)
(info-complete 'file
(or mode
(if (info-lookup->mode-value
'file (info-lookup-select-mode))
info-lookup-mode
(info-lookup-change-mode 'file)))))
(defun info-complete (topic mode)
"Try to complete a help item."
(barf-if-buffer-read-only)
(or mode (setq mode (info-lookup-select-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s completion available for `%s'" topic mode))
(let ((modes (info-lookup-quick-all-modes topic mode))
(start (point))
try)
(while (and (not try) modes)
(setq mode (car modes)
modes (cdr modes)
try (info-lookup-guess-default* topic mode))
(goto-char start))
(and (not try)
(error "Found no %S to complete" topic))
(let ((completions (info-lookup->completions topic mode))
(completion-ignore-case (info-lookup->ignore-case topic mode))
completion)
(setq completion (try-completion try completions))
(cond ((not completion)
(ding)
(message "No match"))
((stringp completion)
(or (assoc completion completions)
(setq completion (completing-read
(format "Complete %S: " topic)
completions nil t completion
info-lookup-history)))
(delete-region (- start (length try)) start)
(insert completion))
(t
(message "%s is complete"
(capitalize (prin1-to-string topic))))))))
;;; Initialize some common modes.
(info-lookup-maybe-add-help
:mode 'c-mode :topic 'symbol
:regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*"
:doc-spec '(("(libc)Function Index" nil
"^[ \t]+- \\(Function\\|Macro\\): .*\\<" "\\>")
("(libc)Variable Index" nil
"^[ \t]+- \\(Variable\\|Macro\\): .*\\<" "\\>")
("(libc)Type Index" nil
"^[ \t]+- Data Type: \\<" "\\>")
("(termcap)Var Index" nil
"^[ \t]*`" "'"))
:parse-rule 'info-lookup-guess-c-symbol)
(info-lookup-maybe-add-help
:mode 'c-mode :topic 'file
:regexp "[_a-zA-Z0-9./+-]+"
:doc-spec '(("(libc)File Index")))
(info-lookup-maybe-add-help
:mode 'bison-mode
:regexp "[:;|]\\|%\\([%{}]\\|[_a-z]+\\)\\|YY[_A-Z]+\\|yy[_a-z]+"
:doc-spec '(("(bison)Index" nil
"`" "'"))
:parse-rule "[:;|]\\|%\\([%{}]\\|[_a-zA-Z][_a-zA-Z0-9]*\\)"
:other-modes '(c-mode))
(info-lookup-maybe-add-help
:mode 'makefile-mode
:regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*"
:doc-spec '(("(make)Name Index" nil
"^[ \t]*`" "'"))
:parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
(info-lookup-maybe-add-help
:mode 'texinfo-mode
:regexp "@\\([a-zA-Z]+\\|[^a-zA-Z]\\)"
:doc-spec '(("(texinfo)Command and Variable Index"
;; Ignore Emacs commands and prepend a `@'.
(lambda (item)
(if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item)
(concat "@" (match-string 1 item))))
"`" "'")))
(info-lookup-maybe-add-help
:mode 'm4-mode
:regexp "[_a-zA-Z][_a-zA-Z0-9]*"
:doc-spec '(("(m4)Macro index"))
:parse-rule "[_a-zA-Z0-9]+")
(info-lookup-maybe-add-help
:mode 'autoconf-mode
:regexp "A[CM]_[_A-Z0-9]+"
:doc-spec '(("(autoconf)Macro Index" "AC_"
"^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")
("(automake)Index" nil
"^[ \t]*`" "'"))
;; Autoconf symbols are M4 macros. Thus use M4's parser.
:parse-rule 'ignore
:other-modes '(m4-mode))
(info-lookup-maybe-add-help
:mode 'awk-mode
:regexp "[_a-zA-Z]+"
:doc-spec '(("(gawk)Index"
(lambda (item)
(let ((case-fold-search nil))
(cond
;; `BEGIN' and `END'.
((string-match "^\\([A-Z]+\\) special pattern\\b" item)
(match-string 1 item))
;; `if', `while', `do', ...
((string-match "^\\([a-z]+\\) statement\\b" item)
(if (not (string-equal (match-string 1 item) "control"))
(match-string 1 item)))
;; `NR', `NF', ...
((string-match "^[A-Z]+$" item)
item)
;; Built-in functions (matches to many entries).
((string-match "^[a-z]+$" item)
item))))
"`" "\\([ \t]*([^)]*)\\)?'")))
(info-lookup-maybe-add-help
:mode 'perl-mode
:regexp "[$@%][^a-zA-Z]\\|\\$\\^[A-Z]\\|[$@%]?[a-zA-Z][_a-zA-Z0-9]*"
:doc-spec '(("(perl5)Function Index"
(lambda (item)
(if (string-match "^\\([a-zA-Z0-9]+\\)" item)
(match-string 1 item)))
"^" "\\b")
("(perl5)Variable Index"
(lambda (item)
;; Work around bad formatted array variables.
(let ((sym (cond ((or (string-match "^\\$\\(.\\|@@\\)$" item)
(string-match "^\\$\\^[A-Z]$" item))
item)
((string-match
"^\\([$%@]\\|@@\\)?[_a-zA-Z0-9]+" item)
(match-string 0 item))
(t ""))))
(if (string-match "@@" sym)
(setq sym (concat (substring sym 0 (match-beginning 0))
(substring sym (1- (match-end 0))))))
(if (string-equal sym "") nil sym)))
"^" "\\b"))
:parse-rule "[$@%]?\\([_a-zA-Z0-9]+\\|[^a-zA-Z]\\)")
(info-lookup-maybe-add-help
:mode 'latex-mode
:regexp "\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)"
:doc-spec '(("(latex2e)Command Index" nil
"`" "\\({[^}]*}\\)?'")))
(info-lookup-maybe-add-help
:mode 'scheme-mode
:regexp ;; "\\(\\sw\\|\\s_\\)+"
"[^()' \t\n]+"
:ignore-case t
;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm>
:doc-spec '(("(r5rs)Index")))
(info-lookup-maybe-add-help
:mode 'emacs-lisp-mode
:regexp "[^()' \t\n]+"
:doc-spec '(("(emacs)Command Index")
("(emacs)Variable Index")
("(elisp)Index"
(lambda (item)
(let ((sym (intern-soft item)))
(cond ((null sym)
(if (string-equal item "nil") item))
((or (boundp sym) (fboundp sym))
item))))
"^[ \t]+- [^:]+:[ \t]*" "\\b")))
(info-lookup-maybe-add-help
:mode 'lisp-interaction-mode
:regexp "[^()' \t\n]+"
:parse-rule 'ignore
:other-modes '(emacs-lisp-mode))
(info-lookup-maybe-add-help
:mode 'lisp-mode
:regexp "[^()' \t\n]+"
:parse-rule 'ignore
:other-modes '(emacs-lisp-mode))
(info-lookup-maybe-add-help
:mode 'scheme-mode
:regexp "[^()' \t\n]+"
:ignore-case t
:doc-spec '(("(r5rs)Index" nil
"^[ \t]+- [^:]+:[ \t]*" "\\b")))
(provide 'info-look)
;;; info-look.el ends here

View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here