1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00
Commit graph

144739 commits

Author SHA1 Message Date
Stefan Monnier
29c7f8c915 * lisp/emacs-lisp/cl-macs.el: Optimize self-calls in tail position
Implement a limited form of tail-call optimization for the special
case of recursive functions defined with `cl-labels`.  Only self-recursion
is optimized, no attempt is made to handle more complex cases such a mutual
recursion.

The main benefit is to reduce the use of the stack, tho in my limited
tests, this can also improve performance (about half of the way to
a hand-written `while` loop).

(cl--self-tco): New function.
(cl-labels): Use it.

* lisp/subr.el (letrec): Optimize single-binding corner case.

* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): Add tests
to check that TCO is working.
2021-01-08 19:59:31 -05:00
Dmitry Gutov
6e73e07a6f Make sure default-directory relates to the originating buffer
* lisp/progmodes/xref.el (xref--show-xref-buffer):
Pick up default-directory value from the caller
(https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00551.html).
(xref-show-definitions-buffer-at-bottom): Same.
2021-01-09 02:10:06 +02:00
Stefan Monnier
3b9dad88e0 * lisp/subr.el (letrec): Optimize some non-recursive bindings
* lisp/emacs-lisp/macroexp.el (macroexp--fgrep): Look inside bytecode
objects as well.

* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels):
* test/lisp/subr-tests.el (subr--tests-letrec): New tests.
2021-01-08 18:44:13 -05:00
Stefan Monnier
9d3d6f8500 * lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Fix last change 2021-01-08 18:28:47 -05:00
Stefan Monnier
768a352793 * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): Rename from pcase--fgrep
* lisp/emacs-lisp/cl-generic.el (cl--generic-fgrep): Delete.
(cl--generic-lambda): Use `macroexp--pacse` instead.

