New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a tip if user just re-types the string at point #112
Comments
Other thoughts: we should truncate the default input if it's too long. If there's nothing at point, and nothing selected, offer the previous search input as the default. |
i've been using this hack locally for a few days and i'm actually quite happy with how it works in practice: modified Emacs/elpa/ag-20160731.1323/ag.el
@@ -112,6 +112,12 @@ If set to nil, fall back to finding VCS root directories."
:type '(repeat (string))
:group 'ag)
+(defcustom ag-editable-default nil
+ "Non-nil means the default search string is editable when reading
+from the minibuffer."
+ :type 'boolean
+ :group 'ag)
+
(require 'compile)
;; Although ag results aren't exactly errors, we treat them as errors
@@ -476,14 +482,15 @@ If called with a prefix, prompts for flags to pass to ag."
If there's a string at point, offer that as a default."
(let* ((suggested (ag/dwim-at-point))
(final-prompt
- (if suggested
+ (if (and suggested (not ag-editable-default))
(format "%s (default %s): " prompt suggested)
(format "%s: " prompt)))
;; Ask the user for input, but add `suggested' to the history
;; so they can use M-n if they want to modify it.
(user-input (read-from-minibuffer
final-prompt
- nil nil nil nil suggested)))
+ (when ag-editable-default suggested)
+ nil nil nil suggested)))
;; Return the input provided by the user, or use `suggested' if
;; the input was empty.
(if (> (length user-input) 0) to delete the whole line from the minibuffer, i use |
If the region is active, we should probably pre-populate the input anyway. The M-down shortcut is not discoverable.
The text was updated successfully, but these errors were encountered: