• Stars
    star
    508
  • Rank 86,669 (Top 2 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created about 14 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Writable grep buffer and apply the changes to files

wgrep.el

Summary:

wgrep allows you to edit a grep buffer and apply those changes to the file buffer like sed interactively. No need to learn sed script, just learn Emacs.

Install:

Put this file into load-path'ed directory, and byte compile it if desired. And put the following expression into your ~/.emacs.

(require 'wgrep)

Usage:

You can edit the text in the grep buffer after typing C-c C-p . After that the changed text is highlighted. The following keybindings are defined:

  • C-c C-e: Apply the changes to file buffers.

  • C-c C-u: All changes are unmarked and ignored.

  • C-c C-d: Mark as delete to current line (including newline).

  • C-c C-r: Remove the changes in the region (these changes are not applied to the files. Of course, the remaining changes can still be applied to the files.)

  • C-c C-p: Toggle read-only area.

  • C-c C-k: Discard all changes and exit.

  • C-x C-q: Exit wgrep mode.

  • To save all buffers that wgrep has changed, run

M-x wgrep-save-all-buffers
  • To save buffer automatically when wgrep-finish-edit.
(setq wgrep-auto-save-buffer t)
  • You can change the default key binding to switch to wgrep.
(setq wgrep-enable-key "r")
  • To apply all changes regardless of whether or not buffer is read-only.
(setq wgrep-change-readonly-file t)

Trivial features:

  • wdired.el like interface.
  • Support GNU grep --context (-A -B and -C) option.
  • Can handle too many files.
  • Can handle newline insertion in grep buffer.
  • Delete whole line include newline.

Similar software:

GNU sed helm-ag has a similar feature.

History:

This program was forked from Matsushita Akihisa's grep-edit.el v2.11. As this website is now inaccessible, emacswiki.org's copy may be consulted.

Imported version can be downloaded from this orphan commit: https://github.com/mhayashi1120/Emacs-wgrep/tree/import-original-author/

Following added implementations and differences.

  • Support GNU grep context option -A -B and -C
  • Some bugfix. (wrong coloring text etc..)
  • wdired.el like interface.
  • Remove all advice.
  • Bind to local variables. (grep-a-lot.el works well)
  • After save buffer, colored face will be removed.
  • Change face easy to see.
  • Reinforce checking error.
  • Support removing whole line include new-line.

More Repositories

1

Emacs-langtool

LanguageTool for Emacs
Emacs Lisp
360
star
2

Emacs-imagex

Emacs image extensions
Emacs Lisp
51
star
3

Emacs-erefactor

Emacs-Lisp refactoring utilities
Emacs Lisp
26
star
4

Emacs-esqlite

sqlite file manipulate utilities
Emacs Lisp
24
star
5

Emacs-image-diredx

image-dired extension
Emacs Lisp
20
star
6

Emacs-pcsv

Emacs Lisp
15
star
7

auto-highlight-symbol-mode

automatic highlighting current symbol minor mode
Emacs Lisp
14
star
8

Gauche-net-twitter

Twitter API access library for Gauche
Scheme
11
star
9

Emacs-shelldoc

Shell command editing support with man page.
Emacs Lisp
11
star
10

Emacs-gosh-mode

Gauche editing extensions for Emacs scheme-mode
Emacs Lisp
10
star
11

Gauche-dbd-sqlite3

sqlite3 module
Scheme
8
star
12

Emacs-kaesar

Another AES algorithm encrypt/decrypt string with password.
Emacs Lisp
6
star
13

Gauche-net-oauth

OAuth library for Gauche
Scheme
5
star
14

japanlaw.el

Emacs 電子六法
Emacs Lisp
5
star
15

Emacs-color-dired

Emacs Lisp
5
star
16

Emacs-Lisp

My miscellaneous Emacs-Lisp
Emacs Lisp
5
star
17

Emacs-rectplus

Emacs Lisp
4
star
18

Gauche-net-oauth2

OAuth2 library for Gauche
Scheme
4
star
19

smart-log.el

Major mode with intepretting miscellaneous time format
Emacs Lisp
4
star
20

Gauche-dbd-sqlite

Another sqlite binding for gauche
Scheme
3
star
21

Emacs-image-archive

Image thumbnails in archive file
Emacs Lisp
3
star
22

Emacs-slideview

Slideshow
Emacs Lisp
3
star
23

Emacs-twittering-stream

Stream extensions for twittering-mode
Emacs Lisp
3
star
24

Emacs-piki

piki editing mode for Emacs
Emacs Lisp
3
star
25

Emacs-guid

Simple GUID/UUID generator/updator
Emacs Lisp
2
star
26

Emacs-cipher

AES cipher for Emacs
Emacs Lisp
2
star
27

Emacs-openssl-cipher

Cipher utilities using openssl
Emacs Lisp
2
star
28

Emacs-findwalker

Emacs Lisp
2
star
29

Emacs-fsvn

Subversion frontend for Emacs
Emacs Lisp
2
star
30

Emacs-gather

Gather string in buffer
Emacs Lisp
2
star
31

bs2sxml

BeautifulSoup to sxml (Gauche)
Scheme
2
star
32

PuyoPuyoMisc

test
C#
1
star
33

git-test

Emacs Lisp
1
star
34

Gauche-gis-hubeny

Calculate distance between 2 latitude/longitude
Scheme
1
star
35

Gauche-net-hatena

Hatena access library for Gauche
Scheme
1
star
36

Gauche-rfc-3339

RFC3339 (Date and Time on the Internet: Timestamps)
Scheme
1
star
37

mhc-gcal

1
star
38

Haskell-Test

Haskell
1
star
39

Gauche-net-yamareco

ヤマレコ api
Scheme
1
star
40

Emacs-jcalendar

Calendar extension for japanese
Emacs Lisp
1
star