]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoGeneric 'with-narrowing' macro.
Gregory Heytings [Fri, 25 Nov 2022 21:43:48 +0000 (21:43 +0000)]
Generic 'with-narrowing' macro.

* lisp/subr.el (with-narrowing): New generic macro, replacing the
'with-locked-narrowing' one.  Suggested by Stefan Monnier.
(with-narrowing-1, with-narrowing-2): Helper functions.

2 years agoReworked locked narrowing.
Gregory Heytings [Fri, 25 Nov 2022 17:51:01 +0000 (17:51 +0000)]
Reworked locked narrowing.

* src/editfns.c: (narrowing_locks): New alist to hold the narrowing
locks and their buffers.
(narrowing_lock_get_bound, narrowing_lock_peek_tag)
(narrowing_lock_push, narrowing_lock_pop): New functions to access
and update 'narrowing_locks'.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing):
Functions moved from src/xdisp.c, and rewritten with the above
functions.
(Fwiden): Use the above functions. Update docstring.
(Fnarrow_to_region, Fnarrowing_lock, Fnarrowing_unlock): Use the above
functions.
(syms_of_editfns): Remove the 'narrowing-locks' variable.

* src/lisp.h: Make 'reset_outermost_narrowings' externally visible.

* src/xdisp.c (reset_outermost_narrowings)
unwind_reset_outermost_narrowing): Functions moved to src/editfns.c.

* lisp/subr.el (with-locked-narrowing): Improved macro, with a helper
function.

2 years agoMerge master into feature/improved-locked-narrowing.
Gregory Heytings [Thu, 24 Nov 2022 13:21:30 +0000 (14:21 +0100)]
Merge master into feature/improved-locked-narrowing.

2 years agoMake sed invocation in Makefile POSIX-compliant
Gregory Heytings [Mon, 21 Nov 2022 12:44:13 +0000 (12:44 +0000)]
Make sed invocation in Makefile POSIX-compliant

* Makefile.in: Add a semicolon before the closing brace, which is
required by POSIX.  Fixes bug#59444.

2 years ago* lisp/forms.el (forms-mode): Prefer setq-local.
Stefan Kangas [Mon, 21 Nov 2022 10:30:58 +0000 (11:30 +0100)]
* lisp/forms.el (forms-mode): Prefer setq-local.

2 years agoMake instructions for updating ancient filesets obsolete
Stefan Kangas [Mon, 21 Nov 2022 10:20:01 +0000 (11:20 +0100)]
Make instructions for updating ancient filesets obsolete

* lisp/filesets.el (filesets-update-pre010505): Make update
information for filesets older than 2001 obsolete.  Note that this
dates back to before filesets.el was even added to Emacs.

2 years ago* lisp/woman.el (woman-mode-map): Prefer defvar-keymap.
Stefan Kangas [Mon, 21 Nov 2022 08:28:05 +0000 (09:28 +0100)]
* lisp/woman.el (woman-mode-map): Prefer defvar-keymap.

