[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/symbol-overlay 1d971f69fb 037/152: (v3.3) add isearch
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/symbol-overlay 1d971f69fb 037/152: (v3.3) add isearch |
Date: |
Thu, 7 Jul 2022 12:04:10 -0400 (EDT) |
branch: elpa/symbol-overlay
commit 1d971f69fba6e98079517a32e22e07675f2a3396
Author: wolray <290061869@qq.com>
Commit: wolray <290061869@qq.com>
(v3.3) add isearch
---
readme.md | 9 ++---
symbol-overlay.el | 100 ++++++++++++++++++++++++++++++------------------------
2 files changed, 61 insertions(+), 48 deletions(-)
diff --git a/readme.md b/readme.md
index e782bf9785..7f421226ae 100644
--- a/readme.md
+++ b/readme.md
@@ -33,13 +33,14 @@ When putting overlays on symbols, **an auto-activated
overlay-inside keymap** wi
### Powerful
- Toggle all overlays of symbol at point: `symbol-overlay-put`
-- Copy symbol at point: `symbol-overlay-save-symbol`
-- Jump back to the position before a recent jump: `symbol-overlay-echo-mark`
-- Remove all highlighted symbols in the buffer: `symbol-overlay-remove-all`
- Jump between locations of symbol at point: `symbol-overlay-jump-next` &
`symbol-overlay-jump-prev`
-- Jump to the definition of symbol at point:
`symbol-overlay-jump-to-definition`
- Switch to the closest symbol highlighted nearby:
`symbol-overlay-switch-forward` & `symbol-overlay-switch-backward`
+- Remove all highlighted symbols in the buffer: `symbol-overlay-remove-all`
+- Copy symbol at point: `symbol-overlay-save-symbol`
- Toggle overlays to be showed in buffer or only in scope:
`symbol-overlay-toggle-in-scope`
+- Jump back to the position before a recent jump: `symbol-overlay-echo-mark`
+- Jump to the definition of symbol at point:
`symbol-overlay-jump-to-definition`
+- Isearch symbol at point literally, without `regexp-quote` the symbol:
`symbol-overlay-isearch-literally`
- Query replace symbol at point: `symbol-overlay-query-replace`
- Rename symbol at point on all its occurrences: `symbol-overlay-rename`
diff --git a/symbol-overlay.el b/symbol-overlay.el
index b0823cd108..b75a64d65f 100644
--- a/symbol-overlay.el
+++ b/symbol-overlay.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2017 wolray
;; Author: wolray <wolray@foxmail.com>
-;; Version: 3.2
+;; Version: 3.3
;; URL: https://github.com/wolray/symbol-overlay/
;; Keywords: faces, matching
;; Package-Requires: ((emacs "24.3"))
@@ -45,16 +45,18 @@
;; will enable you to call various useful commands with a single keystroke.
;; Toggle all overlays of symbol at point: `symbol-overlay-put'
-;; Copy symbol at point: `symbol-overlay-save-symbol'
-;; Jump back to the position before a recent jump: `symbol-overlay-echo-mark'
-;; Remove all highlighted symbols in the buffer: `symbol-overlay-remove-all'
;; Jump between locations of symbol at point: `symbol-overlay-jump-next' &
;; `symbol-overlay-jump-prev'
-;; Jump to the definition of symbol at point:
`symbol-overlay-jump-to-definition'
;; Switch to the closest symbol highlighted nearby:
;; `symbol-overlay-switch-forward' & `symbol-overlay-switch-backward'
+;; Remove all highlighted symbols in the buffer: `symbol-overlay-remove-all'
+;; Copy symbol at point: `symbol-overlay-save-symbol'
;; Toggle overlays to be showed in buffer or only in scope:
;; `symbol-overlay-toggle-in-scope'
+;; Jump back to the position before a recent jump: `symbol-overlay-echo-mark'
+;; Jump to the definition of symbol at point:
`symbol-overlay-jump-to-definition'
+;; Isearch symbol at point literally, without `regexp-quote' the symbol:
+;; `symbol-overlay-isearch-literally'
;; Query replace symbol at point: `symbol-overlay-query-replace'
;; Rename symbol at point on all its occurrences: `symbol-overlay-rename'
@@ -82,9 +84,10 @@
(define-key map (kbd "o") 'symbol-overlay-jump-next)
(define-key map (kbd "k") 'symbol-overlay-remove-all)
(define-key map (kbd "w") 'symbol-overlay-save-symbol)
+ (define-key map (kbd "t") 'symbol-overlay-toggle-in-scope)
(define-key map (kbd "e") 'symbol-overlay-echo-mark)
(define-key map (kbd "d") 'symbol-overlay-jump-to-definition)
- (define-key map (kbd "t") 'symbol-overlay-toggle-in-scope)
+ (define-key map (kbd "s") 'symbol-overlay-isearch-literally)
(define-key map (kbd "q") 'symbol-overlay-query-replace)
(define-key map (kbd "SPC") 'symbol-overlay-rename)
map)
@@ -220,6 +223,23 @@ If SHOW-COLOR is non-nil, display the color used by
current overlay."
(and (looking-at-p "\\_>") (backward-char))
(symbol-overlay-count (symbol-overlay-put-all symbol) t)))))
+;;;###autoload
+(defun symbol-overlay-remove-all ()
+ "Remove all highlighted symbols in the buffer."
+ (interactive)
+ (unless (minibufferp)
+ (mapc 'delete-overlay (symbol-overlay-get-list))
+ (setq symbol-overlay-keywords-alist nil)))
+
+;;;###autoload
+(defun symbol-overlay-save-symbol ()
+ "Copy symbol at point."
+ (interactive)
+ (unless (minibufferp)
+ (symbol-overlay-get-symbol)
+ (kill-ring-save (match-beginning 0) (match-end 0))
+ (message "Current symbol saved")))
+
;;;###autoload
(defun symbol-overlay-toggle-in-scope ()
"Toggle overlays to be showed in buffer or only in scope."
@@ -236,23 +256,6 @@ If SHOW-COLOR is non-nil, display the color used by
current overlay."
(symbol-overlay-count
(symbol-overlay-put-all symbol scope keyword)))))))
-;;;###autoload
-(defun symbol-overlay-remove-all ()
- "Remove all highlighted symbols in the buffer."
- (interactive)
- (unless (minibufferp)
- (mapc 'delete-overlay (symbol-overlay-get-list))
- (setq symbol-overlay-keywords-alist nil)))
-
-;;;###autoload
-(defun symbol-overlay-save-symbol ()
- "Copy symbol at point."
- (interactive)
- (let ((symbol (symbol-overlay-get-symbol))
- (bounds (bounds-of-thing-at-point 'symbol)))
- (kill-ring-save (car bounds) (cdr bounds))
- (message (concat "Current symbol saved"))))
-
(defvar symbol-overlay-mark nil
"A mark used for jumping back to the point saved befored.")
(make-variable-buffer-local 'symbol-overlay-mark)
@@ -277,10 +280,9 @@ DIR must be 1 or -1."
(defun symbol-overlay-basic-jump (symbol dir)
"Jump to SYMBOL's next location in the direction DIR. DIR must be 1 or -1."
- (let* ((case-fold-search nil)
- (bounds (bounds-of-thing-at-point 'symbol))
- (offset (- (point) (if (> dir 0) (cdr bounds) (car bounds))))
- target)
+ (let ((case-fold-search nil)
+ (offset (- (point) (if (> dir 0) (match-end 0) (match-beginning 0))))
+ target)
(goto-char (- (point) offset))
(setq target (re-search-forward symbol nil t dir))
(unless target
@@ -353,6 +355,16 @@ DIR must be 1 or -1."
(interactive)
(symbol-overlay-switch-symbol -1))
+;;;###autoload
+(defun symbol-overlay-isearch-literally ()
+ "Isearch symbol at point literally, without `regexp-quote' the symbol."
+ (interactive)
+ (let ((symbol (symbol-overlay-get-symbol))
+ (beg (match-beginning 0)))
+ (goto-char beg)
+ (isearch-forward nil t)
+ (isearch-yank-string (substring symbol 3 -3))))
+
(defun symbol-overlay-replace-call (replace-function)
"Replace symbol using REPLACE-FUNCTION."
(unless (minibufferp)
@@ -360,10 +372,10 @@ DIR must be 1 or -1."
(symbol (symbol-overlay-get-symbol))
(keyword (symbol-overlay-assoc symbol))
(scope (cadr keyword))
- (new (substring symbol 3 -3)))
+ new)
(beginning-of-thing 'symbol)
(setq symbol-overlay-mark (point)
- new (funcall replace-function symbol new scope))
+ new (funcall replace-function symbol scope))
(unless (string= new symbol)
(symbol-overlay-remove (symbol-overlay-assoc new t))
(setq keyword (symbol-overlay-put-all
@@ -377,11 +389,11 @@ DIR must be 1 or -1."
"Query replace symbol at point."
(interactive)
(symbol-overlay-replace-call
- '(lambda (symbol new scope)
+ '(lambda (symbol scope)
(and scope (user-error "Query replace is invalid in scope"))
- (setq new (read-string "Replacement: "))
- (let ((inhibit-modification-hooks t)
- (defaults (cons symbol new)))
+ (let* ((new (read-string "Replacement: "))
+ (defaults (cons symbol new))
+ (inhibit-modification-hooks t))
(query-replace-regexp symbol new)
(setq query-replace-defaults
(if (< emacs-major-version 25) `,defaults `(,defaults))))
@@ -392,17 +404,17 @@ DIR must be 1 or -1."
"Rename symbol at point on all its occurrences."
(interactive)
(symbol-overlay-replace-call
- '(lambda (symbol new scope)
- (setq new (read-string (concat (format "Rename (%s)" new)
- (and scope " in scope")
- ": ")))
- (save-excursion
- (save-restriction
- (symbol-overlay-narrow scope)
- (goto-char (point-min))
- (let ((inhibit-modification-hooks t))
- (while (re-search-forward symbol nil t) (replace-match new)))))
- (symbol-overlay-get-symbol new))))
+ '(lambda (symbol scope)
+ (let ((new (read-string (concat "Rename"
+ (and scope " in scope")
+ ": "))))
+ (save-excursion
+ (save-restriction
+ (symbol-overlay-narrow scope)
+ (goto-char (point-min))
+ (let ((inhibit-modification-hooks t))
+ (while (re-search-forward symbol nil t) (replace-match new)))))
+ (symbol-overlay-get-symbol new)))))
(defun symbol-overlay-refresh (beg end len)
"Refresh overlays. Installed on `after-change-functions'.
- [nongnu] elpa/symbol-overlay a3f708ce3f 015/152: add a version, (continued)
- [nongnu] elpa/symbol-overlay a3f708ce3f 015/152: add a version, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 794ae33cc1 019/152: v2.2 Make some optimizations. Add a mark variable., ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 9fc0cfaf36 043/152: fix doc, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 0ec27ba84b 057/152: fix, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay f6d065eb3a 006/152: checkdoc, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay b34d0a37ab 012/152: Fix package, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 148652222c 025/152: fix some documentation text., ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 674b78983c 027/152: add an image in readme, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 03e94a9a64 028/152: fix the image, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 9f5d3c10fa 033/152: fix readme, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 1d971f69fb 037/152: (v3.3) add isearch,
ELPA Syncer <=
- [nongnu] elpa/symbol-overlay fd0bd0f23f 042/152: (v3.4) add symbol-overlay-mode, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 69dd2bdaac 048/152: fix doc, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 5fd2c80610 036/152: fix conflicts with replace-match, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay f21c2447b7 046/152: better code, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay b4659bf6b1 052/152: toggle minor-mode when jumping without highlight, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 334eed7052 049/152: fix a jump error, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay fb9c1a5cb1 058/152: delete symbol-overlay-narrow-function, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay c7918e18bb 061/152: Make symbol-overlay-mode autoloadable, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 7b638c8418 064/152: Properly define symbol-overlay-temp-face, ELPA Syncer, 2022/07/07
- [nongnu] elpa/symbol-overlay 6971ab0c16 067/152: Declare minor mode earlier to avoid byte compilation warnings, ELPA Syncer, 2022/07/07