* bug#23219: 25.0.92; Find command cannot be customized for grep-find @ 2016-04-04 20:37 Eli Zaretskii 2016-04-04 21:16 ` Dmitry Gutov 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2016-04-04 20:37 UTC (permalink / raw) To: 23219 On one of my machines, the GNU Find utility's executable file is named 'gfind'. To have xref-collect-matches work, I customized grep-find-command to have the value "gfind", but the find-grep pipe used after that still tried to invoke 'find', not 'gfind'. Looking around, I see that grep-compute-defaults effectively ignores grep-find-command and uses the value of find-program instead. Now, find-program is a defvar, so it wasn't supposed to be customized. Its value is never changed, no matter what are your customizations. How am I supposed to make this stuff work in this situation? If the solution is to poke find-program, it should be defcustom, and I shouldn't need to customize 2 variables to begin with. Why isn't find-program get the value from grep-find-command? Am I missing something? In GNU Emacs 25.0.92.75 (i686-pc-mingw32) of 2016-04-04 built on HOME-C4E4A596F7 Repository revision: f501116ea896b20f195f5c841e8770d7fe0418b9 Windowing system distributor 'Microsoft Corp.', version 5.1.2600 Configured using: 'configure --prefix=/d/usr --enable-checking=yes,glyphs --with-wide-int --with-modules 'CFLAGS=-O0 -gdwarf-4 -g3'' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS MODULES Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-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 blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote w32notify w32 multi-tty make-network-process emacs) Memory information: ((conses 16 93260 6213) (symbols 56 20721 0) (miscs 48 36 128) (strings 16 17748 6507) (string-bytes 1 439920) (vectors 16 12405) (vector-slots 8 429730 4395) (floats 8 162 88) (intervals 40 261 118) (buffers 856 11)) ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#23219: 25.0.92; Find command cannot be customized for grep-find 2016-04-04 20:37 bug#23219: 25.0.92; Find command cannot be customized for grep-find Eli Zaretskii @ 2016-04-04 21:16 ` Dmitry Gutov 2016-04-05 15:01 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Dmitry Gutov @ 2016-04-04 21:16 UTC (permalink / raw) To: Eli Zaretskii, 23219 On 04/04/2016 11:37 PM, Eli Zaretskii wrote: > On one of my machines, the GNU Find utility's executable file is named > 'gfind'. To have xref-collect-matches work, I customized > grep-find-command to have the value "gfind", but the find-grep pipe > used after that still tried to invoke 'find', not 'gfind'. You need grep-find-template, not grep-find-command. > Looking > around, I see that grep-compute-defaults effectively ignores > grep-find-command and uses the value of find-program instead. Now, > find-program is a defvar, so it wasn't supposed to be customized. Its > value is never changed, no matter what are your customizations. Yes, it's a mess. Auto-computed custom variable values don't make much sense to me either, but maybe the idea is if you want to change the program to use as 'find', it'll likely have a slightly different syntax (not in your case, though), and grep-compute-defaults might fail to work, so you're better off customizing the end values. > How am I supposed to make this stuff work in this situation? If the > solution is to poke find-program, Probably. > it should be defcustom, *shrug* > and I > shouldn't need to customize 2 variables to begin with. Why isn't > find-program get the value from grep-find-command? It's the other way around: grep-compute-defaults sets grep-find-command using the value of find-program. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#23219: 25.0.92; Find command cannot be customized for grep-find 2016-04-04 21:16 ` Dmitry Gutov @ 2016-04-05 15:01 ` Eli Zaretskii 2016-04-05 15:12 ` Dmitry Gutov 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2016-04-05 15:01 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 23219 > From: Dmitry Gutov <dgutov@yandex.ru> > Date: Tue, 5 Apr 2016 00:16:32 +0300 > > On 04/04/2016 11:37 PM, Eli Zaretskii wrote: > > On one of my machines, the GNU Find utility's executable file is named > > 'gfind'. To have xref-collect-matches work, I customized > > grep-find-command to have the value "gfind", but the find-grep pipe > > used after that still tried to invoke 'find', not 'gfind'. > > You need grep-find-template, not grep-find-command. > > > Looking > > around, I see that grep-compute-defaults effectively ignores > > grep-find-command and uses the value of find-program instead. Now, > > find-program is a defvar, so it wasn't supposed to be customized. Its > > value is never changed, no matter what are your customizations. > > Yes, it's a mess. Auto-computed custom variable values don't make much > sense to me either, but maybe the idea is if you want to change the > program to use as 'find', it'll likely have a slightly different syntax > (not in your case, though), and grep-compute-defaults might fail to > work, so you're better off customizing the end values. I see. But if only the name of the program's executable changes, then customizing everything would be an overkill, IMO. > > How am I supposed to make this stuff work in this situation? If the > > solution is to poke find-program, > > Probably. > > > it should be defcustom, > > *shrug* OK, suggested patch below. Thanks for the feedback. --- lisp/progmodes/grep.el~0 2016-02-15 06:39:16.000000000 +0200 +++ lisp/progmodes/grep.el 2016-04-05 17:45:42.595409800 +0300 @@ -411,21 +411,33 @@ This gets tacked on the end of the generated expressions.") ;;;###autoload -(defvar grep-program (purecopy "grep") +(defcustom grep-grep-program (purecopy "grep") "The default grep program for `grep-command' and `grep-find-command'. -This variable's value takes effect when `grep-compute-defaults' is called.") +This variable's value takes effect when `grep-compute-defaults' is called." + :type 'string + :set 'grep-apply-setting + :version "25.1" + :group 'grep) ;;;###autoload -(defvar find-program (purecopy "find") +(defcustom grep-find-program (purecopy "find") "The default find program. This is used by commands like `grep-find-command', `find-dired' -and others.") +and others." + :type 'string + :set 'grep-apply-setting + :version "25.1" + :group 'grep) ;;;###autoload -(defvar xargs-program (purecopy "xargs") +(defcustom grep-xargs-program (purecopy "xargs") "The default xargs program for `grep-find-command'. See `grep-find-use-xargs'. -This variable's value takes effect when `grep-compute-defaults' is called.") +This variable's value takes effect when `grep-compute-defaults' is called." + :type 'string + :set 'grep-apply-setting + :version "25.1" + :group 'grep) ;;;###autoload (defvar grep-find-use-xargs nil @@ -549,8 +561,8 @@ (grep-probe grep-command `(nil t nil "^English" ,hello-file) #'call-process-shell-command) - ;; otherwise use `grep-program' - (grep-probe grep-program + ;; otherwise use `grep-grep-program' + (grep-probe grep-grep-program `(nil t nil "-nH" "^English" ,hello-file))) (progn (goto-char (point-min)) @@ -561,7 +573,7 @@ (when (eq grep-highlight-matches 'auto-detect) (setq grep-highlight-matches (with-temp-buffer - (and (grep-probe grep-program '(nil t nil "--help")) + (and (grep-probe grep-grep-program '(nil t nil "--help")) (progn (goto-char (point-min)) (search-forward "--color" nil t)) @@ -573,16 +585,16 @@ grep-template grep-find-template) (let ((grep-options (concat (if grep-use-null-device "-n" "-nH") - (if (grep-probe grep-program + (if (grep-probe grep-grep-program `(nil nil nil "-e" "foo" ,null-device) nil 1) " -e")))) (unless grep-command (setq grep-command - (format "%s %s %s " grep-program + (format "%s %s %s " grep-grep-program (or (and grep-highlight-matches - (grep-probe grep-program + (grep-probe grep-grep-program `(nil nil nil "--color" "x" ,null-device) nil 1) (if (eq grep-highlight-matches 'always) @@ -591,17 +603,18 @@ grep-options))) (unless grep-template (setq grep-template - (format "%s <X> <C> %s <R> <F>" grep-program grep-options))) + (format "%s <X> <C> %s <R> <F>" grep-grep-program grep-options))) (unless grep-find-use-xargs (setq grep-find-use-xargs (cond - ((grep-probe find-program + ((grep-probe grep-find-program `(nil nil nil ,null-device "-exec" "echo" "{}" "+")) 'exec-plus) ((and - (grep-probe find-program `(nil nil nil ,null-device "-print0")) - (grep-probe xargs-program `(nil nil nil "-0" "echo"))) + (grep-probe grep-find-program + `(nil nil nil ,null-device "-print0")) + (grep-probe grep-xargs-program `(nil nil nil "-0" "echo"))) 'gnu) (t 'exec)))) @@ -612,10 +625,11 @@ ;; after the pipe symbol be quoted if they use ;; forward slashes as directory separators. (format "%s . -type f -print0 | \"%s\" -0 %s" - find-program xargs-program grep-command)) + grep-find-program grep-xargs-program + grep-command)) ((memq grep-find-use-xargs '(exec exec-plus)) (let ((cmd0 (format "%s . -type f -exec %s" - find-program grep-command)) + grep-find-program grep-command)) (null (if grep-use-null-device (format "%s " null-device) ""))) @@ -627,27 +641,28 @@ (1+ (length cmd0))))) (t (format "%s . -type f -print | \"%s\" %s" - find-program xargs-program grep-command))))) + grep-find-program grep-xargs-program + grep-command))))) (unless grep-find-template (setq grep-find-template (let ((gcmd (format "%s <C> %s <R>" - grep-program grep-options)) + grep-grep-program grep-options)) (null (if grep-use-null-device (format "%s " null-device) ""))) (cond ((eq grep-find-use-xargs 'gnu) (format "%s <D> <X> -type f <F> -print0 | \"%s\" -0 %s" - find-program xargs-program gcmd)) + grep-find-program grep-xargs-program gcmd)) ((eq grep-find-use-xargs 'exec) (format "%s <D> <X> -type f <F> -exec %s {} %s%s" - find-program gcmd null + grep-find-program gcmd null (shell-quote-argument ";"))) ((eq grep-find-use-xargs 'exec-plus) (format "%s <D> <X> -type f <F> -exec %s %s{} +" - find-program gcmd null)) + grep-find-program gcmd null)) (t (format "%s <D> <X> -type f <F> -print | \"%s\" %s" - find-program xargs-program gcmd)))))))) + grep-find-program grep-xargs-program gcmd)))))))) ;; Save defaults for this host. (setq grep-host-defaults-alist @@ -1080,7 +1095,7 @@ ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. -Like `rgrep' but uses `zgrep' for `grep-program', sets the default +Like `rgrep' but uses `zgrep' for `grep-grep-program', sets the default file name to `*.gz', and sets `grep-highlight-matches' to `always'." (interactive (progn @@ -1088,7 +1103,7 @@ (grep-compute-defaults) ;; Compute the default zrgrep command by running `grep-compute-defaults' ;; for grep program "zgrep", but not changing global values. - (let ((grep-program "zgrep") + (let ((grep-grep-program "zgrep") ;; Don't change global values for variables computed ;; by `grep-compute-defaults'. (grep-find-template nil) ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#23219: 25.0.92; Find command cannot be customized for grep-find 2016-04-05 15:01 ` Eli Zaretskii @ 2016-04-05 15:12 ` Dmitry Gutov 2016-04-05 15:40 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Dmitry Gutov @ 2016-04-05 15:12 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 23219 On 04/05/2016 06:01 PM, Eli Zaretskii wrote: > -(defvar grep-program (purecopy "grep") > +(defcustom grep-grep-program (purecopy "grep") I didn't mean to suggest renaming the variables. At the very least, we'd need obsolete aliases, as they're likely to be used in some third party code. Also, grep-grep-program looks weird. > "The default grep program for `grep-command' and `grep-find-command'. > -This variable's value takes effect when `grep-compute-defaults' is called.") > +This variable's value takes effect when `grep-compute-defaults' is called." > + :type 'string > + :set 'grep-apply-setting Does grep-apply-setting expect the new variables? Its docstring disagrees. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#23219: 25.0.92; Find command cannot be customized for grep-find 2016-04-05 15:12 ` Dmitry Gutov @ 2016-04-05 15:40 ` Eli Zaretskii 2016-04-05 15:42 ` Dmitry Gutov 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2016-04-05 15:40 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 23219 > Cc: 23219@debbugs.gnu.org > From: Dmitry Gutov <dgutov@yandex.ru> > Date: Tue, 5 Apr 2016 18:12:46 +0300 > > On 04/05/2016 06:01 PM, Eli Zaretskii wrote: > > > -(defvar grep-program (purecopy "grep") > > +(defcustom grep-grep-program (purecopy "grep") > > I didn't mean to suggest renaming the variables. I don't think it's a good idea to have, say, 'find-program' in grep.el without a prefix. > At the very least, we'd need obsolete aliases, as they're likely to > be used in some third party code. Right, will do. > Also, grep-grep-program looks weird. I can make it grep-program again. > > "The default grep program for `grep-command' and `grep-find-command'. > > -This variable's value takes effect when `grep-compute-defaults' is called.") > > +This variable's value takes effect when `grep-compute-defaults' is called." > > + :type 'string > > + :set 'grep-apply-setting > > Does grep-apply-setting expect the new variables? Its docstring disagrees. I will double-check. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#23219: 25.0.92; Find command cannot be customized for grep-find 2016-04-05 15:40 ` Eli Zaretskii @ 2016-04-05 15:42 ` Dmitry Gutov 2016-04-08 13:56 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Dmitry Gutov @ 2016-04-05 15:42 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 23219 On 04/05/2016 06:40 PM, Eli Zaretskii wrote: >> Also, grep-grep-program looks weird. > > I can make it grep-program again. Yes, please do. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#23219: 25.0.92; Find command cannot be customized for grep-find 2016-04-05 15:42 ` Dmitry Gutov @ 2016-04-08 13:56 ` Eli Zaretskii 0 siblings, 0 replies; 7+ messages in thread From: Eli Zaretskii @ 2016-04-08 13:56 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 23219-done > Cc: 23219@debbugs.gnu.org > From: Dmitry Gutov <dgutov@yandex.ru> > Date: Tue, 5 Apr 2016 18:42:09 +0300 > > On 04/05/2016 06:40 PM, Eli Zaretskii wrote: > > >> Also, grep-grep-program looks weird. > > > > I can make it grep-program again. > > Yes, please do. Fixed all the issues and pushed. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-08 13:56 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-04-04 20:37 bug#23219: 25.0.92; Find command cannot be customized for grep-find Eli Zaretskii 2016-04-04 21:16 ` Dmitry Gutov 2016-04-05 15:01 ` Eli Zaretskii 2016-04-05 15:12 ` Dmitry Gutov 2016-04-05 15:40 ` Eli Zaretskii 2016-04-05 15:42 ` Dmitry Gutov 2016-04-08 13:56 ` Eli Zaretskii
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.