wilfred / ag.el Goto Github PK
View Code? Open in Web Editor NEWAn Emacs frontend to The Silver Searcher
Home Page: http://agel.readthedocs.org/en/latest/
An Emacs frontend to The Silver Searcher
Home Page: http://agel.readthedocs.org/en/latest/
If you select file type "ruby" for example, it yells:
replace-regexp-in-string: Wrong type argument: stringp, (".rb" ".rhtml" ".rjs" ".rxml" ".erb" ".rake" ".spec")
It works with the custom regexp tho.
using ag.el 0.43 installed from melpa, ag.exe 0.18.1, GNU Emacs 24.4.50.1 (x86_64-w64-mingw32), windows 7
seems like this was fixed many versions ago, but I can't seem to jump to the results. All I get is 'No Error here'
Possibly something I need to adjust in my config?
.gitignore has absolute path syntax, for specific, repository-root -relative ignores:
/foo/bar
which ignores exactly $(REPOROOT)/foo/bar
, as opposed to
foo/bar
which would ignore any bar
contained immediately within any foo
.
Ag, however, treats thes repo-relative absolutes as absolute absolutes.
I am running ubuntu 14.04 with GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.6). I have the same config on OSX and it works fine. I am getting the following error on startup.
Wrong type argument: arrayp, ([cl-struct-package-desc ag (20140322 948) A front-end for ag ('the silver searcher'), the C ack replacement. nil nil nil /home/dhill/.emacs.d/elpa/ag-20140322.948 nil nil])
When I enable debub-init I get
Debugger entered--Lisp error: (wrong-type-argument arrayp ([cl-struct-package-desc ag (20140322 948) "A front-end for ag ('the silver searcher'), the C ack replacement." nil nil nil "/home/dhill/.emacs.d/elpa/ag-20140322.948" nil nil]))
aref(([cl-struct-package-desc ag (20140322 948) "A front-end for ag ('the silver searcher'), the C ack replacement." nil nil nil "/home/dhill/.emacs.d/elpa/ag-20140322.948" nil nil]) 0)
(memq (aref package-info 0) cl-struct-package-desc-tags)
Any thoughts on how to fix this. I am new to emacs so if I need to run more tests please let me know.
It would give us greater confidence in the code and avoid silly mistakes like #29. I have a branch travis_unit_tests that I'm working on.
ag/pt are quite close to eachother featurewise. It might be a good idea to have support for both in the same codebase. Currently pt does not have all of the options that ag does so I would guess that a test to see how well it works is to just omit a few command line arguments and take it from there.. I can probably tinker a bit with that stuff..
Does it seem like a good idea?
Often when searching I have three or four windows open. When I start an ag search from a given buffer, it opens a ag search buffer in one of my already open windows, replacing whatever buffer was open there. I am fine with that behavior since I see no simple alternative.
When I click on a search result in the ag buffer it opens the result in another window - typically the one that I began my search from. This is rarely my use case; typically I spot what I was searching for in the ag results and no longer need the search results, so when I click on the result of interest I would rather it just replace the ag buffer so I can compare the buffer I found in my search to the buffer I began the search from.
I propose we change the default behavior so that clicking on an ag search result replaces the ag buffer with the buffer of the search result. To instead execute the current behavior of opening the ag search result in another window, we could require using the middle or right mouse button to click the result (similar to 'Open Link in New Window' found in most web browsers).
What do you think?
Ag, when used with projectile via C-c p A, seems to be searching log files as well. Does it honor the .gitignore file in a project ?
ack-and-a-half (C-c p a) skips logs files during searches.
Would you be interested in such a feature? I could implement it myself, so I'm more asking if you would consider merging it or not.
In short, -g
is like find
, but it ignores all the crap ag
ignores by default, which is VERY convenient. For example the 20 line find
invocations that projectile uses are almost replacible by ag -g '*.'
.
I'm imagining an interface like find-dired
that would drop you to a dired buffer of results. One could search for a pattern or a regexp matching parts of file-name, and possibly specify the parent directory... basic stuff you'd expect. As of now it can't list directories, so that's the only downfall wrt find
(but so doesn't find-dired
, so that's irrelevant as a replacement for that)
Would it be possible to add total matches found (possibly, in how many total files)? It could be in the *ag search*
buffer, or, if it wouldn't be compatible with other packages (like wgrep
), just a message in the minibuffer would be all right, something like 1071 matches across 363 files
.
I find this feature quite useful, as it can give a quick ballpark idea if the search string was properly set, or not.
Thank you so much for ag.el
, it is indispensable.
This feature is very cool. I love dired manipulation.
Unfortunately, Mac OSX's xargs doesn't have -r and -d options.
Without these options, it seems to work fine.
I'm not sure, but are these options indispensable?
Currently ag.el searches for roots for different kinds of projects one-by-one in order of git, svn, and hg. The first project found is the one used. This causes trouble when I have, say, a Mercurial project in my ~/lib/project folder but my home folder config files are managed using git. Since git projects are searched first, the ~/lib/project project is never found and I end up searching my home folder git repo.
My current workaround is to swap the search order so that hg projects are searched for first, then git. However, ideally order should not matter and instead the algorithm should search for all the project types in each folder, recursing from current path to root.
I would implement this myself but my LISP is too poor.
hi there, thanks for the very nice plugin for ag. I'm very new to Emacs. I experience a strange behavior when using k
to go up in ag buffer. It seems to switch to another buffer instead of go up, meanwhile j
to go down works perfectly.
It'd be great if you do have any hint about this.
Thanks
pass list of ignore patterns as option in ag.el
Ag can receive --ignore
option
Emacs 24.3/4: needed to replace flet in ag/next-error-function with cl-flet.
Hey,
first off all, thank you for this extension for the_silver_searcher.
It would be great if the key n
and p
in the ag search buffer are bound to next-error-no-select
and previous-error-no-select
by default, as it is in grep search buffer.
In grep search buffer you can move right to the location with n
and p
(no leaving of the buffer) whereas in
ag search buffer you would have to press C-c C-c
or Enter
to jump to the location and than you would have to go back.
Of course as the parent mode is compiliation-mode
you could also press C-x `` to jump to next "error" or
M-g pto jump to the previous "error". But I think if you use
grepor
ag` you usually want to investigate the hits quickly with less key strokes.
Just my opinion, let me know what you think.
regards,
Christian
UPDATE:
For now I have added this to my emacs init file.
;;; Rebind 'n' and 'p' of *ag search* buffer
(define-key ag-mode-map (kbd "n") 'next-error-no-select)
(define-key ag-mode-map (kbd "p") 'previous-error-no-select)
Would be nice if this would be the default bindings.
Basically, I only wish that the cursor was positioned already before the "--"
element of the list, so I can type in the option right away. Maybe some even better interface could be cooked, but I think this is for the post part satisfactory.
I'm lazy to do the patch, so I'll just patiently wait for someone else to do it :)
When I run these commands from emacs in my terminal (not sure whether they work from gui emacs but I don't have one to try it with atm), they fail reporting that the terminal is not fully functional.
I would like a quick hotkey to kill the ag buffer open in the current window. Note this is quite different from ag-kill-all-buffers which kills all buffers, not just the active one.
The rationale is much of the time I have multiple ag.el buffers open and want to keep all but the one I am currently on.
Preferably this hotkey would be as simple as 'q' to quit. Maybe 'k' for kill?
Because each ag-project
buffer is named uniquely, it doesn't re-use them and leaves loads of *ag text:thing dir:thing*
buffers lying around. It'd be nice to have a customisation option to re-use the same buffer over and over - I very rarely revisit *grep*
buffers once I've found a result (and don't miss them when they get overwritten).
ag-kill-buffers expects all ag buffers to use ag-mode, but ag-dired buffers are in dired-mode. We should probably define an ag-dired-mode.
on GNU Emacs 24.4.1:
Get the following warnings
In ag/next-error-function:
ag.el:114:7:Warning: `flet' is an obsolete macro (as of 24.3); use either
`cl-flet' or `cl-letf'.
In end of data:
ag.el:579:1:Warning: the function `find-dired-filter' is not known to be
defined.
I just saw that this package has Sphinx docs now, and wanted to make you aware that I wrote a Sphinx extension for documenting Emacs projects at http://sphinxcontrib-emacs.readthedocs.org/en/latest/. I'm using it for the Flycheck documentation.
Among other things, the documentation provides directives and roles to document commands and options, including automatic extraction of docstrings.
You may find it useful. If you're going to use it, I'd love to hear some feedback.
^ would make this thing even better.
It would be great to see this package among those available via ELPA or marmalade so that it can be installed via package-list-packages from within emacs.
Would you please remove keymap for k in ag-mode map, or replace it with q? I suppose that people using vim and emacs simultaneously will mistakenly press k and quit the buffer.
Hi,
While I'm a it, I was wandering why the "--literal" option was passed to the command? I just removed it and it works for regex. But I didn't test it extensively so I may miss something.
Regards,
When I have the below in my setup-ag.el, the ag buffer becomes weird.
(setq ag-arguments '("--ignore" "'*#*#'"
"--ignore" "'*~'"
))
Even if I execute (setq ag-arguments '())
, kill the ag buffer and do an ag search, the above ag buffer issue remains.
The only way to resolve it is commenting out that setq ag-arguments and restarting emacs. Then the above 2 issues of ag buffer get resolved.
But then, how do I customize the ag-arguments?
I installed ag via brew, so the path to it is only activated once .bash_profile is run. If I run ag.el it can't find ag at all. Can you add a variable to set the executable path so I can hook it up in my .emacs?
Invalid function: evil-add-hjkl-bindings
evil-add-hjkl-bindings is a macro, and my (elisp-novice) thought is that it isn't being expanded.
hey guys, i want to add "--silent" to ag in my emacs, but also don't want to change ag.el manually? is there any way to add option to ag in ag.el?
When I use emacs prelude to search my project using "C-c p A" looking for method calls, like, say, "call_customer(" , the command ag.el generates is
ag --color --color-match 30\;43 --smart-case --nogroup --column -- call_customer\(
Resulting in
ERR: pcre_compile failed at position 14. Error: missing )
Quoting the search string appears to work.
ag --color --color-match 30\;43 --smart-case --nogroup --column -- "call_customer\("
Does it make sense to always quote the search string ?
I got this with both "ag-20140220.1438" from MELPA and "ag-0.36" from marmalade
Thanks.
ag
provides very useful switch -z
that allows you to search in archives. For example, on many unix platforms emacs sources (and many other software) come gziped. Right now I can't use ag
from emacs to search these.
I'm not sure how to handle this, maybe C-u
could ask for additional flags? A global setting seems dangerous since user might have huge zip archives around.
When running ag, the ag subprocess doesn't actually start searching. It seems to wait for input from stdin.
A small change in line 138 fixes this, just append "." to the end of the command:
(compilation-start
(mapconcat 'shell-quote-argument
(append '("ag") arguments (list string) '("."))
" ")
Release 0.42 to Marmalade. EOM
It's possible to wgrep-change-to-wgrep-mode
in the ag results buffer, but saving the changes doesn't work correctly. If there's a way to make this work, that would be a huge win. :-)
Since Ag is a major mode, it needs a major mode hook! Please add one. All I currently want it for is to automatically enable visual-line-mode for line wrapping, but who knows what else I may eventually want.
(BTW, love the work done to bring ag integration to Emacs - productivity boost and rainbows galore)
This is a really great extension!
Could you please add an option to replace the current buffer with the results buffer, or for the focus to go to the new buffer?
It would be nice if multiple search result buffers are supported, like a grep-a-lot.el.
is there any options that I can enable regexp instead of literal by default with ag.el.
Thanks !
When evil
is not installed, then
(eval-after-load 'evil
`(progn
(eval-when-compile (require 'evil-core))
(add-to-list 'evil-motion-state-modes 'ag-mode)
(evil-add-hjkl-bindings ag-mode-map 'motion)))
leads to
ag.el:592:35:Error: Cannot open load file: no such file or directory, evil-core
I want ag
to default to the "thing at point", without guessing the project root.
MELPA and other repositories generate an autoload file which is automatically populated with autoloads for functions with the following comment before them:
;;;###autoload
This allows the package to be installed using package.el and all function to be available without having to (require 'ag)
.
Hello,
I just installed your excellent "ag.el" package into my Emacs-24 installation (I used MELPA). I'm trying to pass a prefix argument so that ag is invoked with more arguments. Specifically, I want ag to only search XML files. So here's what I do: C-u M-x ag-project, then I hit , and in the mini-buffer I'm prompted for a search string, which I input, and then, (because I launched ag-project with "C-u"), the mini-buffer shows: Arg arguments ("--smart-case" "--nogroup" "--column" "--") and the cursor is sitting immediately right of the closing-paren. I just don't know what to type here. I tried a few things like "-G xml" (I tried both including and not including the double-quotes) and "--file-search-regex xml" but every time it seems what I've entered is ignored. In the ag results buffers, where it displays the actual full ag command-line that was executed, There is no sign of the "-G" or "--file-search-regex" argument that I wanted added.
Thank you,
-Paul
ag-project
raises an error 'abbreviate-file-name: Wrong type argument: stringp, nil' when run from a dired buffer that is inside a git project.
Desired behavior would be to search the project regardless of whether or not the current buffer is associated with a directory or a file.
I'm using ag.el version 0.14 from marmalade.
Initially reported at prelude's issues (bbatsov/prelude#487) and projectile's (bbatsov/projectile#274). But the bug is present in ag.el itself.
An example is worth a thousand words so here goes:
Make a project with this test string:
global.extendAllProperties.apply(null, mixins);
Try to ag-regexp
search for it -> no results
The command issued is:
ag --color --color-match 30\;43 --smart-case --nogroup --column -- global.extendAllProperties.apply\(null\,\ mixins\)\; .
If you quote the search string (with the CLI), you get the expected result:
ag --color --color-match 30\;43 --smart-case --nogroup --column -- "global.extendAllProperties.apply\(null\,\ mixins\)\;" .
adding the option --literal
to ag-arguments
solves the problem but disables regexes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.