* lisp/find-lisp.el (find-lisp-find-dired-other-window): New command.
(find-lisp-find-dired): Improve the doc string.
(find-lisp-find-dired-subdirectories): Clarify doc string.
(find-lisp-find-dired-subdirs-other-window): New command.
(find-lisp-find-dired-internal): Adjust to allow being called by
the new command.
(find-lisp-format): Make symlink output more regular.
Apply syntax highlighting for all python f-strings
* lisp/progmodes/python.el (python--f-string-p)
(python--font-lock-f-strings): Edit functions to use a regular
expression matching all f-strings (bug#56757).
Stefan Monnier [Tue, 6 Sep 2022 04:08:35 +0000 (00:08 -0400)]
cl-symbol-macrolet: Fix recent regression
The recent fix for bug#57397 introduced a regression, breaking
the `cl-lib-symbol-macrolet-hide` test. It turned out that the
origin of the problem was that `gv.el` uses `macroexpand-1` which
does not (can't) use `macroexpand` but `cl-symbol-macrolet` failed
to advise `macroexpand-1` the way it advised `macroexpand`.
To fix this, we change `cl-symbol-macrolet` so it advises both, and we
do that with a new `macroexpand` advice which delegates the bulk of
the work to `macroexpand-1`.
Along the way, I bumped into another bug in the interaction between
`cl-letf` and `cl-symbol-macrolet`, which I tried to fix in `cl-letf`.
I hear the war on `cl-symbol-macrolet` was a failure.
Maybe ... just say no?
* lisp/emacs-lisp/cl-macs.el (cl--sm-macroexpand-1): New function,
extracted from `cl--sm-macroexpand`.
(cl--sm-macroexpand): Rewrite completely.
(cl-symbol-macrolet): Advise both `macroexpand` and `macroexpand-1`.
(cl--letf): Don't use the "simple variable" code for symbol macros.
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-symbol-macrolet-hide):
Revert last change because the test was right.
* test/lisp/emacs-lisp/cl-macs-tests.el
(cl-macs-test--symbol-macrolet): Add a test case.
Sean Whitton [Tue, 6 Sep 2022 00:39:21 +0000 (17:39 -0700)]
; Document that a value of any other type means no highlighting
* lisp/vc/vc-git.el (vc-git-log-edit-summary-target-len)
(vc-git-log-edit-summary-max-len): Document that a value of any other
type means no highlighting.
Stefan Kangas [Tue, 6 Sep 2022 00:05:18 +0000 (02:05 +0200)]
Add new --timeout flag to emacsclient
* lib-src/emacsclient.c (DEFAULT_TIMEOUT): New constant.
(timeout): New static variable.
(longopts, shortopts, decode_options, print_help_and_exit): Add new
flag --timeout.
(set_socket_timeout, check_socket_timeout): New helper functions.
(main): Display a status message or exit after Emacs has not responded
for a while, depending on above new --timeout flag. (Bug#50849)
* doc/emacs/misc.texi (emacsclient Options):
* doc/man/emacsclient.1: Document the above new option.
* etc/NEWS: Announce it.
* lisp/help-fns.el (describe-function-1): Do not pass
'describe-function-orig-buffer' as argument to...
(help-fns--key-bindings): but use it directly there instead.
This simplifies 1d1158397b.
Hugo Heagren [Mon, 5 Sep 2022 18:54:51 +0000 (20:54 +0200)]
Add new functions for splitting the root window
* lisp/window.el (split-window-right): Add optional argument to
control which window is split (previously, would only split selected
window). Update docstring.
* doc/lispref/windows.texi (Splitting Windows): Update docs for
`split-window-right'.
* lisp/window.el (split-window-below): Add optional argument to
control which window is split (previously, would only split selected
window). Update docstring.
* doc/lispref/windows.texi (Splitting Windows): Update docs for
`split-window-below'.
* lisp/window.el (ctl-x-map): Bind `split-root-window-right' to 9 in
ctl-x-map. This is consistent with binding other window-splitting
operations to numbers in this map.
* lisp/window.el (ctl-x-map): Bind `split-root-window-below' to 7 in
ctl-x-map. This is consistent with binding other window-splitting
operations to numbers in this map.
* lisp/window.el (split-root-window-right): New function to split
whole frame.
* doc/lispref/windows.texi (Splitting Windows): Add documentation for
`split-root-window-right'.
* lisp/window.el (split-root-window-below): New function to split
whole frame.
* doc/lispref/windows.texi (Splitting Windows): Add documentation for
`split-root-window-below' (bug#56791).
Sean Whitton [Sun, 4 Sep 2022 23:20:15 +0000 (16:20 -0700)]
Font lock long Git commit summary lines
* lisp/vc/vc-git.el (vc-git-log-edit-summary-target-len)
(vc-git-log-edit-summary-max-len): New defcustoms.
(vc-git-log-edit-summary-target-warning)
(vc-git-log-edit-summary-max-warning): New faces.
(vc-git--log-edit-summary-check): New function.
(vc-git-log-edit-mode): Add vc-git--log-edit-summary-check to
log-edit-font-lock-keywords to font lock long Git commit summary
lines.
* etc/NEWS (VC): Document the change.
* .dir-locals.el: Set vc-git-log-edit-summary-target-len.
Jim Porter [Sun, 28 Aug 2022 18:53:07 +0000 (11:53 -0700)]
Let external Eshell processes send stdout and stderr to different places
* lisp/eshell/esh-proc.el (eshell-put-process-properties): Pass INDEX.
(eshell-gather-process-output): Create a pipe process for stderr when
stderr goes somewhere different than stdout.
(eshell-insertion-filter, eshell-sentinel): Consult
':eshell-handle-index' property.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/output/stdout-to-buffer)
(esh-proc-test/output/stderr-to-buffer)
(esh-proc-test/exit-status/with-stderr-pipe): New tests (bug#21605).
Jim Porter [Sun, 28 Aug 2022 18:19:30 +0000 (11:19 -0700)]
Put Eshell's bookkeeping data for external processes on the process object
This allows tracking this information for process objects not recorded
in 'eshell-process-list', which will be useful for pipe processes for
stderr output.
* lisp/eshell/esh-proc.el (eshell-process-list): Add docstring.
(eshell-record-process-object): Only record the process object and
whether it's a subjob.
(eshell-remove-process-entry): Adapt to changes in
'eshell-record-process-object'.
(eshell-record-process-properties): New function...
(eshell-gather-process-output): ... call it.
(eshell-insertion-filter, eshell-sentinel): Use new process
properties, don't require process to be in 'eshell-process-list'.
* test/lisp/eshell/esh-proc-tests.el (esh-proc-test--output-cmd): New
variable.
(esh-proc-test--detect-pty-cmd): Add docstring.
(esh-proc-test/output/to-screen)
(esh-proc-test/output/stdout-and-stderr-to-buffer)
(esh-proc-test/exit-status/success, esh-proc-test/exit-status/failure)
(esh-proc-test/kill-process/foreground-only): New tests.
(esh-proc-test/kill-background-process): Rename to...
(esh-proc-test/kill-process/background-prompt): ... this, and use
'eshell-wait-for-subprocess' instead of 'sit-for'.
Jim Porter [Sat, 9 Jul 2022 23:26:55 +0000 (16:26 -0700)]
Add support for more kinds of redirect operators in Eshell
* lisp/eshell/esh-arg.el: Require cl-lib.
(eshell-finish-arg): Allow passing multiple ARGUMENTS.
(eshell-quote-argument): Handle the case when 'eshell-finish-arg' was
passed multiple arguments.
* lisp/eshell/esh-cmd.el (eshell-do-pipelines)
(eshell-do-pipelines-synchronously): Only set stdout output handle.
* lisp/eshell/esh-io.el (eshell-redirection-operators-alist): New
constant.
(eshell-io-initialize): Prefer sharp quotes for functions.
(eshell-parse-redirection, eshell-strip-redirections): Add support for
more redirection forms.
(eshell-copy-output-handle, eshell-set-all-output-handles): New
functions.
* test/lisp/eshell/esh-io-tests.el
(esh-io-test/redirect-all/overwrite, esh-io-test/redirect-all/append)
(esh-io-test/redirect-all/insert, esh-io-test/redirect-copy)
(esh-io-test/redirect-copy-first, esh-io-test/redirect-pipe): New
tests.
* doc/misc/eshell.texi (Redirection): Document new redirection syntax.
(Pipelines): Document '|&' syntax.
(Bugs and ideas): Update item about redirection syntax.
Jim Porter [Sat, 9 Jul 2022 17:34:31 +0000 (10:34 -0700)]
Simplify Eshell handle functions and add tests/documentation
* lisp/eshell/esh-arg.el (eshell-parse-argument-hook): Explain how to
use 'eshell-finish-arg'.
* lisp/eshell/esh-io.el (eshell-create-handles): Only call
'eshell-get-target' for stderr if necessary.
(eshell-protect-handles): Use 'dotimes'.
(eshell-set-output-handle): Pass HANDLES and fix an edge case with
setting a duplicate TARGET.
* test/lisp/eshell/eshell-tests-helpers.el (eshell-with-temp-buffer):
New macro.
* test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/quoted-lisp-form)
(esh-cmd-test/backquoted-lisp-form)
(esh-cmd-test/backquoted-lisp-form/splice): New tests.
* test/lisp/eshell/eshell-tests.el (eshell-test/redirect-buffer)
(eshell-test/redirect-buffer-escaped): Move to...
* test/lisp/eshell/esh-io-tests.el: ... here, and add other I/O tests.
* doc/misc/eshell.texi (Arguments): Add documentation for special
argument types.
(Input/Output): Expand documentation for redirection and pipelines.
Matt Armstrong [Sun, 4 Sep 2022 21:58:55 +0000 (23:58 +0200)]
Add basic test coverage for overlay modification hooks
* test/src/buffer-tests.el: (overlay-modification-hooks) new
ert-deftest.
(overlay-tests-start-recording-modification-hooks): New function.
(overlay-tests-get-recorded-modification-hooks): New function
(bug#57150).
* test/lisp/filenotify-tests.el (file-notify-test03-events)
(file-notify-test09-watched-file-in-watched-dir): Mark as unstable
on EMBA, because they seem to fail regularly.
* lisp/paren.el (show-paren-predicate):
* lisp/outline.el (outline-minor-mode-use-buttons): Use it.
* lisp/wid-edit.el (buffer-predicate): New widget type.
Po Lu [Sun, 4 Sep 2022 13:03:31 +0000 (21:03 +0800)]
Fix earlier change to xterm.c
* src/xterm.c (x_detect_focus_change): Finally figure out what
the call to x_new_focus_frame does with the core focus, and do
the equivalent with the XInput 2 focus.
Augusto Stoffel [Sun, 4 Sep 2022 11:14:58 +0000 (13:14 +0200)]
Add Python import management commands
* lisp/progmodes/python.el (python-interpreter): New variable
(python-mode-map): Keybindings and menu entries for new commands
(python--list-imports, python-import-history, python--query-import)
(python--do-isort): New variables and helper functions.
(python-add-import, python-import-symbol-at-point)
(python-remove-import, python-sort-imports, python-fix-imports): New
interactive commands (bug#57574).
Augusto Stoffel [Sun, 4 Sep 2022 11:13:57 +0000 (13:13 +0200)]
Python shells dedicated to a project
* lisp/progmodes/python.el: Require 'seq' and (optionally) 'compat'
and 'project' libraries.
(python-shell-dedicated): New user option
(python-shell-get-process-name): Adapt to project-dedicated shells.
(run-python): Offer possibility to create a project-dedicated shell,
or use 'python-shell-dedicated' as the default behavior.
(python-shell-get-buffer): Adapt to project-dedicated shells
(bug#56997).
Improve documentation of several functions in seq.el
* doc/lispref/sequences.texi (Sequence Functions):
* lisp/emacs-lisp/seq.el (seq-contains):
(seq-contains-p):
(seq-set-equal-p):
(seq-position):
(seq-union):
(seq-intersection):
(seq-difference): Use more standard wording in the docstrings
(bug#57561).
Stefan Monnier [Sun, 4 Sep 2022 02:38:28 +0000 (22:38 -0400)]
gv.el and cl-macs.el: Fix bug#57397
* lisp/emacs-lisp/gv.el (gv-get): Obey symbol macros.
* lisp/emacs-lisp/cl-macs.el (cl--letf): Remove workaround placed to
try and handle symbol macros.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-test--symbol-macrolet):
Add new testcase.
Look up keybindings in correct buffer in describe-function.
* lisp/help-fns.el (help-fns--key-bindings): New parameter.
Use it when looking up keybindings.
(describe-function-1): Add the buffer in which the command
was invoked as argument to 'help-fns--key-bindings'.
Fixes bug#57568.
* lisp/emacs-lisp/seq.el (seq-take, seq--activate-font-lock-keywords):
Simplify unnecessarily guarded code, as this file will only ever be
used with the same version of Emacs.
Po Lu [Sat, 3 Sep 2022 13:39:30 +0000 (21:39 +0800)]
Work around another X server bug in crossing event dispatch
* src/xterm.c (xi_focus_handle_for_device): Clear implicit focus
along with FocusOut. (bug#57468)
(x_mouse_leave): Avoid invalid reads of
dpyinfo->x_focus_event_frame on input extension builds.
Po Lu [Sat, 3 Sep 2022 11:55:31 +0000 (19:55 +0800)]
Work around potential X server bug
* src/xterm.c (handle_one_xevent): Ignore core crossing events
on input extension builds. The X server is not actually
supposed to deliver them to us, and it messes up MPX focus
tracking. (bug#57468)
Stefan Kangas [Wed, 31 Aug 2022 03:59:35 +0000 (05:59 +0200)]
Add new defgroup image-dired-dired
* lisp/image/image-dired-dired.el
(image-dired-dired-append-when-browsing): Rename from
'image-dired-append-when-browsing'. Update all uses.
(image-dired-dired): New defgroup.
(image-dired-dired-append-when-browsing)
(image-dired-dired-disp-props): Use above new defgroup.
Stefan Kangas [Wed, 31 Aug 2022 03:52:11 +0000 (05:52 +0200)]
image-dired: Minor cleanups
* lisp/image/image-dired-dired.el
(image-dired-dired-after-readin-hook, image-dired-minor-mode):
Minor doc fixes.
(image-dired-dired-display-image): Don't accept ineffectual prefix
argument.
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point): Use when-let.
(image-dired-display-thumb-properties): Redefine as obsolete function
alias for 'image-dired-update-header-line'.
* lisp/image/image-dired-util.el
(image-dired-window-width-pixels): Make obsolete in favor of
window-body-width.
* lisp/image/image-dired.el (image-dired-line-up-dynamic)
(image-dired-display-window-width): Don't use above obsolete function.
Stefan Kangas [Fri, 19 Aug 2022 19:14:13 +0000 (21:14 +0200)]
Split image-dired.el into several files (part 2/2)
Use a git trick to split a file while preserving line history (for
"git blame", "git log --follow", etc.):
1) Make exact copies of the original file, in the same commit as
moving it.
2) Next, trim down the extra copies to contain only the relevant
parts. [this commit]
* lisp/image-dired.el:
* lisp/image/image-dired-dired.el:
* lisp/image/image-dired-external.el:
* lisp/image/image-dired-tags.el:
* lisp/image/image-dired-util.el:
* lisp/image/image-dired.el: Trim files down to keep only one copy of
each definition.
Stefan Kangas [Thu, 1 Sep 2022 09:04:21 +0000 (11:04 +0200)]
Make some versions in docs match package version
* doc/emacs/misc.texi (Interactive Shell): Bump Emacs version.
* doc/misc/ediff.texi:
* doc/misc/flymake.texi:
* doc/misc/viper.texi: Fix version to match package.
* lisp/emulation/viper.el: Make version match variable.
Display a warning for some uses of nil in face attributes.
* src/xfaces.c (HANDLE_INVALID_NIL_VALUE): New macro, which displays
a warning for invalid uses of nil as a face attribute value.
(Finternal_set_lisp_face_attribute): Use the macro for the attributes
:foreground, :distant-foreground and :background.
Stefan Monnier [Fri, 2 Sep 2022 13:54:13 +0000 (09:54 -0400)]
* lisp/help-fns.el: Minor fixes
(describe-mode--minor-modes): Don't burp on minor modes that lack a docstring.
(describe-mode--minor-modes): Simplify eta-redex.
(find-lisp-object-file-name): Use `autoload-file`.
(help-fns--describe-function-or-command-prompt): Allow the user to
insist on choosing a function even if it appears not to exist.