Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site smeagol.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!oberon!smeagol!earle From: earle@smeagol.UUCP (Greg Earle) Newsgroups: net.emacs Subject: Minibuffer completion update for (underground) 17.30 GNU Emacs Message-ID: <526@smeagol.UUCP> Date: Wed, 18-Dec-85 00:41:04 EST Article-I.D.: smeagol.526 Posted: Wed Dec 18 00:41:04 1985 Date-Received: Fri, 20-Dec-85 05:26:42 EST References: <5428@mit-eddie.UUCP> Organization: Spacecraft Data Systems, JPL, Pasadena, CA Lines: 46 In article <5428@mit-eddie.UUCP>, Bruce Israel writes: > Here is a really useful function that I wrote for minibuffer > completion. It will complete as much as possible, exiting if there is > only one possibility. If there are two or more, then it completes > until the two choices differ. If there aren't any possibilities, then > it removes characters off the end of the completion string until it > gets to a point where completions are possible and stops there. > > I bind it to the SPACE key in the minibuffer, since I don't really > like completion by single words at all. Following the function is the > function call that will bind it to the SPACE key. Change the > character there if you want to bind it to something else. Enjoy. > > (defun minibuffer-complete-exit-backup nil > "Minibuffer completion, exiting on unique completion with backup." > (interactive) > (let (comp (complete t)) > (set-mark (dot-min)) > (while (null (setq comp (all-completions > (region-to-string) > minibuffer-completion-table > minibuffer-completion-predicate))) > (setq complete nil) > (delete-backward-char 1 nil)) > (and complete (if (null (cdr comp)) (minibuffer-complete-and-exit) > (minibuffer-complete))))) > ; > (define-key minibuffer-local-must-match-map " " > (define-key minibuffer-local-completion-map " " > 'minibuffer-complete-exit-backup)) If you want this useful little guy to work under GNU Emacs 17.30, do this: (1) Remove the line with "(set-mark (dot-min))". (2) Change the line containing "(region-to-string)" to : "(buffer-substring (dot-min) (dot))". ---------- Greg Earle JPL sdcrdcf!smeagol!earle (UUCP) ia-sun2!smeagol!earle@cit-vax.arpa (ARPA) => Know Your Culture <= "Chronos", a silent (no-talking) film about our history - at an IMAX theatre near you. (What? No IMAX near you? Aye, there's the pity) Makes all the movies discussed in net.movies ( :=+ ) totally irrelevant and meaningless.