ds@hollin.prime.com (06/29/89)
I've got lots of EMACS functions that I've written, in an attempt to make EMACS into a really useable high-productivity environment that pleases me. Is there any interest out there in the world for this stuff? Here is a small example of what I have. This is a function (which I arbitrarily bind to "CTRL-\") to repeat the last command, even if it is not a "complex command" (which means an extended command whose keypath started with "ESC-x"). It will, for example, search for the next occurrence of a string, when 'search-forward was the last command. (Writing this particular function got me a free lunch from the colleague who requested it!) Remember, this is only a tiny example of lots of functions. (Should I post a one-line description of each? The documentation string of each? The full EMACS-lisp text of each?) David Spector ds@primerd.prime.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (defun repeat (count) "Repeat last command with no query. Repeats the command as many times as indicated by numeric argument COUNT. If the last command had a numeric argument, it is ignored; if it had an argument list (usually happens only for functions that are not invoked by interactive keypath), the list is omitted; and if it was a self-inserted character, the current keybinding is inserted instead." (interactive "p") (let (str pos) (if (eq last-command 'repeat) () (setq pos (- (- (length (recent-keys)) 2) (length (this-command-keys)))) (setq str (substring (recent-keys) pos (+ pos 2))) (setq repeat-complex-flag nil) (setq repeat-kill-flag nil) (cond ((or (equal str "e") (equal str "E")) (setq repeat-command 'call-last-kbd-macro)) ((or (equal str "d") (equal str "D")) (setq repeat-command 'kill-word) (setq repeat-kill-flag t)) ((or (equal str "") (equal str "")) (setq repeat-command 'backward-kill-word) (setq repeat-kill-flag t)) ((eq last-command 'exit-minibuffer) (setq repeat-complex-flag t) (setq repeat-command (car command-history))) (t (setq repeat-command last-command)))) ;(princ repeat-command) (while (> count 0) (if repeat-kill-flag (append-next-kill)) (if repeat-complex-flag (eval repeat-command) (command-execute repeat-command)) (setq this-command 'repeat) (setq count (1- count))) (setq last-command 'repeat))) (global-set-key "\^\\" 'repeat)