-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcc-wgrep-mode.el
68 lines (50 loc) · 2.2 KB
/
cc-wgrep-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
;;; cc-wgrep-mode.el --- wgrep configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2023-2024 Charles Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
(require 'wgrep)
(easy-menu-define cc/wgrep-menu nil
"Keymap for wgrep menu"
'("Writeable Grep"
:visible (derived-mode-p 'grep-mode)
["Change to wgrep mode" wgrep-change-to-wgrep-mode
:enable (equal buffer-read-only t)
:help "Change to wgrep mode."]
["Finish Edit" wgrep-finish-edit
:enable (not buffer-read-only)
:help "Apply the changes to file buffers and exit."]
["Mark Current Line for Deletion" wgrep-mark-deletion
:enable (not buffer-read-only)
:help "Mark as delete to current line (including newline)."]
["Toggle Readonly" wgrep-toggle-readonly-area
:enable (not buffer-read-only)
:help "Toggle read-only area to remove a whole line."]
["Remove Change" wgrep-remove-change
:enable (not buffer-read-only)
:help "Remove changes in the region between BEG and END."]
["Remove All Changes" wgrep-remove-all-change
:enable (not buffer-read-only)
:help "Remove changes in the whole buffer."]
["Abort Changes and Exit" wgrep-abort-changes
:enable (not buffer-read-only)
:help "Discard all changes and return to original mode."]
["Exit" wgrep-exit
:enable (not buffer-read-only)
:help "Return to original mode."]))
(easy-menu-add-item grep-menu-map nil
cc/wgrep-menu
nil)
(provide 'cc-wgrep-mode)
;;; cc-wgrep-mode.el ends here