emacs/lisp/erc
Alan Mackenzie 7cc20b5d7f Make property byte-run-defined-symbol more flexible.
Also Numerous small amendments.

* lisp/emacs-lisp/byte-run.el (byte-run-pull-lambda-source)
(byte-run--posify-def-form, byte-run-format-read-stream): New
functions.
(byte-run--posify-list): Small corrections to functionality.
(byte-run-posify-all-lambdas-etc): Renamed from name without
"-etc".  Strip a lambda off position when it doesn't open a
form.
(byte-run-get-position-vec): Renamed from
byte-run-position-vec.
(byte-run-posify-doc-string): New argument READ-STREAM, and
its addition to the ;POS structure as a fifth element.
(byte-run-posify-lambda-form): New optional argument
LAMBDA-READ-STREAM, which is passed to the above function.  The
original arguments are no longer changed, new ones are created.
(byte-run--set-compiler-macro): Remove unneeded entry from
lambda-source-alist.
(byte-run--posify-defining-form): New variable DOC-INDEX, the
position in the generated macro's arguments of the doc string.
(defmacro): Move the stripping of a lambda's position to
earlier in the function.  Adapt to the new form of the
byte-run-defined-form property.
(byte-run-posify-existing-lambdas): Use the new
byte-run-pull-lambda-source function.
(eval-when-compile, eval-and-compile): Process the argument
with byte-run-posify-all-lambdas-etc before calling eval.

* lisp/emacs-lisp/bytecomp.el (byte-extrude-byte-code-vectors):
Amend the macro so that it can be run twice without adverse
effect.

* lisp/emacs-lisp/cl-generic.el
(cl-generic-define-context-rewriter): Bind
symbols-with-pos-enabled to t for the benefit of pcase.
(cl-defmethod): Set the cdr of the byte-run-defined-form
property to a function which handles the non-constant position
of the doc string of generated defining functions.

* lisp/emacs-lisp/cl-macs.el (cl-function): Preserve the
positioned lambda.

* lisp/emacs-lisp/gv.el (gv--expander-defun-declaration)
(gv--setter-defun-declaration): Wrap the expansion in
byte-run-position-lambda-form where appropriate.

* lisp/emacs-lisp/macroexp.el (macroexp--funcall-if-compiled):
Bind symbols-with-pos-enabled to t.
(macroexp--strip-lambda): New function.
(macroexp--expand-all): Handle eval-when-compile and
eval-and-compile by expanding their arguments first, then
expanding the forms.  Sometimes wrap a
byte-run-posify-lambda-form around the expansion of a
backquote-list* form.  Add in a pcase arm for vectors.  In the
\#'(lambda ...) arm, handle function args which are called
"lambda".  Separate the (quote ...) form from the (function
...) form, and call byte-run-posify-all-lambdas-etc on its arg.
Remove a superfluous arm involving lambda.  Add an arm to
handle backquote expansions of "complicated" lambda forms.
Remove the final guard arm which stripped symbols of their
positions.

* lisp/emacs-lisp/pcase.el (pcase--subtype-bitsets): don't
create and eval-after-load form before the macro machinery is
fully working.

* lisp/help.el (help-strip-pos-info): Renamed to
byte-run-strip-pos-info and moved to byte-run.el.

