SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions
Jordan, Independence Day, Argentina, National Day

RunCommandOverLines

Last edit

Summary: Update URL to github location

Changed:

< * http://asf.void.at/emacs/map-lines.el *Note:* 2010-12-04 The URL no longer exists. Possible new location https://alioth.debian.org/scm/viewvc.php/emacs-goodies-el/elisp/emacs-goodies-el/map-lines.el?view=markup&revision=HEAD&root=pkg-goodies-el
< The map-lines.el
is included in Debian package "emacs-goodies-el" and the code is maintained by Paul Hobbs <Paul_Hobbs@hmc.edu> (2010).

to

> * The code is here: https://github.com/PaulHobbs/Map-lines and is included in the Debian package "emacs-goodies-el".
> It
is maintained by Paul Hobbs <paul . mcdill . hobbs atsign gmail> (2010).


    (defun tsp-run-command-over-lines (command &optional n)
      "Run COMMAND over the following N lines.
    We use the previous N lines if N is negative."
      (interactive "CCommand: \np\n")
      (let ((a (if (< n 0)
                   (line-end-position)
                 (line-beginning-position)))
            (b (if (< n 0)
                   (line-beginning-position n)
                 (line-end-position n))))
        (save-restriction
          (narrow-to-region a b)
          (call-interactively command))))

Also, try map-lines – it does what your code does, with regexps, and you get the lines collected on top of the kill ring:

It is maintained by Paul Hobbs <paul . mcdill . hobbs atsign gmail> (2010).


CategoryEditing