* lisp/emacs-lisp/pcase.el (pcase--fgrep): Rename to `macroexp--fgrep`.
2021-01-08 17:57:26 -05:00
Stefan Kangas
a31bfd5945 Merge recently added kbd tests
* test/lisp/subr-tests.el (subr--kbd): Merge test...
(subr-test-kbd): ...with this one.  Fix thinko in my previous commit.
Thanks to Mattias Engdegård <mattiase@acm.org>.
2021-01-08 15:26:11 +01:00
Stefan Kangas
5ac7b48075 Lift define-prefix-command to Lisp
* lisp/subr.el (define-prefix-command): New defun.
* src/keymap.c (Fdefine_prefix_command): Remove DEFUN.
(syms_of_keymap): Remove defsubr for Fdefine_prefix_command.
* test/lisp/subr-tests.el (subr-test-define-prefix-command): New
test.
2021-01-08 15:16:02 +01:00
Stefan Kangas
f5cfe5a0a9 * test/lisp/subr-tests.el (subr-test-kbd): New test. 2021-01-08 14:00:42 +01:00
Stefan Kangas
705292c200 Remove unused DEFSYM
* src/minibuf.c (syms_of_minibuf) <Qhistory_length>: Remove unused
DEFSYM.
2021-01-08 14:00:42 +01:00
Eli Zaretskii
62e0c67590 Fix syntax of space characters
* lisp/international/characters.el (tbl): Give all the space
characters whose Unicode General Category is Zs the 'space'
syntax.  (Bug#45660)
2021-01-08 13:53:28 +02:00
Michael Albinus
656801f5bb * test/lisp/net/tramp-tests.el (tramp-test31-interrupt-process):
Tag it :unstable on hydra.
2021-01-08 09:58:31 +01:00
Juri Linkov
cd56406b62 * lisp/tab-bar.el: Improve tab-bar-show (bug#45556)
* lisp/tab-bar.el (tab-bar-show): Change :set lambda to update all frames.
Improve docstring.
2021-01-07 20:08:44 +02:00
Juri Linkov
c0ca935917 * lisp/mb-depth.el (minibuffer-depth-indicator): Add :group 'minibuffer'. 2021-01-07 19:56:59 +02:00
Stefan Kangas
c8448f6185 Remove an outdated comment
* lisp/subr.el: Remove comment to reflect recent change in the
definition of global-map, esc-map and ctl-x-map.
2021-01-07 18:51:50 +01:00
Lars Ingebrigtsen
3dc3874c76 Further display-buffer doc changes
* lisp/window.el (display-buffer): `display-buffer-alist' is
apparently the variable the user should be directed towards.
2021-01-07 16:47:30 +01:00
Michael Albinus
3e99ff97e5 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2021-01-07 16:43:45 +01:00
Michael Albinus
f5b8e5a757 * test/lisp/filenotify-tests.el (file-notify-test07-many-events-remote):
Mark it as unstable also on emba.
2021-01-07 16:43:27 +01:00
Lars Ingebrigtsen
40a0f8a3a2 Add a display-buffer window selection function that's more like XEmacs
* doc/lispref/windows.texi (Buffer Display Action Functions):
Document it.
* lisp/window.el (display-buffer--action-function-custom-type): Add.
(display-buffer): Mention it.
(display-buffer-use-least-recent-window): New function (bug#45688).

* src/window.c (Fwindow_bump_use_time): New function.
2021-01-07 16:35:48 +01:00
Lars Ingebrigtsen
0e6b74d204 Fix typo in last display-buffer doc string change
* lisp/window.el (display-buffer): Fix typo in last doc string change.
2021-01-07 16:00:58 +01:00
Lars Ingebrigtsen
fa1f41159f Edit the display-buffer doc string slightly
* lisp/window.el (display-buffer): Reword the start of the doc
string (bug#45688).
2021-01-07 15:45:05 +01:00
Lars Ingebrigtsen
23a887e426 Add work-around for nnmaildir encoding problem
* lisp/gnus/mm-decode.el (mm-with-part): Fix problem with
multipart 8bit encoded posts from nnmaildir (bug#44307).
2021-01-07 15:12:23 +01:00
Lars Ingebrigtsen
7e80aecc24 Add tests for mm-decode.el 2021-01-07 14:32:28 +01:00
F. Jason Park
a7fdba7889 Clear socks protocol scratch after authentication
* lisp/net/socks.el (socks-open-connection): Fix incomplete patch
titled "Append incremental message segments in socks-filter," which
addressed chunk ordering but neglected to zero out the work area
following successful username/password authentication (bug#45162).
2021-01-07 13:43:13 +01:00
Andreas Schwab
e15386da5d Fix quoting problem in pop3-uidl-save
* lisp/net/pop3.el (pop3-uidl-save): Quote strings properly
(bug#43896).
2021-01-07 13:20:43 +01:00
Lars Ingebrigtsen
2f6e30cd86 Revert mark-paragraph change and add tests
* lisp/textmodes/paragraphs.el (mark-paragraph): Revert
eb090f65ce (bug#45318).  This restores
the behaviour from Emacs 27 -- further work is needed on this patch.
2021-01-07 13:08:52 +01:00
Michael Albinus
9db1c0993a * test/Makefile.in (WRITE_LOG): Mark also problematic tests for emba. 2021-01-07 10:14:37 +01:00
Glenn Morris
9b31802e2d Update a substitute-command-keys test
* test/lisp/help-tests.el (help-tests-substitute-command-keys/keymaps):
Update for "Pretty-print keys without <> around modifiers" change.
2021-01-06 17:19:17 -08:00
Daniel Martín
331e40a8fd Fix some failing tests in BSD systems
* test/lisp/progmodes/xref-tests.el
(xref--xref-file-name-display-is-abs)
(xref--xref-file-name-display-is-relative-to-project-root):
Accommodate some older versions of BSD find
(https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00156.html).
2021-01-06 23:07:22 +02:00
Dmitry Gutov
665b4e7c4e Proof some searches and file listings against symlinks
* lisp/progmodes/project.el (project--files-in-directory):
Make sure the directory includes the trailing slash in case it's
a symlink, discussed in
https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00345.html.

* lisp/progmodes/xref.el (xref-matches-in-directory): Same.

* lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search):
Same.
2021-01-06 23:07:22 +02:00
Gabriel do Nascimento Ribeiro
7936c8a960 * lisp/mb-depth.el (minibuffer-depth-indicator): New face.
(minibuffer-depth-setup): Use new face and add a single space between
the depth indicator and the minibuffer prompt.
https://lists.gnu.org/archive/html/emacs-devel/2020-12/msg00230.html

Copyright-paperwork-exempt: yes
2021-01-06 20:27:26 +02:00
Michael Heerdegen
96bbbaec5c Fix obsolete variable warnings about class names
* lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload): Try to make
the wording of the warning about the obsoleted variable less confusing.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-variable): Don't
warn for lexical variables (Bug#39169).  Fix spurious `or'.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp/warn-obsolete-variable-bound\.el): New test.
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el:
New file.
2021-01-06 10:51:28 +01:00
Stefan Monnier
ba011e487d * lisp/play/dunnet.el: Run the game when loaded via --batch -l dunnet
(dun--batch): Rename from `dun-batch` and don't autoload.
(dunnet): Delegate to `dun--batch` when in batch mode.
2021-01-05 21:29:41 -05:00
Stefan Monnier
cf672c6671 * lisp/emacs-lisp/package.el (package-activate-all): Another tweak
`package-quickstart.el` files presume `package-activated-list`
is a bound variable, so make sure this is the case even when `package.el` is
not yet loaded.
2021-01-05 21:26:03 -05:00
Stefan Monnier
7d7bfbf034 * lisp/emacs-lisp/autoload.el: Improve last change
It turns out there were other places that used `custom-initialize-delay`
on autoloaded variables and used various hacks to make it work with
`autoload.el`.  The new code makes those hacks unneeded.
Also, there's no point trying to "optimize" those rare cases anyway,
so I simplified the `autoload.el` code for those cases.

(make-autoload): For non-trivial cases,
just include the whole `defcustom` instead of trying to mimic it.

* lisp/mail/rmail.el (rmail-spool-directory): Remove hacks.
* lisp/info.el (Info-default-directory-list): Remove `progn` hack.

* lisp/custom.el (custom-declare-variable)
(custom-handle-all-keywords): Don't use pseudo-group `nil`.
2021-01-05 17:57:15 -05:00
Alan Third
048b1aaec8 Prevent stack overflow in GNUstep menu code
* src/nsmenu.m (ns_update_menubar): Always do a deep update for
GNUstep.
([EmacsMenu menuNeedsUpdate:]): Don't update the menu as it should
always have had a deep update.
2021-01-05 21:43:12 +00:00
Juri Linkov
3b835f7b81 * lisp/subr.el (remove-hook): Add default value (bug#45393) 2021-01-05 20:59:51 +02:00
Juri Linkov
7469214d94 * lisp/tab-bar.el (tab-bar-tab-name-format-function): New defcustom.
(tab-bar-tab-name-format-default): New function as the default value.
(tab-bar-make-keymap-1): Funcall tab-bar-tab-name-format-function.
2021-01-05 20:55:29 +02:00
Juri Linkov
e72fd12ec6 * lisp/tab-bar.el (toggle-frame-tab-bar): New command (bug#45556) 2021-01-05 20:43:22 +02:00
James N. V. Cash
c1daeb4c28 Refactor tab-bar-mode to -define-keys and -load-buttons (bug#42052)
* lisp/tab-bar.el (tab-bar--define-keys, tab-bar--load-buttons):
Move some code here from 'tab-bar-mode'.
(tab-bar-new-tab-to): Call tab-bar--load-buttons and tab-bar--define-keys.

Copyright-paperwork-exempt: yes
2021-01-05 20:35:35 +02:00
Eli Zaretskii
02e6ffe860 Fix process-tests on MS-Windows
It was again broken by recent changes.
* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-serial-process): Skip test
on MS-Windows.
2021-01-05 20:26:38 +02:00
Stefan Monnier
9973019764 * lisp/emacs-lisp/package.el: Load package-quickstart without package.el
Speed up startup when `package-quickstart` is in use by making it possible
to load the quickstart file without having to load `package.el` at all.

(package-user-dir, package-directory-list, package-quickstart-file):
Preload those variables.
(package--get-activatable-pkg): New fun, extracted from `package-activate`.
(package-activate): Use it.
(package--activate-all): New function, extracted from
`package-activate-all`.
(package-activate-all): Use it and make the function preloaded.
(package--archives-initialize): New function.
(package-install): Use it.
(list-packages): Avoid `switch-to-buffer`.
(package-get-descriptor): New function.

* lisp/startup.el (command-line): Simplify the code now that
package-user-dir and package-directory-list are preloaded.

* lisp/emacs-lisp/autoload.el (make-autoload): Add support for
`:initialize #'custom-initialize-delay` in `defcustom`.
2021-01-05 12:28:37 -05:00
Mattias Engdegård
1433a12014 ruby-mode: eliminate redundant regexp branch
* lisp/progmodes/ruby-mode.el (ruby-add-log-current-method):
Since ruby-operator-re matches dot, don't include both in regexp.
This pacifies relint.
2021-01-05 12:01:32 +01:00
Mattias Engdegård
77796eb014 ; * lisp/subr.el (ctl-x-map): Fix typo in kill-buffer binding. 2021-01-05 11:28:58 +01:00
Mattias Engdegård
7f16f17727 Pretty-print keys without <> around modifiers (bug#45536)
Be consistent when pretty-printing keys: put modifiers outside <>,
thus the more logical C-M-<return> instead of <C-M-return>.

* src/keymap.c (Fsingle_key_description):
Skip modifier prefix before adding <>.
* doc/lispref/help.texi (Describing Characters): Update example.
* doc/lispref/debugging.texi (Backtraces):
* doc/lispref/minibuf.texi (Text from Minibuffer):
Use @kbd instead of @key.
* etc/NEWS: Announce the change.
* test/src/keymap-tests.el (keymap--key-description):
* test/lisp/subr-tests.el (subr--kbd): New tests.
2021-01-05 11:28:58 +01:00
Mattias Engdegård
e6617f0dff * lisp/filesets.el (filesets-external-viewers): Tighten regexp. 2021-01-05 11:28:58 +01:00
Harald Jörg
06810abc59 perl-mode: Display here-docs as strings instead of comments
* lisp/progmodes/perl-mode.el
(perl-syntax-propertize-function): Handle HERE doc starter
lines ending in a comment.
(perl-heredoc): New face for HERE docs, inheriting from
font-lock-string-face.
(perl-font-lock-syntactic-face-function): Apply the new face
to HERE docs (Bug#23461).

* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test--run-bug-10483): Skip for Perl mode.  The test
explicitly calls a function of CPerl mode.
2021-01-05 10:15:04 +01:00
Stefan Monnier
8ef4314c44 * lisp/subr.el (esc-map): Initialize inside declaration
* src/commands.h (meta_map):
* src/keymap.c (meta_map): Delete variable.
(syms_of_keymap): Don't initialize esc-map here.
(initial_define_key):
* src/keymap.h (initial_define_key): Delete function.

* src/keyboard.c (keys_of_keyboard): Don't initialize esc-map here.

* src/window.h (keys_of_window):
* src/window.c (keys_of_window): Delete function.
* src/lisp.h (keys_of_casefiddle):
* src/casefiddle.c (keys_of_casefiddle): Delete function.
* src/emacs.c (main): Don't call them.
2021-01-04 23:43:40 -05:00
Stefan Monnier
5bddc09738 * lisp/subr.el (ctl-x-map): Initialize inside the declaration.
* src/command.h (control_x_map):
* src/keymap.c (control_x_map): Delete variable.
(syms_of_keymap):
* src/keyboard.c (keys_of_keyboard):
* src/casefiddle.c (keys_of_casefiddle):
* src/window.c (keys_of_window): Move initialization of ctl-x-map to
subr.el.

* src/lisp.h (syms_of_buffer):
* src/buffer.c (keys_of_buffer): Delete function.
* src/emacs.c (main): Don't call it.
2021-01-04 23:41:31 -05:00
Stefan Monnier
d6f30e5632 * lisp/subr.el (global-map): Initialize inside declaration.
* src/commands.h (global_map):
* src/keymap.c (global_map): Delete variable.
(syms_of_keymap): Don't initialize global_map here.
(keys_of_keymap): Delete function.
* src/lisp.h (keys_of_cmds):
* src/cmds.c (keys_of_cmds): Delete function.
* src/emacs.c (main): Don't call them.

* src/window.c (keys_of_window): Don't initialize global_map here.
* src/keyboard.c (keys_of_keyboard): Don't initialize global_map here.
2021-01-04 23:41:19 -05:00
Stefan Monnier
898a94a9be Use lexical-binding in the remaining preloaded files
* lisp/widget.el:
* lisp/w32-fns.el:
* lisp/textmodes/fill.el:
* lisp/term/common-win.el:
* lisp/scroll-bar.el:
* lisp/rfn-eshadow.el:
* lisp/menu-bar.el:
* lisp/language/tibetan.el:
* lisp/language/thai.el:
* lisp/language/misc-lang.el:
* lisp/language/lao.el:
* lisp/language/korean.el:
* lisp/language/japanese.el:
* lisp/language/indian.el:
* lisp/language/hebrew.el:
* lisp/language/european.el:
* lisp/language/ethiopic.el:
* lisp/language/english.el:
* lisp/language/cyrillic.el:
* lisp/language/chinese.el:
* lisp/jka-cmpr-hook.el:
* lisp/international/ucs-normalize.el:
* lisp/international/mule.el:
* lisp/international/mule-conf.el:
* lisp/international/iso-transl.el:
* lisp/international/fontset.el:
* lisp/international/characters.el:
* lisp/format.el:
* lisp/facemenu.el:
* lisp/electric.el:
* lisp/dos-w32.el:
* lisp/dos-fns.el:
* lisp/disp-table.el:
* lisp/cus-face.el:
* lisp/composite.el:
* lisp/bindings.el:
* admin/unidata/blocks.awk:
* admin/charsets/eucjp-ms.awk:
* admin/charsets/cp51932.awk: Use `lexical-binding`.
2021-01-04 20:57:42 -05:00