Stefan Monnier [Thu, 25 Mar 2021 15:57:58 +0000 (11:57 -0400)]
* lisp/htmlfontify.el: Fix misuses of `nconc`
(hfy-face-to-style-i): `this` is not known to be fresh.
(hfy--size-to-int): Rename from `hfy--size-to-int` and return just the
integer without wrapping it in a list.
(hfy-flatten-style): Avoid O(n²) problems. Use `float`.
Update rnc to use Open Document's Relax-NG schema to version 1.3
* Use the LibreOffice Relax-NG files since they include a hack to
support 1.2.
* rng source:
https://raw.githubusercontent.com/freedesktop/libreoffice-core/master/
schema/libreoffice/OpenDocument-schema-v1.3%2Blibreoffice.rng
* translation to rnc with trang:
trang -I rng -O rnc OpenDocument-schema-v1.3+libreoffice.rng \
OpenDocument-schema-v1.3+libreoffice.rnc
Amos Bird [Thu, 25 Mar 2021 06:50:46 +0000 (14:50 +0800)]
Fix preeditarea reporting wrong spot.
This patch adjust the x position of preeditarea with both left fringe
and left margin, which prevents IME preedit box (such as fcitx) from
placing at the wrong position in GUI emacs.
* src/xfns.c (xic_set_preeditarea): Adjust X for left margin width.
(Bug#47377)
Paul Eggert [Mon, 22 Mar 2021 01:08:13 +0000 (18:08 -0700)]
Fix replace-buffer-contents undefined behavior
* src/editfns.c (Freplace_buffer_contents): Avoid undefined
behavior with competing side effects in parallel subexpressions.
Problem reported by Apple clang version 12.0.0 (clang-1200.0.32.29).
Michael Albinus [Thu, 25 Mar 2021 14:36:33 +0000 (15:36 +0100)]
Fix filenotify-tests.el for Solaris (bug#47262), do not merge
* test/lisp/filenotify-tests.el (file-notify--test-read-event):
Check also for GFamDirectoryMonitor.
(file-notify--test-timeout): Increase cygwin timeout.
(file-notify--test-monitor): Use `alist-get'.
(file-notify--test-event-actions): New defun.
(file-notify--test-with-actions-explainer): Use it.
(file-notify--test-with-actions-check): Use it. If
file-notify-debug is non-nil, trace received events instead of
checking them.
(file-notify-test03-events, file-notify-test05-file-validity)
(file-notify-test07-many-events, file-notify-test08-backup)
(file-notify-test09-watched-file-in-watched-dir):
Handle GFamFileMonitor and GFamDirectoryMonitor.
Michael Albinus [Thu, 25 Mar 2021 11:02:57 +0000 (12:02 +0100)]
Adapt Tramp file notification support
* lisp/net/tramp-integration.el (tramp-use-ssh-controlmaster-options):
Declare it.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
Remove "gvfs-monitor-dir".
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-get-remote-gvfs-monitor-dir): Remove.
(tramp-get-remote-gio-file-monitor): Support also cygwin, and
GFamDirectoryMonitor, GPollFileMonitor.
* lisp/progmodes/project.el (project--remove-from-project-list): Add
new argument, report-message, used to signal various messages when
removal has happened.
* lisp/progmodes/project.el (project-remove-known-project): New
command that removes the selected directory from the project-list-file.
* lisp/progmodes/project.el (project-current): Add the report message.
* doc/emacs/maintaining.text: Add information about the new command to
the manual.
Stefan Monnier [Wed, 24 Mar 2021 21:11:05 +0000 (17:11 -0400)]
* list/progmodes/idl*.el: Use lexical-binding
* lisp/progmodes/idlw-complete-structtag.el: Use lexical-binding.
* lisp/progmodes/idlw-help.el: Use lexical-binding.
Delete redundant `:group` arguments.
(idlwave-query-class, idlwave-force-class-query, idlw-help-name)
(idlw-help-kwd, idlw-help-link): Declare vars.
(idlwave-highlight-linked-completions): Remove unused var `class`.
(idlwave-help-find-in-doc-header): Remove unused var `header-re`.
* lisp/progmodes/idlw-shell.el (idlwave-shell-input-mode-magic):
Remove XEmacs-only code.
(idlwave-shell-filter, idlwave-shell-scan-for-state):
Use `functionp` since a function can also satisfy `listp`.
(idlwave-shell--mouse-examine): Rename from `idlwave-shell-mouse-examine`.
Make it a function, and simplify for Emacs≥22. Simplify calling convention
since all callers always immediately `funcall`d the result.
Update all callers.
(idlwave-default-mouse-track-event-is-with-button): Use `always`.
(idlwave-shell-filter-bp): Simplify a tiny bit.
* lisp/progmodes/idlwave.el: Use lexical-binding.
(idlwave--dlet): New macro.
(<toplevel>): Use it.
(idlwave-keyword-abbrev): Turn it into a function.
(idlwave-code-abbrev): Delete macro.
(idlwave-mode-abbrev-table): Use `:enable-function` instead.
(idlwave-with-special-syntax): Delete macro; use `with-syntax-table`
instead in all callers.
(idlwave-action-and-binding): Use `alist-get` and replace `(lambda...)
with a proper closure. Change all callers to prefer passing a function
in the `cmd` argument.
(idlwave-fill-function): Delete constant var.
Replace its uses with its value (the symbol `auto-fill-function`).
(idlwave-mode): Set `normal-auto-fill-function` instead of the
cumbersome use of `idlwave-fill-function`. Tighten a regexp.
Don't set `imenu-create-index-function` to the value it should already have.
(idlwave-auto-fill-mode): Make it an obsolete alias for `auto-fill-mode`.
(idlwave-modify-abbrev): Rename from `idlwave-check-abbrev`.
Don't check `idlwave-quoted` since `:enable-function` did it for us already.
(idlwave--command-function): Rename from `idlwave-command-hook`
and make it hold a function rather than an expression.
(idlwave-command-hook, idlwave-modify-abbrev): Adjust accordingly.
(idlwave-show-begin-check): Don't check `idlwave-quoted` since
`:enable-function` did it for us already.
(idlwave-do-action): Use `functionp` since a function can also satisfy `listp`
(idlwave-new-sintern-type): Make it a macro, so we don't need to
`declare-function` for the functions it defines.
(idlwave--class-selector, idlwave--type-selector)
(idlwave--method-selector, idlwave--super-classes): Rename those vars
by adding the `idlwave--` prefix. Adjust all uses.
(idlwave-complete-functions): Rename from `idlwave-complete-special`.
(idlwave-call-special): Declare obsolete. Change all callers to use
`run-hook-with-args-until-success` instead.
(idlwave-complete-filename): Use `dlet`.
(idlwave-rinfo-assq-any-class): Remove unused var `class`.
(idlwave-determine-class-functions): Rename from
`idlwave-determine-class-special`; fix docstring since the functions
are called with only one argument.
(idlwave--complete-after-success-function): Rename from
`idlwave-complete-after-success-form` and make it hold a function.
Adjust all users.
(idlwave--complete-after-success-force-function): Rename from
`idlwave-complete-after-success-form-force` and make it hold a function.
Adjust all users.
(idlwave-attach-classes): Remove always-t variable `do-dots`.
(idlwave-local-value): Use `local-variable-p` and `buffer-local-value`
to avoid `with-current-buffer`.
(idlwave-default-choose-completion): Comment out (unused and calls
a function that doesn't exist).
(idlwave-shell-filter-sysvars): Remove unused vars `type`, `name`, and `class`
(idlwave-fix-module-if-obj_new): Remove unused var `name`.
(idlwave-fix-keywords): Bind `idlwave--super-classes` via `let` than
via the function's argument.
(idlwave-twin-class, idlwave-twin-name): Move before first use.
(idlwave-study-twins): Remove stealth/redundant `type` variable.
(idlwave-routine-entry-compare-twins): Remove unused var `type`.
(idlwave-path-alist-add-flag): Avoid `add-to-list` on a local var.
(idlwave-list-abbrevs): Simplify a tiny bit.
Alan Mackenzie [Wed, 24 Mar 2021 18:57:48 +0000 (18:57 +0000)]
Improve failure reporting in test/lisp/electric-tests.el
In particular, on a failure, output the test's doc string to
electric-tests.log, along with all the other failure information.
Fixes bug #47320.
* electric-tests.el (electric-pair-test-for) New parameter doc-string. On a
test failure, output the doc-string parameter with message.
(electric-pair-define-test-form): Set the new variable doc-string to the
generated doc string, and pass this as argument to both ert-deftest and
electric-pair-test-for.
Harald Jörg [Wed, 24 Mar 2021 16:06:21 +0000 (17:06 +0100)]
perl-mode: Fix regexps for fontification
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-declarations): New test to ensure consistency
between perl-mode.el and cperl-mode.el (bug#47345).
* lisp/progmodes/perl-mode.el (perl-font-lock-keywords-1): pick
correct capture groups for "use Pack::Age;"
Fontify all components of "Pack::Age", not just "Pack"
(perl-font-lock-keywords-2): Use keyword-face for declarators
Paul W. Rankin [Wed, 24 Mar 2021 14:26:59 +0000 (00:26 +1000)]
Remove font-lock toggle from font-lock-update
* lisp/font-lock.el (font-lock-update): Remove call to
font-lock-unfontify-region and font-lock-mode toggle with ARG; this
did not perform what original author intended
Stefan Monnier [Tue, 23 Mar 2021 05:00:56 +0000 (01:00 -0400)]
* lisp/mh-e: Enable lexical-binding in all the files
* lisp/mh-e/mh-alias.el: Use lexical-binding.
(mh-alias-insert-file): Completion tables can be mere lists of strings.
* lisp/mh-e/mh-mime.el: Use lexical-binding.
(mh-mm-inline-message): Remove always-nil var `visible-headers`.
* lisp/mh-e/mh-search.el: Use lexical-binding.
(mh-search-folder): Remove unused var `pick-folder`.
* lisp/mh-e/mh-show.el: Use lexical-binding.
(mh-display-msg): Remove always-nil var `visible-headers`.
* lisp/mh-e/mh-utils.el: Use lexical-binding.
(completion-root-regexp): Always declare var.
* lisp/mh-e/mh-buffers.el: Use lexical-binding.
* lisp/mh-e/mh-comp.el: Use lexical-binding.
* lisp/mh-e/mh-folder.el: Use lexical-binding.
* lisp/mh-e/mh-funcs.el: Use lexical-binding.
* lisp/mh-e/mh-gnus.el: Use lexical-binding.
* lisp/mh-e/mh-identity.el: Use lexical-binding.
* lisp/mh-e/mh-inc.el: Use lexical-binding.
* lisp/mh-e/mh-junk.el: Use lexical-binding.
* lisp/mh-e/mh-letter.el: Use lexical-binding.
* lisp/mh-e/mh-limit.el: Use lexical-binding.
* lisp/mh-e/mh-print.el: Use lexical-binding.
* lisp/mh-e/mh-scan.el: Use lexical-binding.
* lisp/mh-e/mh-seq.el: Use lexical-binding.
* lisp/mh-e/mh-speed.el: Use lexical-binding.
* lisp/mh-e/mh-thread.el: Use lexical-binding.
* lisp/mh-e/mh-tool-bar.el: Use lexical-binding.
* lisp/mh-e/mh-xface.el: Use lexical-binding.
Juri Linkov [Mon, 22 Mar 2021 18:55:49 +0000 (20:55 +0200)]
* lisp/tab-bar.el (tab-bar-new-tab-group): Set default to t.
(tab-bar-tabs, tab-bar-select-tab, tab-bar-new-tab-to):
Use tab-bar--current-tab-make instead of tab-bar--current-tab.
(tab-bar--tab): Add arg 'frame' to tab-bar--current-tab-find.
(tab-bar--current-tab, tab-bar--current-tab-make): Move most of body
from the former to the latter, thus reverting tab-bar--current-tab
to its previous behavior.
https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00959.html
Alan Mackenzie [Sun, 21 Mar 2021 16:54:31 +0000 (16:54 +0000)]
Prevent open minibuffers getting lost when their frame gets deleted
This happened with minibuffer-follows-selected-frame set to t.
* doc/emacs/mini.texi (Basic Minibuffer): State where a command's action takes
place when a minibuffer's frame has been deleted.
* lisp/window.el (window--before-delete-windows, record-window-buffer): Take
into account that minibuffers are now recorded on w->prev_buffers field.
* src/fns.c (merge_c): New version of `merge' taking a C function, rather than
a Lisp function as the comparison function.
* src/frame.c (do_switch_frame): Pass arguments sf and for_deletion to
move_minibuffers_onnto_frame.
* src/lisp.h (top level): Declare merge_c and
move_minibuffers_onto_selected_frame.
* src/minibuf.c (MB_frame): New Lisp_Object recording the minibuffer's frame.
(choose_minibuf_frame): Remove all code except that which sets minibuf_window
to the current frame's minibuffer.
(minibuffer_ent_greater): New comparison function, passed to merge_c.
(zip_minibuffer_stacks): New function.
(move_minibuffers_onto_frame): Renamed from `move_minibuffer_onto_frame' given
two arguments, the old frame and for_deletion, and simplified. Minibuffers
are now stacked in the mini-window's ->prev_buffers field.
(read_minibuf): Several detailed amendments.
(exp_MB_frame): New Lisp_Object, the expired minibuffer's frame.
(read_minibuf_unwind): Search for the expired minibuffer's frame, rather than
taking it from (unreliable) variables. Switch temporarily to this frame for
tidying up operations.
(minibuffer_unwind): New function which pops a stacked minibuffer.
(syms_of_minibuf): Call staticpro for the two new Lisp variables.
* src/window.c (Fset_window_configuration): Don't record minibuffers with
record-window-buffer.
* src/xdisp.c (gui_consider_frame_title): Remove redundant Fselect_window,
which caused an unwanted frame switch. Amend the arguments to
format_mode_line_unwind_data to match.
* lisp/progmodes/project.el (project-shell): Behave the same way as
'M-x project-eshell'.
* lisp/shell.el (shell): Behave the same way as 'M-x eshell'.
* etc/NEWS: Add news entry describing the change.
* lisp/tutorial.el: Use lexical-binding.
Stefan Kangas [Sat, 20 Mar 2021 08:58:02 +0000 (09:58 +0100)]
Remove Gnus specific .dir-locals.el
* lisp/gnus/.dir-locals.el: Delete file. The only variable it set was
'show-trailing-whitespace', but this should be up to the individual
developer. (Bug#47278)
Stefan Kangas [Sat, 20 Mar 2021 00:16:26 +0000 (01:16 +0100)]
Assume something more recent than X11R6
* lisp/bindings.el:
* lisp/menu-bar.el:
* lisp/printing.el:
* lisp/thumbs.el (thumbs-conversion-program): Assume we have something
more recent than X11R6.
Stefan Monnier [Fri, 19 Mar 2021 23:04:27 +0000 (19:04 -0400)]
* lisp/wdired.el: Use lexical-binding
Remove redundant `:group` args.
(wdired-change-to-wdired-mode): Use `add-function` to modify
`revert-buffer-function`.
(wdired-change-to-dired-mode): Adjust accordingly.
(wdired-do-renames): Make sure to bind `dired-backup-overwrite` dynamically.
Stefan Monnier [Fri, 19 Mar 2021 22:33:38 +0000 (18:33 -0400)]
* lisp/emacs-lisp/bytecomp.el: Remember location of unresolved calls
I've gotten tired of seeing the "function foo not known to be defined"
warning without any line number information. So this patch adds as
line number the position of the first use of that function in the file
(well, approximately, as usual).
(byte-compile-unresolved-functions): Add POSITIONs in the alist.
(byte-compile-function-warn): Store the current position in
`byte-compile-unresolved-functions`.
(byte-compile-arglist-warn): Adjust accordingly.
(byte-compile-print-syms): Delete unused function.
(byte-compile-warn-about-unresolved-functions): Use the stored position
to give more precise warnings.
Eli Zaretskii [Fri, 19 Mar 2021 12:46:15 +0000 (14:46 +0200)]
Improve the docs of a recent change in mb-depth.el
* lisp/mb-depth.el (minibuffer-depth-indicator-function): Improve
the wording of the doc string and of the label used for the
default value. (Bug#47252)
Stefan Monnier [Fri, 19 Mar 2021 03:14:33 +0000 (23:14 -0400)]
lisp/erc: Use lexical-binding
Also remove various redundant `:group` arguments.
* lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare`
after the docstring.
* lisp/erc/erc-capab.el: Use lexical-binding.
(erc-capab-identify-activate): Simplify with `member`.
* lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition,
which refers to it.
(erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`.
* lisp/erc/erc-imenu.el: Use lexical-binding.
(erc-create-imenu-index): Remove unused var `prev-pos`.
* lisp/erc/erc-match.el: Use lexical-binding.
(erc-match-message): Remove unused var `old-pt`.
(erc-match-message): Strength-reduce `eval` to `symbol-value`.
* lisp/erc/erc-page.el: Use lexical-binding.
(erc-page): Move Custom group before `erg-page-mode` which refers to it.
* lisp/erc/erc-replace.el: Use lexical-binding.
(erc-replace-insert): Use `functionp`.
* lisp/erc/erc-status-sidebar.el: Use lexical-binding.
(erc-status-sidebar-open): Remove unused var `sidebar-window`.
* lisp/erc/erc.el: Fix header to use the customary 3 semi-colons.
(erc-fill-column): Declare variable.
* lisp/erc/erc-autoaway.el: Use lexical-binding.
* lisp/erc/erc-ezbounce.el: Use lexical-binding.
* lisp/erc/erc-fill.el: Use lexical-binding.
* lisp/erc/erc-goodies.el: Use lexical-binding.
* lisp/erc/erc-ibuffer.el: Use lexical-binding.
* lisp/erc/erc-identd.el: Use lexical-binding.
* lisp/erc/erc-join.el: Use lexical-binding.
* lisp/erc/erc-lang.el: Use lexical-binding.
* lisp/erc/erc-log.el: Use lexical-binding.
* lisp/erc/erc-menu.el: Use lexical-binding.
* lisp/erc/erc-netsplit.el: Use lexical-binding.
* lisp/erc/erc-networks.el: Use lexical-binding.
* lisp/erc/erc-pcomplete.el: Use lexical-binding.
* lisp/erc/erc-ring.el: Use lexical-binding.
* lisp/erc/erc-speedbar.el: Use lexical-binding.
* lisp/erc/erc-spelling.el: Use lexical-binding.
* lisp/erc/erc-truncate.el: Use lexical-binding.
* lisp/erc/erc-xdcc.el: Use lexical-binding.
Include tab bar in frame's inner height in non-GUI builds that don't
define tab-bar-height. This is consistent with the inclusion of the
menu bar in the calculated height. It is also consistent with TTY
frames of GUI builds, for which tab-bar-height is always zero
anyway (bug#47234). Fix suggested by Eli Zaretskii <eliz@gnu.org>.
* lisp/frame.el (frame-inner-height): Don't assume tab-bar-height is
defined in builds --without-x.