2 years ago* lisp/outline.el (outline-search-function): New variable (bug#53981).
Juri Linkov [Mon, 21 Nov 2022 07:56:06 +0000 (09:56 +0200)]
* lisp/outline.el (outline-search-function): New variable (bug#53981).

(outline-font-lock-keywords, outline-font-lock-face)
(outline-minor-mode-highlight-buffer, outline-next-preface)
(outline-next-heading, outline-previous-heading)
(outline-back-to-heading, outline-on-heading-p, outline-demote)
(outline-map-region, outline-next-visible-heading)
(outline-hide-sublevels, outline-up-heading): Use outline-search-function
when it's non-nil as an alternative to searching outline-regexp.
(outline-search-level, outline-search-text-property): New functions.

* lisp/apropos.el (apropos-mode): Set outline-search-function
instead of unreliable outline-regexp.
(apropos-print): Add text property outline-level.

* lisp/emacs-lisp/shortdoc.el (shortdoc-display-group):
Add text property outline-level on text separate from final newlines.
(shortdoc-display-group): Add a narrow newline to not show
text properties of the final line when the outline is hidden.
(shortdoc--display-function): Add text property outline-level.
(shortdoc-mode): Set buffer-local outline-search-function and outline-level.

2 years agoDelete eglot spinner; not useful
Stephen Leake [Sun, 20 Nov 2022 21:45:13 +0000 (13:45 -0800)]
Delete eglot spinner; not useful

* lisp/progmodes/eglot.el (eglot-lsp-server): Delete slot spinner.
(eglot--mode-line-format): Don't include spinner in mode-line.
(eglot--signal-textDocument/didChange): Don't set spinner.

2 years agoAvoid native compiler setting user-init-file to warnings.el (bug#59358)
Juanma Barranquero [Sun, 20 Nov 2022 20:40:08 +0000 (21:40 +0100)]
Avoid native compiler setting user-init-file to warnings.el (bug#59358)

* src/lread.c (maybe_swap_for_eln): Use a delayed warning
instead of `display-warning' to avoid a recursive call to
Fload while loading the init file that sets `user-init-file'
to a bogus value.

2 years agoRename 'elisp-eval-buffer' to 'elisp-eval-region-or-buffer' (bug#59350)
Juri Linkov [Sun, 20 Nov 2022 18:10:45 +0000 (20:10 +0200)]
Rename 'elisp-eval-buffer' to 'elisp-eval-region-or-buffer' (bug#59350)

* lisp/progmodes/elisp-mode.el (elisp-eval-region-or-buffer):
Rename recently added command 'elisp-eval-buffer' to support active region.
(emacs-lisp-mode-map, lisp-interaction-mode-map): Rebind 'C-c C-e'
from elisp-eval-buffer to elisp-eval-region-or-buffer.

2 years agoDisable display-line-numbers-mode in string-pixel-width (bug#59311)
Juri Linkov [Sun, 20 Nov 2022 18:02:20 +0000 (20:02 +0200)]
Disable display-line-numbers-mode in string-pixel-width (bug#59311)

* lisp/emacs-lisp/subr-x.el (string-pixel-width):
Turn off display-line-numbers-mode when it's enabled.

2 years ago* doc/misc/Makefile.in (INFO_COMMON): Sort alphabetically.
Michael Albinus [Sun, 20 Nov 2022 16:58:49 +0000 (17:58 +0100)]
* doc/misc/Makefile.in (INFO_COMMON): Sort alphabetically.

2 years agoRework tramp-archive autoloads
Michael Albinus [Sun, 20 Nov 2022 16:58:34 +0000 (17:58 +0100)]
Rework tramp-archive autoloads

* lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-regexp):
Use `tramp-compat-rx'.  Protect `tramp-archive-suffixes' and
`tramp-archive-compression-suffixes'.
(tramp-archive-file-name-handler): Don't autoload.
(tramp-register-archive-autoload-file-name-handler): Rename from
`tramp-register-archive-file-name-handler'.  Adapt callees.

2 years agoCoalesce duplicate scroll valuator handling code
Po Lu [Sun, 20 Nov 2022 13:01:10 +0000 (21:01 +0800)]
Coalesce duplicate scroll valuator handling code

Also, write more commentary.

* src/xterm.c (xi_populate_scroll_valuator): New function.
Describe the meaning of each field in xi_scroll_valuator_t.
(xi_populate_device_from_info, xi_handle_new_classes): Factor
out duplicate code to that function.

2 years ago; Fix typos
Stefan Kangas [Sun, 20 Nov 2022 11:59:39 +0000 (12:59 +0100)]
; Fix typos

2 years ago; Add .no-advice-on-failure to .gitignore
Stefan Kangas [Sun, 20 Nov 2022 11:25:54 +0000 (12:25 +0100)]
; Add .no-advice-on-failure to .gitignore

This is for the new "disable advice on failure" feature added by
Gregory Heytings <gregory@heytings.org>.
* .gitignore: Add .no-advice-on-failure.

2 years ago; * lisp/proced.el (proced-auto-update-timer): Fix last change.
Eli Zaretskii [Sun, 20 Nov 2022 11:51:22 +0000 (13:51 +0200)]
; * lisp/proced.el (proced-auto-update-timer): Fix last change.

2 years agoCancel proced auto update timer if no proced buffers are open
Laurence Warne [Tue, 15 Nov 2022 18:48:40 +0000 (18:48 +0000)]
Cancel proced auto update timer if no proced buffers are open

* lisp/proced.el (proced-auto-update-timer): Cancel timer if no proced
buffers are open.

2 years agoAdvise against using too-high GC thresholds
Eli Zaretskii [Sun, 20 Nov 2022 11:10:08 +0000 (13:10 +0200)]
Advise against using too-high GC thresholds

* doc/lispref/internals.texi (Garbage Collection):
* src/alloc.c (syms_of_alloc) <gc-cons-threshold>
<gc-cons-percentage>: Advise against enlarging the GC thresholds
more than needed and for prolonged periods of time.

2 years agoHandle error in bookmark-relocate when filename is nil
Gabriel do Nascimento Ribeiro [Thu, 17 Nov 2022 00:59:17 +0000 (21:59 -0300)]
Handle error in bookmark-relocate when filename is nil

* lisp/bookmark.el (bookmark-relocate): Handle error when
filename is nil.  (Bug#59326)

2 years ago; Avoid "Local Variables" popups in Emacs tree
Eli Zaretskii [Sun, 20 Nov 2022 10:10:38 +0000 (12:10 +0200)]
; Avoid "Local Variables" popups in Emacs tree

* lisp/vc/vc.el (vc-prepare-patches-separately): Add an autoloaded
form for the 'safe-local-variable' property.  (Bug#59384)

2 years ago; Fix typos
Juanma Barranquero [Sun, 20 Nov 2022 09:25:59 +0000 (10:25 +0100)]
; Fix typos

* doc/lispref/display.texi (Size of Displayed Text):
* lisp/net/trampver.el (tramp-inside-emacs): Fix typos in docstrings.

2 years agoFix encoding and display of messages sent by server to emacsclient
Eli Zaretskii [Sat, 19 Nov 2022 19:34:07 +0000 (21:34 +0200)]
Fix encoding and display of messages sent by server to emacsclient

* lisp/server.el (server-start): Use 'locale-coding-system' to
encode messages sent back to the client.

* lib-src/emacsclient.c (main): Print '-error' messages via
'message', not directly via 'fprintf'.  This shows the error on
MS-Windows when the client is invoked as 'emacsclientw', since
stderr goes to the bit bucket in that case.

2 years agoEUDC: Add BBDB test
Thomas Fitzsimmons [Sat, 19 Nov 2022 16:39:21 +0000 (11:39 -0500)]
EUDC: Add BBDB test

* test/lisp/net/eudc-tests.el (eudcb-ldap): Call skip-unless with
slapd check.
(eudcb-bbdb): New test.

2 years agoFix global face scaling bug due to rounding.
Gregory Heytings [Sat, 19 Nov 2022 15:46:46 +0000 (15:46 +0000)]
Fix global face scaling bug due to rounding.

* lisp/face-remap.el (global-text-scale-adjust): Try again if the face
height should have changed but did not actually change.  Update the
docstring to clarify the difference with 'text-scale-adjust'.
(global-text-scale-adjust--increment-factor): New internal variable.
Fixes bug#59122.
(text-scale-adjust): Update the docstring to clarify the difference
with 'global-text-scale-adjust'.

2 years agoEUDC: Fix a void-variable error
Brent Westbrook [Sat, 19 Nov 2022 14:23:57 +0000 (09:23 -0500)]
EUDC: Fix a void-variable error

* lisp/net/eudcb-mailabbrev.el (eudc-mailabbrev-query-internal):
Check if symbol is bound before taking its value.  (Bug#59369)

2 years ago; * Makefile.in: Add option to disable advice on failure.
Gregory Heytings [Sat, 19 Nov 2022 14:00:17 +0000 (14:00 +0000)]
; * Makefile.in: Add option to disable advice on failure.

2 years ago* lisp/emacs-lisp/package.el (package-maintainers): Improve error handling
Philip Kaludercic [Sat, 19 Nov 2022 11:19:37 +0000 (12:19 +0100)]
* lisp/emacs-lisp/package.el (package-maintainers): Improve error handling

2 years ago; Avoid byte-compiler warning in startup.el
Eli Zaretskii [Sat, 19 Nov 2022 12:43:51 +0000 (14:43 +0200)]
; Avoid byte-compiler warning in startup.el

* lisp/startup.el (startup--load-user-init-file): Avoid
byte-compiler warnings about 'comp-eln-to-el-h'.  (Bug#59334)

2 years ago; Fix typos in bs.el
Stefan Kangas [Sat, 19 Nov 2022 11:51:31 +0000 (12:51 +0100)]
; Fix typos in bs.el

* lisp/bs.el: Fix typos.
(bs-define-sort-function, bs-cycle-next, bs-cycle-previous): Fix
variable name typo.

2 years ago* Makefile.in: Escape literal asterisks in regexps
Mattias Engdegård [Sat, 19 Nov 2022 11:29:46 +0000 (12:29 +0100)]
* Makefile.in: Escape literal asterisks in regexps

Discovered by Po Lu.

2 years agoFix error trapping in x_set_mouse_color
Po Lu [Sat, 19 Nov 2022 10:46:07 +0000 (18:46 +0800)]
Fix error trapping in x_set_mouse_color

* src/xfns.c (x_set_mouse_color): Use
x_uncatch_errors_after_check right after x_had_errors_p.  Then,
trap errors around FreeCursor requests, since some of the IDs
may not name valid cursors.

2 years ago; Improve doc strings of Ethiopic support functions and variables
Eli Zaretskii [Sat, 19 Nov 2022 09:52:06 +0000 (11:52 +0200)]
; Improve doc strings of Ethiopic support functions and variables

* lisp/language/ethio-util.el (ethio-primary-language)
(ethio-secondary-language, ethio-use-colon-for-colon)
(ethio-use-three-dot-question, ethio-quote-vowel-always)
(ethio-W-sixth-always, ethio-sera-to-fidel-buffer)
(ethio-sera-to-fidel-region, ethio-sera-to-fidel-marker)
(ethio-fidel-to-sera-buffer, ethio-fidel-to-sera-region)
(ethio-fidel-to-sera-marker, ethio-get-consonant)
(ethio-fidel-to-tex-buffer, ethio-tex-to-fidel-buffer)
(ethio-fidel-to-java-buffer, ethio-java-to-fidel-buffer)
(ethio-find-file, ethio-write-file, ethio-gemination)
("ethiopic-sera"): Doc fixes.

2 years ago; Explain why some files are encoded in utf-8-emacs
Eli Zaretskii [Sat, 19 Nov 2022 09:25:25 +0000 (11:25 +0200)]
; Explain why some files are encoded in utf-8-emacs

* lisp/international/titdic-cnv.el:
* lisp/language/ethio-util.el:
* lisp/language/ethiopic.el:
* lisp/language/ind-util.el:
* lisp/language/tibetan.el:
* lisp/language/tibet-util.el:
* lisp/leim/quail/ethiopic.el:
* lisp/leim/quail/tibetan.el: Add commentary explaining why these
files are encoded in utf-8-emacs.  (Bug#59341)

2 years agoFixes to fast mouse position reporting
Po Lu [Sat, 19 Nov 2022 07:24:25 +0000 (15:24 +0800)]
Fixes to fast mouse position reporting

* src/xterm.c (x_fast_mouse_position): New function.  Factor out
most of the fast mouse position code here.  Correctly port some
Haiku code to take into account multiple displays.  Report
scroll bar coordinates correctly.
(XTmouse_position): Call it.

2 years agoEUDC: Add LDAP tests
Thomas Fitzsimmons [Sat, 19 Nov 2022 07:05:36 +0000 (02:05 -0500)]
EUDC: Add LDAP tests

* test/lisp/net/eudc-resources/slapd.conf: New file.
* test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif: Likewise.
* test/lisp/net/eudc-resources/dc=gnu,dc=org: New files.
* test/lisp/net/eudc-tests.el (eudcb-ldap): New test.

2 years agoFix automatic DPI adjustment and add workarounds for some systems
Po Lu [Sat, 19 Nov 2022 05:59:53 +0000 (13:59 +0800)]
Fix automatic DPI adjustment and add workarounds for some systems

* lisp/faces.el (x-create-frame-with-faces): New field
`delayed-font'.  Set the `font-parameter' property to `font' in
the given parameter list after face-set-after-frame-default is
called.
* src/fontset.c (Fset_fontset_font): Avoid changing
`font-parameter' with the call to Fmodify_frame_parameters.
* src/frame.c (gui_set_frame_parameters_1): New function.
Factor out gui_set_frame_parameters here, and add an argument
DEFAULT_PARAMETER.  If the `font' parameter is set, and
`default_parameter' is not, then set the `font-parameter' frame
parameter to the `font' parameter as well, to keep track of
which user-specified `font' frame parameter set the default
face's font on the frame.
(gui_set_frame_parameters): Call gui_set_frame_parameters_1 with
new arg set to false.
(gui_set_font): Remove broken implementation of
`font-parameter'.
(gui_default_parameter): If the default value was used, then
call gui_set_frame_parameters_1 with the new argument set to
false.  This is because no font was specified as a frame
parameter by the user, so Freconsider_frame_fonts is free to do
anything it wants.
(Freconsider_frame_fonts): If `font-parameter' is set, then use
it.
(syms_of_frame): New defsym Qfont_parameter.

* src/frame.h: Update prototypes.

* src/haikuterm.c (haiku_default_font_parameter):
* src/pgtkfns.c (pgtk_default_font_parameter):
* src/w32fns.c (w32_default_font_parameter): Stop setting
`font-parameter' here.  This code resulted in decades of
automatic font rescaling not working correctly.

* src/xfaces.c (set_font_frame_param): Clear the
`font-parameter' frame parameter.
(Finternal_merge_in_global_face):
* src/xfns.c (x_default_font_parameter): Avoid changing
`font-parameter' in response to changes to face attributes.
* src/xsettings.c (apply_xft_settings): Add workaround for
Cairo.  (bug#59371, bug#59347, bug#59283, bug#59271, bug#59285,
bug#59306.)

2 years agoFix bug#59371
Po Lu [Sat, 19 Nov 2022 03:19:41 +0000 (11:19 +0800)]
Fix bug#59371

* src/frame.c (Freconsider_frame_fonts): If a font parameter was
set, create a params alist with it.  Then, pass it to both
default_font_parameter and face-set-after-frame-default.
(bug#59371)

2 years agoFix earlier changes to keyboard.c
Po Lu [Sat, 19 Nov 2022 03:13:15 +0000 (11:13 +0800)]
Fix earlier changes to keyboard.c

* src/keyboard.c (coords_in_menu_bar_window): New function.
(make_lispy_event): Do not process menu bar events on window
system frames if there is no menu bar window or the click lies
outside.

2 years agoFix build with ext menu bar
Po Lu [Sat, 19 Nov 2022 00:42:56 +0000 (08:42 +0800)]
Fix build with ext menu bar

* src/keyboard.c (make_lispy_event): Don't access
menu_bar_window when !HAVE_EXT_MENU_BAR.

2 years agoFix click position to menu bar entry with no-toolkit
Manuel Giraud [Fri, 18 Nov 2022 08:24:55 +0000 (09:24 +0100)]
Fix click position to menu bar entry with no-toolkit

* src/keyboard.c (make_lispy_event): Use x_y_to_hpos_vpos to
compute correct menu bar position should the menu face change.
* src/xdisp.c (x_y_to_hpos_vpos): Not static anymore.
* src/dispextern.h: Export x_y_to_hpos_vpos.

2 years ago; gnus-icalendar-tests: revert erroneous 'typo fix'
Mattias Engdegård [Fri, 18 Nov 2022 18:50:33 +0000 (19:50 +0100)]
; gnus-icalendar-tests: revert erroneous 'typo fix'

2 years agoEUDC: Revert eudc-server-hotlist default change
Thomas Fitzsimmons [Thu, 17 Nov 2022 14:22:08 +0000 (09:22 -0500)]
EUDC: Revert eudc-server-hotlist default change

* etc/NEWS: Remove eudc-server-hotlist default change.
* lisp/net/eudc-vars.el (eudc-server-hotlist): Set to nil.
(Bug#59314)

2 years agoitree: Make sure a deleted overlay has NULL pointer fields
Stefan Monnier [Fri, 18 Nov 2022 16:11:46 +0000 (11:11 -0500)]
itree: Make sure a deleted overlay has NULL pointer fields

* src/buffer.c (delete_all_overlays): Use POST_ORDER to set the node's
pointers to NULL, as god intended.

* src/itree.c (itree_insert_node): Uncomment the assertion accordingly.

2 years ago* lisp/emacs-lisp/bytecomp.el (byte-compile-dynamic-variable-bind): Typo
Stefan Monnier [Fri, 18 Nov 2022 15:45:29 +0000 (10:45 -0500)]
* lisp/emacs-lisp/bytecomp.el (byte-compile-dynamic-variable-bind): Typo

2 years agoImprove 'defvar-keymap' docstring
Robert Pluim [Fri, 18 Nov 2022 15:05:05 +0000 (16:05 +0100)]
Improve 'defvar-keymap' docstring

* etc/NEWS: Improve ':repeat' entry for 'defvar-keymap'.
* lisp/keymap.el (defvar-keymap): Improve description of ':repeat'
keyword.

2 years agoSilence rmailsum byte compiler warnings
Robert Pluim [Fri, 18 Nov 2022 15:02:32 +0000 (16:02 +0100)]
Silence rmailsum byte compiler warnings

* lisp/mail/rmailsum.el (rmail-summary-by-thread): Prefix unused
lambda args with '_'.

2 years agoUse boolean values directly in rmailsum
Robert Pluim [Thu, 17 Nov 2022 15:45:36 +0000 (16:45 +0100)]
Use boolean values directly in rmailsum

* lisp/mail/rmailsum.el (rmail-summary-invert):
(rmail-summary-direct-descendants):
(rmail-summary--walk-thread-message-recursively):
(rmail-summary-by-thread):
(rmail-summary-by-labels):
(rmail-summary-by-recipients):
(rmail-summary-by-regexp):
(rmail-summary-by-topic):
(rmail-summary-by-senders): Use the boolean values in
'rmail-summary-currently-displayed-msgs' and similar directly instead
of comparing them to t and nil.

2 years ago; Fix typos
Stefan Kangas [Fri, 18 Nov 2022 14:48:22 +0000 (15:48 +0100)]
; Fix typos

2 years agoAvoid `user-init-file' being set to an eln file (bug#59334)
Juanma Barranquero [Fri, 18 Nov 2022 12:57:00 +0000 (13:57 +0100)]
Avoid `user-init-file' being set to an eln file (bug#59334)

* lisp/startup.el (startup--load-user-init-file): If possible,
point `user-init-file' to the source file if the init file was
native-compiled.

2 years ago; Fix typos (prefer US spelling)
Stefan Kangas [Fri, 18 Nov 2022 12:06:55 +0000 (13:06 +0100)]
; Fix typos (prefer US spelling)

2 years agoFix simple-tests when run noninteractively
Mattias Engdegård [Fri, 18 Nov 2022 11:09:46 +0000 (12:09 +0100)]
Fix simple-tests when run noninteractively

* test/lisp/simple-tests.el
(simple-execute-extended-command--describe-binding-msg):
Bind text-quoting-style explicitly to ensure consistent behaviour
whether or not the test is run interactively.

2 years agoAvoid raw control characters in grm-wy-boot.el
Stefan Kangas [Fri, 18 Nov 2022 10:59:07 +0000 (11:59 +0100)]
Avoid raw control characters in grm-wy-boot.el

* lisp/cedet/semantic/grm-wy-boot.el
(semantic-grammar-wy--parse-table): Don't use raw control characters.

2 years ago* lisp/repeat.el (describe-repeat-maps): More outlines and page separators.
Juri Linkov [Fri, 18 Nov 2022 07:19:23 +0000 (09:19 +0200)]
* lisp/repeat.el (describe-repeat-maps): More outlines and page separators.

2 years agoAdd knob to make `mouse-position' faster on X
Po Lu [Fri, 18 Nov 2022 01:08:59 +0000 (09:08 +0800)]
Add knob to make `mouse-position' faster on X

* etc/PROBLEMS (Improving performance with slow X connections):
Add new advice.
* src/xterm.c (XTmouse_position): Add alternative
implementations for slow connections.
(syms_of_xterm): Add new variable to enable them.
* src/xterm.h (struct x_display_info): Update commentary.

2 years agoMerge remote-tracking branch 'origin/scratch/noverlay'
Stefan Monnier [Thu, 17 Nov 2022 23:48:38 +0000 (18:48 -0500)]
Merge remote-tracking branch 'origin/scratch/noverlay'

2 years agoitree.c: Get rid of the old iterator code scratch/noverlay
Stefan Monnier [Thu, 17 Nov 2022 23:09:37 +0000 (18:09 -0500)]
itree.c: Get rid of the old iterator code

Only use the new iterator which relies on a fixed size (and small)
state in the iterator.
This makes non-local exits safe within ITREE_FOREACH loops.

* src/itree.c (make_nav, nav_nodeptr, nav_flag, itree_stack_clear)
(itree_stack_push_flagged): Delete functions.
(nodeptr_and_flag): Delete type.
(struct itree_stack): Make the array hold plain pointers instead.
(itree_stack_push): Inline the former code of `itree_stack_push_flagged`.
(itree_stack_pop): Change return type.
(itree_contains): Don't call `ITREE_FOREACH_ABORT` any more.
(itree_insert_gap): Simplify access to the stack of nodes.
(itree_delete_gap, itree_insert_gap): Adjust code to new return type of
`itree_stack_pop`.
(itree_iterator_finish): Delete function.
(itree_iterator_start): Don't setup the `stack` field any more.
(itree_iterator_next): Delete function.
(itree_iter_next): Rename to `itree_iterator_next` and make it non-static.
(itree_iterator_narrow): Don't check the `running` flag any more.

* src/itree.h (itree_iterator_finish): Remove declaration.
(struct itree_iterator): Remove the `stack` and `running` fields.
(ITREE_FOREACH_ABORT): Delete macro.
(ITREE_FOREACH): Don't call `itree_iterator_finish` any more.

* src/xdisp.c (strings_with_newlines):
* src/buffer.c (overlays_in, next_overlay_change, overlay_touches_p):
Don't call `ITREE_FOREACH_ABORT` any more.

2 years agoitree.c: Make the iterator reentrant (bug#59183)
Stefan Monnier [Thu, 17 Nov 2022 22:00:22 +0000 (17:00 -0500)]
itree.c: Make the iterator reentrant (bug#59183)

Get rid of the global iterator object and instead allocate
a separate iterator for every loop.  This still uses the "duplicate
iterator" code, including the old iterator which needs a stack,
make ITREE_FOREACH a bit more expensive than we'd like.

* src/itree.h (init_itree, forget_itree, itree_iterator_busy_p):
Delete declarations.
(itree_iterator_start): Add iterator arg and remove `line` and `file` args.
(struct itree_iterator): Move from `itree.c`.  Remove `line` and
`file` fields.
(ITREE_FOREACH): Stack allocate an iterator object and pass it to
`itree_iterator_start`.

* src/itree.c (struct itree_iterator): Move to itree.h.
(iter): Delete global variable.
(itree_iterator_create, init_itree, forget_itree, itree_iterator_busy_p):
Delete functions.
(itree_contains): Adjust assertion.
(itree_iterator_finish): Deallocate the iterator's stack.
(itree_iterator_start): Take the (uninitialized) iterator as argument.
Allocate a fresh new stack.  Remove `file` and `line` arguments.
Don't check `running` any more since the iterator is not expected to be
initialized at all.

* src/eval.c (signal_or_quit):
* src/alloc.c (garbage_collect): Don't check `itree_iterator_busy_p`
any more.

* src/emacs.c (main): No need to `init_itree` any more.
(Fdump_emacs): No need to `forget_itree` any more.

2 years ago* lisp/emacs-lisp/package-vc.el: Autoload package-vc-update{,-all}
Philip Kaludercic [Thu, 17 Nov 2022 16:39:46 +0000 (17:39 +0100)]
* lisp/emacs-lisp/package-vc.el: Autoload package-vc-update{,-all}

2 years ago; Clarify what a package specification is
Philip Kaludercic [Wed, 16 Nov 2022 09:59:53 +0000 (10:59 +0100)]
; Clarify what a package specification is

* lisp/emacs-lisp/package-vc.el (package-vc-selected-packages): Expand
docstring.

2 years agoEnsure 'package-vc-prepare-patch' runs in the right directory
Philip Kaludercic [Wed, 16 Nov 2022 09:46:43 +0000 (10:46 +0100)]
Ensure 'package-vc-prepare-patch' runs in the right directory

* lisp/emacs-lisp/package-vc.el (package-vc-prepare-patch): Bind
'default-directory'.p

2 years agoAvoid duplicate source packages in 'package-alist'
Philip Kaludercic [Wed, 16 Nov 2022 09:37:10 +0000 (10:37 +0100)]
Avoid duplicate source packages in 'package-alist'

* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Remove all
other source packages before installing the new package description.

2 years agoFix issues related to 'package-vc-install-from-checkout'
Philip Kaludercic [Wed, 16 Nov 2022 09:28:14 +0000 (10:28 +0100)]
Fix issues related to 'package-vc-install-from-checkout'

* lisp/emacs-lisp/package-vc.el (package-vc--main-file): Ensure the
package name is a string.
(package-vc--unpack-1): Use pkg-dir instead of the empty return value
of 'package-lisp-dir'.
(package-vc-install-from-checkout): Fix file name handling.

2 years ago; * lisp/emacs-lisp/package-vc.el: Update TODO
Philip Kaludercic [Tue, 15 Nov 2022 19:19:33 +0000 (20:19 +0100)]
; * lisp/emacs-lisp/package-vc.el: Update TODO

2 years agoAllow the direct installation of package specifications
Philip Kaludercic [Tue, 15 Nov 2022 19:05:33 +0000 (20:05 +0100)]
Allow the direct installation of package specifications

* lisp/emacs-lisp/package-vc.el (package-vc-install): Handle package
specifications as an argument.

2 years agoOnly fetch elpa-packages.eld when necessary
Philip Kaludercic [Tue, 15 Nov 2022 14:40:58 +0000 (15:40 +0100)]
Only fetch elpa-packages.eld when necessary

* lisp/emacs-lisp/package-vc.el: Remove hook from
'package-refresh-contents-hook'.

2 years agoRemove duplicate package descriptions after updating
Philip Kaludercic [Tue, 15 Nov 2022 13:36:26 +0000 (14:36 +0100)]
Remove duplicate package descriptions after updating

* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Ensure there
is always just one instance of a package description in 'package-alist'.

2 years agoRemove temporary .texi files if used to build documentation
Philip Kaludercic [Tue, 15 Nov 2022 12:27:59 +0000 (13:27 +0100)]
Remove temporary .texi files if used to build documentation

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Remember if a temporary file was generated and delete it afterwards.

2 years agoFix the behaviour of 'byte-compile-ignore-files'
Philip Kaludercic [Tue, 15 Nov 2022 10:03:58 +0000 (11:03 +0100)]
Fix the behaviour of 'byte-compile-ignore-files'

* lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Negate the
'string-match-p' check.  (Bug#59139)

2 years agoAdd missing elpa-package.eld to package test resources
Philip Kaludercic [Tue, 15 Nov 2022 10:00:14 +0000 (11:00 +0100)]
Add missing elpa-package.eld to package test resources

2 years agoAvoid destructive manipulation of 'package-vc--archive-spec-alist'
Philip Kaludercic [Tue, 15 Nov 2022 09:46:23 +0000 (10:46 +0100)]
Avoid destructive manipulation of 'package-vc--archive-spec-alist'

* lisp/emacs-lisp/package-vc.el (package-vc--desc->spec): Replace
'mapcar' with 'apply'.  This is done to avoid unintentional cycles.

2 years agoImprove robustness of 'package-vc-update'
Philip Kaludercic [Tue, 15 Nov 2022 09:20:01 +0000 (10:20 +0100)]
Improve robustness of 'package-vc-update'

* lisp/emacs-lisp/package-vc.el (package-vc-update): Ensure that the
command is only invoked with installed packages. that the hook is
always removed and that 'vc-pull' is always called in the right
directory.

2 years ago* lisp/vc/vc.el (vc-default-last-change): Use 'vc-call'
Philip Kaludercic [Mon, 14 Nov 2022 13:24:14 +0000 (14:24 +0100)]
* lisp/vc/vc.el (vc-default-last-change): Use 'vc-call'

2 years agoHave 'vc-prepare-patch' handle prefix arguments.
Philip Kaludercic [Sun, 13 Nov 2022 16:05:20 +0000 (17:05 +0100)]
Have 'vc-prepare-patch' handle prefix arguments.

* lisp/emacs-lisp/package-vc.el (package-vc-prepare-patch): Use
'vc-prepare-patch-prompt-revisions'.
* lisp/vc/vc.el (vc-prepare-patch-prompt-revisions): Extract common
function and handle prefix arguments.
(vc-prepare-patch): Pull logic out to
'vc-prepare-patch-prompt-revisions'.

2 years agoExplain that 'package-vc-install' doesn't remove tarball packages
Philip Kaludercic [Sun, 13 Nov 2022 07:18:49 +0000 (08:18 +0100)]
Explain that 'package-vc-install' doesn't remove tarball packages

* lisp/emacs-lisp/package-vc.el (package-vc-install): Expand documentation.

2 years agoMention package name when package is lacking VC data
Philip Kaludercic [Sun, 13 Nov 2022 07:17:07 +0000 (08:17 +0100)]
Mention package name when package is lacking VC data

* lisp/emacs-lisp/package-vc.el (package-vc-install): Add package name.
(package-vc-checkout): Add package name.

2 years agoAdd new command 'package-vc-update-all'
Philip Kaludercic [Sun, 13 Nov 2022 07:12:18 +0000 (08:12 +0100)]
Add new command 'package-vc-update-all'

* lisp/emacs-lisp/package-vc.el (package-vc-update-all): Add command
(package-vc-update): Add an assertion to verify this.

2 years agoRaise 'wrong-type-argument' when installing package nil
Philip Kaludercic [Sat, 12 Nov 2022 08:18:19 +0000 (09:18 +0100)]
Raise 'wrong-type-argument' when installing package nil

* lisp/emacs-lisp/package-vc.el (package-vc-install): Check if the
package is nil.

2 years agoHave 'package-vc-selected-packages' consider all installed packages
Philip Kaludercic [Sat, 12 Nov 2022 08:14:33 +0000 (09:14 +0100)]
Have 'package-vc-selected-packages' consider all installed packages

* lisp/emacs-lisp/package-vc.el
(package-vc-install-selected-packages): Consider more than just one
value in `package-alist', in case there are multiple installations.

2 years agoFix indefinite loading of asynchronous downloads
Philip Kaludercic [Fri, 11 Nov 2022 17:34:14 +0000 (18:34 +0100)]
Fix indefinite loading of asynchronous downloads

* lisp/emacs-lisp/package.el (package--download-one-archive): Only add
the archive that is actually being downloaded to
'package--downloads-in-progress'.

2 years agoFix edebug spec for 'package--with-response-buffer'
Philip Kaludercic [Fri, 11 Nov 2022 17:32:13 +0000 (18:32 +0100)]
Fix edebug spec for 'package--with-response-buffer'

* lisp/emacs-lisp/package.el (package--with-response-buffer): Add a
spec that makes the macro debuggable.

2 years agoImprove robustness of documentation generation
Philip Kaludercic [Thu, 10 Nov 2022 23:09:46 +0000 (00:09 +0100)]
Improve robustness of documentation generation

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation): Log
output and display error messages if anything goes wrong.

2 years agoRemove unused variable in 'package-vc--unpack'
Philip Kaludercic [Thu, 10 Nov 2022 20:55:30 +0000 (21:55 +0100)]
Remove unused variable in 'package-vc--unpack'

* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Remove 'url'.

2 years agoMove package spec documentation to 'package-vc-selected-packages'
Philip Kaludercic [Thu, 10 Nov 2022 20:52:46 +0000 (21:52 +0100)]
Move package spec documentation to 'package-vc-selected-packages'

* lisp/emacs-lisp/package-vc.el (package-vc-selected-packages): Add
documentation.
(package-vc--archive-spec-alist): Remove documentation.

2 years agoFix type error in package-vc prompt function
Philip Kaludercic [Thu, 10 Nov 2022 18:18:00 +0000 (19:18 +0100)]
Fix type error in package-vc prompt function

* lisp/emacs-lisp/package-vc.el (package-vc--read-package-name):  Pass
(not allow-url) as REQUIRE-MATCH, not as INITIAL-INPUT.

2 years agoRename 'package-vc-refresh' to 'package-vc-rebuild'
Philip Kaludercic [Sat, 12 Nov 2022 23:59:35 +0000 (00:59 +0100)]
Rename 'package-vc-refresh' to 'package-vc-rebuild'

* doc/emacs/package.texi (Fetching Package Sources): Update documentation.
* lisp/emacs-lisp/package-vc.el (package-vc-refresh): Rename from.
(package-vc-rebuild): Rename to.

This intends to clarify the intention and avoid confusion with
'package-refresh-contents'.  Thanks to Rudolf Adamkovič for the
suggestion.

2 years agoTrack 'default-directory' while updating source packages
Philip Kaludercic [Wed, 9 Nov 2022 08:35:11 +0000 (09:35 +0100)]
Track 'default-directory' while updating source packages

* lisp/emacs-lisp/package-vc.el (package-vc-update): Add the source
directory to the identifier list, in case the remaining
'vc-do-command' arguments are all read-time constants.

2 years agoRespect :lisp-dir in package specs by loading a sub-directory
Philip Kaludercic [Tue, 8 Nov 2022 22:45:35 +0000 (23:45 +0100)]
Respect :lisp-dir in package specs by loading a sub-directory

* lisp/emacs-lisp/package-vc.el (package-vc-repository-store): Remove
obsolete variable.
(package-vc--unpack-1): Respect :lisp-dir.
(package-vc--unpack): Add :lisp-dir to the package description if
necessary.
* lisp/emacs-lisp/package.el (package--delete-directory): Check if a
directory is a symbolic link.

2 years agoFix generation of documentation for source packages
Philip Kaludercic [Sun, 6 Nov 2022 20:53:32 +0000 (21:53 +0100)]
Fix generation of documentation for source packages

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Call "makeinfo" before "install-info"

2 years agoRemove references to internal symbols from public docstrings
Philip Kaludercic [Sun, 6 Nov 2022 16:45:08 +0000 (17:45 +0100)]
Remove references to internal symbols from public docstrings

* lisp/emacs-lisp/package-vc.el (package-vc-repository-store):
Unmention 'package-vc--unpack'.
(package-vc-install): Unmention 'package-vc--guess-backend' in favour
of 'package-vc-heuristic-alist'.

2 years agoExpand 'package-vc--unpack-1' documentation
Philip Kaludercic [Sun, 6 Nov 2022 12:16:50 +0000 (13:16 +0100)]
Expand 'package-vc--unpack-1' documentation

* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Explain what
the function does.

2 years agoClarify 'package-vc--build-documentation' docstring
Philip Kaludercic [Sun, 6 Nov 2022 11:12:23 +0000 (12:12 +0100)]
Clarify 'package-vc--build-documentation' docstring

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Rewrite the first line.

As suggested by Eli Zaretskii.

2 years agoFix the docstring for 'package-vc--version'
Philip Kaludercic [Sun, 6 Nov 2022 11:05:32 +0000 (12:05 +0100)]
Fix the docstring for 'package-vc--version'

* lisp/emacs-lisp/package-vc.el (package-vc--version): Replace
docstring.

It seems like this was just copied over from 'package-vc-commit', for
no good reason.

2 years agoFix 'package-vc-selected-packages' documentation
Philip Kaludercic [Sun, 6 Nov 2022 09:43:44 +0000 (10:43 +0100)]
Fix 'package-vc-selected-packages' documentation

* lisp/emacs-lisp/package-vc.el (package-vc-selected-packages): Remove
reference to non-existent function and add an explanation that the
value won't override an existing source package installation.

2 years agoMark 'package-vc-update' as interactive
Philip Kaludercic [Sun, 6 Nov 2022 09:24:56 +0000 (10:24 +0100)]
Mark 'package-vc-update' as interactive

* lisp/emacs-lisp/package-vc.el (package-vc--sourced-packages-list):
Remove function in favour of 'package-vc--read-package-name'.
(package-vc--read-package-name):
Extract out common functionality.
(package-vc--read-package-desc): Add auxiliary function based on
'package-vc--read-package-name'.
(package-vc-update): Add interactive spec using
'package-vc--read-package-desc'.
(package-vc-install): Use 'package-vc--read-package-desc'.
(package-vc-checkout): Use 'package-vc--read-package-desc'.
(package-vc--read-pkg): Remove in favour of 'package-vc--read-package-desc'.
(package-vc-refresh): Use 'package-vc--read-package-desc'.
(package-vc-prepare-patch): Use 'package-vc--read-package-desc'.

2 years agoAutoload 'package-vc-install-selected-packages'
Philip Kaludercic [Sun, 6 Nov 2022 08:52:57 +0000 (09:52 +0100)]
Autoload 'package-vc-install-selected-packages'

* lisp/emacs-lisp/package-vc.el (package-vc-ensure-packages): Add an
autoload cookie.
(package-vc-selected-packages): Set
:initialize to 'custom-initialize-default'.

2 years agoMark 'package-vc-install-selected-packages' as interactive
Philip Kaludercic [Sun, 6 Nov 2022 08:52:12 +0000 (09:52 +0100)]
Mark 'package-vc-install-selected-packages' as interactive

* lisp/emacs-lisp/package-vc.el (package-vc-ensure-packages): Add an
interactive spec.

2 years agoRename '-ensure-packages' to -install-selected-packages'
Philip Kaludercic [Sun, 6 Nov 2022 08:51:45 +0000 (09:51 +0100)]
Rename '-ensure-packages' to -install-selected-packages'

* doc/emacs/package.texi (Fetching Package Sources): Rename instances.
* lisp/emacs-lisp/package-vc.el (package-vc-ensure-packages): Rename
to 'package-vc-install-selected-packages'.
(package-vc-selected-packages): Call renamed function.

2 years agoHandle strings as keys in 'package-vc-ensure-packages'
Philip Kaludercic [Sun, 6 Nov 2022 08:47:39 +0000 (09:47 +0100)]
Handle strings as keys in 'package-vc-ensure-packages'

* lisp/emacs-lisp/package-vc.el (package-vc-ensure-packages): Inter
sting keys while processing 'package-vc-selected-packages'.

As requested by Rudolf Adamkovič.