Eric Abrahamsen [Fri, 21 Aug 2020 20:36:58 +0000 (13:36 -0700)]
Add basic D-Bus integration to Gnus
* lisp/gnus/gnus-dbus.el: New library, registering a signal that
closes all Gnus servers when the system is going to sleep.
* lisp/gnus/gnus-start.el: Check new option
`gnus-dbus-close-on-sleep', and register the appropriate D-Bus signal
if it is non-nil.
* lisp/gnus/gnus.el: New gnus-dbus customization group.
* doc/misc/gnus.texi: Document.
Preserve setf semantics in 'substring', 'cons', 'logand' expanders
* doc/lispref/variables.texi (Adding Generalized Variables): Fix example.
* lisp/emacs-lisp/cl-lib.el (substring)
* lisp/emacs-lisp/gv.el (cons, logand): Return the value being
assigned, as specified for 'setf'. (bug#35546)
Tweak the file/buffer comparison from previous save-some-buffers change
* lisp/files.el (save-some-buffers): Relax the "similarity" regexp
from the previous regexp: Don't show both file and buffer names if
the file is /tmp/foo and the buffer name is foo<zot>.
* lisp/net/shr.el (shr-colorize-region): Extend backgrounds to the
end (bug#43031). This avoid ragged edges to the right when, for
instance, the <body> has a bgcolor.
(shr-face-background): Ditto.
Stephen Berman [Tue, 25 Aug 2020 11:30:58 +0000 (13:30 +0200)]
Tweak how "u" works in Info buffers when scroll-conservatively is set
* info.el (Info-up): If scroll-conservatively is non-zero and
less than 101, display as much of the superior node above the
target line as possible (Bug#13690).
Make shadowing warning in describe_map less confusing
* src/keymap.c (describe_map): A binding may be shadowed by
something else than a mode (bug#14086) (just a `define-key'
works), so don't say that it's a mode that shadows it.
Hideshow has defaults that are overridden if we look for derived modes
in hs-special-modes-alist. For instance, in lisp-interaction-mode
we'll choose a lookup based on parent modes, and that overrides the
default (bug#43032).
Paul Eggert [Mon, 24 Aug 2020 20:12:51 +0000 (13:12 -0700)]
replace-buffer-contents cleanups
* src/editfns.c (NOTE_DELETE, NOTE_INSERT): Avoid unnecessary parens.
(Freplace_buffer_contents): Check args before returning results.
Avoid integer overflow when computing too_expensive, and work even
if MAX-COSTS is bignum. Call alloca and/or malloc just once, not
three times.
(set_bit, bit_is_set): Simplify micro-optimization by using eassume.
Paul Eggert [Mon, 24 Aug 2020 20:12:51 +0000 (13:12 -0700)]
Fix replace-region-contents performance bug
* src/editfns.c (rbc_quitcounter): Remove; the quitcounter
is now part of the context.
(EXTRA_CONTEXT_FIELDS): Remove unused member early_abort_tests.
Add jmp, quitcounter.
(Freplace_buffer_contents): Use setjmp/longjmp to recover from
a compareseq that runs too long. Omit unnecessary rarely_quit
call.
(buffer_chars_equal): Occasionally check for early abort and
longjmp out if so (Bug#43016).
Rewrite the epa key interface to use buttons instead of widgets
* lisp/epa.el (epa-font-lock-keywords): Removed.
(epa-key-list-mode-map): Bind tab/backtab to button navigation.
(epa-key): Remove widget.
(epa--button-key-text): Return the propertized text instead of
return a widget text.
(epa-key-list-mode): Don't use font locking; everything is output
as it should be.
(epa--insert-keys): Rewrite to just output the data instead of
widgetising.
(epa--select-keys): Insert buttons instead of widgets.
Fix error when loading a new, non-existent foo.gpg file
* lisp/epa-file.el (epa-file-insert-file-contents): Propagate the
correct error upwards (bug introduced by fixing bug#3829, and
messing up where the `when' form ended).
Reported by "Herbert J. Skuhra" <herbert@gojira.at>.
Extend the default value in dired-diff to all the backup files
* lisp/dired-aux.el (dired-diff): When diffing files with backup
files, put all the backup files into the defaults so that they can
be reached with `M-n' from `read-file-name' (bug#24089).
Noam Postavsky [Mon, 24 Aug 2020 15:33:49 +0000 (17:33 +0200)]
Fix inferior octave single-quote font lock
* lisp/progmodes/octave.el (octave-mode-syntax-table): Fix
fontification of single quotes in inferior octave mode (bug#25517).
It looks like the problem is that octave-mode-syntax-table sets single
quotes as punctuation even though GNU Octave's manual says single quotes
are string syntax [1].
Have gnutls_symmetric cache the results from Fgnutls_ciphers
* src/gnutls.c (gnutls_symmetric): Cache the results from
Fgnutls_ciphers, since that function isn't very fast (bug#42998).
(syms_of_gnutls): Initialize cache variable.
Paul Eggert [Sun, 23 Aug 2020 21:59:15 +0000 (14:59 -0700)]
Simplify by using Gnulib sigdescr_np module
Inspired by a straightforward patch by Bruno Haible.
* admin/merge-gnulib (GNULIB_MODULES): Add sigdescr_np.
* configure.ac: Do not check for sys_siglist or __sys_siglist.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/sigdescr_np.c, m4/sigdescr_np.m4: New files, copied from Gnulib.
* src/sysdep.c (sys_siglist, sys_siglist_entries): Remove.
(init_signals): Do not initialize sys_siglist.
(safe_strsignal): Use sigdescr_np instead of sys_siglist.
Paul Eggert [Sun, 23 Aug 2020 21:09:48 +0000 (14:09 -0700)]
Update from Gnulib
This incorporates:
2020-08-23 intprops: be consistent about +X vs X+0
2020-08-23 intprops: fix INT_MULTIPLY_WRAPV bit-field bug
2020-08-23 verify: Make assume work on bit field expressions
2020-08-23 libc-config: Improve comments
2020-08-22 verify: Do use __builtin_assume on clang
2020-08-22 sig2str: Add more signals
2020-08-21 sigdescr_np: New module
* lib/cdefs.h, lib/intprops.h, lib/sig2str.c, lib/string.in.h:
* lib/verify.h, m4/string_h.m4: Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
Eli Zaretskii [Sun, 23 Aug 2020 18:23:45 +0000 (21:23 +0300)]
Improve handling of coding-system mnemonic indicators
This fixes assertion violations when the mnemonic is
given as a string, and allows non-ASCII characters be
used as mode-line mnemonic of a coding-system.
* src/xdisp.c (decode_mode_spec_coding): Handle multibyte
characters as coding-system's mnemonic.
(display_mode_element): If decode_mode_spec returns a multibyte
string, display it as multibyte.
* src/coding.c (Fdefine_coding_system_internal)
(Fcoding_system_put): If :mnemonic is a string, use its first
character. This avoids assertion violations if someone uses a
string as the mnemonic of a coding-system.
Always make a multibyte string for the frame title (bug#42904)
* src/xdisp.c (gui_consider_frame_title): Multibyte-encode any raw
bytes in the title, and then pass a multibyte string to the back-end
for use as a frame title. This cuts down a little on the rubbish
shown when raw bytes sneak in by mistake (as part of the buffer name,
for instance).
Eli Zaretskii [Sun, 23 Aug 2020 16:25:58 +0000 (19:25 +0300)]
Fix image display on w32 as followup to recent changes
The new code calls 'malloc' and 'free', so we can no longer
* src/image.c (struct image_type): Rename 'load' to 'load_img' and
'free' to 'free_img'. All callers changed.
(free_image) [WINDOWSNT]: Don't #undef 'free'.
Alan Third [Sun, 23 Aug 2020 15:28:17 +0000 (16:28 +0100)]
Set basic SVG attributes (bug#40845)
* test/manual/image-transforms-tests.el: Replace hard-coded colors
with defaults.
* src/dispextern.h (struct image):
* src/image.c (search_image_cache):
(xbm_load_image):
(xbm_load):
(pbm_load): Rename from frame to face where relevant.
(svg_load_image): Parse the image to find out the size, then wrap it
in another SVG to set a new size and colors, etc.
(lookup_image): Use the face colors instead of the frame colors.
(search_image_cache): Add ability to ignore the face colors.
(uncache_image): Uncache all copies of the image that share the spec,
even if the face colors don't match.
* etc/NEWS: Describe the changes.
Michael Albinus [Sun, 23 Aug 2020 11:30:43 +0000 (13:30 +0200)]
Rework direct async processes in Tramp
* doc/misc/tramp.texi (Remote processes): Precise restrictions for direct
async processes.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-direct-async-process-p): Make it more precise.
(tramp-handle-make-process): Rewrite, based on `make-process'.
* test/lisp/net/tramp-tests.el (tramp-test-temporary-file-directory):
Add `tramp-direct-async-args` for mock method.
(tramp-test29-start-file-process, tramp-test30-make-process):
Use weaker regexp checking "foo".
(tramp-test30-make-process): Do not check stderr for direct async processes.
(tramp--test--deftest-direct-async-process): New defmacro.
(tramp-test29-start-file-process-direct-async)
(tramp-test30-make-process-direct-async): New tests.
Yuan Fu [Wed, 27 May 2020 02:47:27 +0000 (22:47 -0400)]
Improve word wrapping for CJK characters
Note about the change around line 9257 and 23372:
Before, the test for whitespace checks for can_wrap_before and
can_wrap_after simutaniously. Now we separate these two checks, and
the logic needs to change a little bit. However, when we don't enable
the new wrapping feature, 'can_wrap_after' is equivalent to
'IT_DISPLAYING_WHITESPACE' and 'can_wrap_before' is equivalent to
'!IT_DISPLAYING_WHITESPACE'. And the new logic is equivalent with the
old one in that case.
Old logic:
if (whitespace) /* Which means can wrap after && can't wrap
before. */
may_wrap = true;
else if (may_wrap) /* aka (!whitespace && may_wrap)
(set wrap point) * aka (can't wrap after && can wrap before
may_wrap = false * && may_wrap)
*/
New logic:
if (can_wrap_after)
next_may_wrap = true
else
next_may_wrap = false;
if (may_wrap && can_wrap_before)
(set wrap point)
/* Update may_wrap. */
may_wrap = next_may_wrap;
* src/xdisp.c (it_char_has_category, char_can_wrap_before)
(char_can_wrap_after): New functions.
(move_it_in_display_line_to, display_line): Replace calls to
'IT_DISPLAYING_WHITESPACE' with either 'char_can_wrap_before' or
'char_can_wrap_after'.
(word-wrap-by-category): New variable.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): Add
'word-wrap-by-category' as a customizable variable.
* doc/emacs/display.texi (Visual Line Mode): Add a paragraph about the
new 'word-wrap-by-category' feature.
* etc/NEWS: Announce the change.
Tino Calancha [Sat, 22 Aug 2020 15:39:16 +0000 (17:39 +0200)]
Handle globstar in dired
Allow user to enable globstar when the shell support
it and disable it by default (e.g. bash).
* lisp/dired.el (dired-maybe-use-globstar): New user option.
(dired-enable-globstar-in-shell): New variable.
(dired-insert-directory): if `dired-maybe-use-globstar' is
non-nil and the shell supports globstar, then enable it.
Doc string (and defcustom type) fix for grep-find-command
* lisp/progmodes/grep.el (grep-find-command): Add the cons type to
the defcustom, and document it (bug#36113). (It has always been a
valid value for the variable.)
Jan Tatarik [Sat, 22 Aug 2020 13:39:17 +0000 (15:39 +0200)]
gnus-icalendar does not understand multiple repeating days
* lisp/gnus/gnus-icalendar.el
(gnus-icalendar-event:recurring-days): New function (bug#39782).
(gnus-icalendar-event:org-timestamp): New function.
(gnus-icalendar--find-day): Use them.
(gnus-icalendar-event--org-timestamp): Ditto.
Stefan Kangas [Sat, 22 Aug 2020 11:21:13 +0000 (13:21 +0200)]
Bind mwheel-scroll on more parts of frame's display
* lisp/mwheel.el (mouse-wheel-mode): Bind unmodified 'mwheel-scroll'
on scroll bars, fringes, margins, header and mode line. (Bug#5557)
(mouse-wheel--create-scroll-keys): New helper function for
'mouse-wheel-mode'.
* test/lisp/mwheel-tests.el: New file.
Stephen Berman [Fri, 21 Aug 2020 20:41:48 +0000 (22:41 +0200)]
Fix several todo-mode.el editing bugs (bug#42976)
* lisp/calendar/todo-mode.el (todo-insert-item--basic): Ensure the
target todo file is in todo-mode.
(todo-edit-item--text): When editing a done item comment, prevent
clobbering match data on finishing the edit.
(todo-edit-item--header): Ensure that decrementing the month of
the date header works for intervals greater than a year, and when
incrementing or decrementing the month crosses one or more years,
adjust the year as needed.
(todo-read-category): If we're outside of todo-mode and there is a
current todo file, use it; otherwise, use the default todo file.
* test/lisp/calendar/todo-mode-tests.el
(todo-test-edit-item-date-month): New test.
* test/lisp/calendar/todo-mode-resources/todo-test-1.todo: Modify
to accommodate new test.
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Clarify that the minor mode hook is called both when enabling and
disabling the mode (bug#34073).
* lisp/vc/diff-mode.el (diff-error): New face (bug#2739).
(diff-font-lock-keywords): Use it to highlight lines like "diff: "
which are error messages from diff (for instance, when a file
doesn't exist).
Fix problem with 8bit content-transfer-encoding in nndoc mbox files
* lisp/gnus/nndoc.el (nndoc-possibly-change-buffer): If we're
reading an mbox file, it may contain messages that use
content-transfer-encoding 8bit, which means that we have to treat
the file as a sequence of byte (bug#42951). This avoids
double-decoding -- once by Emacs when inserting the mbox into the
buffer, and once by Gnus when displaying the articles.
Kevin Ryde [Fri, 21 Aug 2020 12:17:56 +0000 (14:17 +0200)]
Have ispell add new LocalWords lines after any such existing lines
* textmodes/ispell.el (ispell-add-per-file-word-list): Add new
LocalWords line just after existing such lines. Good to keep words
together or if deliberately placed somewhere special (bug#20486).
Fix problem with non-ASCII characters in ediff error messages
* lisp/vc/ediff-diff.el (ediff-prepare-error-list): Decode the
data from diff before displaying (bug#5050). This fixes a problem
with displaying raw bytes in the error messages in non-ASCII locales.
Make image-mode give better feedback when the buffer is empty
* lisp/image-mode.el (image-mode): Give a less confusing message
if we don't have any image data (bug#16062). Also leave the
buffer in fundamental mode.
Fix NS crash on invalid frame title string (bug#42904)
Instead of blindly assuming that all Emacs strings are valid UTF-8,
which they are not, use a more careful conversion going via UTF-16
which is what NSString uses internally. Unpaired surrogates will
still go through to the NSString objects, but the NS libs handle them
gracefully.
* src/nsterm.h (EmacsString): New category.
* src/nsfns.m (all_nonzero_ascii): New helper function.
([NSString stringWithLispString:]): New method.
(ns_set_name_internal): Use new conversion method.
Don't message the hunk status when just going to it
* lisp/vc/diff-mode.el (diff-goto-source): Don't output a status
about the hunk just when jumping to it (bug#38370). This would
output "Hunk already applied" when browsing diffs.