Created
July 26, 2016 04:14
-
-
Save syohex/faea94f7e5e21cb4c0e46f65280bb35d to your computer and use it in GitHub Desktop.
anzu current prefix key behavior
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/anzu.el b/anzu.el | |
index 4d0cf62..84d099d 100644 | |
--- a/anzu.el | |
+++ b/anzu.el | |
@@ -408,7 +408,7 @@ | |
(defconst anzu--from-to-separator | |
(propertize | |
(or (ignore-errors | |
- (if (char-displayable-p ?\u2192) " \u2192 " " -> ")) | |
+ (if (char-displayable-p ?\u2192) " \u2192 " " -> ")) | |
" -> ") | |
'face 'minibuffer-prompt)) | |
@@ -454,7 +454,7 @@ | |
anzu--query-defaults) | |
(symbol-value query-replace-from-history-variable)))) | |
-(defun anzu--read-from-string (prompt beg end use-regexp overlay-limit) | |
+(defun anzu--read-from-string (prompt beg end use-regexp overlay-limit default-input) | |
(let ((curbuf (current-buffer)) | |
(blink-matching-paren nil) | |
(anzu--history (anzu--transform-from-to-history)) | |
@@ -472,7 +472,7 @@ | |
(anzu--check-minibuffer-input | |
curbuf beg end use-regexp overlay-limit)))))) | |
(prog1 (read-from-minibuffer (format "%s: " prompt) | |
- nil nil nil 'anzu--history nil t) | |
+ default-input nil nil 'anzu--history nil t) | |
(setq is-input t))) | |
(when timer | |
(cancel-timer timer) | |
@@ -490,8 +490,8 @@ | |
(message "\\t' here doesn't match a tab; to do that, just type TAB!!"))) | |
(sit-for 2)))) | |
-(defun anzu--query-from-string (prompt beg end use-regexp overlay-limit) | |
- (let* ((from (anzu--read-from-string prompt beg end use-regexp overlay-limit)) | |
+(defun anzu--query-from-string (prompt beg end use-regexp overlay-limit default-input) | |
+ (let* ((from (anzu--read-from-string prompt beg end use-regexp overlay-limit default-input)) | |
(is-empty (string= from ""))) | |
(when (and (not is-empty) (not anzu--query-defaults)) | |
(setq anzu--last-replaced-count anzu--total-matched)) | |
@@ -659,20 +659,12 @@ | |
(defun anzu--region-begin (use-region thing backward) | |
(cond (use-region (region-beginning)) | |
- (current-prefix-arg (line-beginning-position)) | |
(thing (anzu--thing-begin thing)) | |
(backward (point-min)) | |
(t (point)))) | |
-(defsubst anzu--line-end-position (num) | |
- (save-excursion | |
- (forward-line (1- num)) | |
- (line-end-position))) | |
- | |
(defun anzu--region-end (use-region thing) | |
(cond (use-region (region-end)) | |
- (current-prefix-arg | |
- (anzu--line-end-position (prefix-numeric-value current-prefix-arg))) | |
(thing (anzu--thing-end thing)) | |
(t (point-max)))) | |
@@ -743,12 +735,15 @@ | |
(unwind-protect | |
(let* ((from (cond ((and at-cursor beg) | |
(setq delimited nil) | |
- (anzu--query-from-at-cursor curbuf beg end overlay-limit)) | |
+ (if current-prefix-arg | |
+ (anzu--query-from-string | |
+ curbuf beg end use-regexp overlay-limit (thing-at-point 'symbol)) | |
+ (anzu--query-from-at-cursor curbuf beg end overlay-limit))) | |
(isearch-p | |
(anzu--query-from-isearch-string | |
curbuf beg end use-regexp overlay-limit)) | |
(t (anzu--query-from-string | |
- prompt beg end use-regexp overlay-limit)))) | |
+ prompt beg end use-regexp overlay-limit nil)))) | |
(to (cond ((consp from) | |
(prog1 (cdr from) | |
(setq from (car from) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment