1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00
Commit graph

402 commits

Author SHA1 Message Date
Dmitry Gutov
4589f51c21 (project-find-regexp): Fix the temporary value of DEFAULT-DIRECTORY
* lisp/progmodes/project.el (project-find-regexp): Make sure the
assigned value of DEFAULT-DIRECTORY ends with a slash.
read-directory-name returns the name without it in certain cases.
2024-08-13 15:14:18 +03:00
Dmitry Gutov
08e38818f6 * lisp/progmodes/project.el: Bump the version 2024-06-14 18:27:48 +03:00
Pär Bohrarper
2dae603c41 Fix file listing in submodules with project-files-relative-names=t
* lisp/progmodes/project.el (project--vc-list-files):
Prepend module names to files when project-files-relative-names is
non-nil (bug#71538).
2024-06-14 04:05:46 +03:00
Dmitry Gutov
a486782f5e project-list-buffers-ibuffer: Handle the FILES-ONLY argument
* lisp/progmodes/project.el (project-list-buffers-ibuffer):
Handle the FILES-ONLY argument (bug71290).
(project-list-buffers-buffer-menu): Expand docstring.
2024-06-09 05:37:42 +03:00
mikpom
c0480e2211 Support Ibuffer in project-list-buffers
* lisp/progmodes/project.el (project-buffers-viewer): New option.
(project-list-buffers): Dispatch using it.
(project-list-buffers-buffer-menu, project-list-buffers-ibuffer):
New functions (bug#71290).
2024-06-09 05:37:42 +03:00
Juri Linkov
ebac4d4872 Provide a list of default values for M-n of project-find-file (bug#70996)
* lisp/progmodes/project.el (project-find-file)
(project-or-external-find-file): Provide a list of suggested
filenames for the first arg of project-find-file-in.
Use buffer-file-name first to make it more predictable for M-n.
(project--read-file-cpd-relative): Handle mb-default as a list.
2024-05-28 19:31:55 +03:00
Dmitry Gutov
56871dbd4c * lisp/progmodes/project.el: Up xref dependency and bump the version 2024-05-27 01:23:30 +03:00
Spencer Baugh
c812c93548 Fix usage of cons cells in grep-find-ignored-files
grep-find-ignored-files is documented to also include cons
cells, not just globs, but there were two places outside grep.el
where we were using it as if it was only a string list.

To fix this, add a helper function named grep-find-ignored-files
which handles grep-find-ignored-files properly and returns the
list of globs, and use it everywhere.

* lisp/progmodes/grep.el (grep--filter-list-by-dir)
(grep-find-ignored-files): New functions.
(rgrep-find-ignored-directories): Use grep--filter-list-by-dir.
(lgrep, rgrep-default-command):
Use grep-find-ignored-files function.
* lisp/dired-aux.el (dired-do-find-regexp):
Use grep-find-ignored-files function.
* lisp/progmodes/project.el (project-ignores):
Use grep-find-ignored-files function, if bound. (bug#71115)
2024-05-24 23:04:32 +03:00
Dmitry Gutov
b20d4ab374 Fix 'C-u C-x p g' globally and 'A' in dired-mode
* lisp/progmodes/project.el (project-find-regexp): Ensure the
DEFAULT-DIRECTORY is set correctly for the 'C-u' case (bug#70888).

* lisp/progmodes/project.el (project--files-in-directory):
Ensure that the DIR argument ends with a slash --
'dired-do-find-regexp' passes it differently, for example.

* lisp/progmodes/xref.el (xref--group-name-for-display): Ensure
the project-relative and absolute display modes work well for
groups with "relative" file names.
(xref--analyze, xref--add-log-current-defun): Change accordingly.

* test/lisp/progmodes/project-tests.el
(project-find-regexp-with-prefix): New test.
2024-05-12 20:56:55 +03:00
Dmitry Gutov
8d3e4e823f project--vc-list-files: Use vc-git-command for better error reporting
* lisp/progmodes/project.el (project--vc-list-files):
Use 'vc-git-command' for better error reporting
(https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00399.html).
2024-05-05 20:19:48 +03:00
Eli Zaretskii
8098ad9679 ; Improve documentation of a recent change
* lisp/progmodes/project.el (project-files-relative-names):
* etc/NEWS: Improve documentation of 'project-files-relative-names'.
2024-05-05 08:20:39 +03:00
Dmitry Gutov
370b216f08 New variable 'project-files-relative-names'
* lisp/progmodes/project.el (project-files-relative-names):
New variable (bug#69233).
(project--files-in-directory): Honor it.
(project--vc-list-files): Here too.
(project-find-regexp): Use it to improve performance.
(project-or-external-find-regexp): Add a TODO.
(project-find-file): Use it here too.
(project--read-file-cpd-relative, project--read-file-absolute):
Try to handle file lists with absolute and relative files names.
(project-find-file-in): Set default-directory, so relative names
are interpreted correctly.

* lisp/progmodes/xref.el (xref-matches-in-files):
Consider that the first in FILES can be a relative file name.

* test/lisp/progmodes/project-tests.el (project-find-regexp):
New test.

* etc/NEWS: Mention it.
2024-05-05 06:27:55 +03:00
Dmitry Gutov
55a200d707 ; Capitalize 'project' in project-name's docstring 2024-04-15 05:29:59 +03:00
Spencer Baugh
21f9be0053 (project-current): Fix the previous change
* lisp/progmodes/project.el (project-current):
Fix the previous change (bug#69584).
2024-04-05 03:29:42 +03:00
Dmitry Gutov
1552f8345d (project-current): Add binding for 'non-essential'
* lisp/progmodes/project.el (project-current):
Add binding for 'non-essential' (bug#69584).
2024-03-28 05:41:52 +02:00
Dmitry Gutov
77a86d738e (project--value-in-dir): Ensure that the global value is still honored
* lisp/progmodes/project.el (project--value-in-dir):
Ensure that the global value of the variable is still honored,
when the variable is not in dir-locals.
2024-03-15 04:28:45 +02:00
Patrick Bader
5037b9eed7 fix: project submodule detection does not work for worktrees 2024-03-15 04:26:02 +02:00
Juri Linkov
bd6b64e0a8 * lisp/progmodes/project.el: Don't run modes from .dir-locals.el.
(project--value-in-dir): Use 'alist-get' on 'file-local-variables-alist'
to avoid calling 'hack-local-variables-apply' via
'hack-dir-local-variables-non-file-buffer' because it might enable
undesirable modes such as flyspell-mode in a temporary buffer (bug#69740).
2024-03-14 19:37:44 +02:00
Juri Linkov
f3deaa117a Context menu for project (bug#69566)
* lisp/menu-bar.el (menu-bar-project-item): New variable from
'project-menu-entry'.
(menu-bar-tools-menu): Use 'menu-bar-project-item'.

* lisp/mouse.el (context-menu-functions): Add
'context-menu-project' to choice.
(context-menu-project): New function.

* lisp/progmodes/project.el (project-menu-entry): Remove variable.
(project-mode-line-map): Use 'menu-bar-project-item' instead of
'project-menu-entry'.
2024-03-14 19:29:16 +02:00
Juri Linkov
6b800f9adf * lisp/progmodes/project.el (project-any-command): Allow local keymaps.
Use overriding-terminal-local-map instead of overriding-local-map.
This allows using keys from local maps (bug#69242).
2024-02-25 09:32:45 +02:00
Dmitry Gutov
7b34bb5c92 project-or-external-find-regexp: Fix the docstring
* lisp/progmodes/project.el (project-or-external-find-regexp):
Fix the docstring (bug#68958).
2024-02-15 20:14:37 +02:00
Juri Linkov
ce7365b591 Use new variable Buffer-menu-show-internal in project-list-buffers.
* lisp/progmodes/project.el (project-list-buffers): Add the new variable
`Buffer-menu-show-internal' used to toggle internal buffers (bug#68949).
2024-02-06 19:55:41 +02:00
Dmitry Gutov
22a58fccb7 project--read-project-list: Handle corrupted file contents
* lisp/progmodes/project.el (project--read-project-list):
Handle the 'end-of-file' error (bug#68546).
2024-01-26 03:00:23 +02:00
Dmitry Gutov
0a07603ae8 project-recompile: New command
* lisp/progmodes/project.el (project-recompile):
New command (bug#68570).
2024-01-21 07:08:43 +02:00
Po Lu
070cb32463 ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
Dmitry Gutov
5213e92f20 Fix Tramp error in project-find-file
* lisp/progmodes/project.el (project--read-file-cpd-relative):
Avoid new Tramp connections (bug#68041).
2023-12-27 02:20:39 +02:00
Dmitry Gutov
0d518b78d7 project--read-file-cpd-relative: Don't abbreviate at all
* lisp/progmodes/project.el (project--read-file-cpd-relative):
Don't abbreviate at all, only suffixes are shown anyway.
And expand-file-name is slightly faster.
2023-12-20 17:34:12 +02:00
Dmitry Gutov
338409c1f1 Fix project-find-file history (with project--read-file-cpd-relative)
* lisp/progmodes/project.el (project--transplant-file-name):
Don't abbreviate here (bug#67901, bug#63829).
(project--read-file-cpd-relative): Do it here instead.  The reader
functions should decide on the preferred format themselves.
2023-12-20 17:20:26 +02:00
Dmitry Gutov
64cdcf7f51 project-any-command: Use 'project-aware'
* lisp/progmodes/project.el (project-any-command): Change the
symbol it's looking for to 'project-aware'.  Seems to convey the
semantics best.
2023-12-11 03:19:11 +02:00
Sean Whitton
ef732bd208 ; * lisp/progmodes/project.el (project-any-command): Fix last change 2023-12-08 22:37:06 +00:00
Dmitry Gutov
11b7b0d4ab project-any-command: Change the method for passing project root
* lisp/progmodes/project.el (project-any-command): Change the
check which decides whether 'project-current-directory-override'
should be used.  Instead of looking in project-prefix-map, see
whether the command's name starts with 'project-', or the symbol
has the property 'project-command' (bug#67171).
2023-12-08 22:34:06 +02:00
Juri Linkov
39cd1db63a * lisp/progmodes/project.el (project-prompt-project-name): Add 'reverse'.
Reverse ret that should restore order for 'C-x p p M-n M-n ...' (bug#67310).
2023-11-27 19:09:49 +02:00
Dmitry Gutov
efae0e68ef (project-prompt-project-name): Simplify a bit
* lisp/progmodes/project.el (project-prompt-project-name):
Fold the inner 'let' into 'when-let'.
2023-11-25 17:04:32 +02:00
Dmitry Gutov
ab37e0b56a ; project-prompt-project-name: Reword a comment 2023-11-25 16:07:28 +02:00
Spencer Baugh
505edceaf4 Use the project--list as history when prompting for a project
The project--list is already ordered such that the most recently used
projects are at the front.  Now we use it as the minibuffer history
when prompting for a project.

To avoid savehist from picking up project--list as a minibuffer
history variable and overriding our own persistence mechanism, we
don't pass project--list directly as a history variable, but instead
pass project--dir-history or project--name-history, dynamically-bound
to an appropriate value.  project--dir-history and
project--name-history won't be persisted since they're always unbound
at the top level; but if they are persisted anyway somehow, it won't
affect us.

If we later find a way to rely on savehist for persistence instead of
having our own mechanism, we can change the in-memory format of
project--list to be just a list of directories, and our explicit calls
to project--add-dir can be replaced by let-binding
history-delete-duplicates=t, history-length=t.

* lisp/progmodes/project.el (project--remember-dir): Add.
(project-remember-project): Use project--remember-dir.
(project--name-history, project-prompt-project-name)
(project--dir-history, project-prompt-project-dir): Pass a
preprocessed project--list as HIST to completing-read.  (bug#67310)
(project-switch-project): Call project--remember-dir.
2023-11-25 03:59:21 +02:00
Philip Kaludercic
bf9cbc2354 Simplify 'project-remember-projects-under'
* lisp/progmodes/project.el (project-remember-projects-under): Instead
of traversing the directories manually, re-use
`directory-files-recursively' to reduce complexity.  (Bug#66649)
2023-11-08 08:57:40 +01:00
Dmitry Gutov
41e801fea1 Add project-any-command and project-prefix-or-any-command
* lisp/progmodes/project.el (project-any-command): New command.
(project-prefix-map): Bind it to 'o'.
(project-switch-commands): Add entry for it here too.
(project-prefix-or-any-command): New command (bug#63648).
(project-switch-commands): Update the custom type to mention
'project-prefix-or-any-command' as well.
* etc/NEWS: Document the change.
2023-11-05 02:41:53 +02:00
Dmitry Gutov
32ed6e610f (project-switch-project): Fix the previous change
* lisp/progmodes/project.el (project-switch-project):
Clear the buffer-local value in the right buffer (bug#66317).
2023-11-01 22:48:51 +02:00
Dmitry Gutov
ffe894d0f3 Only override the current project buffer-locally
* lisp/progmodes/project.el (project-switch-project): Only
override the current project buffer-locally.  This is mostly for
the the mode-line indicator (https://debbugs.gnu.org/66317#53).
2023-11-01 04:01:53 +02:00
Dmitry Gutov
8439f83449 Catch 'permission-denied' during project lookup
* lisp/progmodes/project.el (project--find-in-directory):
Catch 'permission-denied' (bug#66317).

Co-Authored-By: Spencer Baugh <sbaugh@catern.com>
2023-11-01 03:58:45 +02:00
Juri Linkov
dd92ccc7ee * lisp/progmodes/project.el (project-menu-entry): Add 'bound-and-true-p'.
This is needed for compatibility with older versions (bug#66317).
2023-10-31 09:34:03 +02:00
Juri Linkov
dec79825ba Fix project-mode-line-format breaking buffer-file-coding-system (bug#66825)
* lisp/progmodes/project.el (project-mode-line-format):
Let-bind 'last-coding-system-used' to prevent changing
'buffer-file-coding-system' in 'basic-save-buffer'.
2023-10-31 09:22:28 +02:00
Jim Porter
271d8b70f8 Exclude Git submodules from 'project-files'
* lisp/progmodes/project.el (project--vc-list-files): Exclude Git
submodules (bug#66806).
(project-search, project-query-replace-regexp): Remove now-unneeded
workaround.
2023-10-30 03:42:49 +02:00
Dmitry Gutov
1a8f61a9f6 project--switch-project-command: Retouch
* lisp/progmodes/project.el (project--switch-project-command):
Remove outdated comment and clear the echo area at the end.
2023-10-20 22:04:03 +03:00
Dmitry Gutov
e170869712 Improve behavior with project-switch-use-entire-map=t
* lisp/progmodes/project.el (project--keymap-prompt): New function.
(project--switch-project-command): Use it when
project-switch-use-entire-map is non-nil.  Also check that CHOICE
is not a number (bug#63648).  And print incorrect inputs too.
2023-10-20 01:24:56 +03:00
Juri Linkov
4ace48f394 * lisp/progmodes/project.el (project--other-place-prefix): New function.
(project-other-window-command, project-other-frame-command)
(project-other-tab-command): Use it in Emacs versions not less than 30
where other-*-prefix commands are available.
This fixes the cases such as 'C-u C-x 5 p p f TAB' from bug#65558.
2023-10-19 21:50:28 +03:00
Spencer Baugh
0d536f2755 Use project-name in the project-kill-buffers prompt
This is mildly prettier (bug#66518).

* lisp/progmodes/project.el (project-kill-buffers): Use project-name.
2023-10-17 02:28:02 +03:00
Juri Linkov
960c98ce3a * lisp/progmodes/project.el (project-mode-line-face): New variable.
(project-mode-line-format): Use it (bug#66317).
2023-10-11 09:27:28 +03:00
Eli Zaretskii
d51f3165f7 Improve documentation of 'project-mode-line'
* etc/NEWS:
* doc/emacs/maintaining.texi (Projects):
* lisp/progmodes/project.el (project-mode-line): Improve the
documentation of 'project-mode-line'.  (Bug#66317)
2023-10-10 14:46:08 +03:00
Juri Linkov
238292d657 New option 'project-mode-line' to show project name on mode line (bug#66317)
* lisp/bindings.el (standard-mode-line-format):
Add '(project-mode-line project-mode-line-format)'.

* lisp/progmodes/project.el (project-mode-line): New user option.
(project-menu-entry, project-mode-line-map): New variables.
(project-mode-line-format): New variable.
(project-mode-line-format): New function.
2023-10-09 21:09:03 +03:00