mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
Delete some libraries obsolete since Emacs 24.4/24.5
* lisp/obsolete/cc-compat.el: * lisp/obsolete/info-edit.el: * lisp/obsolete/meese.el: * lisp/obsolete/otodo-mode.el: * lisp/obsolete/rcompile.el: * lisp/obsolete/sup-mouse.el: * lisp/obsolete/terminal.el: * lisp/obsolete/vi.el: * lisp/obsolete/vip.el: * lisp/obsolete/ws-mode.el: * lisp/obsolete/yow.el: Delete libraries obsolete since Emacs 24.4 and 24.5. (Bug#73257) * doc/misc/vip.texi: * etc/refcards/vipcard.tex: Delete vip.el documentation. * doc/emacs/ack.texi (Acknowledgments): * doc/misc/Makefile.in (INFO_COMMON): * etc/refcards/Makefile (PDF_ENGLISH, survival.dvi): * etc/refcards/README: * lisp/info.el (Info-url-alist): (Info-file-list-for-emacs): Delete references to above libraries.
This commit is contained in:
parent
e3c45b9d70
commit
685ec273ec
@ -1044,7 +1044,7 @@ a package for running source-level debuggers like GDB and SDB in
|
||||
Emacs; @file{asm-mode.el}, a mode for editing assembly language code;
|
||||
@file{AT386.el}, terminal support package for IBM's AT keyboards;
|
||||
@file{cookie1.el}, support for fortune-cookie programs like
|
||||
@file{yow.el} and @file{spook.el}; @file{finder.el}, a package for
|
||||
@file{spook.el}; @file{finder.el}, a package for
|
||||
finding Emacs Lisp packages by keyword and topic; @file{keyswap.el},
|
||||
code to swap the @key{BS} and @key{DEL} keys; @file{loadhist.el},
|
||||
functions for loading and unloading Emacs features;
|
||||
|
@ -74,7 +74,7 @@ INFO_COMMON = auth autotype bovine calc ccmode cl dbus dired-x \
|
||||
modus-themes newsticker nxml-mode octave-mode org pcl-cvs pgg \
|
||||
rcirc reftex remember sasl sc semantic ses sieve smtpmail \
|
||||
speedbar srecode todo-mode tramp transient url use-package \
|
||||
vhdl-mode vip viper vtable widget wisent woman
|
||||
vhdl-mode viper vtable widget wisent woman
|
||||
|
||||
## Info files to install on current platform.
|
||||
INFO_INSTALL = $(INFO_COMMON) $(DOCMISC_W32)
|
||||
|
1952
doc/misc/vip.texi
1952
doc/misc/vip.texi
File diff suppressed because it is too large
Load Diff
4
etc/NEWS
4
etc/NEWS
@ -478,6 +478,10 @@ All the characters that belong to the 'symbol' script (according to
|
||||
'char-script-table') now have the 'symbol' category, whose mnemonic is
|
||||
'5'.
|
||||
|
||||
** Some libraries obsolete since Emacs 24.4 and 24.5 have been removed:
|
||||
cc-compat.el, info-edit.el, meese.el, otodo-mode.el, rcompile.el,
|
||||
sup-mouse.el, terminal.el, vi.el, vip.el, ws-mode.el, and yow.el.
|
||||
|
||||
|
||||
* Lisp Changes in Emacs 31.1
|
||||
|
||||
|
@ -29,7 +29,6 @@ PDF_ENGLISH = \
|
||||
orgcard.pdf \
|
||||
refcard.pdf \
|
||||
survival.pdf \
|
||||
vipcard.pdf \
|
||||
viperCard.pdf
|
||||
|
||||
PDF_CZECH = \
|
||||
@ -296,12 +295,6 @@ survival.pdf: $(survival_deps)
|
||||
survival.dvi: $(survival_deps)
|
||||
$(ENVADD) tex survival.tex
|
||||
|
||||
vipcard_deps = vipcard.tex emacsver.tex pdflayout.sty
|
||||
vipcard.pdf: $(vipcard_deps)
|
||||
$(ENVADD) pdftex vipcard.tex
|
||||
vipcard.dvi: $(vipcard_deps)
|
||||
$(ENVADD) tex vipcard.tex
|
||||
|
||||
vipercard_deps = viperCard.tex emacsver.tex pdflayout.sty
|
||||
viperCard.pdf: $(vipercard_deps)
|
||||
$(ENVADD) pdftex viperCard.tex
|
||||
|
@ -32,7 +32,6 @@ List of generated cards:
|
||||
orgcard.pdf Org-Mode Reference Card
|
||||
refcard.pdf Emacs Reference Card
|
||||
survival.pdf Emacs Survival Card
|
||||
vipcard.pdf VIP Quick Reference Card
|
||||
viperCard.pdf ViperCard: Viper Reference Pal
|
||||
|
||||
Brazilian Portuguese
|
||||
|
@ -1,681 +0,0 @@
|
||||
% Quick Reference Card for VIP
|
||||
|
||||
% Copyright (C) 1987, 2001--2024 Free Software Foundation, Inc.
|
||||
|
||||
% Author: Masahiko Sato <ms@sail.stanford.edu>, <masahiko@sato.riec.tohoku.junet>
|
||||
|
||||
% This document 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 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
|
||||
% As a special additional permission, you may distribute reference cards
|
||||
% printed, or formatted for printing, with the notice "Released under
|
||||
% the terms of the GNU General Public License version 3 or later"
|
||||
% instead of the usual distributed-under-the-GNU-GPL notice, and without
|
||||
% a copy of the GPL itself.
|
||||
|
||||
% This document 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
% This file is intended to be processed by plain TeX (TeX82).
|
||||
%
|
||||
% The final reference card has six columns, three on each side.
|
||||
% This file can be used to produce it in any of three ways:
|
||||
% 1 column per page
|
||||
% produces six separate pages, each of which needs to be reduced to 80%.
|
||||
% This gives the best resolution.
|
||||
% 2 columns per page
|
||||
% produces three already-reduced pages.
|
||||
% You will still need to cut and paste.
|
||||
% 3 columns per page
|
||||
% produces two pages which must be printed sideways to make a
|
||||
% ready-to-use 8.5 x 11 inch reference card.
|
||||
% For this you need a dvi device driver that can print sideways.
|
||||
% Which mode to use is controlled by setting \columnsperpage.
|
||||
|
||||
|
||||
%**start of header
|
||||
\newcount\columnsperpage
|
||||
|
||||
% This file can be printed with 1, 2, or 3 columns per page.
|
||||
% Specify how many you want here.
|
||||
\columnsperpage=1
|
||||
|
||||
% PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
|
||||
% a landscape layout.
|
||||
\input pdflayout.sty
|
||||
\pdflayout=(1)
|
||||
|
||||
\input emacsver.tex
|
||||
\def\versionemacs{18} % version of Emacs this is for
|
||||
\def\versionvip{3.5}
|
||||
|
||||
% Nothing else needs to be changed.
|
||||
|
||||
\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
|
||||
\centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
|
||||
Permissions on back.}}
|
||||
|
||||
\def\copyrightnotice{
|
||||
%\vskip 1ex plus 2 fill\begingroup\small
|
||||
\vskip 1ex \begingroup\small
|
||||
\centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
|
||||
\centerline{For VIP \versionvip\ with GNU Emacs version \versionemacs}
|
||||
\centerline{Written by Masahiko Sato,}
|
||||
\centerline{using refcard layout designed by Stephen Gildea.}
|
||||
|
||||
Released under the terms of the GNU General Public License version 3 or later.
|
||||
|
||||
For more Emacs documentation, and the \TeX{} source for this card,
|
||||
see the Emacs distribution, or {\tt https://www.gnu.org/software/emacs}
|
||||
\endgroup}
|
||||
|
||||
% make \bye not \outer so that the \def\bye in the \else clause below
|
||||
% can be scanned without complaint.
|
||||
\def\bye{\par\vfill\supereject\end}
|
||||
|
||||
\newdimen\intercolumnskip
|
||||
\newbox\columna
|
||||
\newbox\columnb
|
||||
|
||||
\def\ncolumns{\the\columnsperpage}
|
||||
|
||||
\message{[\ncolumns\space
|
||||
column\if 1\ncolumns\else s\fi\space per page]}
|
||||
|
||||
\def\scaledmag#1{ scaled \magstep #1}
|
||||
|
||||
% This multi-way format was designed by Stephen Gildea
|
||||
% October 1986.
|
||||
% Slightly modified by Masahiko Sato, September 1987.
|
||||
\if 1\ncolumns
|
||||
\hsize 4in
|
||||
\vsize 10in
|
||||
%\voffset -.7in
|
||||
\voffset -.57in
|
||||
\font\titlefont=\fontname\tenbf \scaledmag3
|
||||
\font\headingfont=\fontname\tenbf \scaledmag2
|
||||
\font\miniheadingfont=\fontname\tenbf \scaledmag1 % masahiko
|
||||
\font\smallfont=\fontname\sevenrm
|
||||
\font\smallsy=\fontname\sevensy
|
||||
|
||||
\footline{\hss\folio}
|
||||
\def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
|
||||
\else
|
||||
%\hsize 3.2in
|
||||
%\vsize 7.95in
|
||||
\hsize 3.41in % masahiko
|
||||
\vsize 8in % masahiko
|
||||
\hoffset -.75in
|
||||
\voffset -.745in
|
||||
\font\titlefont=cmbx10 \scaledmag2
|
||||
\font\headingfont=cmbx10 \scaledmag1
|
||||
\font\miniheadingfont=cmbx10 % masahiko
|
||||
\font\smallfont=cmr6
|
||||
\font\smallsy=cmsy6
|
||||
\font\eightrm=cmr8
|
||||
\font\eightbf=cmbx8
|
||||
\font\eightit=cmti8
|
||||
\font\eightsl=cmsl8
|
||||
\font\eighttt=cmtt8
|
||||
\font\eightsy=cmsy8
|
||||
\textfont0=\eightrm
|
||||
\textfont2=\eightsy
|
||||
\def\rm{\eightrm}
|
||||
\def\bf{\eightbf}
|
||||
\def\it{\eightit}
|
||||
\def\sl{\eightsl} % masahiko
|
||||
\def\tt{\eighttt}
|
||||
\normalbaselineskip=.8\normalbaselineskip
|
||||
\normallineskip=.8\normallineskip
|
||||
\normallineskiplimit=.8\normallineskiplimit
|
||||
\normalbaselines\rm %make definitions take effect
|
||||
|
||||
\if 2\ncolumns
|
||||
\let\maxcolumn=b
|
||||
\footline{\hss\rm\folio\hss}
|
||||
\def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
|
||||
\else \if 3\ncolumns
|
||||
\let\maxcolumn=c
|
||||
\nopagenumbers
|
||||
\else
|
||||
\errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
|
||||
\errmessage{Illegal number of columns per page}
|
||||
\fi\fi
|
||||
|
||||
%\intercolumnskip=.46in
|
||||
\intercolumnskip=.19in % masahiko .19x4 + 3.41x3 = 10.99
|
||||
\def\abc{a}
|
||||
\output={%
|
||||
% This next line is useful when designing the layout.
|
||||
%\immediate\write16{Column \folio\abc\space starts with \firstmark}
|
||||
\if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
|
||||
\else\if a\abc
|
||||
\global\setbox\columna\columnbox \global\def\abc{b}
|
||||
%% in case we never use \columnb (two-column mode)
|
||||
\global\setbox\columnb\hbox to -\intercolumnskip{}
|
||||
\else
|
||||
\global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
|
||||
\def\multicolumnformat{\shipout\vbox{\makeheadline
|
||||
\hbox{\box\columna\hskip\intercolumnskip
|
||||
\box\columnb\hskip\intercolumnskip\columnbox}
|
||||
\makefootline}\advancepageno}
|
||||
\def\columnbox{\leftline{\pagebody}}
|
||||
|
||||
\def\bye{\par\vfill\supereject
|
||||
\if a\abc \else\null\vfill\eject\fi
|
||||
\if a\abc \else\null\vfill\eject\fi
|
||||
\end}
|
||||
\fi
|
||||
|
||||
% we won't be using math mode much, so redefine some of the characters
|
||||
% we might want to talk about
|
||||
\catcode`\^=12
|
||||
\catcode`\_=12
|
||||
|
||||
\chardef\\=`\\
|
||||
\chardef\{=`\{
|
||||
\chardef\}=`\}
|
||||
|
||||
\hyphenation{mini-buf-fer}
|
||||
|
||||
\parindent 0pt
|
||||
\parskip 1ex plus .5ex minus .5ex
|
||||
|
||||
\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
|
||||
|
||||
\outer\def\newcolumn{\vfill\eject}
|
||||
|
||||
\outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
|
||||
|
||||
\outer\def\section#1{\par\filbreak
|
||||
\vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
|
||||
\vskip 2ex plus 1ex minus 1.5ex}
|
||||
|
||||
% masahiko
|
||||
\outer\def\subsection#1{\par\filbreak
|
||||
\vskip 2ex plus 2ex minus 2ex {\miniheadingfont #1}\mark{#1}%
|
||||
\vskip 1ex plus 1ex minus 1.5ex}
|
||||
|
||||
\newdimen\keyindent
|
||||
|
||||
\def\beginindentedkeys{\keyindent=1em}
|
||||
\def\endindentedkeys{\keyindent=0em}
|
||||
\endindentedkeys
|
||||
|
||||
\def\paralign{\vskip\parskip\halign}
|
||||
|
||||
\def\<#1>{$\langle${\rm #1}$\rangle$}
|
||||
|
||||
\def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
|
||||
|
||||
\def\beginexample{\par\leavevmode\begingroup
|
||||
\obeylines\obeyspaces\parskip0pt\tt}
|
||||
{\obeyspaces\global\let =\ }
|
||||
\def\endexample{\endgroup}
|
||||
|
||||
\def\key#1#2{\leavevmode\hbox to \hsize{\vtop
|
||||
{\hsize=.75\hsize\rightskip=1em
|
||||
\hskip\keyindent\relax#1}\kbd{#2}\hfil}}
|
||||
|
||||
\newbox\metaxbox
|
||||
\setbox\metaxbox\hbox{\kbd{M-x }}
|
||||
\newdimen\metaxwidth
|
||||
\metaxwidth=\wd\metaxbox
|
||||
|
||||
\def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
|
||||
{\hskip\keyindent\relax#1\hfil}%
|
||||
\hskip -\metaxwidth minus 1fil
|
||||
\kbd{#2}\hfil}}
|
||||
|
||||
\def\fivecol#1#2#3#4#5{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
|
||||
&\kbd{#3}\quad&\kbd{#4}\quad&\kbd{#5}\cr}
|
||||
|
||||
\def\fourcol#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
|
||||
&\kbd{#3}\quad&\kbd{#4}\quad\cr}
|
||||
|
||||
\def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
|
||||
&\kbd{#3}\quad\cr}
|
||||
|
||||
\def\twocol#1#2{\hskip\keyindent\relax\kbd{#1}\hfil&\kbd{#2}\quad\cr}
|
||||
|
||||
\def\twocolkey#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad&\relax#3\hfil&\kbd{#4}\quad\cr}
|
||||
|
||||
%**end of header
|
||||
|
||||
\beginindentedkeys
|
||||
|
||||
\title{VIP Quick Reference Card}
|
||||
|
||||
\centerline{(Based on VIP \versionvip\ in GNU Emacs \versionemacs)}
|
||||
|
||||
%\copyrightnotice
|
||||
|
||||
\section{Loading VIP}
|
||||
|
||||
Just type \kbd{M-x vip-mode} followed by \kbd{RET}
|
||||
|
||||
\section{VIP Modes}
|
||||
|
||||
VIP has three modes: {\it emacs mode}, {\it vi mode} and {\it insert mode}.
|
||||
Mode line tells you which mode you are in.
|
||||
In emacs mode you can do all the normal GNU Emacs editing.
|
||||
This card explains only vi mode and insert mode.
|
||||
{\bf GNU Emacs Reference Card} explains emacs mode.
|
||||
You can switch modes as follows.
|
||||
|
||||
\key{from emacs mode to vi mode}{C-z}
|
||||
\key{from vi mode to emacs mode}{C-z}
|
||||
\metax{from vi mode to insert mode}{i, I, a, A, o, O {\rm or} C-o}
|
||||
\key{from insert mode to vi mode}{ESC}
|
||||
|
||||
If you wish to be in vi mode just after you startup Emacs,
|
||||
include the line:
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{(add-hook 'emacs-startup-hook 'vip-mode)}
|
||||
|
||||
in your \kbd{.emacs} file.
|
||||
Or, you can put the following alias in your \kbd{.cshrc} file.
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{alias vip 'emacs \\!* -f vip-mode'}
|
||||
|
||||
|
||||
\section{Insert Mode}
|
||||
Insert mode is like emacs mode except for the following.
|
||||
|
||||
\key{go back to vi mode}{ESC}
|
||||
\key{delete previous character}{C-h}
|
||||
\key{delete previous word}{C-w}
|
||||
\key{emulate \kbd{ESC} key in emacs mode}{C-z}
|
||||
|
||||
The rest of this card explains commands in {\bf vi mode}.
|
||||
|
||||
\section{Getting Information on VIP}
|
||||
|
||||
Execute info command by typing \kbd{M-x info} and select menu item
|
||||
\kbd{vip}. Also:
|
||||
|
||||
\key{describe function attached to the key {\it x}}{C-h k {\it x}}
|
||||
|
||||
\section{Leaving Emacs}
|
||||
|
||||
\key{suspend Emacs}{X Z {\rm or} :st}
|
||||
\metax{exit Emacs permanently}{Z Z {\rm or} X C {\rm or} :q}
|
||||
|
||||
\section{Error Recovery}
|
||||
|
||||
\key{abort partially typed or executing command}{C-g}
|
||||
\key{redraw messed up screen}{C-l}
|
||||
\metax{{\bf recover} a file lost by a system crash}{M-x recover-file}
|
||||
\metax{restore a buffer to its original contents}{M-x revert-buffer}
|
||||
|
||||
\shortcopyrightnotice
|
||||
|
||||
\section{Counts}
|
||||
|
||||
Most commands in vi mode accept a {\it count} which can be supplied as a
|
||||
prefix to the commands. In most cases, if a count is given, the
|
||||
command is executed that many times. E.g., \kbd{5 d d} deletes 5
|
||||
lines.
|
||||
|
||||
%\shortcopyrightnotice
|
||||
\section{Registers}
|
||||
|
||||
There are 26 registers (\kbd{a} to \kbd{z}) that can store texts
|
||||
and marks.
|
||||
You can append a text at the end of a register (say \kbd{x}) by
|
||||
specifying the register name in capital letter (say \kbd{X}).
|
||||
There are also 9 read only registers (\kbd{1} to \kbd{9}) that store
|
||||
up to 9 previous changes.
|
||||
We will use {\it x\/} to denote a register.
|
||||
\section{Entering Insert Mode}
|
||||
|
||||
\key{{\bf insert} at point}{i}
|
||||
\key{{\bf append} after cursor}{a}
|
||||
\key{{\bf insert} before first non-white}{I}
|
||||
\key{{\bf append} at end of line}{A}
|
||||
\key{{\bf open} line below}{o}
|
||||
\key{{\bf open} line above}{O}
|
||||
\key{{\bf open} line at point}{C-o}
|
||||
|
||||
\section{Buffers and Windows}
|
||||
|
||||
\key{move cursor to {\bf next} window}{C-n}
|
||||
\key{delete current window}{X 0}
|
||||
\key{delete other windows}{X 1}
|
||||
\key{split current window into two windows}{X 2}
|
||||
\key{show current buffer in two windows}{X 3}
|
||||
\key{{\bf switch} to a buffer in the current window}{s {\sl buffer}}
|
||||
\key{{\bf switch} to a buffer in another window}{S {\sl buffer}}
|
||||
\key{{\bf kill} a buffer}{K}
|
||||
\key{list existing {\bf buffers}}{X B}
|
||||
|
||||
\section{Files}
|
||||
|
||||
\metax{{\bf visit} file in the current window}{v {\sl file} {\rm or} :e {\sl file}}
|
||||
\key{{\bf visit} file in another window}{V {\sl file}}
|
||||
\key{{\bf save} buffer to the associated file}{X S}
|
||||
\key{{\bf write} buffer to a specified file}{X W}
|
||||
\key{{\bf insert} a specified file at point}{X I}
|
||||
\key{{\bf get} information on the current {\bf file}}{g {\rm or} :f}
|
||||
\key{run the {\bf directory} editor}{X d}
|
||||
|
||||
\section{Viewing the Buffer}
|
||||
|
||||
\key{scroll to next screen}{SPC {\rm or} C-f}
|
||||
\key{scroll to previous screen}{RET {\rm or} C-b}
|
||||
\key{scroll {\bf down} half screen}{C-d}
|
||||
\key{scroll {\bf up} half screen}{C-u}
|
||||
\key{scroll down one line}{C-e}
|
||||
\key{scroll up one line}{C-y}
|
||||
|
||||
\key{put current line on the {\bf home} line}{z H {\rm or} z RET}
|
||||
\key{put current line on the {\bf middle} line}{z M {\rm or} z .}
|
||||
\key{put current line on the {\bf last} line}{z L {\rm or} z -}
|
||||
|
||||
\section{Marking and Returning}
|
||||
|
||||
\key{{\bf mark} point in register {\it x}}{m {\it x}}
|
||||
\key{set mark at buffer beginning}{m <}
|
||||
\key{set mark at buffer end}{m >}
|
||||
\key{set mark at point}{m .}
|
||||
\key{jump to mark}{m ,}
|
||||
\key{exchange point and mark}{` `}
|
||||
\key{... and skip to first non-white on line}{' '}
|
||||
\key{go to mark {\it x}}{` {\it x}}
|
||||
\key{... and skip to first non-white on line}{' {\it x}}
|
||||
|
||||
\section{Macros}
|
||||
|
||||
\key{start remembering keyboard macro}{X (}
|
||||
\key{finish remembering keyboard macro}{X )}
|
||||
\key{call last keyboard macro}{*}
|
||||
\key{execute macro stored in register {\it x}}{@ {\it x}}
|
||||
|
||||
\section{Motion Commands}
|
||||
|
||||
\key{go backward one character}{h}
|
||||
\key{go forward one character}{l}
|
||||
\key{next line keeping the column}{j}
|
||||
\key{previous line keeping the column}{k}
|
||||
\key{next line at first non-white}{+}
|
||||
\key{previous line at first non-white}{-}
|
||||
|
||||
\key{beginning of line}{0}
|
||||
\key{first non-white on line}{^}
|
||||
\key{end of line}{\$}
|
||||
\key{go to {\it n}-th column on line}{{\it n} |}
|
||||
|
||||
\key{go to {\it n}-th line}{{\it n} G}
|
||||
\key{go to last line}{G}
|
||||
\key{find matching parenthesis for \kbd{()}, \kbd{\{\}} and \kbd{[]}}{\%}
|
||||
|
||||
\key{go to {\bf home} window line}{H}
|
||||
\key{go to {\bf middle} window line}{M}
|
||||
\key{go to {\bf last} window line}{L}
|
||||
|
||||
\subsection{Words, Sentences, Paragraphs}
|
||||
|
||||
\key{forward {\bf word}}{w {\rm or} W}
|
||||
\key{{\bf backward} word}{b {\rm or} B}
|
||||
\key{{\bf end} of word}{e {\rm or} E}
|
||||
|
||||
In the case of capital letter commands, a word is delimited by a
|
||||
non-white character.
|
||||
|
||||
\key{forward sentence}{)}
|
||||
\key{backward sentence}{(}
|
||||
|
||||
\key{forward paragraph}{\}}
|
||||
\key{backward paragraph}{\{}
|
||||
|
||||
\subsection{Find Characters on the Line}
|
||||
|
||||
\key{{\bf find} {\it c} forward on line}{f {\it c}}
|
||||
\key{{\bf find} {\it c} backward on line}{F {\it c}}
|
||||
\key{up {\bf to} {\it c} forward on line}{t {\it c}}
|
||||
\key{up {\bf to} {\it c} backward on line}{T {\it c}}
|
||||
\key{repeat previous \kbd{f}, \kbd{F}, \kbd{t} or \kbd{T}}{;}
|
||||
\key{... in the opposite direction}{,}
|
||||
|
||||
\newcolumn
|
||||
\title{VIP Quick Reference Card}
|
||||
|
||||
\section{Searching and Replacing}
|
||||
|
||||
\key{search forward for {\sl pat}}{/ {\sl pat}}
|
||||
\key{search backward for {\sl pat}}{?\ {\sl pat}}
|
||||
\key{repeat previous search}{n}
|
||||
\key{... in the opposite direction}{N}
|
||||
|
||||
\key{incremental {\bf search}}{C-s}
|
||||
\key{{\bf reverse} incremental search}{C-r}
|
||||
|
||||
\key{{\bf replace}}{R}
|
||||
\key{{\bf query} replace}{Q}
|
||||
\key{{\bf replace} a character by another character {\it c}}{r {\it c}}
|
||||
|
||||
\section{Modifying Commands}
|
||||
|
||||
The delete (yank, change) commands explained below accept a motion command as
|
||||
their argument and delete (yank, change) the region determined by the motion
|
||||
command. Motion commands are classified into {\it point commands} and
|
||||
{\it line commands}. In the case of line commands, whole lines will
|
||||
be affected by the command. Motion commands will be represented by
|
||||
{\it m} below.
|
||||
|
||||
The point commands are as follows:
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}
|
||||
|
||||
The line commands are as follows:
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{j k + - H M L \{ \} G '}
|
||||
|
||||
\subsection{Delete/Yank/Change Commands}
|
||||
|
||||
\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\cr
|
||||
\fourcol{}{{\bf delete}}{{\bf yank}}{{\bf change}}
|
||||
\fourcol{region determined by {\it m}}{d {\it m}}{y {\it m}}{c {\it m}}
|
||||
\fourcol{... into register {\it x}}{" {\it x\/} d {\it m}}{" {\it x\/} y {\it m}}{" {\it x\/} c {\it m}}
|
||||
\fourcol{a line}{d d}{Y {\rm or} y y}{c c}
|
||||
\fourcol{current {\bf region}}{d r}{y r}{c r}
|
||||
\fourcol{expanded {\bf region}}{d R}{y R}{c R}
|
||||
\fourcol{to end of line}{D}{y \$}{c \$}
|
||||
\fourcol{a character after point}{x}{y l}{c l}
|
||||
\fourcol{a character before point}{DEL}{y h}{c h}
|
||||
}
|
||||
|
||||
\subsection{Put Back Commands}
|
||||
|
||||
Deleted/yanked/changed text can be put back by the following commands.
|
||||
|
||||
\key{{\bf Put} back at point/above line}{P}
|
||||
\key{... from register {\it x}}{" {\it x\/} P}
|
||||
\key{{\bf put} back after point/below line}{p}
|
||||
\key{... from register {\it x}}{" {\it x\/} p}
|
||||
|
||||
\subsection{Repeating and Undoing Modifications}
|
||||
|
||||
\key{{\bf undo} last change}{u {\rm or} :und}
|
||||
\key{repeat last change}{.\ {\rm (dot)}}
|
||||
|
||||
Undo is undoable by \kbd{u} and repeatable by \kbd{.}.
|
||||
For example, \kbd{u...} will undo 4 previous changes.
|
||||
A \kbd{.} after \kbd{5dd} is equivalent to \kbd{5dd},
|
||||
while \kbd{3.} after \kbd{5dd} is equivalent to \kbd{3dd}.
|
||||
|
||||
\section{Miscellaneous Commands}
|
||||
|
||||
\endindentedkeys
|
||||
|
||||
\paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\tabskip=0pt&#\cr
|
||||
\fivecol{}{{\bf shift left}}{{\bf shift right}}{{\bf filter shell command}}{{\bf indent}}
|
||||
\fivecol{region}{< {\it m}}{> {\it m}}{!\ {\it m\/} {\sl shell-com}}{= {\it m}}
|
||||
\fivecol{line}{< <}{> >}{!\ !\ {\sl shell-com}}{= =}
|
||||
}
|
||||
|
||||
\key{emulate \kbd{ESC}/\kbd{C-h} in emacs mode}{ESC{\rm /}C-h}
|
||||
\key{emulate \kbd{C-c}/\kbd{C-x} in emacs mode}{C{\rm /}X}
|
||||
|
||||
\key{{\bf join} lines}{J}
|
||||
|
||||
\key{lowercase region}{\# c {\it m}}
|
||||
\key{uppercase region}{\# C {\it m}}
|
||||
\key{execute last keyboard macro on each line in the region}{\# g {\it m}}
|
||||
|
||||
\key{insert specified string for each line in the region}{\# q {\it m}}
|
||||
\key{check spelling of the words in the region}{\# s {\it m}}
|
||||
|
||||
\section{Differences from Vi}
|
||||
|
||||
\beginindentedkeys
|
||||
|
||||
In VIP some keys behave rather differently from Vi.
|
||||
The table below lists such keys, and you can get the effect of typing
|
||||
these keys by typing the corresponding keys in the VIP column.
|
||||
|
||||
\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
|
||||
\threecol{}{{\bf Vi}}{{\bf VIP}}
|
||||
\threecol{forward character}{SPC}{l}
|
||||
\threecol{backward character}{C-h}{h}
|
||||
\threecol{next line at first non-white}{RET}{+}
|
||||
\threecol{delete previous character}{X}{DEL}
|
||||
\threecol{get information on file}{C-g}{g}
|
||||
\threecol{substitute characters}{s}{x i}
|
||||
\threecol{substitute line}{S}{c c}
|
||||
\threecol{change to end of line}{C {\rm or} R}{c \$}
|
||||
}
|
||||
|
||||
(Strictly speaking, \kbd{C} and \kbd{R} behave slightly differently in Vi.)
|
||||
|
||||
\section{Customization}
|
||||
|
||||
By default, search is case sensitive.
|
||||
You can change this by including the following line in your \kbd{.vip} file.
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{(setq vip-case-fold-search t)}
|
||||
|
||||
\beginindentedkeys
|
||||
|
||||
\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
|
||||
\twocol{{\bf variable}}{{\bf default value}}
|
||||
\twocol{vip-search-wrap-around}{t}
|
||||
\twocol{vip-case-fold-search}{nil}
|
||||
\twocol{vip-re-search}{nil}
|
||||
\twocol{vip-re-replace}{nil}
|
||||
\twocol{vip-re-query-replace}{nil}
|
||||
\twocol{vip-open-with-indent}{nil}
|
||||
\twocol{vip-help-in-insert-mode}{nil}
|
||||
\twocol{vip-shift-width}{8}
|
||||
\twocol{vip-tags-file-name}{"TAGS"}
|
||||
}
|
||||
|
||||
%\subsection{Customizing Key Bindings}
|
||||
|
||||
Include (some of) following lines in your \kbd{.vip} file
|
||||
to restore Vi key bindings.
|
||||
|
||||
\beginexample
|
||||
(define-key vip-mode-map "\\C-g" 'vip-info-on-file)
|
||||
(define-key vip-mode-map "\\C-h" 'vip-backward-char)
|
||||
(define-key vip-mode-map "\\C-m" 'vip-next-line-at-bol)
|
||||
(define-key vip-mode-map " " 'vip-forward-char)
|
||||
(define-key vip-mode-map "g" 'vip-keyboard-quit)
|
||||
(define-key vip-mode-map "s" 'vip-substitute)
|
||||
(define-key vip-mode-map "C" 'vip-change-to-eol)
|
||||
(define-key vip-mode-map "R" 'vip-change-to-eol)
|
||||
(define-key vip-mode-map "S" 'vip-substitute-line)
|
||||
(define-key vip-mode-map "X" 'vip-delete-backward-char)
|
||||
\endexample
|
||||
|
||||
\newcolumn
|
||||
|
||||
\title{Ex Commands in VIP}
|
||||
|
||||
In vi mode, an Ex command is entered by typing:
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{:\ {\sl ex-command} RET}
|
||||
|
||||
\section{Ex Addresses}
|
||||
|
||||
\paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=2pt&#\tabskip=5pt plus 1 fil&#\cr
|
||||
\twocolkey{current line}{.}{next line with {\sl pat}}{/ {\sl pat} /}
|
||||
\twocolkey{line {\it n}}{{\it n}}{previous line with {\sl pat}}{?\ {\sl pat} ?}
|
||||
\twocolkey{last line}{\$}{{\it n\/} line before {\it a}}{{\it a} - {\it n}}
|
||||
\twocolkey{next line}{+}{{\it a\/} through {\it b}}{{\it a\/} , {\it b}}
|
||||
\twocolkey{previous line}{-}{line marked with {\it x}}{' {\it x}}
|
||||
\twocolkey{entire buffer}{\%}{previous context}{' '}
|
||||
}
|
||||
|
||||
Addresses can be specified in front of a command.
|
||||
For example,
|
||||
|
||||
\hskip 5ex
|
||||
\kbd{:.,.+10m\$}
|
||||
|
||||
moves 11 lines below current line to the end of buffer.
|
||||
|
||||
\section{Ex Commands}
|
||||
|
||||
\endindentedkeys
|
||||
|
||||
\key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}
|
||||
|
||||
\key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}
|
||||
|
||||
|
||||
\key{{\bf move} specified lines after {\sl addr}}{:m {\sl addr}}
|
||||
\key{{\bf copy} specified lines after {\sl addr}}{:co\rm\ (or \kbd{:t})\ \sl addr}
|
||||
\key{{\bf delete} specified lines [into register {\it x\/}]}{:d {\rm [{\it x\/}]}}
|
||||
\key{{\bf yank} specified lines [into register {\it x\/}]}{:y {\rm [{\it x\/}]}}
|
||||
\key{{\bf put} back text [from register {\it x\/}]}{:pu {\rm [{\it x\/}]}}
|
||||
|
||||
\key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}
|
||||
|
||||
\key{repeat last substitution}{:\&}
|
||||
\key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}
|
||||
|
||||
\key{{\bf read} in a file}{:r {\sl file}}
|
||||
\key{{\bf read} in the output of a shell command}{:r!\ {\sl command}}
|
||||
\key{write out specified lines into {\sl file}}{:w {\sl file}}
|
||||
\key{write out specified lines at the end of {\sl file}}{:w>> {\sl file}}
|
||||
\key{write out and then quit}{:wq {\sl file}}
|
||||
|
||||
\key{define a macro {\it x} that expands to {\sl cmd}}{:map {\it x} {\sl cmd}}
|
||||
\key{remove macro expansion associated with {\it x}}{:unma {\it x}}
|
||||
|
||||
\key{print line number}{:=}
|
||||
\key{print {\bf version} number of VIP}{:ve}
|
||||
|
||||
\key{shift specified lines to the right}{:>}
|
||||
\key{shift specified lines to the left}{:<}
|
||||
|
||||
\key{{\bf join} lines}{:j}
|
||||
\key{mark specified line to register {\it x}}{:k {\it x}}
|
||||
\key{{\bf set} a variable's value}{:se}
|
||||
\key{run a sub{\bf shell} in a window}{:sh}
|
||||
\key{execute shell command {\sl command}}{:!\ {\sl command}}
|
||||
\key{find first definition of {\bf tag} {\sl tag}}{:ta {\sl tag}}
|
||||
|
||||
|
||||
\copyrightnotice
|
||||
|
||||
\bye
|
||||
|
||||
% Local variables:
|
||||
% compile-command: "pdftex vipcard"
|
||||
% End:
|
@ -223,7 +223,7 @@ These directories are searched after those in `Info-directory-list'."
|
||||
"org" "pcl-cvs" "pgg" "rcirc" "reftex" "remember" "sasl" "sc"
|
||||
"semantic" "ses" "sieve" "smtpmail" "speedbar" "srecode"
|
||||
"todo-mode" "tramp" "transient" "url" "use-package" "vhdl-mode"
|
||||
"vip" "viper" "vtable" "widget" "wisent" "woman") .
|
||||
"viper" "vtable" "widget" "wisent" "woman") .
|
||||
"https://www.gnu.org/software/emacs/manual/html_node/%m/%e"))
|
||||
"Alist telling `Info-mode' where manuals are accessible online.
|
||||
|
||||
@ -4675,7 +4675,7 @@ Advanced commands:
|
||||
|
||||
(defvar Info-file-list-for-emacs
|
||||
'("ediff" "eudc" "forms" "gnus" "info" ("Info" . "info") ("mh" . "mh-e")
|
||||
"sc" "message" ("dired" . "dired-x") "viper" "vip" "idlwave"
|
||||
"sc" "message" ("dired" . "dired-x") "viper" "idlwave"
|
||||
("c" . "ccmode") ("c++" . "ccmode") ("objc" . "ccmode")
|
||||
("java" . "ccmode") ("idl" . "ccmode") ("pike" . "ccmode")
|
||||
("skeleton" . "autotype") ("auto-insert" . "autotype")
|
||||
|
@ -1,165 +0,0 @@
|
||||
;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1985, 1987, 1992-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Authors: 1998- Martin Stjernholm
|
||||
;; 1994-1999 Barry A. Warsaw
|
||||
;; Maintainer: bug-cc-mode@gnu.org
|
||||
;; Created: August 1994, split from cc-mode.el
|
||||
;; Keywords: c languages
|
||||
;; Package: cc-mode
|
||||
;; Obsolete-Since: 24.5
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Boring old c-mode.el (BOCM) is confusion and brain melt. cc-mode.el
|
||||
;; is clarity of thought and purity of chi. If you are still unwilling
|
||||
;; to accept enlightenment, this might help, or it may prolong your
|
||||
;; agony.
|
||||
;;
|
||||
;; To use, add the following to your c-mode-hook:
|
||||
;;
|
||||
;; (require 'cc-compat)
|
||||
;; (c-set-style "BOCM")
|
||||
;;
|
||||
;; This file is completely unsupported! Although it has been patched
|
||||
;; superficially to keep pace with the rest of CC Mode, it hasn't been
|
||||
;; tested for a long time.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(let ((load-path
|
||||
(if (and (boundp 'byte-compile-dest-file)
|
||||
(stringp byte-compile-dest-file))
|
||||
(cons (file-name-directory byte-compile-dest-file) load-path)
|
||||
load-path)))
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(cc-require 'cc-defs)
|
||||
(cc-require 'cc-vars)
|
||||
(cc-require 'cc-styles)
|
||||
(cc-require 'cc-engine)
|
||||
|
||||
|
||||
;; In case c-mode.el isn't loaded
|
||||
(defvar c-indent-level 2
|
||||
"Indentation of C statements with respect to containing block.")
|
||||
;;;###autoload(put 'c-indent-level 'safe-local-variable 'integerp)
|
||||
|
||||
(defvar c-brace-imaginary-offset 0
|
||||
"Imagined indentation of a C open brace that actually follows a statement.")
|
||||
(defvar c-brace-offset 0
|
||||
"Extra indentation for braces, compared with other text in same context.")
|
||||
(defvar c-argdecl-indent 5
|
||||
"Indentation level of declarations of C function arguments.")
|
||||
(defvar c-label-offset -2
|
||||
"Offset of C label lines and case statements relative to usual indentation.")
|
||||
(defvar c-continued-statement-offset 2
|
||||
"Extra indent for lines not starting new statements.")
|
||||
(defvar c-continued-brace-offset 0
|
||||
"Extra indent for substatements that start with open-braces.
|
||||
This is in addition to c-continued-statement-offset.")
|
||||
|
||||
|
||||
|
||||
;; these offsets are taken by brute force testing c-mode.el, since
|
||||
;; there's no logic to what it does.
|
||||
(let* ((offsets '((c-offsets-alist .
|
||||
((defun-block-intro . cc-block-intro-offset)
|
||||
(statement-block-intro . cc-block-intro-offset)
|
||||
(defun-open . 0)
|
||||
(class-open . 0)
|
||||
(inline-open . c-brace-offset)
|
||||
(block-open . c-brace-offset)
|
||||
(block-close . cc-block-close-offset)
|
||||
(brace-list-open . c-brace-offset)
|
||||
(substatement-open . cc-substatement-open-offset)
|
||||
(substatement . c-continued-statement-offset)
|
||||
(knr-argdecl-intro . c-argdecl-indent)
|
||||
(case-label . c-label-offset)
|
||||
(access-label . c-label-offset)
|
||||
(label . c-label-offset)
|
||||
)))))
|
||||
(c-add-style "BOCM" offsets))
|
||||
|
||||
|
||||
(defun cc-block-intro-offset (langelem)
|
||||
;; taken directly from calculate-c-indent confusion
|
||||
(save-excursion
|
||||
(c-backward-syntactic-ws)
|
||||
(if (eq (char-before) ?{)
|
||||
(forward-char -1)
|
||||
(goto-char (cdr langelem)))
|
||||
(let* ((curcol (save-excursion
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage
|
||||
;; If no previous statement, indent it relative to line
|
||||
;; brace is on. For open brace in column zero, don't let
|
||||
;; statement start there too. If c-indent-level is zero,
|
||||
;; use c-brace-offset + c-continued-statement-offset
|
||||
;; instead. For open-braces not the first thing in a line,
|
||||
;; add in c-brace-imaginary-offset.
|
||||
(+ (if (and (bolp) (zerop c-indent-level))
|
||||
(+ c-brace-offset c-continued-statement-offset)
|
||||
c-indent-level)
|
||||
;; Move back over whitespace before the openbrace. If
|
||||
;; openbrace is not first nonwhite thing on the line,
|
||||
;; add the c-brace-imaginary-offset.
|
||||
(progn (skip-chars-backward " \t")
|
||||
(if (bolp) 0 c-brace-imaginary-offset))
|
||||
;; If the openbrace is preceded by a parenthesized exp,
|
||||
;; move to the beginning of that; possibly a different
|
||||
;; line
|
||||
(progn
|
||||
(if (eq (char-before) ?\))
|
||||
(c-forward-sexp -1))
|
||||
;; Get initial indentation of the line we are on.
|
||||
(current-indentation)))))
|
||||
(- bocm-lossage curcol))))
|
||||
|
||||
|
||||
(defun cc-block-close-offset (langelem)
|
||||
(save-excursion
|
||||
(let* ((here (point))
|
||||
bracep
|
||||
(curcol (progn
|
||||
(goto-char (cdr langelem))
|
||||
(current-column)))
|
||||
(bocm-lossage (progn
|
||||
(goto-char (cdr langelem))
|
||||
(if (eq (char-after) ?{)
|
||||
(setq bracep t)
|
||||
(goto-char here)
|
||||
(beginning-of-line)
|
||||
(backward-up-list 1)
|
||||
(forward-char 1)
|
||||
(c-forward-syntactic-ws))
|
||||
(current-column))))
|
||||
(- bocm-lossage curcol
|
||||
(if bracep 0 c-indent-level)))))
|
||||
|
||||
|
||||
(defun cc-substatement-open-offset (_langelem)
|
||||
(+ c-continued-statement-offset c-continued-brace-offset))
|
||||
|
||||
|
||||
(cc-provide 'cc-compat)
|
||||
|
||||
;;; cc-compat.el ends here
|
@ -1,89 +0,0 @@
|
||||
;;; info-edit.el --- Editing info files -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 1985-1986, 1992-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
;; Keywords: help
|
||||
;; Obsolete-since: 24.4
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'info)
|
||||
|
||||
(defvar Info-edit-mode-hook nil
|
||||
"Hook run when `Info-edit-mode' is activated.")
|
||||
|
||||
(make-obsolete-variable 'Info-edit-mode-hook
|
||||
"editing Info nodes by hand is not recommended." "24.4")
|
||||
|
||||
(defvar Info-edit-mode-map (let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map text-mode-map)
|
||||
(define-key map "\C-c\C-c" #'Info-cease-edit)
|
||||
map)
|
||||
"Local keymap used within `e' command of Info.")
|
||||
|
||||
(make-obsolete-variable 'Info-edit-mode-map
|
||||
"editing Info nodes by hand is not recommended."
|
||||
"24.4")
|
||||
|
||||
;; Info-edit mode is suitable only for specially formatted data.
|
||||
(put 'Info-edit-mode 'mode-class 'special)
|
||||
|
||||
(define-derived-mode Info-edit-mode text-mode "Info Edit"
|
||||
"Major mode for editing the contents of an Info node.
|
||||
Like text mode with the addition of `Info-cease-edit'
|
||||
which returns to Info mode for browsing."
|
||||
(setq buffer-read-only nil)
|
||||
(force-mode-line-update)
|
||||
(buffer-enable-undo (current-buffer)))
|
||||
|
||||
(defun Info-edit ()
|
||||
"Edit the contents of this Info node."
|
||||
(interactive)
|
||||
(Info-edit-mode)
|
||||
(message "%s" (substitute-command-keys
|
||||
"Editing: Type \\<Info-edit-mode-map>\\[Info-cease-edit] to return to info")))
|
||||
|
||||
(put 'Info-edit 'disabled "Editing Info nodes by hand is not recommended.
|
||||
This feature will be removed in future.")
|
||||
|
||||
(defun Info-cease-edit ()
|
||||
"Finish editing Info node; switch back to Info proper."
|
||||
(interactive)
|
||||
;; Do this first, so nothing has changed if user C-g's at query.
|
||||
(and (buffer-modified-p)
|
||||
(y-or-n-p "Save the file? ")
|
||||
(save-buffer))
|
||||
(Info-mode)
|
||||
(force-mode-line-update)
|
||||
(and (marker-position Info-tag-table-marker)
|
||||
(buffer-modified-p)
|
||||
(message "Tags may have changed. Use Info-tagify if necessary")))
|
||||
|
||||
(with-eval-after-load 'ibuffer
|
||||
(defvar ibuffer-help-buffer-modes)
|
||||
;; Moved here from definition of ibuffer-help-buffer-modes to make
|
||||
;; that variable customizable even though this code is obsolete. See
|
||||
;; also Bug#30990.
|
||||
(add-to-list 'ibuffer-help-buffer-modes 'Info-edit-mode))
|
||||
|
||||
(provide 'info-edit)
|
||||
|
||||
;;; info-edit.el ends here
|
@ -1,38 +0,0 @@
|
||||
;;; meese.el --- protect the impressionable young minds of America -*- lexical-binding: t; -*-
|
||||
|
||||
;; This is in the public domain on account of being distributed since
|
||||
;; 1985 or 1986 without a copyright notice.
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
;; Keywords: games
|
||||
;; Obsolete-since: 24.4
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Adds a hook to protect the impressionable young minds of America
|
||||
;; from reading certain files in the Emacs distribution using Emacs.
|
||||
|
||||
;; This file is named after Ed Meese, the US Attorney General
|
||||
;; under President Reagan, because of his support for censorship.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun protect-innocence-hook ()
|
||||
(let ((dir (file-name-directory buffer-file-name)))
|
||||
(if (and (equal buffer-file-name (expand-file-name "sex.6" dir))
|
||||
(file-exists-p buffer-file-name)
|
||||
(not (y-or-n-p "Are you over 18? ")))
|
||||
(progn
|
||||
(clear-visited-file-modtime)
|
||||
(setq buffer-file-name (expand-file-name "celibacy.1" dir))
|
||||
(let ((inhibit-read-only t)) ; otherwise (erase-buffer) may bomb.
|
||||
(erase-buffer)
|
||||
(insert-file-contents buffer-file-name t))
|
||||
(rename-buffer (file-name-nondirectory buffer-file-name))))))
|
||||
|
||||
;;;(add-hook 'find-file-hook 'protect-innocence-hook)
|
||||
(provide 'meese)
|
||||
|
||||
;;; meese.el ends here
|
@ -1,965 +0,0 @@
|
||||
;;; otodo-mode.el --- major mode for editing TODO list files -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997, 1999, 2001-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Oliver Seidel <privat@os10000.net>
|
||||
;; Maintainer: Stephen Berman <stephen.berman@gmx.net>
|
||||
;; Created: 2 Aug 1997
|
||||
;; Keywords: calendar, todo
|
||||
;; Obsolete-since: 24.4
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Mode Description
|
||||
;;
|
||||
;; TODO is a major mode for EMACS which offers functionality to
|
||||
;; treat most lines in one buffer as a list of items one has to
|
||||
;; do. There are facilities to add new items, which are
|
||||
;; categorized, to edit or even delete items from the buffer.
|
||||
;; The buffer contents are currently compatible with the diary,
|
||||
;; so that the list of todo-items will show up in the FANCY diary
|
||||
;; mode.
|
||||
;;
|
||||
;; Notice: Besides the major mode, this file also exports the
|
||||
;; function `todo-show' which will change to the one specific
|
||||
;; TODO file that has been specified in the todo-file-do
|
||||
;; variable. If this file does not conform to the TODO mode
|
||||
;; conventions, the todo-show function will add the appropriate
|
||||
;; header and footer. I don't anticipate this to cause much
|
||||
;; grief, but be warned, in case you attempt to read a plain text
|
||||
;; file.
|
||||
;;
|
||||
;; Preface, Quickstart Installation
|
||||
;;
|
||||
;; To get this to work, make Emacs execute the line
|
||||
;;
|
||||
;; (autoload 'todo-mode "todo-mode"
|
||||
;; "Major mode for editing TODO lists." t)
|
||||
;; (autoload 'todo-show "todo-mode"
|
||||
;; "Show TODO items." t)
|
||||
;; (autoload 'todo-insert-item "todo-mode"
|
||||
;; "Add TODO item." t)
|
||||
;;
|
||||
;; You may now enter new items by typing "M-x todo-insert-item",
|
||||
;; or enter your TODO list file by typing "M-x todo-show".
|
||||
;;
|
||||
;; The TODO list file has a special format and some auxiliary
|
||||
;; information, which will be added by the todo-show function if
|
||||
;; it attempts to visit an un-initialized file. Hence it is
|
||||
;; recommended to use the todo-show function for the first time,
|
||||
;; in order to initialize the file, but it is not necessary
|
||||
;; afterwards.
|
||||
;;
|
||||
;; As these commands are quite long to type, I would recommend
|
||||
;; the addition of two bindings to your to your global keymap. I
|
||||
;; personally have the following in my initialization file:
|
||||
;;
|
||||
;; (global-set-key "\C-ct" 'todo-show) ; switch to TODO buffer
|
||||
;; (global-set-key "\C-ci" 'todo-insert-item) ; insert new item
|
||||
;;
|
||||
;; Note, however, that this recommendation has prompted some
|
||||
;; criticism, since the keys C-c LETTER are reserved for user
|
||||
;; functions. I believe my recommendation is acceptable, since
|
||||
;; the Emacs Lisp Manual *Tips* section also details that the
|
||||
;; mode itself should not bind any functions to those keys. The
|
||||
;; express aim of the above two bindings is to work outside the
|
||||
;; mode, which doesn't need the show function and offers a
|
||||
;; different binding for the insert function. They serve as
|
||||
;; shortcuts and are not even needed (since the TODO mode will be
|
||||
;; entered by visiting the TODO file, and later by switching to
|
||||
;; its buffer).
|
||||
;;
|
||||
;; If you are an advanced user of this package, please consult
|
||||
;; the whole source code for autoloads, because there are several
|
||||
;; extensions that are not explicitly listed in the above quick
|
||||
;; installation.
|
||||
;;
|
||||
;; Pre-Requisites
|
||||
;;
|
||||
;; This package will require the following packages to be
|
||||
;; available on the load-path:
|
||||
;;
|
||||
;; time-stamp
|
||||
;; easymenu
|
||||
;;
|
||||
;; Operation
|
||||
;;
|
||||
;; You will have the following facilities available:
|
||||
;;
|
||||
;; M-x todo-show will enter the todo list screen, here type
|
||||
;;
|
||||
;; + to go to next category
|
||||
;; - to go to previous category
|
||||
;; d to file the current entry, including a
|
||||
;; comment and timestamp
|
||||
;; e to edit the current entry
|
||||
;; E to edit a multi-line entry
|
||||
;; f to file the current entry, including a
|
||||
;; comment and timestamp
|
||||
;; i to insert a new entry, with prefix, omit category
|
||||
;; I to insert a new entry at current cursor position
|
||||
;; j jump to category
|
||||
;; k to kill the current entry
|
||||
;; l to lower the current entry's priority
|
||||
;; n for the next entry
|
||||
;; p for the previous entry
|
||||
;; P print
|
||||
;; q to save the list and exit the buffer
|
||||
;; r to raise the current entry's priority
|
||||
;; s to save the list
|
||||
;; S to save the list of top priorities
|
||||
;; t show top priority items for each category
|
||||
;;
|
||||
;; When you add a new entry, you are asked for the text and then
|
||||
;; for the category. I for example have categories for things
|
||||
;; that I want to do in the office (like mail my mum), that I
|
||||
;; want to do in town (like buy cornflakes) and things I want to
|
||||
;; do at home (move my suitcases). The categories can be
|
||||
;; selected with the cursor keys and if you type in the name of a
|
||||
;; category which didn't exist before, an empty category of the
|
||||
;; desired name will be added and filled with the new entry.
|
||||
;;
|
||||
;; Configuration
|
||||
;;
|
||||
;; Variable todo-prefix
|
||||
;;
|
||||
;; I would like to recommend that you use the prefix "*/*" (by
|
||||
;; leaving the variable 'todo-prefix' untouched) so that the
|
||||
;; diary displays each entry every day.
|
||||
;;
|
||||
;; To understand what I mean, please read the documentation that
|
||||
;; goes with the calendar since that will tell you how you can
|
||||
;; set up the fancy diary display and use the #include command to
|
||||
;; include your todo list file as part of your diary.
|
||||
;;
|
||||
;; If you have the diary package set up to usually display more
|
||||
;; than one day's entries at once, consider using
|
||||
;;
|
||||
;; "&%%(equal (calendar-current-date) date)"
|
||||
;;
|
||||
;; as the value of `todo-prefix'. Please note that this may slow
|
||||
;; down the processing of your diary file some.
|
||||
;;
|
||||
;; Carsten Dominik <dominik@strw.LeidenUniv.nl> suggested that
|
||||
;;
|
||||
;; "&%%(todo-cp)"
|
||||
;;
|
||||
;; might be nicer and to that effect a function has been declared
|
||||
;; further down in the code. You may wish to auto-load this.
|
||||
;;
|
||||
;; Carsten also writes that *changing* the prefix after the
|
||||
;; todo list is already established is not as simple as changing
|
||||
;; the variable - the todo files have to be changed by hand.
|
||||
;;
|
||||
;; Variable todo-file-do
|
||||
;;
|
||||
;; This variable is fairly self-explanatory. You have to store
|
||||
;; your TODO list somewhere. This variable tells the package
|
||||
;; where to go and find this file.
|
||||
;;
|
||||
;; Variable todo-file-done
|
||||
;;
|
||||
;; Even when you're done, you may wish to retain the entries.
|
||||
;; Given that they're timestamped and you are offered to add a
|
||||
;; comment, this can make a useful diary of past events. It will
|
||||
;; even blend in with the EMACS diary package. So anyway, this
|
||||
;; variable holds the name of the file for the filed todo-items.
|
||||
;;
|
||||
;; Variable todo-file-top
|
||||
;;
|
||||
;; File storing the top priorities of your TODO list when
|
||||
;; todo-save-top-priorities is non-nil. Nice to include in your
|
||||
;; diary instead of the complete TODO list.
|
||||
;;
|
||||
;; Variable todo-mode-hook
|
||||
;;
|
||||
;; Just like other modes, too, this mode offers to call your
|
||||
;; functions before it goes about its business. This variable
|
||||
;; will be inspected for any functions you may wish to have
|
||||
;; called once the other TODO mode preparations have been
|
||||
;; completed.
|
||||
;;
|
||||
;; Variable todo-insert-threshold
|
||||
;;
|
||||
;; Another nifty feature is the insertion accuracy. If you have
|
||||
;; 8 items in your TODO list, then you may get asked 4 questions
|
||||
;; by the binary insertion algorithm. However, you may not
|
||||
;; really have a need for such accurate priorities amongst your
|
||||
;; TODO items. If you now think about the binary insertion
|
||||
;; halving the size of the window each time, then the threshold
|
||||
;; is the window size at which it will stop. If you set the
|
||||
;; threshold to zero, the upper and lower bound will coincide at
|
||||
;; the end of the loop and you will insert your item just before
|
||||
;; that point. If you set the threshold to, e.g. 8, it will stop
|
||||
;; as soon as the window size drops below that amount and will
|
||||
;; insert the item in the approximate center of that window. I
|
||||
;; got the idea for this feature after reading a very helpful
|
||||
;; e-mail reply from Trey Jackson <trey@cs.berkeley.edu> who
|
||||
;; corrected some of my awful coding and pointed me towards some
|
||||
;; good reading. Thanks Trey!
|
||||
;;
|
||||
;; Things to do
|
||||
;;
|
||||
;; These originally were my ideas, but now also include all the
|
||||
;; suggestions that I included before forgetting them:
|
||||
;;
|
||||
;; o Fancy fonts for todo/top-priority buffer
|
||||
;; o Remove todo-prefix option in todo-top-priorities
|
||||
;; o Rename category
|
||||
;; o Move entry from one category to another one
|
||||
;; o Entries which both have the generic */* prefix and a
|
||||
;; "deadline" entry which are understood by diary, indicating
|
||||
;; an event (unless marked by &)
|
||||
;; o The optional COUNT variable of todo-forward-item should be
|
||||
;; applied to the other functions performing similar tasks
|
||||
;; o Modularization could be done for repeated elements of
|
||||
;; the code, like the completing-read lines of code.
|
||||
;; o license / version function
|
||||
;; o export to diary file
|
||||
;; o todo-report-bug
|
||||
;; o GNATS support
|
||||
;; o elide multiline (as in bbdb, or, to a lesser degree, in
|
||||
;; outline mode)
|
||||
;; o rewrite complete package to store data as Lisp objects
|
||||
;; and have display modes for display, for diary export,
|
||||
;; etc. (Richard Stallman pointed out this is a bad idea)
|
||||
;; o so base todo-mode.el on generic-mode.el instead
|
||||
;;
|
||||
;; History and Gossip
|
||||
;;
|
||||
;; Many thanks to all the ones who have contributed to the
|
||||
;; evolution of this package! I hope I have listed all of you
|
||||
;; somewhere in the documentation or at least in the RCS history!
|
||||
;;
|
||||
;; Enjoy this package and express your gratitude by sending nice
|
||||
;; things to my parents' address!
|
||||
;;
|
||||
;; Oliver Seidel
|
||||
;; (Lessingstr. 8, 65760 Eschborn, Federal Republic of Germany)
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'time-stamp)
|
||||
|
||||
|
||||
;; User-configurable variables:
|
||||
|
||||
(defgroup todo nil
|
||||
"Maintain a list of todo items."
|
||||
:link '(emacs-commentary-link "todo-mode")
|
||||
:version "21.1"
|
||||
:group 'calendar)
|
||||
|
||||
(defcustom todo-prefix "*/*"
|
||||
"TODO mode prefix for entries.
|
||||
|
||||
This is useful in conjunction with `calendar' and `diary' if you use
|
||||
|
||||
#include \"~/.emacs.d/todo-do\"
|
||||
|
||||
in your diary file to include your todo list file as part of your
|
||||
diary. With the default value \"*/*\" the diary displays each entry
|
||||
every day and it may also be marked on every day of the calendar.
|
||||
Using \"&%%(equal (calendar-current-date) date)\" instead will only
|
||||
show and mark todo entries for today, but may slow down processing of
|
||||
the diary file somewhat."
|
||||
:type 'string)
|
||||
(defcustom todo-file-do (locate-user-emacs-file "todo-do" ".todo-do")
|
||||
"TODO mode list file."
|
||||
:version "24.4" ; added locate-user-emacs-file
|
||||
:type 'file)
|
||||
(defcustom todo-file-done (locate-user-emacs-file "todo-done" ".todo-done")
|
||||
"TODO mode archive file."
|
||||
:version "24.4" ; added locate-user-emacs-file
|
||||
:type 'file)
|
||||
(defcustom todo-mode-hook nil
|
||||
"TODO mode hooks."
|
||||
:type 'hook)
|
||||
(defcustom todo-edit-mode-hook nil
|
||||
"TODO Edit mode hooks."
|
||||
:type 'hook)
|
||||
(defcustom todo-insert-threshold 0
|
||||
"TODO mode insertion accuracy.
|
||||
|
||||
If you have 8 items in your TODO list, then you may get asked 4
|
||||
questions by the binary insertion algorithm. However, you may not
|
||||
really have a need for such accurate priorities amongst your TODO
|
||||
items. If you now think about the binary insertion halving the size
|
||||
of the window each time, then the threshold is the window size at
|
||||
which it will stop. If you set the threshold to zero, the upper and
|
||||
lower bound will coincide at the end of the loop and you will insert
|
||||
your item just before that point. If you set the threshold to,
|
||||
e.g. 8, it will stop as soon as the window size drops below that
|
||||
amount and will insert the item in the approximate center of that
|
||||
window."
|
||||
:type 'integer)
|
||||
(defvar todo-edit-buffer " *TODO Edit*"
|
||||
"TODO Edit buffer name.")
|
||||
(defcustom todo-file-top (locate-user-emacs-file "todo-top" ".todo-top")
|
||||
"TODO mode top priorities file.
|
||||
|
||||
Not in TODO format, but diary compatible.
|
||||
Automatically generated when `todo-save-top-priorities' is non-nil."
|
||||
:version "24.4" ; added locate-user-emacs-file
|
||||
:type 'string)
|
||||
|
||||
(defcustom todo-print-function 'ps-print-buffer-with-faces
|
||||
"Function to print the current buffer."
|
||||
:type 'symbol)
|
||||
(defcustom todo-show-priorities 1
|
||||
"Default number of priorities to show by \\[todo-top-priorities].
|
||||
0 means show all entries."
|
||||
:type 'integer)
|
||||
(defcustom todo-print-priorities 0
|
||||
"Default number of priorities to print by \\[todo-print].
|
||||
0 means print all entries."
|
||||
:type 'integer)
|
||||
(defcustom todo-remove-separator t
|
||||
"Non-nil to remove category separators in\
|
||||
\\[todo-top-priorities] and \\[todo-print]."
|
||||
:type 'boolean)
|
||||
(defcustom todo-save-top-priorities-too t
|
||||
"Non-nil makes `todo-save' automatically save top-priorities in `todo-file-top'."
|
||||
:type 'boolean)
|
||||
|
||||
;; Thanks for the ISO time stamp format go to Karl Eichwalder <ke@suse.de>
|
||||
;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p".
|
||||
;;
|
||||
(defcustom todo-time-string-format
|
||||
"%:y-%02m-%02d %02H:%02M"
|
||||
"TODO mode time string format for done entries.
|
||||
For details see the variable `time-stamp-format'."
|
||||
:type 'string)
|
||||
|
||||
(defcustom todo-entry-prefix-function 'todo-entry-timestamp-initials
|
||||
"Function producing text to insert at start of todo entry."
|
||||
:type 'symbol)
|
||||
(defcustom todo-initials (or (getenv "INITIALS") (user-login-name))
|
||||
"Initials of todo item author."
|
||||
:type 'string)
|
||||
|
||||
(defun todo-entry-timestamp-initials ()
|
||||
"Prepend timestamp and your initials to the head of a TODO entry."
|
||||
(let ((time-stamp-format todo-time-string-format))
|
||||
(concat (time-stamp-string) " " todo-initials ": ")))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
;; Set up some helpful context ...
|
||||
|
||||
(defvar todo-categories nil
|
||||
"TODO categories.")
|
||||
|
||||
(defvar todo-cats nil
|
||||
"Old variable for holding the TODO categories.
|
||||
Use `todo-categories' instead.")
|
||||
|
||||
(defvar todo-previous-line 0
|
||||
"Previous line asked about.")
|
||||
|
||||
(defvar todo-previous-answer 0
|
||||
"Previous answer got.")
|
||||
|
||||
(defvar todo-mode-map
|
||||
(let ((map (make-keymap)))
|
||||
(suppress-keymap map t)
|
||||
(define-key map "+" #'todo-forward-category)
|
||||
(define-key map "-" #'todo-backward-category)
|
||||
(define-key map "d" #'todo-file-item) ;done/delete
|
||||
(define-key map "e" #'todo-edit-item)
|
||||
(define-key map "E" #'todo-edit-multiline)
|
||||
(define-key map "f" #'todo-file-item)
|
||||
(define-key map "i" #'todo-insert-item)
|
||||
(define-key map "I" #'todo-insert-item-here)
|
||||
(define-key map "j" #'todo-jump-to-category)
|
||||
(define-key map "k" #'todo-delete-item)
|
||||
(define-key map "l" #'todo-lower-item)
|
||||
(define-key map "n" #'todo-forward-item)
|
||||
(define-key map "p" #'todo-backward-item)
|
||||
(define-key map "P" #'todo-print)
|
||||
(define-key map "q" #'todo-quit)
|
||||
(define-key map "r" #'todo-raise-item)
|
||||
(define-key map "s" #'todo-save)
|
||||
(define-key map "S" #'todo-save-top-priorities)
|
||||
(define-key map "t" #'todo-top-priorities)
|
||||
map)
|
||||
"TODO mode keymap.")
|
||||
|
||||
(defvar todo-category-number 0 "TODO category number.")
|
||||
|
||||
(defvar todo-tmp-buffer-name " *todo tmp*")
|
||||
|
||||
(defvar todo-category-sep (make-string 75 ?-)
|
||||
"Category separator.")
|
||||
|
||||
(defvar todo-category-beg " --- "
|
||||
"Category start separator to be prepended onto category name.")
|
||||
|
||||
(defvar todo-category-end "--- End"
|
||||
"Separator after a category.")
|
||||
|
||||
(defvar todo-header "-*- mode: todo; "
|
||||
"Header of todo files.")
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defun todo-category-select ()
|
||||
"Make TODO mode display the current category correctly."
|
||||
(let ((name (nth todo-category-number todo-categories)))
|
||||
(setq mode-line-buffer-identification
|
||||
;; (concat "Category: " name))
|
||||
(concat "Category: " (format "%18s" name)))
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(search-forward-regexp
|
||||
(concat "^"
|
||||
(regexp-quote (concat todo-prefix todo-category-beg name))
|
||||
"$"))
|
||||
(let ((begin (1+ (line-end-position))))
|
||||
(search-forward-regexp (concat "^" todo-category-end))
|
||||
(narrow-to-region begin (line-beginning-position))
|
||||
(goto-char (point-min)))))
|
||||
(defalias 'todo-cat-slct #'todo-category-select)
|
||||
|
||||
(defun todo-forward-category ()
|
||||
"Go forward to TODO list of next category."
|
||||
(interactive)
|
||||
(setq todo-category-number
|
||||
(mod (1+ todo-category-number) (length todo-categories)))
|
||||
(todo-category-select))
|
||||
(defalias 'todo-cmd-forw #'todo-forward-category)
|
||||
|
||||
(defun todo-backward-category ()
|
||||
"Go back to TODO list of previous category."
|
||||
(interactive)
|
||||
(setq todo-category-number
|
||||
(mod (1- todo-category-number) (length todo-categories)))
|
||||
(todo-category-select))
|
||||
(defalias 'todo-cmd-back #'todo-backward-category)
|
||||
|
||||
(defun todo-backward-item ()
|
||||
"Select previous entry of TODO list."
|
||||
(interactive)
|
||||
(search-backward-regexp (concat "^" (regexp-quote todo-prefix)) nil t)
|
||||
(message ""))
|
||||
(defalias 'todo-cmd-prev #'todo-backward-item)
|
||||
|
||||
(defun todo-forward-item (&optional count)
|
||||
"Select COUNT-th next entry of TODO list."
|
||||
(interactive "P")
|
||||
(if (listp count) (setq count (car count)))
|
||||
(end-of-line)
|
||||
(search-forward-regexp (concat "^" (regexp-quote todo-prefix))
|
||||
nil 'goto-end count)
|
||||
(beginning-of-line)
|
||||
(message ""))
|
||||
(defalias 'todo-cmd-next #'todo-forward-item)
|
||||
|
||||
(defun todo-save ()
|
||||
"Save the TODO list."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(save-buffer)))
|
||||
(if todo-save-top-priorities-too (todo-save-top-priorities)))
|
||||
(defalias 'todo-cmd-save #'todo-save)
|
||||
|
||||
(defun todo-quit ()
|
||||
"Done with TODO list for now."
|
||||
(interactive)
|
||||
(widen)
|
||||
(todo-save)
|
||||
(message "")
|
||||
(bury-buffer))
|
||||
(defalias 'todo-cmd-done #'todo-quit)
|
||||
|
||||
(defun todo-edit-item ()
|
||||
"Edit current TODO list entry."
|
||||
(interactive)
|
||||
(if (< (point-min) (point-max))
|
||||
(let ((item (todo-item-string)))
|
||||
(if (todo-string-multiline-p item)
|
||||
(todo-edit-multiline)
|
||||
(let ((new (read-from-minibuffer "Edit: " item)))
|
||||
(todo-remove-item)
|
||||
(insert new "\n")
|
||||
(todo-backward-item)
|
||||
(message ""))))
|
||||
(error "No TODO list entry to edit")))
|
||||
(defalias 'todo-cmd-edit #'todo-edit-item)
|
||||
|
||||
(defun todo-edit-multiline ()
|
||||
"Set up a buffer for editing a multiline TODO list entry."
|
||||
(interactive)
|
||||
(let ((buffer-name (generate-new-buffer-name todo-edit-buffer)))
|
||||
(switch-to-buffer
|
||||
(make-indirect-buffer
|
||||
(file-name-nondirectory todo-file-do) buffer-name))
|
||||
(message "To exit, simply kill this buffer and return to list.")
|
||||
(todo-edit-mode)
|
||||
(narrow-to-region (todo-item-start) (todo-item-end))))
|
||||
|
||||
;;;###autoload
|
||||
(defun todo-add-category (&optional cat)
|
||||
"Add new category CAT to the TODO list."
|
||||
(interactive)
|
||||
(let ((buf (find-file-noselect todo-file-do t))
|
||||
(prompt "Category: "))
|
||||
(unless (zerop (buffer-size buf))
|
||||
(and (null todo-categories)
|
||||
(null todo-cats)
|
||||
(error "Error in %s: File is non-empty but contains no category"
|
||||
todo-file-do)))
|
||||
(unless cat (setq cat (read-from-minibuffer prompt)))
|
||||
(with-current-buffer buf
|
||||
;; reject names that could induce bugs and confusion
|
||||
(while (and (cond ((string= "" cat)
|
||||
(setq prompt "Enter a non-empty category name: "))
|
||||
((string-match "\\`\\s-+\\'" cat)
|
||||
(setq prompt "Enter a category name that is not only white space: "))
|
||||
((member cat todo-categories)
|
||||
(setq prompt "Enter a non-existing category name: ")))
|
||||
(setq cat (read-from-minibuffer prompt))))
|
||||
;; initialize a newly created Todo buffer for Todo mode
|
||||
(unless (file-exists-p todo-file-do) (todo-mode))
|
||||
(setq todo-categories (cons cat todo-categories))
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "-*- mode: todo; " (+ (point-min) 16) t)
|
||||
(kill-line)
|
||||
(insert "-*- mode: todo; \n")
|
||||
(forward-char -1))
|
||||
(insert (format "todo-categories: %S; -*-" todo-categories))
|
||||
(forward-char 1)
|
||||
(insert (format "%s%s%s\n%s\n%s %s\n"
|
||||
todo-prefix todo-category-beg cat
|
||||
todo-category-end
|
||||
todo-prefix todo-category-sep))
|
||||
(if (called-interactively-p 'interactive)
|
||||
;; properly display the newly added category
|
||||
(progn (setq todo-category-number 0) (todo-show))
|
||||
0))))
|
||||
|
||||
;;;###autoload
|
||||
(defun todo-add-item-non-interactively (new-item category)
|
||||
"Insert NEW-ITEM in TODO list as a new entry in CATEGORY."
|
||||
(save-excursion
|
||||
(todo-show))
|
||||
(save-excursion
|
||||
(if (string= "" category)
|
||||
(setq category (nth todo-category-number todo-categories)))
|
||||
(let ((cat-exists (member category todo-categories)))
|
||||
(setq todo-category-number
|
||||
(if cat-exists
|
||||
(- (length todo-categories) (length cat-exists))
|
||||
(todo-add-category category))))
|
||||
(todo-show)
|
||||
(setq todo-previous-line 0)
|
||||
(let ((top 1)
|
||||
(bottom (1+ (count-lines (point-min) (point-max)))))
|
||||
(while (> (- bottom top) todo-insert-threshold)
|
||||
(let* ((current (/ (+ top bottom) 2))
|
||||
(answer (if (< current bottom)
|
||||
(todo-more-important-p current) nil)))
|
||||
(if answer
|
||||
(setq bottom current)
|
||||
(setq top (1+ current)))))
|
||||
(setq top (/ (+ top bottom) 2))
|
||||
;; goto-line doesn't have the desired behavior in a narrowed buffer.
|
||||
(goto-char (point-min))
|
||||
(forward-line (1- top)))
|
||||
(insert new-item "\n")
|
||||
(todo-backward-item)
|
||||
(todo-save)
|
||||
(message "")))
|
||||
|
||||
;;;###autoload
|
||||
(defun todo-insert-item (arg)
|
||||
"Insert new TODO list entry.
|
||||
With a prefix argument ARG solicit the category, otherwise use the current
|
||||
category."
|
||||
(interactive "P")
|
||||
(save-excursion
|
||||
(if (not (derived-mode-p 'todo-mode)) (todo-show))
|
||||
(let* ((new-item (concat todo-prefix " "
|
||||
(read-from-minibuffer
|
||||
"New TODO entry: "
|
||||
(if todo-entry-prefix-function
|
||||
(funcall todo-entry-prefix-function)))))
|
||||
(current-category (nth todo-category-number todo-categories))
|
||||
(category (if arg (todo-completing-read) current-category)))
|
||||
(todo-add-item-non-interactively new-item category))))
|
||||
|
||||
(defalias 'todo-cmd-inst #'todo-insert-item)
|
||||
|
||||
(defun todo-insert-item-here ()
|
||||
"Insert a new TODO list entry directly above the entry at point.
|
||||
If point is on an empty line, insert the entry there."
|
||||
(interactive)
|
||||
(if (not (derived-mode-p 'todo-mode)) (todo-show))
|
||||
(let ((new-item (concat todo-prefix " "
|
||||
(read-from-minibuffer
|
||||
"New TODO entry: "
|
||||
(if todo-entry-prefix-function
|
||||
(funcall todo-entry-prefix-function))))))
|
||||
(unless (and (bolp) (eolp)) (todo-item-start))
|
||||
(insert (concat new-item "\n"))
|
||||
(backward-char)
|
||||
;; put point at start of new entry
|
||||
(todo-item-start)))
|
||||
|
||||
(defun todo-more-important-p (line)
|
||||
"Ask whether entry is more important than the one at LINE."
|
||||
(unless (equal todo-previous-line line)
|
||||
(setq todo-previous-line line)
|
||||
(goto-char (point-min))
|
||||
(forward-line (1- todo-previous-line))
|
||||
(let ((item (todo-item-string-start)))
|
||||
(setq todo-previous-answer
|
||||
(y-or-n-p (format-message "More important than `%s'? " item)))))
|
||||
todo-previous-answer)
|
||||
(defalias 'todo-ask-p #'todo-more-important-p)
|
||||
|
||||
(defun todo-delete-item ()
|
||||
"Delete current TODO list entry."
|
||||
(interactive)
|
||||
(if (> (count-lines (point-min) (point-max)) 0)
|
||||
(let* ((todo-entry (todo-item-string-start))
|
||||
(todo-answer (y-or-n-p (concat "Permanently remove '"
|
||||
todo-entry "'? "))))
|
||||
(when todo-answer
|
||||
(todo-remove-item)
|
||||
(todo-backward-item))
|
||||
(message ""))
|
||||
(error "No TODO list entry to delete")))
|
||||
(defalias 'todo-cmd-kill #'todo-delete-item)
|
||||
|
||||
(defun todo-raise-item ()
|
||||
"Raise priority of current entry."
|
||||
(interactive)
|
||||
(if (> (count-lines (point-min) (point)) 0)
|
||||
(let ((item (todo-item-string)))
|
||||
(todo-remove-item)
|
||||
(todo-backward-item)
|
||||
(save-excursion
|
||||
(insert item "\n"))
|
||||
(message ""))
|
||||
(error "No TODO list entry to raise")))
|
||||
(defalias 'todo-cmd-rais #'todo-raise-item)
|
||||
|
||||
(defun todo-lower-item ()
|
||||
"Lower priority of current entry."
|
||||
(interactive)
|
||||
(if (> (count-lines (point) (point-max)) 1)
|
||||
;; Assume there is a final newline
|
||||
(let ((item (todo-item-string)))
|
||||
(todo-remove-item)
|
||||
(todo-forward-item)
|
||||
(save-excursion
|
||||
(insert item "\n"))
|
||||
(message ""))
|
||||
(error "No TODO list entry to lower")))
|
||||
(defalias 'todo-cmd-lowr #'todo-lower-item)
|
||||
|
||||
(defun todo-file-item (&optional comment)
|
||||
"File the current TODO list entry away, annotated with an optional COMMENT."
|
||||
(interactive "sComment: ")
|
||||
(or (> (count-lines (point-min) (point-max)) 0)
|
||||
(error "No TODO list entry to file away"))
|
||||
(let ((time-stamp-format todo-time-string-format))
|
||||
(when (and comment (> (length comment) 0))
|
||||
(goto-char (todo-item-end))
|
||||
(insert
|
||||
(if (save-excursion (beginning-of-line)
|
||||
(looking-at (regexp-quote todo-prefix)))
|
||||
" "
|
||||
"\n\t")
|
||||
"(" comment ")"))
|
||||
(goto-char (todo-item-end))
|
||||
(insert " [" (nth todo-category-number todo-categories) "]")
|
||||
(todo-item-start)
|
||||
(let ((temp-point (point)))
|
||||
(if (looking-at (regexp-quote todo-prefix))
|
||||
(replace-match (time-stamp-string))
|
||||
;; Standard prefix -> timestamp
|
||||
;; Else prefix non-standard item start with timestamp
|
||||
(insert (time-stamp-string)))
|
||||
(append-to-file temp-point (todo-item-end 'include-sep) todo-file-done)
|
||||
(delete-region temp-point (todo-item-end 'include-sep)))
|
||||
(todo-backward-item)
|
||||
(message "")))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
;; Utility functions:
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun todo-top-priorities (&optional nof-priorities category-pr-page
|
||||
interactive)
|
||||
"List top priorities for each category.
|
||||
|
||||
Number of entries for each category is given by NOF-PRIORITIES which
|
||||
defaults to `todo-show-priorities'.
|
||||
|
||||
If CATEGORY-PR-PAGE is non-nil, a page separator `^L' is inserted
|
||||
between each category.
|
||||
INTERACTIVE should be non-nil if this function is called interactively."
|
||||
|
||||
(interactive "P\ni\nP")
|
||||
(or nof-priorities (setq nof-priorities todo-show-priorities))
|
||||
(if (listp nof-priorities) ;universal argument
|
||||
(setq nof-priorities (car nof-priorities)))
|
||||
(let ((todo-print-buffer-name todo-tmp-buffer-name)
|
||||
;;(todo-print-category-number 0)
|
||||
(todo-category-break (if category-pr-page "" ""))
|
||||
(cat-end
|
||||
(concat
|
||||
(if todo-remove-separator
|
||||
(concat todo-category-end "\n"
|
||||
(regexp-quote todo-prefix) " " todo-category-sep "\n")
|
||||
(concat todo-category-end "\n"))))
|
||||
beg end)
|
||||
(save-excursion
|
||||
(todo-show)
|
||||
(save-restriction
|
||||
(save-current-buffer
|
||||
(widen)
|
||||
(copy-to-buffer todo-print-buffer-name (point-min) (point-max))
|
||||
(set-buffer todo-print-buffer-name)
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward (regexp-quote todo-header) nil t)
|
||||
(beginning-of-line 1)
|
||||
(delete-region (point) (line-end-position)))
|
||||
(while (re-search-forward ;Find category start
|
||||
(regexp-quote (concat todo-prefix todo-category-beg))
|
||||
nil t)
|
||||
(setq beg (+ (line-end-position) 1)) ;Start of first entry.
|
||||
(re-search-forward cat-end nil t)
|
||||
(setq end (match-beginning 0))
|
||||
(replace-match todo-category-break)
|
||||
(narrow-to-region beg end) ;In case we have too few entries.
|
||||
(goto-char (point-min))
|
||||
(if (zerop nof-priorities) ;Traverse entries.
|
||||
(goto-char end) ;All entries
|
||||
(todo-forward-item nof-priorities))
|
||||
(setq beg (point))
|
||||
(delete-region beg end)
|
||||
(widen))
|
||||
(and (looking-at "") (replace-match "")) ;Remove trailing form-feed.
|
||||
(goto-char (point-min)) ;Due to display buffer
|
||||
)))
|
||||
(when interactive (display-buffer todo-print-buffer-name))
|
||||
(message "Type C-x 1 to remove %s window. M-C-v to scroll the help."
|
||||
todo-print-buffer-name)))
|
||||
|
||||
(defun todo-save-top-priorities (&optional nof-priorities)
|
||||
"Save top priorities for each category in `todo-file-top'.
|
||||
|
||||
Number of entries for each category is given by NOF-PRIORITIES which
|
||||
defaults to `todo-show-priorities'."
|
||||
(interactive "P")
|
||||
(save-window-excursion
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(todo-top-priorities nof-priorities)
|
||||
(set-buffer todo-tmp-buffer-name)
|
||||
(write-file todo-file-top)
|
||||
(kill-this-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun todo-print (&optional category-pr-page)
|
||||
"Print todo summary using `todo-print-function'.
|
||||
If CATEGORY-PR-PAGE is non-nil, a page separator `^L' is inserted
|
||||
between each category.
|
||||
|
||||
Number of entries for each category is given by `todo-print-priorities'."
|
||||
(interactive "P")
|
||||
(save-window-excursion
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(todo-top-priorities todo-print-priorities
|
||||
category-pr-page)
|
||||
(set-buffer todo-tmp-buffer-name)
|
||||
(and (funcall todo-print-function)
|
||||
(kill-this-buffer))
|
||||
(message "Todo printing done.")))))
|
||||
|
||||
(defun todo-jump-to-category ()
|
||||
"Jump to a category. Default is previous category."
|
||||
(interactive)
|
||||
(let ((category (todo-completing-read)))
|
||||
(if (string= "" category)
|
||||
(setq category (nth todo-category-number todo-categories)))
|
||||
(setq todo-category-number
|
||||
(if (member category todo-categories)
|
||||
(- (length todo-categories)
|
||||
(length (member category todo-categories)))
|
||||
(todo-add-category category)))
|
||||
(todo-show)))
|
||||
|
||||
(defun todo-line-string ()
|
||||
"Return current line in buffer as a string."
|
||||
(buffer-substring (line-beginning-position) (line-end-position)))
|
||||
|
||||
(defun todo-item-string-start ()
|
||||
"Return the start of this TODO list entry as a string."
|
||||
;; Suitable for putting in the minibuffer when asking the user
|
||||
(let ((item (todo-item-string)))
|
||||
(if (> (length item) 60)
|
||||
(setq item (concat (substring item 0 56) "...")))
|
||||
item))
|
||||
|
||||
(defun todo-item-start ()
|
||||
"Go to start of current TODO list item and return point."
|
||||
(beginning-of-line)
|
||||
(if (not (looking-at (regexp-quote todo-prefix)))
|
||||
(search-backward-regexp
|
||||
(concat "^" (regexp-quote todo-prefix)) nil t))
|
||||
(point))
|
||||
|
||||
(defun todo-item-end (&optional include-sep)
|
||||
"Return point at end of current TODO list item.
|
||||
If INCLUDE-SEP is non-nil, return point after the separator."
|
||||
(save-excursion
|
||||
(end-of-line)
|
||||
(if (search-forward-regexp
|
||||
(concat "^" (regexp-quote todo-prefix)) nil 'goto-end)
|
||||
(goto-char (match-beginning 0)))
|
||||
(unless include-sep (skip-chars-backward "\n"))
|
||||
(point)))
|
||||
|
||||
(defun todo-remove-item ()
|
||||
"Delete the current entry from the TODO list."
|
||||
(delete-region (todo-item-start) (todo-item-end 'include-sep)))
|
||||
|
||||
(defun todo-item-string ()
|
||||
"Return current TODO list entry as a string."
|
||||
(buffer-substring (todo-item-start) (todo-item-end)))
|
||||
|
||||
(defun todo-string-count-lines (string)
|
||||
"Return the number of lines STRING spans."
|
||||
(length (split-string string "\n")))
|
||||
|
||||
(defun todo-string-multiline-p (string)
|
||||
"Return non-nil if STRING spans several lines."
|
||||
(> (todo-string-count-lines string) 1))
|
||||
|
||||
(defun todo-completing-read ()
|
||||
"Return a category name, with completion, for use in Todo mode."
|
||||
;; make a copy of todo-categories in case history-delete-duplicates is
|
||||
;; non-nil, which makes completing-read alter todo-categories
|
||||
(let* ((categories (copy-sequence todo-categories))
|
||||
(history (cons 'todo-categories (1+ todo-category-number)))
|
||||
(default (nth todo-category-number todo-categories))
|
||||
(category (completing-read
|
||||
(concat "Category [" default "]: ")
|
||||
todo-categories nil nil nil history default)))
|
||||
;; restore the original value of todo-categories
|
||||
(setq todo-categories categories)
|
||||
category))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(easy-menu-define todo-menu todo-mode-map "Todo Menu"
|
||||
'("Todo"
|
||||
["Next category" todo-forward-category t]
|
||||
["Previous category" todo-backward-category t]
|
||||
["Jump to category" todo-jump-to-category t]
|
||||
["Show top priority items" todo-top-priorities t]
|
||||
["Print categories" todo-print t]
|
||||
"---"
|
||||
["Edit item" todo-edit-item t]
|
||||
["File item" todo-file-item t]
|
||||
["Insert new item" todo-insert-item t]
|
||||
["Insert item here" todo-insert-item-here t]
|
||||
["Kill item" todo-delete-item t]
|
||||
"---"
|
||||
["Lower item priority" todo-lower-item t]
|
||||
["Raise item priority" todo-raise-item t]
|
||||
"---"
|
||||
["Next item" todo-forward-item t]
|
||||
["Previous item" todo-backward-item t]
|
||||
"---"
|
||||
["Save" todo-save t]
|
||||
["Save Top Priorities" todo-save-top-priorities t]
|
||||
"---"
|
||||
["Quit" todo-quit t]
|
||||
))
|
||||
|
||||
;; As calendar reads todo-file-do before todo-mode is loaded.
|
||||
;;;###autoload
|
||||
(define-derived-mode todo-mode nil "TODO"
|
||||
"Major mode for editing TODO lists."
|
||||
nil)
|
||||
|
||||
(with-suppressed-warnings ((lexical date entry))
|
||||
(defvar date)
|
||||
(defvar entry))
|
||||
|
||||
;; t-c should be used from diary code, which requires calendar.
|
||||
(declare-function calendar-current-date "calendar" (&optional offset))
|
||||
|
||||
;; Read about this function in the setup instructions above!
|
||||
;;;###autoload
|
||||
(defun todo-cp ()
|
||||
"Make a diary entry appear only in the current date's diary."
|
||||
(if (equal (calendar-current-date) date)
|
||||
entry))
|
||||
|
||||
(define-derived-mode todo-edit-mode text-mode "TODO Edit"
|
||||
"Major mode for editing items in the TODO list.
|
||||
|
||||
\\{todo-edit-mode-map}")
|
||||
|
||||
;;;###autoload
|
||||
(defun todo-show ()
|
||||
"Show TODO list."
|
||||
(interactive)
|
||||
;; Call todo-initial-setup only if there is neither a Todo file nor
|
||||
;; a corresponding unsaved buffer.
|
||||
(if (or (file-exists-p todo-file-do)
|
||||
(let* ((buf (get-buffer (file-name-nondirectory todo-file-do)))
|
||||
(bufname (buffer-file-name buf)))
|
||||
(equal (expand-file-name todo-file-do) bufname)))
|
||||
(find-file todo-file-do)
|
||||
(todo-initial-setup))
|
||||
(if (null todo-categories)
|
||||
(if (null todo-cats)
|
||||
(error "Error in %s: No categories in list `todo-categories'"
|
||||
todo-file-do)
|
||||
(goto-char (point-min))
|
||||
(and (search-forward "todo-cats:" nil t)
|
||||
(replace-match "todo-categories:"))
|
||||
(make-local-variable 'todo-categories)
|
||||
(setq todo-categories todo-cats)))
|
||||
(beginning-of-line)
|
||||
(todo-category-select))
|
||||
|
||||
(defun todo-initial-setup ()
|
||||
"Set up things to work properly in TODO mode."
|
||||
(find-file todo-file-do)
|
||||
(erase-buffer)
|
||||
(todo-mode)
|
||||
(todo-add-category "Todo"))
|
||||
|
||||
(provide 'todo-mode)
|
||||
|
||||
;;; otodo-mode.el ends here
|
@ -1,180 +0,0 @@
|
||||
;;; rcompile.el --- run a compilation on a remote machine -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1993-1994, 2001-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Alon Albert <alon@milcse.rtsg.mot.com>
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
;; Created: 1993 Oct 6
|
||||
;; Keywords: tools, processes
|
||||
;; Obsolete-since: 24.4
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This package is for running a remote compilation and using emacs to parse
|
||||
;; the error messages. It works by rsh'ing the compilation to a remote host
|
||||
;; and parsing the output. If the file visited at the time remote-compile was
|
||||
;; called was loaded remotely (ange-ftp), the host and user name are obtained
|
||||
;; by the calling ange-ftp-ftp-name on the current directory. In this case the
|
||||
;; next-error command will also ange-ftp the files over. This is achieved
|
||||
;; automatically because the compilation-parse-errors function uses
|
||||
;; default-directory to build its file names. If however the file visited was
|
||||
;; loaded locally, remote-compile prompts for a host and user and assumes the
|
||||
;; files mounted locally (otherwise, how was the visited file loaded).
|
||||
|
||||
;; See the user defined variables section for more info.
|
||||
|
||||
;; I was contemplating redefining "compile" to "remote-compile" automatically
|
||||
;; if the file visited was ange-ftp'ed but decided against it for now. If you
|
||||
;; feel this is a good idea, let me know and I'll consider it again.
|
||||
|
||||
;; Installation:
|
||||
|
||||
;; To use rcompile, you also need to give yourself permission to connect to
|
||||
;; the remote host. You do this by putting lines like:
|
||||
|
||||
;; monopoly alon
|
||||
;; vme33
|
||||
;;
|
||||
;; in a file named .rhosts in the home directory (of the remote machine).
|
||||
;; Be careful what you put in this file. A line like:
|
||||
;;
|
||||
;; +
|
||||
;;
|
||||
;; Will allow anyone access to your account without a password. I suggest you
|
||||
;; read the rhosts(5) manual page before you edit this file (if you are not
|
||||
;; familiar with it already)
|
||||
|
||||
;;; Code:
|
||||
|
||||
(provide 'rcompile)
|
||||
(require 'compile)
|
||||
;;; The following should not be needed.
|
||||
;;; (eval-when-compile (require 'ange-ftp))
|
||||
|
||||
;;;; user defined variables
|
||||
|
||||
(defgroup remote-compile nil
|
||||
"Run a compilation on a remote machine."
|
||||
:group 'processes
|
||||
:group 'tools)
|
||||
|
||||
|
||||
(defcustom remote-compile-host nil
|
||||
"Host for remote compilations."
|
||||
:type '(choice string (const nil)))
|
||||
|
||||
(defcustom remote-compile-user nil
|
||||
"User for remote compilations.
|
||||
nil means use the value returned by \\[user-login-name]."
|
||||
:type '(choice string (const nil)))
|
||||
|
||||
(defcustom remote-compile-run-before nil
|
||||
"Command to run before compilation.
|
||||
This can be used for setting up environment variables,
|
||||
since rsh does not invoke the shell as a login shell and files like .login
|
||||
\(tcsh) and .bash_profile \(bash) are not run.
|
||||
nil means run no commands."
|
||||
:type '(choice string (const nil)))
|
||||
|
||||
(defcustom remote-compile-prompt-for-host nil
|
||||
"Non-nil means prompt for host if not available from filename."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom remote-compile-prompt-for-user nil
|
||||
"Non-nil means prompt for user if not available from filename."
|
||||
:type 'boolean)
|
||||
|
||||
;;;; internal variables
|
||||
|
||||
;; History of remote compile hosts and users
|
||||
(defvar remote-compile-host-history nil)
|
||||
(defvar remote-compile-user-history nil)
|
||||
|
||||
|
||||
;;;; entry point
|
||||
|
||||
;; We use the Tramp internal function `tramp-make-tramp-file-name'.
|
||||
;; It has changed its signature in Emacs 27.1, supporting still the
|
||||
;; old calling convention. Let's assume rcompile.el has been removed
|
||||
;; once Tramp does not support it any longer.
|
||||
;; Better would be, if there are functions to provide user, host and
|
||||
;; localname of a remote filename, independent of Tramp's implementation.
|
||||
;; The function calls are wrapped by `funcall' in order to pacify the byte
|
||||
;; compiler. ange-ftp check removed, because it is handled also by Tramp.
|
||||
;;;###autoload
|
||||
(defun remote-compile (host user command)
|
||||
"Compile the current buffer's directory on HOST. Log in as USER.
|
||||
See \\[compile]."
|
||||
(interactive
|
||||
(let (host user command prompt) ;; l l-host l-user
|
||||
(setq prompt (if (stringp remote-compile-host)
|
||||
(format "Compile on host (default %s): "
|
||||
remote-compile-host)
|
||||
"Compile on host: ")
|
||||
host (if (or remote-compile-prompt-for-host
|
||||
(null remote-compile-host))
|
||||
(read-from-minibuffer prompt
|
||||
"" nil nil
|
||||
'remote-compile-host-history)
|
||||
remote-compile-host)
|
||||
user (if remote-compile-prompt-for-user
|
||||
(read-from-minibuffer (format
|
||||
"Compile by user (default %s): "
|
||||
(or remote-compile-user
|
||||
(user-login-name)))
|
||||
"" nil nil
|
||||
'remote-compile-user-history)
|
||||
remote-compile-user))
|
||||
(setq command (read-from-minibuffer "Compile command: "
|
||||
compile-command nil nil
|
||||
'(compile-history . 1)))
|
||||
(list (if (string= host "") remote-compile-host host)
|
||||
(if (string= user "") remote-compile-user user)
|
||||
command)))
|
||||
(setq compile-command command)
|
||||
(cond (user
|
||||
(setq remote-compile-user user))
|
||||
((null remote-compile-user)
|
||||
(setq remote-compile-user (user-login-name))))
|
||||
(let* (;; localname ;; Pacify byte-compiler.
|
||||
(compile-command
|
||||
(format "%s %s -l %s \"(%scd %s; %s)\""
|
||||
remote-shell-program
|
||||
host
|
||||
remote-compile-user
|
||||
(if remote-compile-run-before
|
||||
(concat remote-compile-run-before "; ")
|
||||
"")
|
||||
""
|
||||
compile-command)))
|
||||
(setq remote-compile-host host)
|
||||
(save-some-buffers nil nil)
|
||||
(compilation-start compile-command)
|
||||
;; Set comint-file-name-prefix in the compilation buffer so
|
||||
;; compilation-parse-errors will find referenced files by Tramp.
|
||||
(with-current-buffer next-error-last-buffer
|
||||
(when (fboundp 'tramp-make-tramp-file-name)
|
||||
(setq-local comint-file-name-prefix
|
||||
(funcall
|
||||
#'tramp-make-tramp-file-name
|
||||
nil ;; method.
|
||||
remote-compile-user
|
||||
remote-compile-host
|
||||
""))))))
|
||||
|
||||
;;; rcompile.el ends here
|
@ -1,203 +0,0 @@
|
||||
;;; sup-mouse.el --- supdup mouse support for lisp machines -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1985-1986, 2001-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Wolfgang Rupprecht
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
;; Created: 21 Nov 1986
|
||||
;; Keywords: hardware
|
||||
;; Obsolete-since: 24.4
|
||||
|
||||
;; (from code originally written by John Robinson@bbn for the bitgraph)
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; User customization option:
|
||||
|
||||
(defcustom sup-mouse-fast-select-window nil
|
||||
"Non-nil means mouse hits select new window, then execute.
|
||||
Otherwise just select."
|
||||
:type 'boolean
|
||||
:group 'mouse)
|
||||
|
||||
(defconst mouse-left 0)
|
||||
(defconst mouse-center 1)
|
||||
(defconst mouse-right 2)
|
||||
|
||||
(defconst mouse-2left 4)
|
||||
(defconst mouse-2center 5)
|
||||
(defconst mouse-2right 6)
|
||||
|
||||
(defconst mouse-3left 8)
|
||||
(defconst mouse-3center 9)
|
||||
(defconst mouse-3right 10)
|
||||
|
||||
;;; Defuns:
|
||||
|
||||
(defun sup-mouse-report ()
|
||||
"This function is called directly by the mouse, it parses and
|
||||
executes the mouse commands.
|
||||
|
||||
L move point * |---- These apply for mouse click in a window.
|
||||
2L delete word |
|
||||
3L copy word | If sup-mouse-fast-select-window is nil,
|
||||
C move point and yank * | just selects that window.
|
||||
2C yank pop |
|
||||
R set mark * |
|
||||
2R delete region |
|
||||
3R copy region |
|
||||
|
||||
on mode line on \"scroll bar\" in minibuffer
|
||||
L scroll-up line to top execute-extended-command
|
||||
C proportional goto-char line to middle mouse-help
|
||||
R scroll-down line to bottom eval-expression"
|
||||
|
||||
(interactive)
|
||||
(let*
|
||||
;; expect a string of <esc>:<buttons>;<x-pos>;<y-pos>c
|
||||
((buttons (sup-get-tty-num ?\;))
|
||||
(x (sup-get-tty-num ?\;))
|
||||
(y (sup-get-tty-num ?c))
|
||||
(window (sup-pos-to-window x y))
|
||||
(edges (window-edges window))
|
||||
(old-window (selected-window))
|
||||
(in-minibuf-p (eq y (1- (frame-height))))
|
||||
(same-window-p (and (not in-minibuf-p) (eq window old-window)))
|
||||
(in-mode-line-p (eq y (1- (nth 3 edges))))
|
||||
(in-scrollbar-p (>= x (1- (nth 2 edges)))))
|
||||
(setq x (- x (nth 0 edges)))
|
||||
(setq y (- y (nth 1 edges)))
|
||||
|
||||
; (error "mouse-hit %d %d %d" buttons x y) ;;;; debug
|
||||
|
||||
(cond (in-mode-line-p
|
||||
(select-window window)
|
||||
(cond ((= buttons mouse-left)
|
||||
(scroll-up))
|
||||
((= buttons mouse-right)
|
||||
(scroll-down))
|
||||
((= buttons mouse-center)
|
||||
(goto-char (/ (* x
|
||||
(- (point-max) (point-min)))
|
||||
(1- (window-width))))
|
||||
(beginning-of-line)
|
||||
(what-cursor-position)))
|
||||
(select-window old-window))
|
||||
(in-scrollbar-p
|
||||
(select-window window)
|
||||
(scroll-up
|
||||
(cond ((= buttons mouse-left)
|
||||
y)
|
||||
((= buttons mouse-right)
|
||||
(+ y (- 2 (window-height))))
|
||||
((= buttons mouse-center)
|
||||
(/ (+ 2 y y (- (window-height))) 2))
|
||||
(t
|
||||
0)))
|
||||
(select-window old-window))
|
||||
(same-window-p
|
||||
(cond ((= buttons mouse-left)
|
||||
(sup-move-point-to-x-y x y))
|
||||
((= buttons mouse-2left)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(kill-word 1))
|
||||
((= buttons mouse-3left)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(save-excursion
|
||||
(copy-region-as-kill
|
||||
(point) (progn (forward-word 1) (point))))
|
||||
(setq this-command 'yank)
|
||||
)
|
||||
((= buttons mouse-right)
|
||||
(push-mark)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(exchange-point-and-mark))
|
||||
((= buttons mouse-2right)
|
||||
(push-mark)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(kill-region (mark) (point)))
|
||||
((= buttons mouse-3right)
|
||||
(push-mark)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(copy-region-as-kill (mark) (point))
|
||||
(setq this-command 'yank))
|
||||
((= buttons mouse-center)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(setq this-command 'yank)
|
||||
(yank))
|
||||
((= buttons mouse-2center)
|
||||
(yank-pop 1))
|
||||
)
|
||||
)
|
||||
(in-minibuf-p
|
||||
(cond ((= buttons mouse-right)
|
||||
(call-interactively 'eval-expression))
|
||||
((= buttons mouse-left)
|
||||
(call-interactively 'execute-extended-command))
|
||||
((= buttons mouse-center)
|
||||
(describe-function 'sup-mouse-report)); silly self help
|
||||
))
|
||||
(t ;in another window
|
||||
(select-window window)
|
||||
(cond ((not sup-mouse-fast-select-window))
|
||||
((= buttons mouse-left)
|
||||
(sup-move-point-to-x-y x y))
|
||||
((= buttons mouse-right)
|
||||
(push-mark)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(exchange-point-and-mark))
|
||||
((= buttons mouse-center)
|
||||
(sup-move-point-to-x-y x y)
|
||||
(setq this-command 'yank)
|
||||
(yank))
|
||||
))
|
||||
)))
|
||||
|
||||
|
||||
(defun sup-get-tty-num (term-char)
|
||||
"Read from terminal until TERM-CHAR is read, and return intervening number.
|
||||
Upon non-numeric not matching TERM-CHAR signal an error."
|
||||
(let
|
||||
((num 0)
|
||||
(char (read-char)))
|
||||
(while (and (>= char ?0)
|
||||
(<= char ?9))
|
||||
(setq num (+ (* num 10) (- char ?0)))
|
||||
(setq char (read-char)))
|
||||
(or (eq term-char char)
|
||||
(error "Invalid data format in mouse command"))
|
||||
num))
|
||||
|
||||
(defun sup-move-point-to-x-y (x y)
|
||||
"Position cursor in window coordinates.
|
||||
X and Y are 0-based character positions in the window."
|
||||
(move-to-window-line y)
|
||||
(move-to-column x)
|
||||
)
|
||||
|
||||
(defun sup-pos-to-window (x y)
|
||||
"Find window corresponding to frame coordinates.
|
||||
X and Y are 0-based character positions on the frame."
|
||||
(get-window-with-predicate (lambda (w)
|
||||
(coordinates-in-window-p (cons x y) w))))
|
||||
|
||||
(provide 'sup-mouse)
|
||||
|
||||
;;; sup-mouse.el ends here
|
File diff suppressed because it is too large
Load Diff
1495
lisp/obsolete/vi.el
1495
lisp/obsolete/vi.el
File diff suppressed because it is too large
Load Diff
3050
lisp/obsolete/vip.el
3050
lisp/obsolete/vip.el
File diff suppressed because it is too large
Load Diff
@ -1,539 +0,0 @@
|
||||
;;; ws-mode.el --- WordStar emulation mode for GNU Emacs -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 1991, 2001-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Juergen Nickelsen <nickel@cs.tu-berlin.de>
|
||||
;; Version: 0.7
|
||||
;; Keywords: emulations
|
||||
;; Obsolete-since: 24.5
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This provides emulation of WordStar with a minor mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup wordstar nil
|
||||
"WordStar emulation within Emacs."
|
||||
:prefix "wordstar-"
|
||||
:prefix "ws-"
|
||||
:group 'emulations)
|
||||
|
||||
(defcustom wordstar-mode-lighter " WordStar"
|
||||
"Lighter shown in the modeline for `wordstar' mode."
|
||||
:type 'string)
|
||||
|
||||
(defvar wordstar-C-k-map
|
||||
(let ((map (make-keymap)))
|
||||
(define-key map " " ())
|
||||
(define-key map "0" #'ws-set-marker-0)
|
||||
(define-key map "1" #'ws-set-marker-1)
|
||||
(define-key map "2" #'ws-set-marker-2)
|
||||
(define-key map "3" #'ws-set-marker-3)
|
||||
(define-key map "4" #'ws-set-marker-4)
|
||||
(define-key map "5" #'ws-set-marker-5)
|
||||
(define-key map "6" #'ws-set-marker-6)
|
||||
(define-key map "7" #'ws-set-marker-7)
|
||||
(define-key map "8" #'ws-set-marker-8)
|
||||
(define-key map "9" #'ws-set-marker-9)
|
||||
(define-key map "b" #'ws-begin-block)
|
||||
(define-key map "\C-b" #'ws-begin-block)
|
||||
(define-key map "c" #'ws-copy-block)
|
||||
(define-key map "\C-c" #'ws-copy-block)
|
||||
(define-key map "d" #'save-buffers-kill-emacs)
|
||||
(define-key map "\C-d" #'save-buffers-kill-emacs)
|
||||
(define-key map "f" #'find-file)
|
||||
(define-key map "\C-f" #'find-file)
|
||||
(define-key map "h" #'ws-show-markers)
|
||||
(define-key map "\C-h" #'ws-show-markers)
|
||||
(define-key map "i" #'ws-indent-block)
|
||||
(define-key map "\C-i" #'ws-indent-block)
|
||||
(define-key map "k" #'ws-end-block)
|
||||
(define-key map "\C-k" #'ws-end-block)
|
||||
(define-key map "p" #'ws-print-block)
|
||||
(define-key map "\C-p" #'ws-print-block)
|
||||
(define-key map "q" #'kill-emacs)
|
||||
(define-key map "\C-q" #'kill-emacs)
|
||||
(define-key map "r" #'insert-file)
|
||||
(define-key map "\C-r" #'insert-file)
|
||||
(define-key map "s" #'save-some-buffers)
|
||||
(define-key map "\C-s" #'save-some-buffers)
|
||||
(define-key map "t" #'ws-mark-word)
|
||||
(define-key map "\C-t" #'ws-mark-word)
|
||||
(define-key map "u" #'ws-exdent-block)
|
||||
(define-key map "\C-u" #'keyboard-quit)
|
||||
(define-key map "v" #'ws-move-block)
|
||||
(define-key map "\C-v" #'ws-move-block)
|
||||
(define-key map "w" #'ws-write-block)
|
||||
(define-key map "\C-w" #'ws-write-block)
|
||||
(define-key map "x" #'save-buffers-kill-emacs)
|
||||
(define-key map "\C-x" #'save-buffers-kill-emacs)
|
||||
(define-key map "y" #'ws-delete-block)
|
||||
(define-key map "\C-y" #'ws-delete-block)
|
||||
map))
|
||||
|
||||
(defvar wordstar-C-o-map
|
||||
(let ((map (make-keymap)))
|
||||
(define-key map " " ())
|
||||
(define-key map "c" #'wordstar-center-line)
|
||||
(define-key map "\C-c" #'wordstar-center-line)
|
||||
(define-key map "b" #'switch-to-buffer)
|
||||
(define-key map "\C-b" #'switch-to-buffer)
|
||||
(define-key map "j" #'justify-current-line)
|
||||
(define-key map "\C-j" #'justify-current-line)
|
||||
(define-key map "k" #'kill-buffer)
|
||||
(define-key map "\C-k" #'kill-buffer)
|
||||
(define-key map "l" #'list-buffers)
|
||||
(define-key map "\C-l" #'list-buffers)
|
||||
(define-key map "m" #'auto-fill-mode)
|
||||
(define-key map "\C-m" #'auto-fill-mode)
|
||||
(define-key map "r" #'set-fill-column)
|
||||
(define-key map "\C-r" #'set-fill-column)
|
||||
(define-key map "\C-u" #'keyboard-quit)
|
||||
(define-key map "wd" #'delete-other-windows)
|
||||
(define-key map "wh" #'split-window-right)
|
||||
(define-key map "wo" #'other-window)
|
||||
(define-key map "wv" #'split-window-below)
|
||||
map))
|
||||
|
||||
(defvar wordstar-C-q-map
|
||||
(let ((map (make-keymap)))
|
||||
(define-key map " " ())
|
||||
(define-key map "0" #'ws-find-marker-0)
|
||||
(define-key map "1" #'ws-find-marker-1)
|
||||
(define-key map "2" #'ws-find-marker-2)
|
||||
(define-key map "3" #'ws-find-marker-3)
|
||||
(define-key map "4" #'ws-find-marker-4)
|
||||
(define-key map "5" #'ws-find-marker-5)
|
||||
(define-key map "6" #'ws-find-marker-6)
|
||||
(define-key map "7" #'ws-find-marker-7)
|
||||
(define-key map "8" #'ws-find-marker-8)
|
||||
(define-key map "9" #'ws-find-marker-9)
|
||||
(define-key map "a" #'ws-query-replace)
|
||||
(define-key map "\C-a" #'ws-query-replace)
|
||||
(define-key map "b" #'ws-goto-block-begin)
|
||||
(define-key map "\C-b" #'ws-goto-block-begin)
|
||||
(define-key map "c" #'end-of-buffer)
|
||||
(define-key map "\C-c" #'end-of-buffer)
|
||||
(define-key map "d" #'end-of-line)
|
||||
(define-key map "\C-d" #'end-of-line)
|
||||
(define-key map "f" #'ws-search)
|
||||
(define-key map "\C-f" #'ws-search)
|
||||
(define-key map "k" #'ws-goto-block-end)
|
||||
(define-key map "\C-k" #'ws-goto-block-end)
|
||||
(define-key map "l" #'ws-undo)
|
||||
(define-key map "\C-l" #'ws-undo)
|
||||
;; (define-key map "p" #'ws-last-cursorp)
|
||||
;; (define-key map "\C-p" #'ws-last-cursorp)
|
||||
(define-key map "r" #'beginning-of-buffer)
|
||||
(define-key map "\C-r" #'beginning-of-buffer)
|
||||
(define-key map "s" #'beginning-of-line)
|
||||
(define-key map "\C-s" #'beginning-of-line)
|
||||
(define-key map "\C-u" #'keyboard-quit)
|
||||
(define-key map "w" #'ws-last-error)
|
||||
(define-key map "\C-w" #'ws-last-error)
|
||||
(define-key map "y" #'ws-kill-eol)
|
||||
(define-key map "\C-y" #'ws-kill-eol)
|
||||
(define-key map "\177" #'ws-kill-bol)
|
||||
map))
|
||||
|
||||
(defvar wordstar-mode-map
|
||||
(let ((map (make-keymap)))
|
||||
(define-key map "\C-a" #'backward-word)
|
||||
(define-key map "\C-b" #'fill-paragraph)
|
||||
(define-key map "\C-c" #'scroll-up-command)
|
||||
(define-key map "\C-d" #'forward-char)
|
||||
(define-key map "\C-e" #'previous-line)
|
||||
(define-key map "\C-f" #'forward-word)
|
||||
(define-key map "\C-g" #'delete-char)
|
||||
(define-key map "\C-h" #'backward-char)
|
||||
(define-key map "\C-i" #'indent-for-tab-command)
|
||||
(define-key map "\C-j" #'help-for-help)
|
||||
(define-key map "\C-k" wordstar-C-k-map)
|
||||
(define-key map "\C-l" #'ws-repeat-search)
|
||||
(define-key map "\C-n" #'open-line)
|
||||
(define-key map "\C-o" wordstar-C-o-map)
|
||||
(define-key map "\C-p" #'quoted-insert)
|
||||
(define-key map "\C-q" wordstar-C-q-map)
|
||||
(define-key map "\C-r" #'scroll-down-command)
|
||||
(define-key map "\C-s" #'backward-char)
|
||||
(define-key map "\C-t" #'kill-word)
|
||||
(define-key map "\C-u" #'keyboard-quit)
|
||||
(define-key map "\C-v" #'overwrite-mode)
|
||||
(define-key map "\C-w" #'scroll-down-line)
|
||||
(define-key map "\C-x" #'next-line)
|
||||
(define-key map "\C-y" #'kill-complete-line)
|
||||
(define-key map "\C-z" #'scroll-up-line)
|
||||
map))
|
||||
|
||||
;; wordstar-C-j-map not yet implemented
|
||||
(defvar wordstar-C-j-map nil)
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode wordstar-mode
|
||||
"Minor mode with WordStar-like key bindings.
|
||||
|
||||
BUGS:
|
||||
- Help menus with WordStar commands (C-j just calls help-for-help)
|
||||
are not implemented
|
||||
- Options for search and replace
|
||||
- Show markers (C-k h) is somewhat strange
|
||||
- Search and replace (C-q a) is only available in forward direction
|
||||
|
||||
No key bindings beginning with ESC are installed, they will work
|
||||
Emacs-like."
|
||||
:group 'wordstar
|
||||
:lighter wordstar-mode-lighter
|
||||
:keymap wordstar-mode-map)
|
||||
|
||||
(defun turn-on-wordstar-mode ()
|
||||
(when (and (not (minibufferp))
|
||||
(not wordstar-mode))
|
||||
(wordstar-mode 1)))
|
||||
|
||||
(define-globalized-minor-mode global-wordstar-mode wordstar-mode
|
||||
turn-on-wordstar-mode)
|
||||
|
||||
(defun wordstar-center-paragraph ()
|
||||
"Center each line in the paragraph at or after point.
|
||||
See `wordstar-center-line' for more info."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(forward-paragraph)
|
||||
(or (bolp) (newline 1))
|
||||
(let ((end (point)))
|
||||
(backward-paragraph)
|
||||
(wordstar-center-region (point) end))))
|
||||
|
||||
(defun wordstar-center-region (from to)
|
||||
"Center each line starting in the region.
|
||||
See `wordstar-center-line' for more info."
|
||||
(interactive "r")
|
||||
(if (> from to)
|
||||
(let ((tem to))
|
||||
(setq to from from tem)))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region from to)
|
||||
(goto-char from)
|
||||
(while (not (eobp))
|
||||
(wordstar-center-line)
|
||||
(forward-line 1)))))
|
||||
|
||||
(defun wordstar-center-line ()
|
||||
"Center the line point is on, within the width specified by `fill-column'.
|
||||
This means adjusting the indentation to match
|
||||
the distance between the end of the text and `fill-column'."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(let (line-length)
|
||||
(beginning-of-line)
|
||||
(delete-horizontal-space)
|
||||
(end-of-line)
|
||||
(delete-horizontal-space)
|
||||
(setq line-length (current-column))
|
||||
(beginning-of-line)
|
||||
(indent-to
|
||||
(+ left-margin
|
||||
(/ (- fill-column left-margin line-length) 2))))))
|
||||
|
||||
;;;;;;;;;;;
|
||||
;; wordstar special variables:
|
||||
|
||||
(defvar ws-marker-0 nil "Position marker 0 in WordStar mode.")
|
||||
(defvar ws-marker-1 nil "Position marker 1 in WordStar mode.")
|
||||
(defvar ws-marker-2 nil "Position marker 2 in WordStar mode.")
|
||||
(defvar ws-marker-3 nil "Position marker 3 in WordStar mode.")
|
||||
(defvar ws-marker-4 nil "Position marker 4 in WordStar mode.")
|
||||
(defvar ws-marker-5 nil "Position marker 5 in WordStar mode.")
|
||||
(defvar ws-marker-6 nil "Position marker 6 in WordStar mode.")
|
||||
(defvar ws-marker-7 nil "Position marker 7 in WordStar mode.")
|
||||
(defvar ws-marker-8 nil "Position marker 8 in WordStar mode.")
|
||||
(defvar ws-marker-9 nil "Position marker 9 in WordStar mode.")
|
||||
|
||||
(defvar ws-block-begin-marker nil "Beginning of \"Block\" in WordStar mode.")
|
||||
(defvar ws-block-end-marker nil "End of \"Block\" in WordStar mode.")
|
||||
|
||||
(defvar ws-search-string nil "String of last search in WordStar mode.")
|
||||
(defvar ws-search-direction t
|
||||
"Direction of last search in WordStar mode. t if forward, nil if backward.")
|
||||
|
||||
(defvar ws-last-cursorposition nil
|
||||
"Position before last search etc. in WordStar mode.")
|
||||
|
||||
(defvar ws-last-errormessage nil
|
||||
"Last error message issued by a WordStar mode function.")
|
||||
|
||||
;;;;;;;;;;;
|
||||
;; wordstar special functions:
|
||||
|
||||
(defun ws-error (string)
|
||||
"Report error of a WordStar special function.
|
||||
Error message is saved in `ws-last-errormessage' for recovery
|
||||
with C-q w."
|
||||
(setq ws-last-errormessage string)
|
||||
(error string))
|
||||
|
||||
(defun ws-begin-block ()
|
||||
"In WordStar mode: Set block begin marker to current cursor position."
|
||||
(interactive)
|
||||
(setq ws-block-begin-marker (point-marker))
|
||||
(message "Block begin marker set"))
|
||||
|
||||
(defun ws-show-markers ()
|
||||
"In WordStar mode: Show block markers."
|
||||
(interactive)
|
||||
(if (or ws-block-begin-marker ws-block-end-marker)
|
||||
(save-excursion
|
||||
(if ws-block-begin-marker
|
||||
(progn
|
||||
(goto-char ws-block-begin-marker)
|
||||
(message "Block begin marker")
|
||||
(sit-for 2))
|
||||
(message "Block begin marker not set")
|
||||
(sit-for 2))
|
||||
(if ws-block-end-marker
|
||||
(progn
|
||||
(goto-char ws-block-end-marker)
|
||||
(message "Block end marker")
|
||||
(sit-for 2))
|
||||
(message "Block end marker not set"))
|
||||
(message ""))
|
||||
(message "Block markers not set")))
|
||||
|
||||
(defun ws-indent-block ()
|
||||
"In WordStar mode: Indent block (not yet implemented)."
|
||||
(interactive)
|
||||
(ws-error "Indent block not yet implemented"))
|
||||
|
||||
(defun ws-end-block ()
|
||||
"In WordStar mode: Set block end marker to current cursor position."
|
||||
(interactive)
|
||||
(setq ws-block-end-marker (point-marker))
|
||||
(message "Block end marker set"))
|
||||
|
||||
(defun ws-print-block ()
|
||||
"In WordStar mode: Print block."
|
||||
(interactive)
|
||||
(message "Don't do this. Write block to a file (C-k w) and print this file"))
|
||||
|
||||
(defun ws-mark-word ()
|
||||
"In WordStar mode: Mark current word as block."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(forward-word 1)
|
||||
(sit-for 1)
|
||||
(ws-end-block)
|
||||
(forward-word -1)
|
||||
(sit-for 1)
|
||||
(ws-begin-block)))
|
||||
|
||||
(defun ws-exdent-block ()
|
||||
"I don't know what this (C-k u) should do."
|
||||
(interactive)
|
||||
(ws-error "This won't be done -- not yet implemented"))
|
||||
|
||||
(defun ws-move-block ()
|
||||
"In WordStar mode: Move block to current cursor position."
|
||||
(interactive)
|
||||
(if (and ws-block-begin-marker ws-block-end-marker)
|
||||
(progn
|
||||
(kill-region ws-block-begin-marker ws-block-end-marker)
|
||||
(yank)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
(setq ws-block-begin-marker (point-marker))
|
||||
(goto-char (region-end))
|
||||
(setq ws-block-end-marker (point-marker))))
|
||||
(ws-error (cond (ws-block-begin-marker "Block end marker not set")
|
||||
(ws-block-end-marker "Block begin marker not set")
|
||||
(t "Block markers not set")))))
|
||||
|
||||
(defun ws-write-block ()
|
||||
"In WordStar mode: Write block to file."
|
||||
(interactive)
|
||||
(if (and ws-block-begin-marker ws-block-end-marker)
|
||||
(let ((filename (read-file-name "Write block to file: ")))
|
||||
(write-region ws-block-begin-marker ws-block-end-marker filename))
|
||||
(ws-error (cond (ws-block-begin-marker "Block end marker not set")
|
||||
(ws-block-end-marker "Block begin marker not set")
|
||||
(t "Block markers not set")))))
|
||||
|
||||
|
||||
(defun ws-delete-block ()
|
||||
"In WordStar mode: Delete block."
|
||||
(interactive)
|
||||
(if (and ws-block-begin-marker ws-block-end-marker)
|
||||
(progn
|
||||
(kill-region ws-block-begin-marker ws-block-end-marker)
|
||||
(setq ws-block-end-marker nil)
|
||||
(setq ws-block-begin-marker nil))
|
||||
(ws-error (cond (ws-block-begin-marker "Block end marker not set")
|
||||
(ws-block-end-marker "Block begin marker not set")
|
||||
(t "Block markers not set")))))
|
||||
|
||||
(defun ws-goto-block-begin ()
|
||||
"In WordStar mode: Go to block begin marker."
|
||||
(interactive)
|
||||
(if ws-block-begin-marker
|
||||
(progn
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(goto-char ws-block-begin-marker))
|
||||
(ws-error "Block begin marker not set")))
|
||||
|
||||
(defun ws-search (string)
|
||||
"In WordStar mode: Search string, remember string for repetition."
|
||||
(interactive "sSearch for: ")
|
||||
(message "Forward (f) or backward (b)")
|
||||
(let ((direction
|
||||
(read-char)))
|
||||
(cond ((equal (upcase direction) ?F)
|
||||
(setq ws-search-string string)
|
||||
(setq ws-search-direction t)
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(search-forward string))
|
||||
((equal (upcase direction) ?B)
|
||||
(setq ws-search-string string)
|
||||
(setq ws-search-direction nil)
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(search-backward string))
|
||||
(t (keyboard-quit)))))
|
||||
|
||||
(defun ws-goto-block-end ()
|
||||
"In WordStar mode: Go to block end marker."
|
||||
(interactive)
|
||||
(if ws-block-end-marker
|
||||
(progn
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(goto-char ws-block-end-marker))
|
||||
(ws-error "Block end marker not set")))
|
||||
|
||||
(defun ws-undo ()
|
||||
"In WordStar mode: Undo and give message about undoing more changes."
|
||||
(interactive)
|
||||
(undo)
|
||||
(message "Repeat C-q l to undo more changes"))
|
||||
|
||||
(defun ws-goto-last-cursorposition ()
|
||||
"In WordStar mode: Go to position before last search."
|
||||
(interactive)
|
||||
(if ws-last-cursorposition
|
||||
(progn
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(goto-char ws-last-cursorposition))
|
||||
(ws-error "No last cursor position available")))
|
||||
|
||||
(defun ws-last-error ()
|
||||
"In WordStar mode: repeat last error message.
|
||||
This will only work for errors raised by WordStar mode functions."
|
||||
(interactive)
|
||||
(if ws-last-errormessage
|
||||
(message "%s" ws-last-errormessage)
|
||||
(message "No WordStar error yet")))
|
||||
|
||||
(defun ws-kill-eol ()
|
||||
"In WordStar mode: Kill to end of line (like WordStar, not like Emacs)."
|
||||
(interactive)
|
||||
(let ((p (point)))
|
||||
(end-of-line)
|
||||
(kill-region p (point))))
|
||||
|
||||
(defun ws-kill-bol ()
|
||||
"In WordStar mode: Kill to beginning of line (like WordStar, not like Emacs)."
|
||||
(interactive)
|
||||
(let ((p (point)))
|
||||
(beginning-of-line)
|
||||
(kill-region (point) p)))
|
||||
|
||||
(defun kill-complete-line ()
|
||||
"Kill the complete line."
|
||||
(interactive)
|
||||
(beginning-of-line)
|
||||
(if (eobp) (error "End of buffer"))
|
||||
(let ((beg (point)))
|
||||
(forward-line 1)
|
||||
(kill-region beg (point))))
|
||||
|
||||
(defun ws-repeat-search ()
|
||||
"In WordStar mode: Repeat last search."
|
||||
(interactive)
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(if ws-search-string
|
||||
(if ws-search-direction
|
||||
(search-forward ws-search-string)
|
||||
(search-backward ws-search-string))
|
||||
(ws-error "No search to repeat")))
|
||||
|
||||
(defun ws-query-replace (from to)
|
||||
"In WordStar mode: Search string, remember string for repetition."
|
||||
(interactive "sReplace: \n\
|
||||
sWith: " )
|
||||
(setq ws-search-string from)
|
||||
(setq ws-search-direction t)
|
||||
(setq ws-last-cursorposition (point-marker))
|
||||
(query-replace from to))
|
||||
|
||||
(defun ws-copy-block ()
|
||||
"In WordStar mode: Copy block to current cursor position."
|
||||
(interactive)
|
||||
(if (and ws-block-begin-marker ws-block-end-marker)
|
||||
(progn
|
||||
(copy-region-as-kill ws-block-begin-marker ws-block-end-marker)
|
||||
(yank)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
(setq ws-block-begin-marker (point-marker))
|
||||
(goto-char (region-end))
|
||||
(setq ws-block-end-marker (point-marker))))
|
||||
(ws-error (cond (ws-block-begin-marker "Block end marker not set")
|
||||
(ws-block-end-marker "Block begin marker not set")
|
||||
(t "Block markers not set")))))
|
||||
|
||||
(defmacro ws-set-marker (&rest indices)
|
||||
(let (n forms)
|
||||
(while indices
|
||||
(setq n (pop indices))
|
||||
(push `(defun ,(intern (format "ws-set-marker-%d" n)) ()
|
||||
,(format "In WordStar mode: Set marker %d to current cursor position" n)
|
||||
(interactive)
|
||||
(setq ,(intern (format "ws-marker-%d" n)) (point-marker))
|
||||
(message ,(format "Marker %d set" n)))
|
||||
forms))
|
||||
`(progn ,@(nreverse forms))))
|
||||
|
||||
(ws-set-marker 0 1 2 3 4 5 6 7 8 9)
|
||||
|
||||
(defmacro ws-find-marker (&rest indices)
|
||||
(let (n forms)
|
||||
(while indices
|
||||
(setq n (pop indices))
|
||||
(push `(defun ,(intern (format "ws-find-marker-%d" n)) ()
|
||||
,(format "In WordStar mode: Go to marker %d." n)
|
||||
(interactive)
|
||||
(if ,(intern (format "ws-marker-%d" n))
|
||||
(progn (setq ws-last-cursorposition (point-marker))
|
||||
(goto-char ,(intern (format "ws-marker-%d" n))))
|
||||
(ws-error ,(format "Marker %d not set" n))))
|
||||
forms))
|
||||
`(progn ,@(nreverse forms))))
|
||||
|
||||
(ws-find-marker 0 1 2 3 4 5 6 7 8 9)
|
||||
|
||||
(provide 'ws-mode)
|
||||
|
||||
;;; ws-mode.el ends here
|
@ -1,94 +0,0 @@
|
||||
;;; yow.el --- quote random zippyisms -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1993-1995, 2000-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Richard Mlynarik
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
;; Keywords: games
|
||||
;; Obsolete-since: 24.4
|
||||
|
||||
;; 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 3 of the License, 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. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Important pinheadery for GNU Emacs.
|
||||
;; This file is obsolete. For similar functionality, see
|
||||
;; fortune.el and cookie1.el.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cookie1)
|
||||
|
||||
(defgroup yow nil
|
||||
"Quote random zippyisms."
|
||||
:prefix "yow-"
|
||||
:group 'games)
|
||||
|
||||
(defcustom yow-file (expand-file-name "yow.lines" data-directory)
|
||||
"File containing pertinent pinhead phrases."
|
||||
:type 'file)
|
||||
|
||||
(defconst yow-load-message "Am I CONSING yet?...")
|
||||
(defconst yow-after-load-message "I have SEEN the CONSING!!")
|
||||
|
||||
;;;###autoload
|
||||
(defun yow (&optional insert display)
|
||||
"Return or display a random Zippy quotation. With prefix arg, insert it."
|
||||
(interactive "P\np")
|
||||
(let ((yow (cookie yow-file yow-load-message yow-after-load-message)))
|
||||
(cond (insert
|
||||
(insert yow))
|
||||
((not display)
|
||||
yow)
|
||||
(t
|
||||
(message "%s" yow)))))
|
||||
|
||||
(defsubst read-zippyism (prompt &optional require-match)
|
||||
"Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
|
||||
If optional second arg is non-nil, require input to match a completion."
|
||||
(cookie-read prompt yow-file yow-load-message yow-after-load-message
|
||||
require-match))
|
||||
|
||||
;;;###autoload
|
||||
(defun insert-zippyism (&optional zippyism)
|
||||
"Prompt with completion for a known Zippy quotation, and insert it at point."
|
||||
(interactive (list (read-zippyism "Pinhead wisdom: " t)))
|
||||
(insert zippyism))
|
||||
|
||||
;;;###autoload
|
||||
(defun apropos-zippy (regexp)
|
||||
"Return a list of all Zippy quotes matching REGEXP.
|
||||
If called interactively, display a list of matches."
|
||||
(interactive "sApropos Zippy (regexp): ")
|
||||
(cookie-apropos regexp yow-file (called-interactively-p 'interactive)))
|
||||
|
||||
|
||||
;; Yowza!! Feed zippy quotes to the doctor. Watch results.
|
||||
;; fun, fun, fun. Entertainment for hours...
|
||||
;;
|
||||
;; written by Kayvan Aghaiepour
|
||||
|
||||
(declare-function doctor-ret-or-read "doctor" (arg))
|
||||
|
||||
;;;###autoload
|
||||
(defun psychoanalyze-pinhead ()
|
||||
"Zippy goes to the analyst."
|
||||
(interactive)
|
||||
(cookie-doctor yow-file))
|
||||
|
||||
(provide 'yow)
|
||||
|
||||
;;; yow.el ends here
|
Loading…
Reference in New Issue
Block a user