Add a display-buffer window selection function that's more like XEmacs
* doc/lispref/windows.texi (Buffer Display Action Functions):
Document it.
* lisp/window.el (display-buffer--action-function-custom-type): Add.
(display-buffer): Mention it.
(display-buffer-use-least-recent-window): New function (bug#45688).
* src/window.c (Fwindow_bump_use_time): New function.
F. Jason Park [Thu, 7 Jan 2021 12:43:13 +0000 (13:43 +0100)]
Clear socks protocol scratch after authentication
* lisp/net/socks.el (socks-open-connection): Fix incomplete patch
titled "Append incremental message segments in socks-filter," which
addressed chunk ordering but neglected to zero out the work area
following successful username/password authentication (bug#45162).
* lisp/textmodes/paragraphs.el (mark-paragraph): Revert eb090f65ceb0ae8a90829e911694348583135ba5 (bug#45318). This restores
the behaviour from Emacs 27 -- further work is needed on this patch.
Dmitry Gutov [Wed, 6 Jan 2021 17:41:55 +0000 (19:41 +0200)]
Proof some searches and file listings against symlinks
* lisp/progmodes/project.el (project--files-in-directory):
Make sure the directory includes the trailing slash in case it's
a symlink, discussed in
https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00345.html.
* lisp/mb-depth.el (minibuffer-depth-indicator): New face.
(minibuffer-depth-setup): Use new face and add a single space between
the depth indicator and the minibuffer prompt.
https://lists.gnu.org/archive/html/emacs-devel/2020-12/msg00230.html
* lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload): Try to make
the wording of the warning about the obsoleted variable less confusing.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-variable): Don't
warn for lexical variables (Bug#39169). Fix spurious `or'.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp/warn-obsolete-variable-bound\.el): New test.
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el:
New file.
Stefan Monnier [Wed, 6 Jan 2021 02:26:03 +0000 (21:26 -0500)]
* lisp/emacs-lisp/package.el (package-activate-all): Another tweak
`package-quickstart.el` files presume `package-activated-list`
is a bound variable, so make sure this is the case even when `package.el` is
not yet loaded.
Stefan Monnier [Tue, 5 Jan 2021 22:57:15 +0000 (17:57 -0500)]
* lisp/emacs-lisp/autoload.el: Improve last change
It turns out there were other places that used `custom-initialize-delay`
on autoloaded variables and used various hacks to make it work with
`autoload.el`. The new code makes those hacks unneeded.
Also, there's no point trying to "optimize" those rare cases anyway,
so I simplified the `autoload.el` code for those cases.
(make-autoload): For non-trivial cases,
just include the whole `defcustom` instead of trying to mimic it.
Alan Third [Tue, 5 Jan 2021 21:43:12 +0000 (21:43 +0000)]
Prevent stack overflow in GNUstep menu code
* src/nsmenu.m (ns_update_menubar): Always do a deep update for
GNUstep.
([EmacsMenu menuNeedsUpdate:]): Don't update the menu as it should
always have had a deep update.
Refactor tab-bar-mode to -define-keys and -load-buttons (bug#42052)
* lisp/tab-bar.el (tab-bar--define-keys, tab-bar--load-buttons):
Move some code here from 'tab-bar-mode'.
(tab-bar-new-tab-to): Call tab-bar--load-buttons and tab-bar--define-keys.
Stefan Monnier [Tue, 5 Jan 2021 17:28:37 +0000 (12:28 -0500)]
* lisp/emacs-lisp/package.el: Load package-quickstart without package.el
Speed up startup when `package-quickstart` is in use by making it possible
to load the quickstart file without having to load `package.el` at all.
(package-user-dir, package-directory-list, package-quickstart-file):
Preload those variables.
(package--get-activatable-pkg): New fun, extracted from `package-activate`.
(package-activate): Use it.
(package--activate-all): New function, extracted from
`package-activate-all`.
(package-activate-all): Use it and make the function preloaded.
(package--archives-initialize): New function.
(package-install): Use it.
(list-packages): Avoid `switch-to-buffer`.
(package-get-descriptor): New function.
* lisp/startup.el (command-line): Simplify the code now that
package-user-dir and package-directory-list are preloaded.
* lisp/emacs-lisp/autoload.el (make-autoload): Add support for
`:initialize #'custom-initialize-delay` in `defcustom`.
Harald Jörg [Tue, 5 Jan 2021 09:15:04 +0000 (10:15 +0100)]
perl-mode: Display here-docs as strings instead of comments
* lisp/progmodes/perl-mode.el
(perl-syntax-propertize-function): Handle HERE doc starter
lines ending in a comment.
(perl-heredoc): New face for HERE docs, inheriting from
font-lock-string-face.
(perl-font-lock-syntactic-face-function): Apply the new face
to HERE docs (Bug#23461).
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test--run-bug-10483): Skip for Perl mode. The test
explicitly calls a function of CPerl mode.
Stefan Monnier [Mon, 4 Jan 2021 23:23:43 +0000 (18:23 -0500)]
* lisp/filesets.el: Use lexical-binding
Remove redundant `:group` args. Require cl-lib and seq.
Fix various O(n²) bug and flag a few remaining ones.
(filesets-external-viewers): Simplify regexps. Use \' instead of $.
Remove useless :constraint-flag properties.
(filesets-convert-path-list): η-reduce.
(filesets-eviewer-constraint-p): Mark :constraint-flag as obsolete.
(filesets-spawn-external-viewer): Can't use `run-hooks` on
lexical variable.
(filesets-filter-list): Fix O(n²) bug.
(filesets-ormap): Simplify.
(filesets-some, filesets-member, filesets-sublist): Make them
obsolete aliases.
(filesets-reset-fileset): Simplify.
(filesets-directory-files): Use `push`.
(filesets-spawn-external-viewer): Use `mapconcat` to fix O(n²) bug.
(filesets-cmd-get-args): Use `mapcan` to fix O(n²) bug.
(filesets-run-cmd): Use `mapconcat` and `mapcan` to fix O(n²) bugs.
(filesets-ingroup-collect-finder): Use dynamic scoping.
(filesets-ingroup-collect-files): Use `nreverse` to fix O(n²) bug.
(filesets-ingroup-collect-build-menu): Use `mapcan` to fix O(n²) bug.
Paul Eggert [Mon, 4 Jan 2021 18:33:43 +0000 (10:33 -0800)]
Do not assume Xrender merely because Cairo
Problem reported by Andrea Corallo in:
https://lists.gnu.org/r/emacs-devel/2021-01/msg00225.html
* src/xterm.c (x_term_init) [USE_CAIRO && !HAVE_XRENDER]:
Do not call XRenderQueryExtension.
Paul Eggert [Sun, 3 Jan 2021 19:19:48 +0000 (11:19 -0800)]
Fix broken build on AIX 7.2
Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD
temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined
symbol: BC’. This is because -lcurses does not define BC etc.
* configure.ac: When building terminfo.o, define
TERMINFO_DEFINES_BC if the library defines BC etc.
* src/terminfo.c (UP, BC, PC): Define depending on
TERMINFO_DEFINES_BC, not on TERMINFO.
Michael Albinus [Mon, 4 Jan 2021 15:32:32 +0000 (16:32 +0100)]
Fix error in tramp-sh-handle-insert-directory
* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Let buffer be
unibyte when applying numbers returned with the ls --dired option.
Reported by Justus Piater <Justus-dev@Piater.name>.
Mauro Aranda [Mon, 4 Jan 2021 12:58:10 +0000 (09:58 -0300)]
Update two user option names in the Widget manual
* doc/misc/widget.texi (Basic Types): The user options
widget-glyph-directory and widget-glyph-enable were renamed long ago
to widget-image-directory and widget-image-enable, but the manual
kept calling them by their old names. Update the names.
Mauro Aranda [Mon, 4 Jan 2021 13:02:20 +0000 (10:02 -0300)]
Don't skip widgets when moving backward
* lisp/wid-edit.el (widget-move): Remove code that caused
widget-backward to skip an immediate previous widget when moving
backward from the start of a widget. (Bug#45623)
* test/lisp/wid-edit-tests.el (widget-test-widget-backward): New test.
Stefan Monnier [Mon, 4 Jan 2021 05:21:02 +0000 (00:21 -0500)]
* lisp/erc/erc.el: Use `run-hook-with-args` for `erc-pre-send-functions`
(erc-process-input-line): A function can be `listp`.
(erc-send-input): Use `run-hook-with-args` for `erc-pre-send-functions`.
(erc-display-command): Comment out, unused.
Stefan Monnier [Mon, 4 Jan 2021 05:01:58 +0000 (00:01 -0500)]
* lisp/calc/calc-yank.el (calc-edit-mode): Make it into a proper major mode
Also make `calc-edit-handler` hold a function instead of an expression.
(calc-original-buffer, calc-return-buffer, calc-one-window)
(calc-edit-handler, calc-restore-trail, calc-allow-ret)
(calc-edit-top): Give them a default value.
(calc--edit-mode): New function extracted from old `calc-edit-mode`.
(calc-edit-return, calc-edit-finish): Don't need to test `boundp` any more.
(calc-edit-finish): Allow `calc-edit-handler` to be a function.
(calc-edit, calc-alg-edit):
* lisp/calc/calc-prog.el (calc-edit-user-syntax, calc-user-define-edit):
* lisp/calc/calc-embed.el (calc-embedded-edit):
* lisp/calc/calc-sel.el (calc-edit-selection):
* lisp/calc/calc-store.el (calc-edit-variable):
Use `calc--edit-mode` and make first arg into a function.
* lisp/calc/calc-ext.el (calc-init-extensions): Autoload `calc--edit-mode`
instead of `calc-edit-mode`.
Paul Eggert [Sun, 3 Jan 2021 19:19:48 +0000 (11:19 -0800)]
Fix broken build on AIX 7.2
Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD
temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined
symbol: BC’. This is because -lcurses does not define BC etc.
* configure.ac: When building terminfo.o, define
TERMINFO_DEFINES_BC if the library defines BC etc.
* src/terminfo.c (UP, BC, PC): Define depending on
TERMINFO_DEFINES_BC, not on TERMINFO.
Paul Eggert [Sun, 3 Jan 2021 19:19:48 +0000 (11:19 -0800)]
Fix broken build on AIX 7.2
Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD
temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined
symbol: BC’. This is because -lcurses does not define BC etc.
* configure.ac: When building terminfo.o, define
TERMINFO_DEFINES_BC if the library defines BC etc.
* src/terminfo.c (UP, BC, PC): Define depending on
TERMINFO_DEFINES_BC, not on TERMINFO.
Alan Third [Sun, 3 Jan 2021 16:15:18 +0000 (16:15 +0000)]
Fix child frame restacking on NS (bug#41422)
* src/nsfns.m (Fns_frame_restack): Use new restackWindow method.
* src/nsterm.m ([EmacsWindow orderFront:]):
([EmacsWindow makeKeyAndOrderFront:]):
(nswindow_orderedIndex_sort):
([EmacsWindow orderBack:]):
([EmacsWindow restackWindow:above:]): Override superclass methods to
handle child windows the way we want.
Alan Third [Sat, 2 Jan 2021 18:19:39 +0000 (18:19 +0000)]
Fix NS toolbar image release crash (bug#43973)
The toolbar fails to make a proper copy of EmacsImage objects, so
releasing the copy incorrectly released instance variables from the
original objects.
* src/nsimage.m ([EmacsImage copyWithZone:]): New function to enable
correct copying of EmacsImage.
Mauro Aranda [Sat, 2 Jan 2021 14:59:36 +0000 (11:59 -0300)]
Fix Quit button in dictionary buffer
* lisp/net/dictionary.el (dictionay-close): Changing the arity of the
function in cc5f2803785c5dc785f09a292313cf799e8d29bb was a mistake.
Restore it, but mark the argument as unused to avoid a
wrong-number-of-arguments error when using the Quit button.
Avoid printing stacktraces when it probably wouldn't work anyway.
* src/eval.c (signal_or_quit): Don't try to call the debugger if it's
inhibited or we are about to dump or bootstrap. In those cases the
debugger probably wouldn't work anyway.
The test 'process-tests/fd-setsize-no-crash/make-process' used to call
'sleep' to ensure that enough processes are live to trigger a
FD_SETSIZE overflow. However, we can just call 'cat' instead and
close standard input when done. That way, we only wait as long as
needed.
* process-tests.el
(process-tests/fd-setsize-no-crash/make-process): Invoke 'cat' instead
of 'sleep'. Close standard input to exit the 'cat' processes.
The 'process-tty-name' already provides the TTY name, we don't have
interrogate the TTY host.
* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-serial-process): Use
'process-tty-name' instead of having the TTY host print its TTY
name. Check whether TTY names are unique.
(process-tests--new-pty, process-tests--with-temp-file): Remove;
no longer used.