emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 88e11d2 7/7: Merge commit 'b2c449c0d5aad67eeee9857e7fd7710


From: João Távora
Subject: [elpa] master 88e11d2 7/7: Merge commit 'b2c449c0d5aad67eeee9857e7fd7710f985084ec'
Date: Mon, 6 Jul 2020 07:19:35 -0400 (EDT)

branch: master
commit 88e11d2b1813328aac6e09a1778f648e74eac9e3
Merge: 3be3486 b2c449c
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Merge commit 'b2c449c0d5aad67eeee9857e7fd7710f985084ec'
---
 packages/ack/README.rst | 33 ++++++++++++++++++---------------
 packages/ack/ack.el     | 38 ++++++++++++++++++++++++--------------
 2 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/packages/ack/README.rst b/packages/ack/README.rst
index 5caa477..c0a0ba0 100644
--- a/packages/ack/README.rst
+++ b/packages/ack/README.rst
@@ -1,26 +1,29 @@
 ==============================================================
- Emacs Interface to `Ack <http://beyondgrep.com>`_-like Tools
+ The Simple Emacs Interface to `Ack <http://beyondgrep.com>`_-like Tools
 ==============================================================
  
-This package brings the full power of `ack <http://beyondgrep.com>`_
-to `emacs <http://www.gnu.org/software/emacs>`_ by allowing you to run
-it seamlessly with its large set of options. Ack-like tools such as
-`the silver searcher <https://github.com/ggreer/the_silver_searcher>`_
-and ``git/hg/bzr grep`` are well supported too.
+This package integrates `ack <http://beyondgrep.com>`_ and its large
+set of options with `emacs <http://www.gnu.org/software/emacs>`_.  The
+resulting ``*ack*`` buffer is just like vanilla ``*grep*`` buffer but
+the results come from your tool of choice.
+
+Ack-like tools such as `the silver searcher (ag)
+<https://github.com/ggreer/the_silver_searcher>`_, `ripgrep (rg)
+<https://github.com/BurntSushi/ripgrep>`_ are well supported, as are
+``git grep``, ``hg grep``.
+
+The program guesses good defaults, but lets you give ``C-u`` to
+customize directory to search in, as well as the give special commands
+and switches.
+
+Just ``M-x ack`` or do something like ``(global-set-key (kbd "C-c
+C-g") 'ack)``.
 
 It is part of `GNU ELPA <http://elpa.gnu.org>`_ - the official package
 archive for `emacs <http://www.gnu.org/software/emacs>`_. Patches,
 feature requests and bug reports are welcome.
 
-Features
---------
-
-- Keep all features of `ack <http://beyondgrep.com>`_ and more
-- Handle colors using the standard library ``ansi-color.el``
-- Completion for ack options while reading from the minibuffer
-- Support `the silver search (ag)
-  <https://github.com/ggreer/the_silver_searcher>`_
-- Support ``git grep``, ``hg grep`` and ``bzr grep``
+Colors are handled using the standard library ``ansi-color.el``
 
 Install
 -------
diff --git a/packages/ack/ack.el b/packages/ack/ack.el
index 40c068d..6d8a651 100644
--- a/packages/ack/ack.el
+++ b/packages/ack/ack.el
@@ -4,7 +4,7 @@
 
 ;; Author: Leo Liu <sdl.web@gmail.com>
 ;; Maintainer: João Távora <joaotavora@gmail.com>
-;; Version: 1.8
+;; Version: 1.10
 ;; Keywords: tools, processes, convenience
 ;; Created: 2012-03-24
 ;; URL: https://github.com/leoliu/ack-el
@@ -82,6 +82,7 @@
 (require 'compile)
 (require 'pcase)
 (require 'ansi-color)
+(require 'thingatpt)
 (autoload 'shell-completion-vars "shell")
 
 (eval-when-compile
@@ -102,10 +103,14 @@
 
 (defcustom ack-command
   ;; Note: on GNU/Linux ack may be renamed to ack-grep
-  (concat (file-name-nondirectory (or (executable-find "ack-grep")
-                                      (executable-find "ack")
-                                      (executable-find "ag")
-                                      "ack")) " ")
+  (concat (file-name-nondirectory (or
+                                   (executable-find "ack-grep")
+                                   (executable-find "ack")
+                                   (executable-find "ag")
+                                   (concat
+                                    (executable-find "rg")
+                                    " -n -H -S --no-heading --color always -e")
+                                   "ack")) " ")
   "The default command for \\[ack].
 
 Note also options to ack can be specified in ACK_OPTIONS
@@ -139,7 +144,7 @@ Each element is of the form (VC_DIR . CMD)."
 (define-obsolete-function-alias 'ack-default-directory
   'ack-legacy-defaults "1.7")
 
-(defcustom ack-defaults-function 'ack-legacy-defaults
+(defcustom ack-defaults-function 'ack-quickgrep-defaults
   "A function to return a default parametrization for `ack'.
 It is called with one arg, the prefix arg to `ack'.  It may
 return a single element, a string, which is the directory under
@@ -313,9 +318,12 @@ This gets tacked on the end of the generated expressions.")
   (interactive)
   (delete-minibuffer-contents)
   (let ((ack (or (car (split-string ack-command nil t)) "ack")))
-    (if (equal ack "ag")
-        (skeleton-insert `(nil ,ack " -ig '" _ "'"))
-      (skeleton-insert `(nil ,ack " -g '(?i:" _ ")'")))))
+    (cond ((equal ack "ag")
+           (skeleton-insert `(nil ,ack " -ig '" _ "'")))
+          ((equal ack "rg")
+           (skeleton-insert
+            `(nil ,ack " --color always --files --iglob '*" _ "*'")))
+      (t (skeleton-insert `(nil ,ack " -g '(?i:" _ ")'"))))))
 
 ;; Work around bug http://debbugs.gnu.org/13811
 (defvar ack--project-root nil)          ; dynamically bound in `ack'
@@ -437,7 +445,7 @@ automatically attempted."
     (append (list (if (> numeric 4)
                       (read-directory-name "In directory: " nil nil t)
                     (ack-guess-project-root default-directory))
-                  (= numeric 1))
+                  (and (thing-at-point 'symbol) (= numeric 1)))
             (if (> numeric 4)
                 (list 'ack-yank-symbol-at-point)
               (list 'ack-skel-vc-grep 'ack-yank-symbol-at-point)))))
@@ -467,9 +475,10 @@ automatically attempted."
   (run-hooks 'ack-minibuffer-setup-hook))
 
 (defun ack--auto-confirm ()
-  (throw 'ack--auto-confirm
-         (buffer-substring-no-properties
-          (minibuffer-prompt-end) (point-max))))
+  (when ack--yanked-symbol
+    (throw 'ack--auto-confirm
+           (buffer-substring-no-properties
+            (minibuffer-prompt-end) (point-max)))))
 
 ;;;###autoload
 (defun ack (command-args &optional directory)
@@ -501,7 +510,8 @@ minibuffer:
      (list (minibuffer-with-setup-hook 'ack-minibuffer-setup-function
              (catch 'ack--auto-confirm
                (read-from-minibuffer "Ack: "
-                                     ack-command
+                                    `(,(concat ack-command "''")
+                                      . ,(+ (length ack-command) 2))
                                      ack-minibuffer-local-map
                                      nil 'ack-history)))
            ack--project-root)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]