Article View: comp.emacs
Article #3670Re: isearch-forward
From: Ray Trent
Date: Wed, 03 Dec 1986 07:01
Date: Wed, 03 Dec 1986 07:01
76 lines
3423 bytes
3423 bytes
In article <1381@umd5> cgs@umd5 (Chris Sylvain) writes:
>I'd like to have CTRL-\ act the same way CTRL-S does with all the "magic"
>such as when it is typed more than once -- you can search for the string
>you searched for the last time. As it stands now, CTRL-\ just prompts for
>a new search string repeatedly. Can I do this with a macro, or do I have
The following is an elisp program that does what was requested. It
does its translation before the rest of gnuemacs sees the character,
so everything that worked with C-s and C-q now work with C-\ and C-^.
It was posted to the net a while ago...but since no one seems to
remember it, I thought I'd repost it. The documentation is pretty
self-explanatory. As I remember, it was distributed under the terms
of the Gnu License. (q.v.)
--------------------cut here-------------------
;Kuling :/usr/alla/christer/emacs/xonxoff.el, Thu Apr 10 20:50:38 1986,
; Edit by: Christer Johansson (christer@kuling)
; Changed DOCSTRING of Xon-xoff-mode. Removed -*- line.
;Edited: Tue Nov 19 1985 by christer@kuling (Christer Johansson)
; /usr/alla/christer/emacs/xonxoff.el Added variables C-{S,Q}-Replacement.
;Edited: Mon Nov 11 1985 by christer@kuling (Christer Johansson)
; /usr/alla/christer/emacs/xonxoff.el Works under ver. 16.60
;; Make the identity translation table.
(progn (setq keyboard-translate-table (make-string 128 0))
(let ((i 0))
(while (< i 128)
(aset keyboard-translate-table i i)
(setq i (1+ i)))))
(defvar xon-xoff-mode t
"Controls the xon-xoff mode.
If this variable is nil, xon-xoff-mode is off.")
(defun xon-xoff-mode (arg)
"Xon-xoff mode's good if you want too use ^s and ^q for flow-control.
Turns Xon-xoff mode on if ARG > 0, off if ARG < 0.
With ARG = 0, Xon-xoff-mode toggles.
If Xon-xoff-mode is on, all ^^ typed by the user will be translated to ^q
before they are interpreted in any way. Likewise ^\ will be translated to ^s.
If the options C-Q-Replacement and C-S-Replacement are set, there values will
be used instead of ^^ and ^\. ^q and ^s will be used for flow-controll in
xon-xoff-mode.
"
(interactive "p")
(setq xon-xoff-mode
(if (and (zerop arg)
(boundp xon-xoff-mode))
(not xon-xoff-mode)
(> arg 0)))
(set-input-mode nil xon-xoff-mode)
(if xon-xoff-mode
(progn (aset keyboard-translate-table
(if (boundp 'C-S-Replacement)
C-S-Replacement
?\^^)
?\^s)
(aset keyboard-translate-table
(if (boundp 'C-Q-Replacement)
C-Q-Replacement
?\^\\)
?\^q))
(aset keyboard-translate-table ?\^s ?\^s)
(aset keyboard-translate-table ?\^q ?\^q)))
(xon-xoff-mode 1)
--
"A journey of a thousand miles..."
../ray\..
(trent@csvax.caltech.edu, rat@caltech.bitnet, ...seismo!cit-vax!trent)
Technical Details
Message-ID:
<1267@cit-vax.Caltech.Edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!ames!cit-vax!trentReferences:
<1381@umd5>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!ames!cit-vax!trent From: trent@cit-vax.Caltech.Edu (Ray Trent) Newsgroups: comp.emacs Subject: Re: isearch-forward Message-ID: <1267@cit-vax.Caltech.Edu> Date: Wed, 3-Dec-86 02:01:32 EST Article-I.D.: cit-vax.1267 Posted: Wed Dec 3 02:01:32 1986 Date-Received: Wed, 3-Dec-86 06:20:44 EST References: <1381@umd5> Reply-To: trent@cit-vax.UUCP (Ray Trent) Organization: California Institute of Technology Lines: 76 Keywords: global-set-key,"magic"