Calc: fix formatting and parsing Unix time (bug#43759)
The number of days from epoch to Jan 1, 1970 that was used in parsing
and formatting Unix time was incorrect. The previous fix
(in e368697ce36) was incomplete.
Reported by Vincent Belaïche.
* lisp/calc/calc-forms.el (math-unix-epoch): New constant.
(math-format-date-part, math-parse-standard-date, calcFunc-unixtime):
Use math-unix-epoch instead of a constant that is sometimes wrong.
* test/lisp/calc/calc-tests.el (calc-unix-date): New test.
Alan Mackenzie [Fri, 2 Oct 2020 17:25:02 +0000 (17:25 +0000)]
Enhance syntax-tests.el to test comments in scan-lists
This now tests the interface between scan_lists and the comment functions.
* test/src/syntax-tests.el (syntax-br-comments): New macro.
({-in, ;-in, /*-in): Set parse-sexp-ignore-comments to t.
(top level): Add 15 tests for comments inside brace lists.
* test/data/syntax-comments.txt (top level): Amend some test fragments.
Glenn Morris [Fri, 2 Oct 2020 16:33:53 +0000 (09:33 -0700)]
Merge from origin/emacs-27
2af6b3147d Clarification in Tramp manual 8fbaca7d41 Check Emacs version used for Tramp compilation 90e5549f02 Don't signal an error when saving files on WdebDAV volumes 6f73cc3579 ; * lisp/net/eww.el (eww-search-words): Doc fix. ce0842a165 * lisp/hi-lock.el (hi-lock-find-patterns): Autoload it. (...
* lisp/ebuff-menu.el (electric-buffer-list): Ensure that point is
restored, which isn't always the case if
global-display-line-numbers-mode (bug#43755). This enables
selecting buffers again.
Stefan Monnier [Fri, 2 Oct 2020 10:34:37 +0000 (10:34 +0000)]
CC Mode: Convert the handling of c-special-indent-hook to standard usage
* lisp/progmodes/cc-styles.el (c-set-style): Use kill-local-variable rather
than copying the hook's global value to the local binding.
(c-make-styles-buffer-local): Remove redundant make-variable-buffer-local.
Robert Pluim [Fri, 2 Oct 2020 08:47:06 +0000 (10:47 +0200)]
Don't error if no GPG signing key configured
* lisp/gnus/mml-sec.el (mml-secure-epg-sign): Partially revert
"Make mml-secure-epg-sign bug out if we can't find an identity".
It causes signing to fail for people who have not set up
mml-secure-{smime,openpgp}-sign-with-sender, which is a regression
from Emacs-26 (Bug#40118). In such a situation gpg will use its
default key.
Do not merge to master. On master Emacs will query the user.
The calculation of business days was broken in 2012 (probably 310e60d9454fe2 or thereabouts) when the date representation changed
epoch so that Jan 1, 1 AD became day number 1 instead of 0. Repair
this, along with an unrelated bug that prevented arbitrary holiday
weekdays from working.
Reported by Aaron Zeng.
* lisp/calc/calc-forms.el (math-to-business-day)
(math-from-business-day): Correct calculation of weekdays using Calc's
current (Rata Die) chronology. Modify loop condition to cope with odd
sets of holiday weekdays.
* test/lisp/calc/calc-tests.el (calc-business-days): New test.
* lisp/ebuff-menu.el (electric-buffer-list): Ensure that point is
restored, which isn't always the case if
global-display-line-numbers-mode (bug#43755). This enables
selecting buffers again.
* lisp/progmodes/python.el (python-shell-send-statement): Don't
send a cookie, because that leads to the naked expression not
being evaled (bug#43450).
(python-shell-send-region): Allow not sending a cookie.
(python-shell-buffer-substring): Ditto.
Stop using a dynamically bound 'generated-autoload-file' variable
* doc/lispref/loading.texi (Autoload): Document change of name
(bug#39823).
* lisp/emacs-lisp/autoload.el (autoload-find-generated-file): Pass
the file name in.
(autoload-generated-file): Ditto.
(autoload-file-load-name): Ditto.
(generate-file-autoloads): Ditto.
(autoload--setup-output): Ditto.
(autoload-generate-file-autoloads): Ditto, and alter doc string to
reflect when `generated-autoload-file' is heeded.
(update-file-autoloads): Pass outfile in to functions.
(autoload-find-destination): Ditto.
(update-directory-autoloads): Make into an obsolete shim around
`make-directory-autoloads'.
(make-directory-autoloads): Renamed from
`update-directory-autoloads' with new semantics.
(batch-update-autoloads): Adjust caller.
Tino Calancha [Thu, 1 Oct 2020 21:33:56 +0000 (23:33 +0200)]
Fix wdired-do-perm-changes when over Tramp
* lisp/wdired.el (wdired-do-perm-changes) Use set-file-modes
instead of external program (bug#39284). This fixes the problem
of passing the wrong argument to the external chmod.
Juri Linkov [Thu, 1 Oct 2020 19:17:40 +0000 (22:17 +0300)]
Use new faces isearch-group-odd and isearch-group-even (bug#43702)
* lisp/isearch.el (isearch-group-odd, isearch-group-even): New faces
instead of isearch-group-1 .. isearch-group-9.
(isearch-highlight): Use new faces.
* lisp/progmodes/sql.el (sql-add-product): Re-correct argument
spec. Previous change was due to my mistake; I have
resolved back to the prior behavior (Bug#39960).
* test/lisp/progmodes/sql-tests.el (sql-test-add-product): Added
test to insure I don't make the same mistake again.
Gemini Lasswell [Thu, 1 Oct 2020 17:59:58 +0000 (19:59 +0200)]
Restore some public debugging functions removed in Emacs 27
* lisp/emacs-lisp/backtrace.el (backtrace--to-string): New function.
(backtrace-to-string): Use it. Fix whitespace (bug#40728).
* lisp/emacs-lisp/debug.el (debugger-insert-backtrace): New function.
Mark it as obsolete.
(debugger-toggle-locals, debug-help-follow): New aliases.
* lisp/simple.el (visual-line-mode): Only save values once, even
if the mode is switched on twice (bug#43730). This makes both
previously set local values for variables like truncate-lines, as
well as default values for truncate-lines restorable.
martin rudalics [Thu, 1 Oct 2020 00:00:06 +0000 (02:00 +0200)]
Fix segfault in some cases when restoring a selected window
* src/xdisp.c (restore_selected_window): Fix the more grave
problems caused by a function deleting the previously selected
frame or window (bug#39977).
Stefan Monnier [Wed, 30 Sep 2020 23:08:47 +0000 (19:08 -0400)]
* doc/emacs/basic.texi (Basic Undo): Explain the C-/ situation in xterm
AFAICT, in ttys you can send a `C-_` to Emacs either by pressing
`C-/` (e.g. xterm, uxterm, rxvt, xfce4-terminal, gnome-terminal)
or by pressing `C--` (e.g. rxvt, Linux console).
When recipient has no public key, make offer to skip it optional.
* epa-mail.el (epa-mail-offer-skip): New option.
(epa-mail-encrypt): If epa-mail-offer-skip is nil,
don't offer to skip a keyless recipient, just cause error.
* lisp/cedet/semantic/bovine/scm.el (semantic-lex-scheme-symbol):
Symbols do not have to start with a word-constituent character
(bug#40034). In particular, symbols like : and . are valid.
Fix problem of having the wrong window selected after saving foo.gpg
* lisp/epa.el (epa--select-keys): Restore the window configuration
after selecting the key to use (bug#43703). This also ensures
that the buffer we were editing ends up as the current buffer
after saving it, instead of selecting a different window.
Eli Zaretskii [Wed, 30 Sep 2020 14:33:58 +0000 (17:33 +0300)]
Fix 'move-to-column' when invisible text follows a TAB
* src/indent.c (scan_for_column): Accept 2 more arguments, and
report through them the position corresponding to PREVCOL. All
callers changed.
(Fmove_to_column): Use the prev_col's position to test for a TAB
instead of assuming that the TAB is just before point (which is
false when there's invisible text around). (Bug#43587)
Michael Albinus [Wed, 30 Sep 2020 10:40:08 +0000 (12:40 +0200)]
Minor code cleanup in dbus-tests.el
* test/lisp/net/dbus-tests.el (dbus--tests-dir): Make it a defconst.
(dbus--test-method-reentry-handler): Mark args as unused.
(dbus-test04-method-reentry): Tag it :expensive-test. Fix typo.
(dbus-test06-property-types): Remove duplicate test.
(dbus--test-introspect): Use `insert-file-contents-literally'.
(dbus--test-validate-property): Mark expected-annotations as unused.
(dbus--test-validate-m-or-s): Remove superfluous le-clause.
Give better error feedback on wrong password in .gpg files
* lisp/epa-file.el (epa-file--find-file-not-found-function): Do a
user-error when there's a wrong password (bug#43704).
(epa--wrong-password-p): New function.
(epa-file-insert-file-contents): Use it, and stash the error away
for later signalling.
* lisp/net/soap-client.el (soap-decode-date-time): Add support for
Emacs versions that support fractional seconds. Make DATATYPE
optional. Remove FIXME comment.
Fix emacsclient -c foo.txt behaviour with many frames
* lisp/server.el (server-execute): Pass in whether we opened a new
frame or not (bug#43645).
(server-switch-buffer): Use this to switch to the requested buffer
in the new frame if we have "emacsclient -c foo.txt", and retain
the old behaviour if it's "emacsclient foo.txt".
Michael Albinus [Mon, 28 Sep 2020 12:47:46 +0000 (14:47 +0200)]
Improve D-Bus monitor
* lisp/net/dbus.el (dbus-monitor-method-call)
(dbus-monitor-method-return, dbus-monitor-error)
(dbus-monitor-signal): New defconsts.
(dbus-monitor-goto-serial): New defun.
(dbus-monitor-handler): Use them. Add timestamp. Make also links
between D-Bus messages with the same serial.
Harald Jörg [Mon, 28 Sep 2020 12:13:01 +0000 (14:13 +0200)]
cperl-mode: Add compatibility for Emacs 26.1
* lisp/progmodes/cperl-mode.el (cperl--time-convert): New
compatibility helper for time-convert (available in Emacs
27.1)
(cperl--format-prompt): New compatibility helper for
format-prompt (available in Emacs 28)
(cperl-info-on-command): use cperl--format-prompt
(cperl-perldoc): use cperl--format-prompt
(cperl-time-fontification): use cperl--time-convert (bug#43652)
Jan Tatarik [Mon, 28 Sep 2020 11:08:32 +0000 (13:08 +0200)]
Fix Gnus parsing of weekly recurring icalendar events
* lisp/gnus/gnus-icalendar.el
(gnus-icalendar-event:recurring-interval): Fix parsing of weekly
recurring events (bug#43669).
Example: in the absence of explicit INTERVAL value in the calendar
event, a weekly event with occurrences scheduled for Mondays and
Wednesdays should receive the default recurring interval of "1" and the
org mode timestamp repeater should be "+1w".
Due to a bug in the current code we receive "WEEKLY" and "+WEEKLYw"
instead. The patch fixes the issue.
Stefan Monnier [Mon, 28 Sep 2020 02:07:14 +0000 (22:07 -0400)]
Fix pcomplete completion of things like `xargs` and `sudo` (bug#16197)
* lisp/pcmpl-unix.el (pcomplete/xargs): Don't `pcomplete-this` around
`pcomplete-command-completion-function`.
(pcomplete/sudo): Make it an alias for `pcomplete/xargs`.
* lisp/shell.el (shell-command-completion-function): Return the
names from `exec-path` when the command name has no `/`.
Michael Albinus [Sun, 27 Sep 2020 16:59:04 +0000 (18:59 +0200)]
Document D-Bus monitoring
* doc/misc/dbus.texi: Replace "symbol" by "keyword" where appropriate.
(Alternative Buses): Adapt dbus-init-bus description.
(Errors and Events): Adapt dbus-event structure. New defuns
dbus-event-destination-name, dbus-event-handler and dbus-event-arguments.
(Monitoring Events): New node.
* lisp/net/dbus.el: Replace "symbol" by "keyword" where appropriate.
(cl-lib): Require.
(dbus-register-monitor): Adapt the argument list.
(dbus-monitor-handler): Extend.
(dbus-init-bus): Adapt docstring.
* test/lisp/net/dbus-tests.el (dbus-test01-compound-types):
Skip if needed. Extend test.