* lisp/progmodes/elisp-mode.el (elisp--preceding-sexp): Use the
current value of load-read-function rather than `read'.
(elisp--eval-defun): Bind defining-symbol to nil.  Expand
macros eagerly by calling macroexpand-all rather than
macroexpand.

* src/data.c (Fdefalias): Strip the position from the symbol
being defalias'd.  Call byte-run-posify-doc-string for its doc
string.  Adapt the value of its byte-run-defined-form property
to the new convention.

* src/eval.c (top level): Adapt defvar's and defconst's values
of the byte-run-defined-form property to the new convention.

* src/lread.c (Fload): Amend the bindings of read-stream and
load-read-function.
(readevalloop_early_eval): Preserve original list parameters
rather than changing them with nconc.
(readevalloop_eager_expand_eval): In the non-progn case, macro
expand the form in one go, rather than first the top level then
the rest.  Remove the call to byte-run-strip-symbols-positions.
(Feval_buffer, Feval_region, Fread, Fread_position_symbols)
(Fread_positioning_defined_symbols, Fread_from_string):
Regularize the settings of read-stream and
byte-compile-in-progress.
(set_read_stream): New function superseding get_read_stream.
(quote_second_on_stack): New inline function for read0.
(ADJUST_LOCATE_SYMS): Amend.
(read0): New value 2 for locate_syms meaning "Position next
form if it's a quoted symbol".  Amend the state machine
accordingly.  Adjust the settings of the local variables to
reflect the new convention for the byte-run-defined-symbol
property.
(lambda-source-alist): New alist variable holding the source
buffers of each lambda positioned by read0.

* test/lisp/emacs-lisp/bytecomp-tests.el
(test-byte-comp-compile-and-load, bytecomp-tests-function-put):
Use print-symbols-bare.

* test/lisp/erc/erc-tests.el (erc--with-dependent-type-match):
Use byte-run-strip-lambda-doc.
(erc--restore-initialize-priors): Comment out entirely.

* test/lisp/use-package/use-package-tests
(use-package-test-normalize-function): Use
byte-run-strip-lambda-doc.
(use-package-test/:hook-5, use-package-test/:hook-7): Bind
symbols-with-pos-enabled to t.
2024-06-01 15:02:02 +00:00
..
ChangeLog.1 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
ChangeLog.2 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-autoaway.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-backend.el Make property byte-run-defined-symbol more flexible. 2024-06-01 15:02:02 +00:00
erc-button.el Reconcile erc-stamp--date-stamps when merging buffers 2024-05-18 15:48:05 -07:00
erc-capab.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-common.el Don't nest date stamp insertions in erc-stamp 2024-04-19 13:54:52 -07:00
erc-compat.el Remove "erc-" prefixed Compat definitions 2024-02-16 19:58:35 -08:00
erc-dcc.el ; Simplify (with-current-buffer (get-buffer ...) ...) 2024-03-14 12:40:26 +02:00
erc-desktop-notifications.el Port more notification senders to non-XDG systems 2024-03-13 11:01:39 +08:00
erc-ezbounce.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-fill.el Don't nest date stamp insertions in erc-stamp 2024-04-19 13:54:52 -07:00
erc-goodies.el Reuse command-indicator code for script lines in ERC 2024-03-23 15:10:32 -07:00
erc-ibuffer.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-identd.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-imenu.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-join.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-lang.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-list.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-log.el Don't kill server buffer with erc-kill-buffer-on-part 2024-05-18 15:48:05 -07:00
erc-match.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-menu.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-netsplit.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-networks.el Reconcile erc-stamp--date-stamps when merging buffers 2024-05-18 15:48:05 -07:00
erc-nicks.el ; * lisp/erc/erc-nicks.el: Fix typo in Commentary. 2024-04-07 12:59:21 -07:00
erc-notify.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-page.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-pcomplete.el Clarify purpose of module aliases in ERC 2024-01-07 15:11:26 -08:00
erc-replace.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc-ring.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-sasl.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-services.el ; Improve erc-services and upgrade documentation 2024-04-19 13:54:52 -07:00
erc-sound.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-speedbar.el Fix invisible erc-speedbar cursor in text terminals 2024-04-07 12:59:21 -07:00
erc-spelling.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-stamp.el Reconcile erc-stamp--date-stamps when merging buffers 2024-05-18 15:48:05 -07:00
erc-status-sidebar.el Fix invisible erc-speedbar cursor in text terminals 2024-04-07 12:59:21 -07:00
erc-track.el Prefer erc--skip property to erc-track--skipped-msgs 2024-05-08 17:14:02 -07:00
erc-truncate.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
erc-xdcc.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
erc.el Reconcile erc-stamp--date-stamps when merging buffers 2024-05-18 15:48:05 -07:00