Andrea Corallo [Wed, 31 Mar 2021 12:49:36 +0000 (14:49 +0200)]
Do not defer compilation when bytecode is explicitly requested (bug#46617)
* src/comp.c (maybe_defer_native_compilation): Check if the file
is registered in 'V_comp_no_native_file_h'.
(syms_of_comp): 'V_comp_no_native_file_h' new global.
* src/lread.c (maybe_swap_for_eln): Register files in
'V_comp_no_native_file_h'.
* lisp/faces.el (tty-run-terminal-initialization): Do not
explicitly load .elc file to not exclude .eln being loaded in
place.
Stefan Kangas [Tue, 30 Mar 2021 16:56:02 +0000 (18:56 +0200)]
Use lexical-binding in echistory.el
* lisp/echistory.el: Use lexical-binding.
(electric-history-map): Quote function symbols as such.
(Electric-history-undefined): Use command substitutions.
Dmitry Gutov [Tue, 30 Mar 2021 00:42:11 +0000 (03:42 +0300)]
Provide information to show icons with Elisp completions
* lisp/progmodes/elisp-mode.el (elisp--company-kind): New function.
(elisp-completion-at-point): Use it. And a couple of anonymous
:company-kind functions too.
Stefan Monnier [Mon, 29 Mar 2021 22:35:01 +0000 (18:35 -0400)]
lisp/progmodes/verilog-mode.el: Prepare for lexical-binding.
* lisp/progmodes/verilog-mode.el: Activate lexical-binding.
Insert newlines to avoid some situations where arguments were easy
to misunderstand.
(verilog-set-compile-command): Strength-reduce `eval` to `symbol-value`.
(verilog-error-regexp-add-emacs): Replace `mapcar` => `mapc` since
the result is not used.
(verilog-surelint-off): Remove always-nil var `dir`.
(verilog-do-indent): Minor simplification of the code.
(verilog-pred): Delete var. It was always nil.
(verilog-flag): Delete var; pass the corresponding data via
explicit arguments instead.
(verilog-keyword-completion): Use `dolist`.
(verilog-completion-response): Rename to `verilog--complete-with-action`.
Change calling convention to match that of `complete-with-action`.
Use `complete-with-action` instead when available.
Adjust all callers.
(verilog-completion, verilog-comp-defun): Change arg names so they
don't collide with dynamically scoped vars, and let-bind `verilog-str`
explicitly instead. Use `with-current-buffer`.
(verilog-batch-execute-func): Use `with-current-buffer`.
(verilog-complete-word): Don't convert the completion list into
a completion alist, since lists work just as well.
(verilog-showscopes): Use `with-current-buffer`.
(verilog-symbol-detick, verilog-symbol-detick-text)
(verilog-signals-matching-enum): Strength-reduce `eval` to `symbol-value`.
(verilog--insert-indent): Rename from `verilog--insert-indent`.
Add `indent-pt` argument.
(verilog-insert-indent): New macro wrapper to provide the old
calling convention.
(verilog-auto-assign-modport, verilog-auto-inout-modport):
Remove always-nil var `direction-re`.
(verilog--auto-inst-first): Rename from `verilog-auto-inst-first`.
Add `indent-pt` argument.
(verilog-auto-inst-port): Adjust call accordingly.
Stefan Monnier [Mon, 29 Mar 2021 20:46:41 +0000 (16:46 -0400)]
* lisp/completion.el: Activate lexical-binding
Remove redundant `:group` arguments.
(list-all-completions-1): Merge into `list-all-completions` and
then delete.
(list-all-completions-by-hash-bucket-1): Use `push`. Merge into
`list-all-completions-by-hash-bucket` and then delete.
(completions-list-return-value): Delete variable, not used any more.
(woman-mode, woman2-roff-buffer): Use `cl-letf`.
(woman-request): Move declaration before first use.
(woman0-macro): Rename arg to not shadow the dynamically scoped var.
(woman-set-arg): Strength-reduce `eval` to `symbol-value`.
Stefan Monnier [Mon, 29 Mar 2021 19:29:26 +0000 (15:29 -0400)]
* lisp/allout*.el: Use lexical-binding
* lisp/allout.el: Activate lexical-binding.
(allout-setup-menubar): Delete "complex no-op" function.
(allout-mode): Delete call to it.
(allout-hotspot-key-handler): Delete XEmacs-only code.
(allout-copy-exposed-to-buffer): Remove always-nil var `start-list`.
* lisp/allout-widgets.el: Activate lexical-binding.
(allout-item-icon-keymap): Use `ignore`.
(allout-widgets-exposure-change-processor): Use `cl-callf` instead of
relying on dynamic binding to apply some code to two different variables.
Alan Mackenzie [Mon, 29 Mar 2021 15:32:40 +0000 (15:32 +0000)]
Fix an infinite loop in C++ Mode redisplay. This was bug #47191.
* lisp/progmodes/cc-defs.el (c-forward-syntactic-ws, c-backward-syntactic-ws):
When point is on the wrong side of a supplied search limit, leave point
unmoved rather than setting it to that limit.
* lisp/progmodes/cc-engine.el (c-forward-name): After scanning a template
argument list (which is not itself subject to a search limit) recalculate the
search limit starting from the end point, since these argument lists can
legitimately be long. At each of the scanning loops, check point hasn't gone
past the limit.
Glenn Morris [Mon, 29 Mar 2021 15:26:25 +0000 (08:26 -0700)]
Merge from origin/emacs-27
bcc4cc3362 Doc fixes for 'face-foreground' and 'face-background'. bf6442fafd ; * admin/make-tarball.txt: Minor addition to the Web page... 38b127d32e * admin/admin.el (set-version): Handle malformed NEWS markup. 0d7e2a993e admin.el fix for bug#47394 fdec444758 ; * etc/NEWS: Fix typo. 1e6ca2765f ; * admin/make-tarball.txt: Another minor addition.
Michael Albinus [Mon, 29 Mar 2021 11:52:01 +0000 (13:52 +0200)]
Some Tramp doc clarifications
* doc/misc/tramp.texi (Remote shell setup): Explain meaning of
`tramp-sh-extra-args' for bash.
(Frequently Asked Questions): New item about unloading / reloading Tramp.
Eli Zaretskii [Sun, 28 Mar 2021 12:29:41 +0000 (15:29 +0300)]
Avoid errors in pulse.el for some face customizations
* lisp/cedet/pulse.el (pulse-momentary-highlight-overlay): Make
sure 'face-background' always returns a color name. Suggested by
Ingo Lohmar <ingo.lohmar@posteo.net> in bug#47437.
Stefan Monnier [Sat, 27 Mar 2021 14:54:10 +0000 (10:54 -0400)]
* lisp/wdired.el: Fix minor regressions and simplify a bit
Use `wdired--current-column` more consistently to avoid mayhem when it
doesn't return the same result as `current-column`.
(wdired-get-filename): Fix the unprocessed case.
(wdired-finish-edit): Don't force processing all the lines.
(wdired--col-perm): Remove, redundant with `wdired--perm-beg`.
(wdired-change-to-wdired-mode): Don't error in empty directory.
(wdired--set-permission-bounds): Set `wdired--perm-beg` when we can't
find permissions. Move `wdired--perm-beg` 1 char further (like
`wdired--col-perm`). Use `wdired--current-column`.
(wdired--point-at-perms-p): Fix when `wdired--perm-beg` is nil.
(wdired--self-insert): Lookup the keymap to know command to call.
(wdired--before-change-fn): Just use `point` instead of `beg`.
Use `with-silent-modifications` here rather than in each of the
`wdired--preprocess-*` functions.
(wdired--preprocess-files): Presume we're at BOL and within
`with-silent-modifications`. Fix application of `read-only`.
(wdired-abort-changes): Don't use `with-silent-modifications` since
we're really modifying the buffer.
(wdired--preprocess-symlinks): Presume we're at BOL and within
`with-silent-modifications`.
(wdired--preprocess-perms): Presume we're at BOL and within
`with-silent-modifications`.
(wdired-set-bit): Add `char` argument. Use `wdired--current-column`.
Copy previous text properties rather than duplicating the code of
`wdired--preprocess-perms`.
(wdired-toggle-bit): Delegate to `wdired-set-bit`.
Arthur Miller [Sat, 27 Mar 2021 07:29:44 +0000 (08:29 +0100)]
* lisp/wdired.el: Apply text properties lazily
Entering wdired was taking time proportional to the size of the directory,
making it inconvenient to quickly enter wdired just to rename one or two
files in a large directory.
(wdired-mode-map): Rebind `self-insert-command`.
(wdired--perm-beg, wdired--perm-end): New vars.
(wdired--col-perm, wdired--old-content, wdired--old-point)
(wdired--old-marks): Rename vars, using "--" rather than "-".
All users updated.
(wdired--before-change-fn): New function.
(wdired-change-to-wdired-mode): Use it `before-change-functions`
instead of eagerly putting the various text properties here.
(wdired--set-permission-bounds, wdired--current-column)
(wdired--point-at-perms-p, wdired--line-preprocessed-p):
New auxiliary functions.
(wdired--self-insert): New command.
(wdired--preprocess-files, wdired--preprocess-symlinks)
(wdired--preprocess-perms): Add "--" to the name. Make it operate only
on the current line. Use `with-silent-modifications`.
(wdired-abort-changes): Use `with-silent-modifications`.
Michael Albinus [Sat, 27 Mar 2021 10:43:15 +0000 (11:43 +0100)]
Keep *.log files on emba
* test/infra/gitlab-ci.yml (.test-template): New template.
(test-fast-inotify, test-lisp-inotify, test-lisp-net-inotify)
(test-filenotify-gio, test-gnustep, test-all-inotify): Use it.
Eli Zaretskii [Sat, 27 Mar 2021 10:24:58 +0000 (13:24 +0300)]
Fix lisp/files-tests on MS-Windows
* test/lisp/files-tests.el (files-colon-path)
(files-tests-bug-21454): Adapt to MS-DOS/Windows, where
parse-colon-path needs and absolute file name with a drive letter.
(files-tests-file-name-non-special-get-file-buffer): Forcefully
delete the file's buffer if it happens to exist.
Matt Armstrong [Fri, 19 Feb 2021 23:39:15 +0000 (15:39 -0800)]
File unlock errors now issue warnings (Bug#46397)
The primary idea is to allow `kill-buffer' and `kill-emacs' to
complete even if Emacs has trouble unlocking the buffer's file.
* lisp/userlock.el (userlock--handle-unlock-error): New function, call
`display-error'.
* src/filelock.c (unlock_file_body): New function, do what
'unlock_file' used to.
(unlock_file_handle_error): New function, call
`userlock--handle-unlock-error' with the captured error.
(unlock_file): Handle `file-error' conditions by calling the handler
defined above.
* test/src/filelock-tests.el (filelock-tests-kill-buffer-spoiled):
(filelock-tests-unlock-spoiled): Modify to test new behavior.
Michael Albinus [Fri, 26 Mar 2021 18:30:05 +0000 (19:30 +0100)]
Improve remote file notifications
* lisp/net/tramp-sh.el (tramp-get-remote-gio-file-monitor): Remove it.
(tramp-sh-handle-file-notify-add-watch): Do not call it.
(tramp-sh-gio-monitor-process-filter): Read monitor name.
* test/lisp/filenotify-tests.el (file-notify--test-read-event)
(file-notify--test-timeout): Change timings.
(file-notify--test-monitor): Read remote monitor name more reliably.
(file-notify-test02-rm-watch): Retrieve remote monitor name in time.
(file-notify--test-event-actions): New defun.
(file-notify--test-with-actions-explainer): Use it.
(file-notify--test-with-actions-check): Use it. Dump traces in
case of debug.
(file-notify--test-with-actions): Don't stop while debugging.
(file-notify-test03-events, file-notify-test04-autorevert)
(file-notify-test05-file-validity)
(file-notify-test07-many-events, file-notify-test08-backup)
(file-notify-test09-watched-file-in-watched-dir): Adapt tests.
Address some --without-x byte-compilation warnings
These came to light in the contexts of bug#29713 and bug#47234.
* lisp/emulation/edt-mapper.el (edt-xserver):
* lisp/emulation/edt.el (edt-xserver):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/nnimap.el (nnimap-map-port):
* lisp/term/w32-win.el:
* lisp/image.el (image--get-imagemagick-and-warn):
* lisp/frame.el (frame-notice-user-settings): Declare functions that
are known to be present at runtime in GUI builds.
(make-frame-on-display): Signal more informative error when called
interactively in a non-GUI build (bug#29713).
* lisp/international/mule-diag.el (describe-font):
* lisp/org/org-macs.el (org--string-from-props): Pacify warnings
about unknown functions in non-GUI bilds.
* lisp/mh-e/mh-mime.el (mh-small-image-p): Avoid eliminating fboundp
check in non-GUI builds, to pacify unused lexical variable warning.
* lisp/net/newst-plainview.el (newsticker--plainview-tool-bar-map):
* lisp/net/newst-treeview.el (newsticker-treeview-tool-bar-map):
Declare tool-bar-map as a special variable in non-GUI builds.
Stefan Monnier [Fri, 26 Mar 2021 15:45:31 +0000 (11:45 -0400)]
* lisp/obsolete/tpu-extras.el: Avoid defadvice
(tpu--respect-bottom-scroll-margin): New function, extracted from
`newline`s defadvice.
(newline, newline-and-indent, do-auto-fill): Delete defadvice.
(tpu-set-scroll-margins): Use advice-add instead of
`ad-enable-advice`+`ad-activate`.
Use an explicit arg instead of `called-interactively-p`.
Spencer Baugh [Wed, 24 Mar 2021 03:11:51 +0000 (23:11 -0400)]
Add a test for let-binding unwinding
Bindings in other buffers are not un-set when we unwind a let-binding
which set the default value. There doesn't seem to be an existing
test which covers this, so here's one.
* test/src/data-tests.el (data-tests--let-buffer-local-no-unwind-other-buffers):
Add test for let-binding unwinding behavior
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.