1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00
Commit graph

158265 commits

Author SHA1 Message Date
Mattias Engdegård
6f7941272b Speed up seq-subseq for lists (bug#56521)
* lisp/emacs-lisp/seq.el (seq-subseq):
Make faster by using `take` instead of a lisp loop,
and more importantly by not front-loading the error text formatting.
* test/lisp/emacs-lisp/seq-tests.el (seq-tests--list-subseq-ref)
(test-seq-subseq): Test `seq-subseq` for lists more thoroughly.
2022-07-18 12:49:29 +02:00
Mattias Engdegård
5ad8f3e570 Use take where clearly safe to do so (bug#56521)
* lisp/emacs-lisp/seq.el (seq-take):
* lisp/auth-source.el (auth-source-secrets-search)
(auth-source-plstore-search):
* lisp/gnus/message.el (message-insert-formatted-citation-line):
* lisp/net/dbus.el (dbus-unregister-object):
* lisp/replace.el (occur-context-lines):
* test/src/print-tests.el (print-circular): Replace hand-written loop
or `butlast` call with `take` for clarity, performance and validation.
We have the equivalence
(take N LIST) = (butlast LIST (- (length LIST) N)).
2022-07-18 12:49:29 +02:00
Juri Linkov
2d97fe2710 * lisp/minibuffer.el (minibuffer-complete-history): Define sorting by metadata
(minibuffer-complete-history, minibuffer-complete-defaults):
Use completion metadata to disable sorting of the completion table
(bug#56613)
2022-07-18 10:23:41 +03:00
Po Lu
7b259b2eb1 Implement last change on Haiku as well
* lisp/term/haiku-win.el (haiku-dnd-drag-handler): Stop
redisplaying here.
* src/haikuselect.c (haiku_note_drag_motion): Use
redisplay_preserve_echo_area.
2022-07-18 04:49:46 +00:00
Po Lu
5480d02cc5 Preserve echo area message when running DND mouse movement function
* lisp/term/x-win.el (x-dnd-movement): Stop redisplaying here.
* src/xterm.c (x_dnd_begin_drag_and_drop): Redisplay with the
echo area preserved.
2022-07-18 12:42:55 +08:00
Richard Hansen
ab5468e1a0 Derive Info-mode' from special-mode'
* lisp/info.el (Info-mode): Derive `Info-mode' from `special-mode'.
This makes it easier to exclude it from globalized minor modes that
don't apply to special modes (such as `global-whitespace-mode' and
`global-display-fill-column-indicator-mode').
2022-07-17 21:58:54 -04:00
Richard Hansen
ab50678520 info-edit: Delay ibuffer' var change until after ibuffer' loads
* lisp/obsolete/info-edit.el: Delay the addition of `Info-edit-mode'
to the `ibuffer-help-buffer-modes' list until after `ibuffer' is
loaded.  This fixes a "(void-variable ibuffer-help-buffer-modes)"
error when `info-edit' is loaded before `ibuffer'.
2022-07-17 21:43:12 -04:00
Po Lu
356618ca6a Handle virtual modifiers in the DND scrolling code
* lisp/x-dnd.el (x-dnd-modifier-mask): Handle virtual modifiers.
* src/xfns.c (Fx_get_modifier_masks): New function.
(syms_of_xfns): Define new subr.
* src/xterm.c (x_get_keyboard_modifiers): New function.
* src/xterm.h: Update prototypes.
2022-07-18 09:20:05 +08:00
Stefan Monnier
15df17964d * lisp/minibuffer.el (minibuffer-complete-history): Ensure a list of strings 2022-07-17 14:30:43 -04:00
Juri Linkov
ef77070727 * lisp/subr.el (read-char-from-minibuffer, y-or-n-p): Simplify to use HIST=t. 2022-07-17 21:06:31 +03:00
Juri Linkov
60185819b6 * lisp/minibuffer.el (minibuffer-complete-history): Check for history=t.
Signal a user error when the history is not a list (bug#56613).
2022-07-17 21:04:29 +03:00
Mattias Engdegård
d62766305a Add take and ntake (bug#56521)
These are useful list primitives, complementary to `nthcdr`.

* src/fns.c (Ftake, Fntake): New.
(syms_of_fns): Defsubr them.
* doc/lispref/lists.texi (List Elements):
* lisp/emacs-lisp/shortdoc.el (list): Document.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Declare `take` pure and side-effect-free.
* test/src/fns-tests.el (fns-tests--take-ref, fns--take-ntake):
New test.
* etc/NEWS: Announce.
2022-07-17 17:35:49 +02:00
Eli Zaretskii
637436970f Fix leaking of file descriptors due to pipe processes on MS-Windows
* src/w32proc.c (reader_thread): Wait for 'sys_close' to finish
processing the pipe read descriptor, before trying to close it.

* src/w32.c (sys_close): Attempt to detect when the reader thread
already exited, so that it would be possible to close descriptors
open by pipe processes for reading from the pipe.  (Bug#56606)
2022-07-17 15:44:50 +03:00
Po Lu
202c12a24b Improve handling of tilt scroll and flip options during DND
* lisp/x-dnd.el (x-dnd-mwheel-scroll): New function.
(x-dnd-handle-xdnd): Use that instead of abusing mwheel.el.
2022-07-17 20:14:13 +08:00
Stefan Kangas
5c7d1024c4 Prefer defvar-keymap in mpc.el
* lisp/mpc.el (mpc-mode-map, mpc-tagbrowser-dir-mode-map)
(mpc-volume-map, mpc-songs-mode-map): Prefer defvar-keymap.
2022-07-17 12:56:38 +02:00
Lars Ingebrigtsen
2500ab0894 Make `C' in over tramp work in archive mode
* lisp/arc-mode.el (archive-copy-file): Make `C' in over tramp
work (bug#56574).
2022-07-17 12:12:58 +02:00
Eli Zaretskii
0c9ca96c06 ; * src/xdisp.c (redisplay_tool_bar): Fix a possible typo. 2022-07-17 13:12:03 +03:00
Eli Zaretskii
5db4ec20fe Fix tab-bar resizing under 'auto-resize-tab-bars' = 'grow-only'
* src/xdisp.c (redisplay_tab_bar): Compute the desired height of
the tab-bar before iterating over the tab-bar string, to detect
the required resizing earlier.  Default 'change_p' to 'false'.

* lisp/tab-bar.el (tab-bar--update-tab-bar-lines): Support
'auto-resize-tab-bars' set to 'grow-only'.
2022-07-17 12:33:34 +03:00
Visuwesh
407ee71c06 Ensure that directories exist when copying files from archive
* lisp/arc-mode.el (archive-copy-file): If the directory the file is
being extracted to does not exist, then create it (bug#56603).
2022-07-17 11:22:32 +02:00
Lars Ingebrigtsen
e51850297f Improve error messaging when parent archive buffers are missing
* lisp/arc-mode.el (archive-write-file-member):
* lisp/tar-mode.el (tar-subfile-save-buffer): Give a better error
message when the parent buffer is dead (bug#56605).
2022-07-17 11:16:26 +02:00
Stefan Kangas
dbed538391 Merge from origin/emacs-28
f5218385c0 Fix obsoletion of nntp-authinfo-file
10b6919870 ; Fix typos
2022-07-17 06:30:41 +02:00
Po Lu
e2ccd358c9 Handle scrolling during XDND drag-and-drop
* lisp/x-dnd.el (x-dnd-get-object-rectangle): Handle cases where
`posn-x-y' is nil.
(x-dnd-modifier-mask, x-dnd-hscroll-flags, x-dnd-note-click):
New functions.
(x-dnd-click-count): New defvar.
(x-dnd-handle-xdnd): Handle button press events.

* src/xterm.c (x_dnd_send_position): Fix handling of mouse
rects.
2022-07-17 11:06:14 +08:00
Po Lu
211ca9f916 Fix drag-and-drop button button flags
* src/xterm.c (x_dnd_send_position): Always send buttons
regardless of version.  Fix bit indices.
(handle_one_xevent): Likewise.
2022-07-17 09:13:28 +08:00
kobarity
35d0a2e0a7 Fix python navigation problem with an empty line in nested defun
* lisp/progmodes/python.el (python-nav--beginning-of-defun): Fix
bug when point is on an empty line (bug#56600).
2022-07-16 18:26:58 +02:00
Lars Ingebrigtsen
9b5eb661bf Fix xref links in `C-h o'
* lisp/help-fns.el (describe-symbol): Make xref links happen in
all sections (bug#49587).

* lisp/help-fns.el (describe-symbol): Add back/forward links.

* lisp/help-mode.el (help-make-xrefs): Factor out links from
here...
(help-xref--navigation-buttons): To here.
2022-07-16 18:26:58 +02:00
Stefan Kangas
71b58ade86 New test for make_symbol_constant
* test/src/data-tests.el (data-tests-make_symbol_constant): New
test.
2022-07-16 18:23:09 +02:00
Eli Zaretskii
9a5b52dace * src/composite.c (find_automatic_composition): Fix off-by-one error. 2022-07-16 16:29:24 +03:00
Po Lu
16e16e1f8c Improve documentation of `posn-timestamp'
* doc/lispref/commands.texi (Accessing Mouse): Improve
documentation of `posn-timestamp' by actually describing the
timestamp it returns.
2022-07-16 21:03:06 +08:00
Mattias Engdegård
ea9b442b82 Update eshell-variable-aliases-list defcustom type
* lisp/eshell/esh-var.el (eshell-variable-aliases-list):
Add type for SIMPLE-FUNCTION value.
2022-07-16 14:05:44 +02:00
Michael Albinus
a281abb0c3 Comment docstrings in tramp-test macros
* test/lisp/net/tramp-tests.el (tramp--test-deftest-with-stat)
(tramp--test-deftest-with-perl, tramp--test-deftest-with-ls)
(tramp--test-deftest-direct-async-process): Comment docstring,
it doesn't work this way.  Use `tramp-test-vec' if appropriate.
2022-07-16 14:05:06 +02:00
Lars Ingebrigtsen
630bbe3932 Weed out some false positives in help-fns--mention-first-release
* lisp/help-fns.el (help-fns--mention-first-release): Weed out
things that give too many false positives (bug#49062).
2022-07-16 13:52:46 +02:00
Manuel Giraud
38f9e9cb2c Colored menu highlight in Lucid backend
* lwlib/xlwmenuP.h:
* lwlib/xlwmenu.h:
* lwlib/xlwmenu.c: Introduce resources to handle colored highlighting
of menu entries.
* doc/emacs/xresources.texi (Lucid Resources): Documentation.
2022-07-16 18:59:09 +08:00
Po Lu
af61bc7d0c Decrease network traffic with some XDND programs
* lisp/x-dnd.el (x-dnd-get-drop-width-height):
(x-dnd-get-drop-x-y): Remove functions.

(x-dnd-get-window-rectangle, x-dnd-intersect-rectangles)
(x-dnd-get-object-rectangle, x-dnd-get-drop-rectangle): New
functions.
(x-dnd-handle-xdnd): Generate mouse rectangles consisting of the
object (glyph) under point.
2022-07-16 18:56:30 +08:00
Lars Ingebrigtsen
49e41991b2 Allow ;;;###autoloading transient-define-prefix
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload): Allow ;;;###autoloading
transient-define-prefix (bug#48694).

* lisp/transient.el (transient-define-prefix): Autoload.
2022-07-16 12:40:12 +02:00
Mattias Engdegård
7feb5b2da7 Optimise append calls
Add the transforms

  (append) -> nil
  (append X) -> X
  (append '(X) Y) -> (cons 'X Y)
  (append (list X) Y) -> (cons X Y)
  (append (list X...) nil) -> (list X...)

and the argument transforms:

  (list X...) (list Y...) -> (list X... Y...)
  nil -> ;nothing
  CONST1 CONST2 -> CONST1++CONST2
  (list CONSTANTS...) -> '(CONSTANTS...)

(the last three for non-tail arguments only)

* lisp/emacs-lisp/byte-opt.el: New.
2022-07-16 12:18:48 +02:00
Mattias Engdegård
d1ac1b2108 Improved cons optimisation
* lisp/emacs-lisp/byte-opt.el (byte-optimize-cons):
Add the transform

 (cons X (list Y...)) -> (list X Y...)
2022-07-16 12:18:41 +02:00
Mattias Engdegård
eb0e93478e Transform (list) -> nil in source optimiser
This optimisation is already done in the code generator but performing
it at this earlier stage is a useful normalising step that uncovers
more opportunities.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-list): New.
2022-07-16 12:17:32 +02:00
Stefan Kangas
69223ee975 Delete obsolete variable gnus-secondary-servers
* lisp/gnus/gnus.el (gnus-secondary-servers): Delete variable
obsolete since 24.1.
* lisp/gnus/gnus-group.el (gnus-group-browse-foreign-server):
* lisp/gnus/gnus-int.el (gnus-start-news-server): Don't use above
deleted variable.
2022-07-16 10:57:26 +02:00
Eli Zaretskii
058cc53ea7 ; * src/xdisp.c (try_window): Expand the commentary. (Bug#56561) 2022-07-16 11:21:05 +03:00
Stefan Kangas
f5218385c0 Fix obsoletion of nntp-authinfo-file
* lisp/gnus/nntp.el (nntp-authinfo-file): Fix obsoletion.
2022-07-16 10:11:18 +02:00
Stefan Kangas
10b6919870 ; Fix typos 2022-07-16 10:07:38 +02:00
Stefan Kangas
9699eaf8af Merge from origin/emacs-28
db259d8fd3 Build Seccomp filter only if we have a 64-bit userspace (B...
2022-07-16 06:30:39 +02:00
Po Lu
00501e82c7 Handle XDND mouse rects synchronously
* src/xterm.c (x_dnd_send_position): Record event X and Y for
consumption by the XdndStatus handler.  Ignore mouse rects if
waiting for status.
(x_dnd_send_leave): Clear pending DND event.
(handle_one_xevent): When handling XdndStatus, check if the
pending event is contained in the new mouse rect.
2022-07-16 11:53:42 +08:00
Stefan Monnier
97441f742e * lisp/url/url-vars.el (url-mime-separator-chars): Fix last cosmetic change 2022-07-15 15:59:38 -04:00
Michael Albinus
23ffb0c8c6 Extend tramp-tests
* test/lisp/net/tramp-tests.el (tramp--test-deftest-with-stat)
(tramp--test-deftest-with-perl, tramp--test-deftest-with-ls):
New defmacros.
(tramp-test18-file-attributes-with-stat)
(tramp-test18-file-attributes-with-perl)
(tramp-test18-file-attributes-with-ls)
(tramp-test19-directory-files-and-attributes-with-stat)
(tramp-test19-directory-files-and-attributes-with-perl)
(tramp-test19-directory-files-and-attributes-with-ls): New tests.
(tramp-test21-file-links): Delete also `tmp-name2'.
(tramp--test-deftest-direct-async-process): Rename from
`tramp--test--deftest-direct-async-process'.  Remove DOCSTRING.
Adapt callees.
(tramp--test-special-characters): Remove.  Move body to ...
(tramp-test41-special-characters): ... here.
(tramp--test-utf8): Remove.  Move body to ...
(tramp-test42-utf8): ... here.
(tramp-test41-special-characters-with-stat)
(tramp-test41-special-characters-with-perl)
(tramp-test41-special-characters-with-ls)
(tramp-test42-utf8-with-stat)
(tramp-test42-utf8-with-perl)
(tramp-test42-utf8-with-ls): Rewrite, using the new macros.
2022-07-15 19:52:10 +02:00
Stefan Kangas
d8f88748d9 * lisp/tar-mode.el (tar-mode-map): Prefer defvar-keymap. 2022-07-15 17:57:27 +02:00
Philipp Stephani
db259d8fd3 Build Seccomp filter only if we have a 64-bit userspace (Bug#56549)
* configure.ac (SIZEOF_LONG): New variable.
* lib-src/Makefile.in (SIZEOF_LONG): New variable; added conditional.
2022-07-15 17:56:02 +02:00
Andreas Schwab
889943e2bd Fix ASAN error with fringe bitmap on NS
* src/nsterm.m (ns_define_fringe_bitmap): Correctly access fringe
bitmap data.  (Bug#56553)
2022-07-15 17:26:39 +02:00
Po Lu
bd35ced042 ; * src/nsterm.m (ns_draw_window_cursor): Fix last change. 2022-07-15 22:04:52 +08:00
Po Lu
c829e63b0a Fix double unfocus during NS cursor display
* src/nsterm.m (ns_draw_window_cursor): Unfocus around calls to
draw_phys_cursor_glyph, then focus again later.  (bug#56559)
2022-07-15 22:00:57 +08:00