[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 00abe88e13 061/301: Hide line-feed between occurrenc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 00abe88e13 061/301: Hide line-feed between occurrence |
Date: |
Mon, 10 Jan 2022 22:58:50 -0500 (EST) |
branch: elpa/iedit
commit 00abe88e13aa7f1d3b15c3fd2e6e2316dbf64ad4
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Hide line-feed between occurrence
Keep invisible lines invisible when restricting.
---
iedit.el | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/iedit.el b/iedit.el
index cc713e50df..95107e9a53 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-02-22 23:28:30 Victor Ren>
+;; Time-stamp: <2012-02-23 22:17:08 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
;; Version: 0.94
@@ -199,7 +199,7 @@ occurrence is not applied to other occurrences when it is
true.")
(defvar iedit-current-keymap nil
"The current keymap, `iedit-occurrence-keymap' or `iedit-rect-keymap'.")
-(defvar iedit-occurrence-context-lines 0
+(defvar iedit-occurrence-context-lines 1
"The number of lines before or after the occurrence.")
(make-variable-buffer-local 'iedit-occurrences-overlays)
@@ -270,7 +270,7 @@ This is like `describe-bindings', but displays only Iedit
keys."
(princ keymap)))))
(defun iedit-describe-key ()
- "Display documentation of the function invoked by iedit key."
+ "Display documentation of the function invoked by iedit mode key."
(interactive)
(let (same-window-buffer-names same-window-regexps)
(call-interactively 'describe-key)))
@@ -401,6 +401,8 @@ Commands:
(deactivate-mark)
(iedit-show-all)
(iedit-cleanup-occurrences-overlays beg end arg)
+ (if iedit-unmatched-lines-invisible
+ (iedit-hide-unmatched-lines
iedit-occurrence-context-lines))
(setq iedit-mode (propertize
(concat " Iedit:" (number-to-string
(length
iedit-occurrences-overlays)))
@@ -640,7 +642,14 @@ occurrence, it will exit iedit mode."
(unless (eq beg end) ;; replacement
(goto-char beginning)
(insert-and-inherit value)))))))))))))
-;; (elp-instrument-list '(insert-and-inherit delete-region goto-char
iedit-occurrence-update buffer-substring-no-properties string=
re-search-forward replace-match))
+;; (elp-instrument-list '(insert-and-inherit
+;; delete-region
+;; goto-char
+;; iedit-occurrence-update
+;; buffer-substring-no-properties
+;; string=
+;; re-search-forward
+;; replace-match))
(defun iedit-next-occurrence ()
"Move forward to the next occurrence in the `iedit'.
@@ -729,10 +738,12 @@ If no prefix argument, the prefix argument last time or
default
value of `iedit-occurrence-context-lines' is used for this time."
(interactive "P")
(if (null arg)
+ ;; toggle visible
(progn (setq iedit-unmatched-lines-invisible (not
iedit-unmatched-lines-invisible))
(if iedit-unmatched-lines-invisible
- (iedit-hide-unmatched-lines iedit-occurrence-context-lines)
+ (iedit-hide-unmatched-lines iedit-occurrence-context-lines)
(iedit-show-all)))
+ ;; reset invisible lines
(setq arg (prefix-numeric-value arg))
(if (< arg 0)
(setq arg 0))
@@ -747,25 +758,25 @@ value of `iedit-occurrence-context-lines' is used for
this time."
(defun iedit-show-all()
"Show hided lines."
(setq line-move-ignore-invisible nil)
- (remove-overlays nil nil iedit-invisible-overlay-name t)
- (remove-from-invisibility-spec '(iedit-invisible-overlay-name . t)))
+ (remove-from-invisibility-spec '(iedit-invisible-overlay-name . t))
+ (remove-overlays nil nil iedit-invisible-overlay-name t))
(defun iedit-hide-unmatched-lines (context-lines)
"Hide unmatched lines using invisible overlay."
- (let ((prev-occurrence-end 0)
+ (let ((prev-occurrence-end 1)
(unmatched-lines nil))
(save-excursion
(dolist (overlay iedit-occurrences-overlays)
(goto-char (overlay-start overlay))
(forward-line (- context-lines))
(let ((line-beginning (line-beginning-position)))
- (if (> line-beginning (1+ prev-occurrence-end))
- (push (list (1+ prev-occurrence-end) (1- line-beginning))
unmatched-lines)))
+ (if (> line-beginning prev-occurrence-end)
+ (push (list prev-occurrence-end (1- line-beginning))
unmatched-lines)))
(goto-char (overlay-end overlay))
(forward-line context-lines)
(setq prev-occurrence-end (line-end-position)))
(if (< prev-occurrence-end (point-max))
- (push (list (1+ prev-occurrence-end) (point-max)) unmatched-lines))
+ (push (list prev-occurrence-end (point-max)) unmatched-lines))
(when unmatched-lines
(set (make-local-variable 'line-move-ignore-invisible) t)
(add-to-invisibility-spec '(iedit-invisible-overlay-name . t))
- [nongnu] elpa/iedit d4a878d52e 280/301: Minor docstring typo fix: covert -> convert., (continued)
- [nongnu] elpa/iedit d4a878d52e 280/301: Minor docstring typo fix: covert -> convert., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4765fa7a4d 271/301: Fix a conjoined overlay issue, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 68233e302d 300/301: Fix some byte-compiler warnings in Emacs 28, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7d18e5d775 039/301: Add a help command C-? for occurrences, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e08ad5923a 043/301: Make Iedit mode available for read only buffer, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 78f606d4fc 045/301: Add iedit-number-occurrences function, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 0d4027fe10 046/301: Move save-excursion out of dolist, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3bca7e2da5 048/301: Fix iedit toggle case-sensitive problem when getting occurrence from history, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5ab980908c 050/301: Update documents, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 799a0d17d1 053/301: Bump to version 0.94, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 00abe88e13 061/301: Hide line-feed between occurrence,
ELPA Syncer <=
- [nongnu] elpa/iedit bd8c116489 062/301: Add new occurrence function iedit-restrict-defun, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7ebea0f43b 070/301: Add tests for iedit-rectangle, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e5f083f977 072/301: Add testcase for iedit-restrict-defun, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 62d2a5ac45 077/301: Fix iedit-kill-rectangle problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 8559638b9b 076/301: Fix C-u C-u iedit-last-inital-string-global problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3ead6c6d3b 074/301: run checkdoc, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit ac2faa29d0 075/301: Add iedit-mode-defun and global key binding, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 09c5063668 088/301: Merge pull request #10 from lewang/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5ad28b5ea0 003/301: updates, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6e49225083 042/301: Add iedit-toggle-case-sensitive, ELPA Syncer, 2022/01/10