Extend process-lines to allow exit status handling
* subr.el (process-lines-handling-status): Extension of the old
process-lines, with more flexible handling of the exit status.
(process-lines): Old API implemented using the new function.
(process-lines-ignore-status): Another use of the new function -
return the output lines regardless of the exit status (bug#1321).
* src/nsterm.m ([EmacsView keyDown:]): Call
[NSCursor setHiddenUntilMouseMoves:] with the correct argument, depending on
variable make-pointer-invisible.
Daniel Martín [Sat, 19 Sep 2020 17:15:48 +0000 (19:15 +0200)]
Put files in mhtml-mode when they have <!DOCTYPE, case-insensitive
* lisp/files.el (magic-fallback-mode-alist): Match "DOCTYPE" in a
case-insensitive way before putting files in mhtml-mode. See
https://html.spec.whatwg.org/multipage/syntax.html#the-doctype for the
standard reference.
* test/lisp/files-tests.el (files-test-magic-mode-alist-doctype): Add
a test (bug#43511).
* lisp/emacs-lisp/ewoc.el (ewoc--refresh-node): Save and restore point line
and column offset.
(eowc-map) (ewoc--invalidate) (ewoc-set-hf): Don't use save-excursion
* lisp/vc/vc-dir.el (vc-dir-update): Don't save/restore point on calling
'ewoc-invalidate'.
Stefan Kangas [Fri, 18 Sep 2020 12:43:34 +0000 (14:43 +0200)]
Doc fix in directory-free-space-program
* lisp/files.el (directory-free-space-program): Doc fix; there is no
need to repeat that its obsolete here since it will be shown by
customize, describe-variable, etc. automatically.
Michael Albinus [Fri, 18 Sep 2020 09:17:42 +0000 (11:17 +0200)]
Fix error in D-Bus test
* test/lisp/net/dbus-tests.el (dbus-test04-register-method):
Do not check for error message text.
(dbus--test-signal-handler): Fix docstring.
(dbus--test-timeout-handler): New defun.
(dbus-test05-register-signal)
(dbus-test06-register-property-emits-signal): Use it.
* lisp/wid-edit.el (widget-button--check-and-call-button): Record the
ending position of event, because we might need it when
the :mouse-down-action function returns non-nil (bug#20664).
Make package install not bug out on weird stuff in find-file-hooks
* lisp/emacs-lisp/autoload.el (autoload-find-generated-file):
Users may have read-only-mode in find-file-hooks (bug#43460) so
just disable all the hooks here.
Harald Jörg [Thu, 17 Sep 2020 15:35:04 +0000 (17:35 +0200)]
cperl-mode: Add new value "PBP" for 'cperl-set-style'
* lisp/progmodes/cperl-mode.el (cperl-style-alist)
(cperl-set-style): Add indentation style recommended by Damian Conway's
book "Perl Best Practices".
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-mode-test-indent-styles): Add a test to verify indentation
and unraveling of conditionals (bug#43457).
Michael Albinus [Thu, 17 Sep 2020 15:13:55 +0000 (17:13 +0200)]
Work on D-Bus properties etc
* lisp/net/dbus.el (seq, subr-x): Require.
(dbus-error-disconnected, dbus-error-service-unknown): New defconst.
(dbus-set-property, dbus-register-property): Use `keywordp'. Fix
proper value sending a signal.
* test/lisp/net/dbus-tests.el (dbus-test04-register-method):
Extend test.
(dbus--test-signal-received): New defvar.
(dbus--test-signal-handler): New defun.
(dbus-test05-register-signal)
(dbus-test06-register-property-emits-signal): New tests.
(dbus-test06-register-property)
(dbus-test06-register-property-several-paths): Rename tests.
Add a command 'lossage-size' to set the maximum
number or recorded keystrokes (Bug#38796).
* src/keyboard.c (lossage_limit):
Static variable with the current lossage size limit.
(MIN_NUM_RECENT_KEYS): Renamed from NUM_RECENT_KEYS.
Set it as 100 and use it as the minimum value for lossage_limit.
Keep the same default for the vector size as before (300).
(lossage-size): New command.
(update_recent_keys): Helper function.
(command_loop_1)
(record_char)
(recent-keys)
(syms_of_keyboard): Use lossage_limit as the vector size.
* lisp/help.el (view-lossage): Mention the new command in the docstring.
* etc/NEWS (Changes in Emacs 28.1): Announce this change.
* doc/emacs/help.texi (Misc Help): Update manual.
* test/src/keyboard-tests.el (keyboard-lossage-size): Add test.
Fix up previous change for column/line spec mechanism in the mode line
* lisp/bindings.el (column-number-indicator-zero-based): Make
obsolete (bug#28648).
(mode-line-position-column-line-format): New variable.
(mode-line-position--column-line-properties): New const.
(mode-line-position): Use it.
Michael Albinus [Wed, 16 Sep 2020 12:32:57 +0000 (14:32 +0200)]
D-Bus: keep type information in D-Bus events
* doc/misc/dbus.texi (Errors and Events):
* etc/NEWS: D-Bus events keep the type information of their arguments.
* lisp/net/dbus.el (dbus-check-event): Fix docstring.
(dbus-delete-types, dbus-flatten-types): New defuns.
(dbus-handle-event, dbus-register-property, dbus-property-handler):
Handle type information.
(dbus-set-property): Fix thinko.
* src/dbusbind.c (XD_BASIC_DBUS_TYPE): Simplify.
(xd_dbus_type_to_symbol): New function.
(xd_retrieve_arg): Return type information for the arguments.
(xd_read_message_1): Return type information for the error name.
(dbus-registered-objects-table): Fix docstring.
* lisp/dired.el (dired-get-filename): dired-current-directory
can't be called before the dired buffer has been set up.
(add-hook 'dired-mode-hook 'dired-sort-toggle) calls
dired-get-filename in a way that exposes this problem, so avoid
it.
* lisp/calc/calccomp.el (math-compose-sqrt): Use a square root
character, if possible (bug#22919). Suggested by Zephyr Pellerin
<zephyr.pellerin@gmail.com>.
Eli Zaretskii [Tue, 15 Sep 2020 15:44:01 +0000 (18:44 +0300)]
Avoid aborts in display_mode_element
* src/xdisp.c (display_mode_element): Use parse_str_as_multibyte,
not multibyte_chars_in_text, to determine whether mode-line spec
shall be displayed as a multibyte or unibyte string. We cannot
use multibyte_chars_in_text here because it aborts when it finds
raw bytes in the spec string. (Bug#43409)
Robert Pluim [Fri, 11 Sep 2020 08:29:24 +0000 (10:29 +0200)]
Stop querying for fonts as soon as a match is found
Scanning through fonts can be very slow, especially with the 'x' font
backend, and the result is almost always not used. Stop looking for a
font as soon as one is found rather than scanning all the backends.
* src/font.c (font_list_entities): Stop scanning through the font
backends as soon as we find a match unless
'query-all-font-backends is set (Bug#43177).
(syms_of_font): New variable 'query-all-font-backends', default
false.
Eli Zaretskii [Tue, 15 Sep 2020 15:09:03 +0000 (18:09 +0300)]
Fix MS-Windows compilation of Gnulib with old versions of MinGW
* nt/inc/ms-w32.h (_WIN32_WINNT_WIN2K, _WIN32_WINNT_WINXP)
(_WIN32_WINNT_WS03, _WIN32_WINNT_VISTA, _WIN32_WINNT_WIN7,
_WIN32_WINNT_WIN8, _WIN32_WINNT_WINBLUE, _WIN32_WINNT_WIN10)
[__MINGW32__]: Define if any of these is not defined. Reported by
martin rudalics <rudalics@gmx.at>.
Enable uniquify-buffer-name-style to be a function.
* lisp/uniquify.el (uniquify-buffer-name-style) : Add "Other" custom
option
(uniquify-get-proposed-name) : Add condition for when
uniquify-buffer-name-style is a function.
Fix mailclient-send-it after recent browse-url rewrite
* lisp/mail/mailclient.el (mailclient-send-it): Make this function
work again after the browse-url machinery was changed to use
browse-url-default-handlers instead.
Stephen Berman [Mon, 14 Sep 2020 12:55:52 +0000 (14:55 +0200)]
Fix problem of marking files with hidden subdirs
* lisp/dired.el (dired-unhide-subdir):
(dired-subdir-hidden-p):
(dired-subdir-min): Moved from subr-x.
(dired-get-filename): Get the correct filename when directories
are hidden (bug#8484).
Further fixups in minibuffer-default--in-prompt-regexps
* lisp/minibuf-eldef.el (minibuffer-default--in-prompt-regexps):
Really allow shortening the default prompt format to [foo] (if
requested) (bug#12443).
Calc: fix binomial coefficients for negative arguments (bug#16999)
For some values outside integers 0≤k≤n, (n choose k) gave wrong
results, entered infinite recursion or used unreasonably amounts of
stack space. This change fixes that and extends the function to all
integer arguments using the definitions from M. J. Kronenburg
(https://arxiv.org/abs/1105.3689).
* lisp/calc/calc-comb.el (calcFunc-choose):
Fix sign error to prevent infinite recursion and extend function to
handle all integer arguments.
(math-choose-iter, math-choose-float-iter): Rewrite in iterative form;
no TCO in elisp yet.
* test/lisp/calc/calc-tests.el (calc-tests--fac, calc-tests--choose)
(calc-tests--check-choose, calc-tests--explain-choose)
(calc-tests--calc-to-number): New helper functions.
(calc-choose): New test.
Philipp Stephani [Sun, 13 Sep 2020 18:21:41 +0000 (20:21 +0200)]
Add facility to make module functions interactive (Bug#23486).
* src/module-env-28.h: Add field for 'make_interactive' function.
* src/emacs-module.c (Lisp_Module_Function): Add new field holding the
interactive form.
(allocate_module_function): Adapt to structure layout change.
(module_make_interactive, module_function_interactive_form): New
functions.
(initialize_environment): Use them.
* test/data/emacs-module/mod-test.c (Fmod_test_identity): New test
function.
(emacs_module_init): Create two interactive module test functions.
* test/src/emacs-module-tests.el (module/interactive/return-t)
(module/interactive/return-t-int, module/interactive/identity):
New unit tests.
* doc/lispref/internals.texi (Module Functions): Document new
function. Rework paragraph about wrapping module functions, as the
example no longer applies.
Stefan Kangas [Sun, 13 Sep 2020 16:24:31 +0000 (18:24 +0200)]
Improve frame-title-format and icon-title-format
* src/xdisp.c (syms_of_xdisp): Replace 'invocation-name' with the text
"%b - GNU Emacs" and replace "@" with " at ". (Bug#41147)
* etc/NEWS: Announce the above change.