Eric Abrahamsen [Fri, 28 Aug 2020 00:58:03 +0000 (17:58 -0700)]
New eieio-persistent-make-instance generic function
This allows override of the read process for eieio-persistent objects,
providing the possibility of matching read/write customization for
eieio-persistent subclasses.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-make-instance): New
generic function for constructing instances from object data written
to disk. Previously known as eieio-persistent-convert-list-to-object.
Eric Abrahamsen [Fri, 28 Aug 2020 00:17:19 +0000 (17:17 -0700)]
Remove redundant slot validation in eieio-persistent-read
Actual object creation (in `make-instance') will later run all slot
values through cl-typep, which does a better job of validation. This
validation is redundant, and slows the read process down.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-fix-value): Rename
from `eieio-persistent-validate/fix-slot-value', as we no longer
validate, and we don't care about the slot definition.
(eieio-persistent-slot-type-is-class-p): Delete function.
(eieio-persistent-convert-list-to-object): Still call
`eieio--full-class-object', to trigger an autoload if necessary, but
discard the return value.
Harald Jörg [Fri, 28 Aug 2020 14:33:13 +0000 (16:33 +0200)]
Fix indent-region for identifiers with underscores in cperl-mode
* lisp/progmodes/cperl-mode.el (cperl-fix-line-spacing): Fix Bug#18985.
Hash keys or function names starting with a Perl keyword followed
by an underscore (as in "for_me" are no longer split into two words
by M-x indent-region.
Paul Eggert [Thu, 27 Aug 2020 21:46:52 +0000 (14:46 -0700)]
Fix recently-introduced expand-file-name bug
The bug was that (expand-file-name "~") returned something
like "/home/eggert/" instead of "/home/eggert".
Problem reported by Mattias Engdegård (Bug#26911#27).
* src/fileio.c (Fexpand_file_name): When concatenating NEWDIR to
NM, instead of stripping trailing slashes from NEWDIR (which can
turn non-symlinks into symlinks), strip leading slashes from NM.
This also simplifies the code by removing no-longer-needed DOS_NT
special-casing. Also, remove an unnecessary ‘target[length] = 0;’
as that byte will be overwritten by the next memcpy anyway.
* test/src/fileio-tests.el (fileio-tests--HOME-trailing-slash):
New test.
Eric Abrahamsen [Thu, 27 Aug 2020 20:57:03 +0000 (13:57 -0700)]
Switch Gnus D-Bus signal from :session to :system
* lisp/gnus/gnus-dbus.el (gnus-dbus-register-sleep-signal): Apparently
this needs to be :system -- perhaps because PrepareForSleep is a
system-level event?
Mauro Aranda [Thu, 27 Aug 2020 14:22:35 +0000 (16:22 +0200)]
Keep the user theme in sync when marking a variable as set
* lisp/custom.el (customize-mark-as-set): Keep the user theme in sync
even if the new value of the variable is the saved-value or the
standard-value. If we don't do this, custom themes might end up
stepping over the user preferences in a session (bug#28904).
Stefan Kangas [Thu, 27 Aug 2020 11:38:37 +0000 (13:38 +0200)]
Substitute command keys in display-local-help
* lisp/help-at-pt.el (display-local-help): Pass 'help-echo' property
through 'substitute-command-keys' before displaying to be consistent
with tooltips. (Bug#37628)
This was discussed in:
https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg00090.html
Stephen Berman [Thu, 27 Aug 2020 11:53:22 +0000 (13:53 +0200)]
Prevent spurious tabs by RET in todo-edit-mode (bug#43068)
* lisp/calendar/todo-mode.el (todo-key-bindings-t)
(todo-edit-mode-map): Remove remapping of `newline' to
`newline-and-indent'.
(todo-modes-set-1): Remove local setting of `indent-line-function'.
(todo-edit-mode): Locally set `indent-line-function' to `todo-indent'.
* test/lisp/calendar/todo-mode-tests.el (todo-test-move-item05):
Prevent interactive test failure. (Until the addition of testcat4
to todo-test-1.todo, the test passed by chance, since testcat3 is
empty and has no archived items.)
(todo-test-edit-item-date-month): Refer to bug number.
(todo-test-multiline-item-indentation-1)
(todo-test-multiline-item-indentation-2)
(todo-test-multiline-item-indentation-3): New tests.
* test/lisp/calendar/todo-mode-resources/todo-test-1.todo: Remove
spurious tabs from testcat1.
Stefan Kangas [Thu, 27 Aug 2020 05:07:39 +0000 (07:07 +0200)]
Fix flyspell welcome message
* lisp/textmodes/flyspell.el (flyspell-mode, flyspell-mode-on):
Fix showing welcome message when `flyspell-issue-welcome-flag' and
`flyspell-issue-message-flag' are both non-nil. (Bug#43065)
Stefan Kangas [Thu, 27 Aug 2020 04:48:39 +0000 (06:48 +0200)]
Refer to correct mouse button in flyspell message
* lisp/textmodes/flyspell.el (make-flyspell-overlay)
(flyspell-mode-on): Refer to mouse-3 in help messages when the
variable 'flyspell-use-mouse-3-for-menu' is non-nil. (Bug#11680)
Stefan Kangas [Wed, 26 Aug 2020 19:53:17 +0000 (21:53 +0200)]
Signal error on Hunspell installation problem
* lisp/textmodes/ispell.el (ispell-find-hunspell-dictionaries):
Signal user-error when Hunspell warns that it "Can't open affix or
dictionary files", and propagate this message. (Bug#25825)
Stefan Kangas [Wed, 26 Aug 2020 22:50:59 +0000 (00:50 +0200)]
Sort Info index completions alphabetically
* lisp/info.el (Info-complete-menu-item): Sort the list of completions
alphabetically using 'nreverse'. This makes no difference for Emacs
but helps third-party completion frameworks such as Ivy. (Bug#38614)
Paul Eggert [Wed, 26 Aug 2020 20:25:35 +0000 (13:25 -0700)]
Fix expand-file-name symlink-to-dir bug
Problem reported by Yegor Timoshenko (Bug#26911),
and I ran into it myself recently in normal-top-level.
* doc/lispref/files.texi (File Name Expansion), etc/NEWS: Mention this.
* src/fileio.c (Fexpand_file_name): Expand "/a/b/." to "/a/b/" not
"/a/b", to avoid misinterpreting a symlink "/a/b". Similarly,
expand "/a/b/c/.." to "/a/b/" not "/a/b".
* test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name):
Adjust to match new behavior.
(tramp-test05-expand-file-name-relative): This test now succeeds,
at least on Fedora 31.
* test/src/fileio-tests.el:
(fileio-tests--expand-file-name-trailing-slash) New test.
Paul Eggert [Wed, 26 Aug 2020 17:53:32 +0000 (10:53 -0700)]
Fix PWD startup checking with symlinks
* lisp/startup.el (normal-top-level): Do not put "." after "/";
it’s not needed and with current file-name-as-directory it does
the wrong thing if PWD is a symlink.
ispell: Commands to check comments or strings at point or in region
* lisp/textmodes/ispell.el (ispell-comments-and-strings): Accept START
and END arguments, defaulting to active region in interactive calls.
(ispell-comment-or-string-at-point): New command. (bug#6411)
Brian Leung [Wed, 26 Aug 2020 10:01:14 +0000 (12:01 +0200)]
eshell: Remove unnecessary check in em-hist
* lisp/eshell/em-hist.el
(eshell-previous-matching-input-string-position): Both before and
within the while loop, n is always smaller than n (bug#43056).
Fix lexical misunderstandings in gnus-icalendar-tests.el (bug#39782)
* test/lisp/gnus/gnus-icalendar-tests.el:
(icalendar-tests--get-ical-event): Remove unused function accidentally
copy-pasted from icalendar-tests.el.
(gnus-icalendar-parse, gnus-icalendary-byday):
Remove unintended initial newlines.
Duplicate comma-escaping backslashes so that they have intended
effects, conforming to RFC 5545.
Remove ineffective comma-escaping backslashes where not intended.
Paul Eggert [Wed, 26 Aug 2020 07:07:08 +0000 (00:07 -0700)]
regex-emacs: omit regstart tests and regend set
* src/regex-emacs.c (PUSH_FAILURE_REG, POP_FAILURE_REG_OR_COUNT)
(re_match_2_internal): Add some assertions that regstart
is set whenever regend is.
(re_match_2_internal): Omit two unnecessary REG_UNSET (regstart ...)s
and one unnecessary assignment to regend.
Paul Eggert [Wed, 26 Aug 2020 01:33:22 +0000 (18:33 -0700)]
Fix gpg2-related test failures on RHEL 7.8
* test/lisp/gnus/mml-sec-tests.el (test-conf)
(mml-secure-en-decrypt-passphrase-no-cache-openpgp-todo)
(mml-secure-run-tests-with-gpg2):
Use epg-find-configuration instead of the obsolescent
epg-configuration. This fixes test failures on RHEL 7.8,
where ‘gpg’ and ‘gpg2’ are both 2.0.22.
Stefan Kangas [Tue, 25 Aug 2020 22:37:40 +0000 (00:37 +0200)]
Add package prefix to jsonrpc defconst
* lisp/jsonrpc.el (jsonrpc-default-request-timeout): Rename from
'jrpc-default-request-timeout'.
(jrpc-default-request-timeout): Make into obsolete variable alias
for 'jsonrpc-default-request-timeout'. (Bug#40054)
Paul Eggert [Tue, 25 Aug 2020 21:27:17 +0000 (14:27 -0700)]
Omit "V" at the start of DEFVAR_BOOL vars
Problem noted by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2020-08/msg00846.html
* src/font.c (xft_ignore_color_fonts):
* src/syntax.c (comment_end_can_be_escaped):
* src/xdisp.c (word_wrap_by_category, display_fill_column_indicator):
Rename these DEFVAR_BOOL variables to avoid the initial "V"
that wrongly suggests that they are Lisp_Object variables.
All uses changed.
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.