help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] very slow kbd-macro


From: Michael John Downes
Subject: Re: [h-e-w] very slow kbd-macro
Date: 02 Nov 2001 09:15:42 -0500

Erwin Achermann <address@hidden> writes:

> This could explain it. However i tried it: pressing the keys for the two
> incremental searches by hand was still faster with the visual feedback,
> than calling the macro.... which doesn't  give the visual feedback.....
> so less done, and still slower! 

There's more going on under the hood than you seem to realize, so that
kind of test is not necessarily going to be all that relevant. If you
really want to find out more, change the isearches in the macro to
non-incremental searches and test that.

But if you want extremely fast macro-like operations you will probably
be better off in the long run learning some of the basic functions in
Emacs Lisp that would allow you to write simple macro-like commands such
as

(defun mymacro ()
  "Search for \"setenv\" at the beginning of a line, delete it, then go
forward one word and replace the next space with an equals sign."
  ;; This makes it possible to define a key that calls mymacro:
  (interactive "*")
  ;; Regular expression search: \s- means whitespace, and the backslash
  ;; must be doubled inside string quotes.
  (while (re-search-forward "^setenv\\s-+" nil t)
    (delete-region (match-beginning 0) (match-end 0))
    (forward-word 1)
    (delete-horizontal-space) ;; this is the command called by ESC-\
    (insert "=")))

(global-set-key (kbd "C-c m") 'mymacro)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]