Skip to content

Commit

Permalink
refactor: simplify consult-todo-dir command
Browse files Browse the repository at this point in the history
  • Loading branch information
eki3z committed Jan 19, 2025
1 parent e44575d commit 488e179
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions consult-todo.el
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,18 @@ If BUFFERS is non-nil, prompt with hl-todo keywords in them instead."
(buffer-list))))

;;;###autoload
(defun consult-todo-dir (&optional directory files)
"Jump to hl-todo keywords in FILES in DIRECTORY.
If optinal arg FILES is nil, search in all files.
(defun consult-todo-dir (&optional directory)
"Jump to hl-todo keywords in files located in DIRECTORY.
If optional arg DIRECTORY is nil, rgrep in default directory."
(interactive)
(let* ((files (or files "* .*"))
(directory (or directory default-directory))
(let* ((directory (or directory default-directory))
(todo-buf (format "*consult-todo-dir %s*" directory))
(grep-command "grep --color=auto -nH --null -I -e ")
result)

Check warning on line 249 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.1, true)

Unused lexical variable `result'

Check warning on line 249 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.2, true)

Unused lexical variable `result'

Check warning on line 249 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.3, true)

Unused lexical variable `result'

Check warning on line 249 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.4, true)

Unused lexical variable `result'

Check warning on line 249 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (snapshot, true)

Unused lexical variable `result'
(cl-letf ((compilation-buffer-name-function
(lambda (&rest _) (format "%s" todo-buf))))
(save-window-excursion
(rgrep (hl-todo--regexp) files directory)
(rgrep (hl-todo--regexp) "* .*" directory)
(set-process-sentinel
(get-buffer-process todo-buf)
(lambda (process event)

Check warning on line 256 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.1, true)

Unused lexical argument `process'

Check warning on line 256 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.2, true)

Unused lexical argument `process'

Check warning on line 256 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.3, true)

Unused lexical argument `process'

Check warning on line 256 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (29.4, true)

Unused lexical argument `process'

Check warning on line 256 in consult-todo.el

View workflow job for this annotation

GitHub Actions / build (snapshot, true)

Unused lexical argument `process'
Expand Down

0 comments on commit 488e179

Please sign in to comment.