Commit graph

268 commits

Author SHA1 Message Date
Dmitry Gutov
a658be7742 project-shell: Ensure the resulting buffer is live
* lisp/progmodes/project.el (project-shell):
Make sure to recreate the shell if the buffer exists but not live
(https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00017.html).
2022-03-05 04:33:10 +02:00
Dmitry Gutov
86969f9658 Cache the backend value together with the project root
* lisp/progmodes/project.el (project-try-vc):
Cache the backend value together with the root.
(project-root, project-files, project-ignores):
Update to access the new data structure.
2022-03-03 05:41:46 +02:00
Manuel Uberti
bc0d1f1c46 Add project-ignore-buffer-conditions
* lisp/progmodes/project.el (project-ignore-buffer-conditions):
New defcustom.
(project--read-project-buffer):
Use it (bug#54100).
2022-02-27 05:25:01 +02:00
Dmitry Gutov
3d106897fd Public-ize xref-show-xrefs
* lisp/progmodes/xref.el (xref-show-xrefs):
New function (wrapper for an older, private one, bug#42967).
2022-02-21 03:57:27 +02:00
Juri Linkov
749ba35bf5 * lisp/replace.el (query-replace-read-from-default): New variable.
(query-replace-read-from-regexp-default): New variable.
(query-replace-read-from): Use new variables.

* lisp/progmodes/project.el (project-query-replace-regexp):
Let-bind query-replace-read-from-regexp-default to find-tag-default-as-regexp.

* lisp/progmodes/xref.el (xref-find-references-and-replace):
Let-bind query-replace-read-from-default to find-tag-default.

https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg01909.html
2022-02-01 22:08:22 +02:00
Juri Linkov
4765487d5d More fixes for display-comint-buffer-action
* lisp/window.el (display-comint-buffer-action):
Use display-buffer--same-window-action as the default value.

* lisp/progmodes/sh-script.el (sh-show-shell):
* lisp/shell.el (shell): Add display-comint-buffer-action to pop-to-buffer.

* lisp/progmodes/project.el (project-shell, project-eshell): Use
`bound-and-true-p display-comint-buffer-action' for backward-compatibility.

https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg02964.html
2022-01-11 19:19:37 +02:00
Stefan Kangas
d763c12796 Merge from origin/emacs-28
e7aa3ece52 Fix vc-git with old Git over Tramp and cygwin-mount.el
c0cfbca311 * lisp/emacs-lisp/checkdoc.el (bytecomp): Add missing require

# Conflicts:
#	etc/NEWS
2022-01-05 06:30:39 +01:00
Dmitry Gutov
e7aa3ece52 Fix vc-git with old Git over Tramp and cygwin-mount.el
* lisp/vc/vc-git.el (vc-git-use-literal-pathspecs): New variable.
(vc-git-command, vc-git--call): Use it to determine whether to set
GIT_LITERAL_PATHSPECS=1 (bug#51497).
(vc-git--literal-pathspec, vc-git--literal-pathspecs): Remove.
Update all callers.  This reverts the previous solution for bug#39452.

* lisp/progmodes/project.el (project--vc-list-files):
Use the new variable.
2022-01-05 04:08:10 +02:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Sam Steingold
18b680cfd1 Fix bug#52467 by adding a new custom variable 'display-comint-buffer-action'
* lisp/window.el (display-comint-buffer-action): New `defcustom`,
defaults to 'display-buffer-same-window' for backward compatibility.
* lisp/cmuscheme.el (run-scheme, switch-to-scheme): Pass
'display-comint-buffer-action' to 'pop-to-buffer' instead
of using 'pop-to-buffer-same-window'.
* lisp/eshell/eshell.el (eshell): Likewise.
* lisp/shell.el (shell): Likewise.
* lisp/org/ol-eshell.el (org-eshell-open): Likewise.
* lisp/progmodes/inf-lisp.el (inferior-lisp): Likewise.
* lisp/progmodes/project.el (project-shell, project-eshell): Likewise.
* lisp/textmodes/tex-mode.el (tex-display-shell, tex-compile-default)
(tex-recenter-output-buffer): Pass 'display-comint-buffer-action'
to 'pop-to-buffer'.
2021-12-28 17:28:49 -05:00
Dmitry Gutov
32d12840e6 Kill eshell-mode project buffers too
* lisp/progmodes/project.el (project-kill-buffer-conditions):
Add 'eshell-mode' too (bug#49465).
2021-12-17 04:20:50 +03:00
Dmitry Gutov
ad768d767b project-kill-buffers-display-buffer-list: Fix :package-version value
* lisp/progmodes/project.el (project-kill-buffers-display-buffer-list):
Fix :package-version value.
2021-12-15 02:58:45 +03:00
Dmitry Gutov
38977b6134 Add 'comint-mode' and 'change-log-mode' to project-kill-buffer-conditions
* lisp/progmodes/project.el (project-kill-buffer-conditions):
Add 'comint-mode' and 'change-log-mode' to the list (bug#52465).
2021-12-15 02:57:20 +03:00
Matthias Meulien
0d2f184a11 project-kill-buffers can display list of buffers to kill
* lisp/progmodes/project.el
(project-kill-buffers-display-buffer-list): Option to toggle
temporarily display of the list of buffers to kill when calling
project-kill-buffers
(project-kill-buffers): Handle
project-kill-buffers-display-buffer-list option (bug#52148).
2021-11-29 16:42:02 +01:00
Dmitry Gutov
7dedba1cc0 Special-case the "Permission denied" messages
* lisp/progmodes/project.el (project--files-in-directory):
Special-case the "Permission denied" messages, to make sure the
user sees the unreadable directory's name
(https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg01015.html).
2021-10-15 15:12:29 +03:00
Dmitry Gutov
14bfb31dba Add new argument INCLUDE-ALL to project-find-file
* lisp/progmodes/project.el (project-find-file):
Add new argument INCLUDE-ALL.  Have 'C-u' make it non-nil.
(project-or-external-find-file): Ditto.
(project-find-file-in): Add new argument INCLUDE-ALL.
(https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg00209.html)
2021-10-14 03:43:42 +03:00
Dmitry Gutov
6bf29072e9 Avoid mapping file names through 'substring'
* lisp/progmodes/project.el (project--files-in-directory):
Avoid mapping file names through 'substring'.  Reducing the amount
of garbage generated.  Better perf by up to 20%.
Bump the package version.
2021-10-10 04:15:42 +03:00
Dmitry Gutov
9f041cdfac Bump project.el version
* lisp/progmodes/project.el: Bump the version.
2021-10-05 19:58:26 +03:00
Philip Kaludercic
aef84c5f17 Add aggregate project discovery and maintenance functions
* project.el (project-remember-project): Add optional no-write argument
(project-remember-projects-under): Add command
(project-forget-zombie-projects): Add command
(project-forget-projects-under): Add command
* etc/NEWS: Document new commands
2021-09-23 14:07:00 +02:00
Stefan Kangas
aebba085cb ; More minor stylistic fixes found by checkdoc 2021-09-22 20:26:40 +02:00
Dmitry Gutov
7f06fe894c Put './' in the project directory completions
* lisp/progmodes/project.el (project--read-file-cpd-relative):
Put './' in the completions set when cpd was in the original
(bug#50732).
2021-09-22 21:08:42 +03:00
Dmitry Gutov
e1712bdb35 Rename project-remove-known-project to project-forget-project
* doc/emacs/maintaining.texi (Managing Projects): Ditto.

* etc/NEWS: Update accordingly.

* lisp/progmodes/project.el (project-forget-project):
Rename from 'project-remove-known-project', for consistency with
'project-remember-project' (discussed in bug#50297).
2021-09-21 16:07:52 +03:00
Dmitry Gutov
df1d4f5894 New command: project-find-dir
* doc/emacs/maintaining.texi (Project File Commands):
Mention the new command and update the bindings information.

* lisp/progmodes/project.el (project-find-dir):
New command (bug#43153).
(project-prefix-map): Use 'd' as its binding.
Move 'project-dired' to 'D'.
(project-switch-commands):
Replace 'project-dired' with 'project-find-dir'.
2021-09-21 03:53:21 +03:00
João Távora
79eb840753 Bump lisp/progmodes/project.el version to 0.7.1
Amont other things exposes the new project-buffers generic function to
ELPA users.

* lisp/progmodes/project.el (Version): Bump to 0.7.1
2021-09-14 12:22:15 +01:00
Dmitry Gutov
5a34b65a3b Use the term "future history" rather than "default"
* lisp/progmodes/project.el
(project-find-file, project-or-external-find-file):
Update docstring.
(project--read-file-cpd-relative, project--read-file-absolute)
(project--completing-read-strict): Rename DEFAULT to MB-DEFAULT.
(project-find-file-in): Rename FILENAME to SUGGESTED-FILENAME.
2021-09-14 00:56:20 +03:00
Dmitry Gutov
9000aeaed4 Make sure to return some valid project root
* lisp/progmodes/project.el (project-prompt-project-dir):
If the user just pressed RET on prompt, prompt again.
2021-09-14 00:53:05 +03:00
Dmitry Gutov
b52cafe496 Support specifying just one command in project-switch-commands
* lisp/progmodes/project.el (project-switch-commands):
Describe the new possible type of value.
(project--switch-project-command):
New function, extract from project-switch-project.
(project-switch-project): If project-switch-commands's value is a
symbol, invoke that command without showing a menu.

Co-authored-by: Jiacai Liu <hello@liujiacai.net>
2021-09-07 04:45:15 +03:00
Dmitry Gutov
71f8b55f46 project--files-in-directory: Fix handling of ignores
* lisp/progmodes/project.el (project--files-in-directory):
Pass "." as the DIR argument to 'find' because otherwise the ignore
expression can match the project root directory name, which we don't
want to happen (bug#50240).  Fixup the resulting file names at the end
with concatenation.
Originally I thought it could lead to worse performance, but the
results show equal or slightly better timings.

* lisp/progmodes/xref.el (xref-matches-in-directory):
Apply a similar fix.
(xref--find-ignores-arguments): Use file-name-as-directory, so
that when passed "." replace-match still had the expected effect.

* test/lisp/progmodes/project-tests.el (project-ignores-bug-50240):
New test.

* test/lisp/progmodes/xref-tests.el
(xref-matches-in-directory-filters-with-ignores): New test.
2021-09-06 05:01:07 +03:00
Philip Kaludercic
8761d30da0
Avoid failing if vc backend doesn't implement ignore-completion-table
* project.el (project-ignores): Handle vc-not-supported signals
2021-08-31 23:36:55 +02:00
Eli Zaretskii
742ae84a9c ; * lisp/progmodes/project.el: Fix punctuation in the commentary. 2021-08-21 10:10:28 +03:00
Dmitry Gutov
28170b7d48 Speed up project--read-project-buffer in remote buffers
* lisp/progmodes/project.el (project-buffers): New generic function.
(project--read-project-buffer): Use it here (bug#49264).
(project--buffers-to-kill): And here.
(project-buffers): Specialized implementation for vc-project.
2021-08-21 05:26:12 +03:00
Dmitry Gutov
3b32d057ff project.el: Bump the version
* lisp/progmodes/project.el: Bump the version.
2021-08-08 14:13:49 +03:00
Dmitry Gutov
35cea6c94c Add colon-space after prompt
* lisp/progmodes/project.el (project--completing-read-strict):
Fix last change's regression (bug#49865).
2021-08-06 11:36:14 +03:00
Dmitry Gutov
fa895379d6 Change how project-find-file's completion works
* lisp/progmodes/project.el (project--completing-read-strict):
Allow to choose a non-existent file, with confirmation
(bug#49204).
Don't use the string at point as a "real" default, and instead
only include it in "future history": meaning, it will be inserted
on 'M-n' (bug#49865).
2021-08-06 03:30:10 +03:00
Juri Linkov
a6f67d60e1 * lisp/progmodes/project.el (project-switch-project): Use 'let*' (bug#49635).
This allows overriding-local-map to have effect on read-key-sequence.
2021-08-01 23:43:37 +03:00
Philipp Stephani
2e55201b80 Fix find invocation for macOS (Bug#48471).
* lisp/progmodes/project.el (project--files-in-directory): Instead of
appending a slash (which doesn't work well with macOS find), remove
trailing slash and pass -H instead.
2021-05-23 13:03:49 +02:00
Jim Porter
704755a568 Shell-quote the directory when finding a project's files
* lisp/progmodes/project.el (project--files-in-directory):
Shell-quote the directory (bug48247).
2021-05-06 20:44:50 +03:00
Dmitry Gutov
8616e4f747 project--buffer-list: Tighten the check
* lisp/progmodes/project.el (project--buffer-list): Tighten the
check to speed up in the presence of multiple Tramp sessions, too.
(https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg00152.html)
2021-05-06 20:43:02 +03:00
Philip K
3c4619edeb project--buffer-list: Avoid Tramp buffers when possible
* project.el (project--buffer-list): Add file-remote-p check.
2021-05-04 00:36:00 +03:00
Dmitry Gutov
1054525ae3 * lisp/progmodes/project.el: Also bump version. 2021-04-29 05:02:13 +03:00
Juri Linkov
bc026835df * lisp/progmodes/project.el: Use project-prefixed-buffer-name in more places.
(project-shell, project-eshell): Use project-prefixed-buffer-name (bug#47975).
(project-compilation-buffer-name-function): Add :version tag.
2021-04-25 00:54:01 +03:00
Dmitry Gutov
08fab316a1 Misc changes
* lisp/progmodes/project.el (project-shell, project-eshell):
Simplify.
(project-switch-commands, project-switch-use-entire-map):
Add :group keywords (to fix misattribution to project-vc).
2021-04-23 03:24:47 +03:00
Ivan Sokolov
1c3a86e7fc Introduce project-compilation-buffer-name-function
* lisp/progmodes/project.el (project-compilation-buffer-name-function):
New option.
(project-compile): Use it.
(project-prefixed-buffer-name): New function.

Copyright-paperwork-exempt: yes
2021-04-23 03:14:44 +03:00
Dmitry Gutov
eadf4cff7c Move part of the fix from project to xref
* lisp/progmodes/project.el (project--find-regexp-in-files):
Don't unquote file names here.

* lisp/progmodes/xref.el (xref-matches-in-files): Do it here.
And only if the first element in the list is quoted (bug#47799).
2021-04-22 17:40:30 +03:00
Philipp Stephani
6ebc6e12cf Add quoted filename support to 'project-find-regexp' (Bug#47799).
This is only a band-aid; it would be better to fix xref.el to work
with quoted filenames as well.

* lisp/progmodes/project.el (project--find-regexp-in-files): Unquote
filenames before passing them to 'xref-matches-in-files'.
* test/lisp/progmodes/project-tests.el (project/quoted-directory):
Also test 'project-find-regexp'.
2021-04-18 21:59:25 +02:00
Dmitry Gutov
f955df1788 Improve quoting of directory names in project/xref
* lisp/progmodes/project.el (project--files-in-directory):
Quote LOCALDIR a bit earlier, to affect
xref--find-ignores-arguments as well (bug#47799).

* lisp/progmodes/xref.el (xref-matches-in-directory):
Quote the dir passed to xref--rgrep-command.
2021-04-16 03:52:44 +03:00
Dmitry Gutov
4180429d5d project--files-in-directory: Handle errors reported by 'find'
* lisp/progmodes/project.el (project--files-in-directory):
Handle errors reported by 'find' (bug#47799).
2021-04-16 03:38:23 +03:00
Philipp Stephani
157bfc1812 Improve project support for quoted directory names (Bug#47799)
* lisp/progmodes/project.el (project--files-in-directory): Unquote
directory name before passing it to 'find'.
(project--remote-file-names): Requote local filenames if the original
directory is quoted.
* test/lisp/progmodes/project-tests.el (project/quoted-directory): New
unit test.
2021-04-15 18:41:04 +02:00
Dmitry Gutov
1ff7cde102 Add explicit support for C-g or ESC ESC ESC after keymap prompt
* lisp/progmodes/project.el (project-switch-project):
Add explicit support for C-g or ESC ESC ESC after keymap prompt
(bug#47620).
2021-04-07 03:25:18 +03:00