Subject: 29.0.50; xref-search-program-alist: support ugrep
From: Manuel Uberti <[email-masked]>
To: [email-masked]
Date: Mon, 28 Mar 2022 14:29:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I attached a small patch to extend xref-search-program-alist and
xref-xref-search-program with support for ugrep[1].

Is it something that can be of any interest?

[1] https://github.com/Genivia/ugrep

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 
1.16.0, Xaw3d scroll bars)
  of 2022-03-28 built on hathaway
Repository revision: 0e7314f6f15a20cb2ae712c09bb201f571823a6f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04 LTS

Configured using:
  'configure --with-harfbuzz --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
   value of $LC_MONETARY: it_IT.UTF-8
   value of $LC_NUMERIC: it_IT.UTF-8
   value of $LC_TIME: it_IT.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
   goto-address-mode: t
   shell-dirtrack-mode: t
   pixel-scroll-precision-mode: t
   windmove-mode: t
   delete-selection-mode: t
   minibuffer-electric-default-mode: t
   savehist-mode: t
   global-so-long-mode: t
   global-subword-mode: t
   subword-mode: t
   winner-mode: t
   global-company-mode: t
   company-mode: t
   minibuffer-depth-indicate-mode: t
   vertico-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   window-divider-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug dabbrev goto-addr pcmpl-args pcmpl-linux
pcmpl-unix shell pcomplete smerge-mode diff whitespace bug-reference
log-edit message sendmail yank-media rmc puny dired-x dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log vc-dir ewoc server misearch multi-isearch
time-date noutline outline checkdoc lisp-mnt elec-pair flymake-proc
flymake pp buffer-env vc-git diff-mode easy-mmode vc vc-dispatcher grep
compile text-property-search comint ansi-color thingatpt
vertico-directory cursor-sensor modus-operandi-theme modus-themes
pixel-scroll windmove delight comp comp-cstr warnings cl-extra help-mode
delsel minibuf-eldef savehist so-long cap-words superword subword winner
company-oddmuse company-keywords company-etags etags fileloop generator
xref project ring company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb company pcase mb-depth vertico ibuf-macs
rx info tex-site package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map url-vars seq gv subr-x byte-opt
bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice simple cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray cl-preloaded
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 295405 65421)
  (symbols 48 17422 1)
  (strings 32 62953 4379)
  (string-bytes 1 2031804)
  (vectors 16 33099)
  (vector-slots 8 928479 37143)
  (floats 8 203 609)
  (intervals 56 3658 1060)
  (buffers 992 31))

-- 
Manuel Uberti
www.manueluberti.eu

From ff949f7c65913697bfc9f284b86c6e55479e9730 Mon Sep 17 00:00:00 2001
From: Manuel Uberti <[email-masked]>
Date: Mon, 28 Mar 2022 14:26:50 +0200
Subject: [PATCH] Support ugrep in xref-search-program-alist

* lisp/progmodes/xref.el
xref-search-program-alist (Add ugrep)
xref-search-program (Add ugrep)
---
 lisp/progmodes/xref.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 5d1ba4eaf5..870dad61a4 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1715,7 +1715,8 @@ xref-search-program-alist
      .
      ;; '!*/' is there to filter out dirs (e.g. submodules).
      "xargs -0 rg <C> --null -nH --no-heading --no-messages -g '!*/' -e <R>"
-     ))
+     )
+    (ugrep . "xargs -0 ugrep <C> --null -ns -e <R>"))
   "Associative list mapping program identifiers to command templates.
 
 Program identifier should be a symbol, named after the search program.
@@ -1744,6 +1745,7 @@ xref-search-program
   :type '(choice
           (const :tag "Use Grep" grep)
           (const :tag "Use ripgrep" ripgrep)
+          (const :tag "Use ugrep" grep)
           (symbol :tag "User defined"))
   :version "28.1"
   :package-version '(xref . "1.0.4"))
-- 
2.25.1