Fix infloop when folding difficult headers in Message
* lisp/mail/rfc2047.el (rfc2047-fold-field): Return the end point.
* lisp/gnus/message.el (message--fold-long-headers): Use that to
reliably achieve progress.
Alan Mackenzie [Sun, 20 Sep 2020 19:57:05 +0000 (19:57 +0000)]
C++ Mode: Modernize the fontification of "using"
Since "using" is now used in three distinct ways in C++, write a special
function to handle these rather than attempting to adapt the old regular
expressions.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Amend to allow the
argument TYPES to be a face. This face is given to the declarator being
processed.
(c-font-lock-single-decl): Make an argument to c-font-lock-declarators nil or
t, not merely nil or non-nil.
(c-complex-decl-matchers): Include c-font-lock-c++-using in the C++ value of
this variable.
(c-font-lock-c++-using): New function.
* lisp/progmodes/cc-langs.el (c-using-kwds, c-using-key): New lang
consts/vars.
(c-modifier-kwds): Remove "using" from the C++ value.
Michael Albinus [Sun, 20 Sep 2020 14:44:17 +0000 (16:44 +0200)]
Make D-Bus properties type safe
* doc/misc/dbus.texi (Properties and Annotations):
Precise dbus-get-property and dbus-set-property.
(Type Conversion): Explain :byte and :boolean type conversion.
(Errors and Events): dbus-ignore-errors returns nil when there is
a D-Bus error. Remove dbus-show-dbus-errors.
* etc/NEWS: Some D-Bus relevant changes.
* lisp/net/dbus.el (dbus-show-dbus-errors): Remove.
(dbus-ignore-errors): Replay implamentation without that variable.
(dbus-check-arguments): New defun.
(dbus-list-activatable-names, dbus-list-names)
(dbus-list-queued-owners, dbus-get-name-owner, dbus-introspect)
(dbus-get-all-properties, dbus-get-all-managed-objects): Don't debug.
(dbus-get-property, dbus-set-property): Propagate errors.
(dbus-register-property): Check for valid VALUE.
(dbus-property-handler): Simplify.
* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter. Make sure to
return the first isolated match.
(dired--need-confirm-positions, dired--mark-positions)
(dired--highlight-no-subst-chars, dired--no-subst-explain)
(dired--no-subst-ask, dired--no-subst-confirm): New functions.
(dired-do-shell-command): Use them (bug#28969, bug#35564).
* test/lisp/dired-aux-tests.el (dired-test-bug27496): Adapt to
new prompt.
(dired-test--check-highlighting): New test helper.
(dired-test-highlight-metachar): New tests.
* doc/emacs/files.texi (Reverting): Document the new command and the
new variable.
* etc/NEWS: Mention the new command and the new variable.
* lisp/files.el (revert-buffer-with-fine-grain): New command. Revert
a buffer trying to be non-destructive, by using replace-buffer-contents.
(revert-buffer-insert-file-contents-delicately): New function, alternative
to revert-buffer-insert-file-contents-function--default-function.
(revert-buffer-with-fine-grain-max-seconds): New variable. Passed as
argument MAX-SECS of replace-buffer-contents.
* test/lisp/files-tests.el (files-tests-lao files-tests-tzu): Helper
variables, taken from diffutils manual, to test reverting a buffer.
(files-tests-revert-buffer)
(files-tests-revert-buffer-with-fine-grain): New tests (bug#18).
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).