[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/urgrep 0c966b2001 075/115: Ensure `default-directory' s
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/urgrep 0c966b2001 075/115: Ensure `default-directory' stays in sync |
|
Date: |
Wed, 10 May 2023 03:00:46 -0400 (EDT) |
branch: externals/urgrep
commit 0c966b2001a7073b014adaa65673438834c87edf
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
Ensure `default-directory' stays in sync
---
urgrep.el | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/urgrep.el b/urgrep.el
index a72f1536b5..69dc75546f 100644
--- a/urgrep.el
+++ b/urgrep.el
@@ -779,19 +779,29 @@ This function is called from `compilation-filter-hook'."
compilation-error-screen-columns nil)
(add-hook 'compilation-filter-hook 'urgrep-filter nil t))
-(defun urgrep--start (command query tool)
+(defun urgrep--start (command query tool &optional directory)
"Start a urgrep process for COMMAND.
QUERY is the original argument list that generated COMMAND (or it may
be the same value as COMMAND). TOOL is the tool that was used to
generate the command. This sets `urgrep-current-query' and
`urgrep-current-tool' buffer-locally so that they can be used when
rerunning the search."
+ (setq directory (if directory
+ (file-name-as-directory (expand-file-name directory))
+ default-directory))
(with-current-buffer
;; Dynamically bind `urgrep-current-tool' so that `urgrep-process-filter'
;; can consult it.
(urgrep--with-killed-local-variable 'urgrep-current-tool
- (let ((urgrep-current-tool tool))
+ ;; Let-bind `default-directory' here so that the external command knows
+ ;; where to search...
+ (let ((urgrep-current-tool tool)
+ (default-directory directory))
(compilation-start command #'urgrep-mode)))
+ ;; ... and then set `default-directory' here to be sure it's up to date.
+ ;; This can get out of sync if re-running urgrep from a urgrep buffer, but
+ ;; with a different search directory set.
+ (setq default-directory directory)
(setq urgrep-current-query query
urgrep-current-tool tool)
(current-buffer)))
@@ -999,10 +1009,8 @@ Type \\[urgrep-set-file-wildcards] to set a wildcard to
filter the files searche
(cons (car full-query) (cons directory (cdr full-query)))))
(let* ((full-query (cons query rest))
(command (apply #'urgrep-command full-query))
- (tool (urgrep-get-tool (cadr (cl-member :tool full-query))))
- (default-directory (if directory (expand-file-name directory)
- default-directory)))
- (urgrep--start command full-query tool)))
+ (tool (urgrep-get-tool (cadr (cl-member :tool full-query)))))
+ (urgrep--start command full-query tool directory)))
;;;###autoload
(defun urgrep-run-command (command directory tool)
- [elpa] externals/urgrep 98e20f0630 021/115: Use pcase macros for filling in optional arguments, (continued)
- [elpa] externals/urgrep 98e20f0630 021/115: Use pcase macros for filling in optional arguments, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep bf24dac2ac 025/115: Allow for separate before/after contexts, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep f2ba643f35 028/115: Typo, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep c26ff9b22b 029/115: Add note about grep issues on MS Windows, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 6f50ef99d3 032/115: Remove urgrep--to-command, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 3599ad1a56 033/115: Update comment, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep ba2b01b91b 042/115: Remove no-longer-needed `post-arguments', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 3643c933c4 055/115: Add support for ugrep, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 0de93bfdb9 068/115: Fix use of wgrep on long urgrep results, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep e2e8898ab2 074/115: Update copyright, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 0c966b2001 075/115: Ensure `default-directory' stays in sync,
ELPA Syncer <=
- [elpa] externals/urgrep c15be33112 076/115: Wrap shell argument quoting with `with-connection-local-variables`, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep e63c6c5173 089/115: Add link to wgrep package and clarify the README, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 61478da305 077/115: Improve reliability of running urgrep over Tramp, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 77fcfc1916 090/115: Use `push` instead of `add-to-list`, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 559b2c07cd 091/115: Add a unit test for getting the preferred tool on multiple hosts, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep fe13a3cbb5 081/115: Fix project-root call on Emacs 27, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep f2c87e7520 080/115: Improve robustness of tests for grep command generation, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep b03a3d84ec 098/115: Add `suffix` argument to `urgrep--get-prop(-pcase)?`, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep eb5191bfd5 097/115: Update copyright year, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 43c82e84ec 082/115: Add CI for Emacs 27.1, ELPA Syncer, 2023/05/10