emacs/lisp/emacs-lisp
Alan Mackenzie 368570b3fd First commit of scratch/correct-warning-pos.
This branch is intended to generate correct position information in warning
and error messages from the byte compiler, and is intended thereby to fix bugs

It introduces a new mechanism, the symbol with position.  This is taken over
from the previous git branch scratch/accurate-warning-pos which was abandoned
for being too slow.  The main difference in the current branch is that the
symbol `nil' is never given a position, thus speeding up NILP markedly.

* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-optimize-form-code-walker, byte-optimize-let-form, byte-optimize-while)
(byte-optimize-apply): Use byte-compile-warn-x in place of byte-compile-warn.

* lisp/emacs-lisp/bytecomp.el (byte-compile--form-stack): New variable.
(byte-compile-strip-s-p-1, byte-compile-strip-symbol-positions): New
functions.
(byte-compile-recurse-toplevel, byte-compile-initial-macro-environment)
(byte-compile-preprocess, byte-compile-macroexpand-declare-function): Bind
print-symbols-bare to non-nil.
(byte-compile--first-symbol, byte-compile--warning-source-offset): New
functions.
(byte-compile-warning-prefix): Modify to output two sets of position
information, the old (incorrect) set and the new set.
(byte-compile-warn): Strip positions from symbols before outputting.
(byte-compile-warn-x): New function which outputs a correct position supplied
in an argument.
(byte-compile-warn-obsolete, byte-compile-emit-callargs-warn)
(byte-compile-format-warn, byte-compile-nogroup-warn)
(byte-compile-arglist-warn, byte-compile-docstring-length-warn)
(byte-compile-warn-about-unresolved-functions, byte-compile-file)
(byte-compile--check-prefixed-var, byte-compile--declare-var)
(byte-compile-file-form-defvar-function, byte-compile-file-form-defmumble)
(byte-compile-check-lambda-list, byte-compile--warn-lexical-dynamic)
(byte-compile-lambda, byte-compile-form, byte-compile-normal-call)
(byte-compile-check-variable, byte-compile-free-vars-warn)
(byte-compile-subr-wrong-args, byte-compile-fset, byte-compile-set-default)
(byte-compile-condition-case, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-make-variable-buffer-local, byte-compile-define-symbol-prop)
(byte-compile-define-keymap): Replace byte-compile-warn with
byte-compile-warn-x.
(byte-compile-file, compile-defun): Bind symbols-with-pos-enabled to non-nil.
(compile-defun, byte-compile-from-buffer): Use `read-positioning-symbols'
rather than plain `read'.
(byte-compile-toplevel-file-form, byte-compile-form): Dynamically bind
byte-compile--form-stack.
(byte-compile-file-form-autoload, byte-compile-file-form-defvar)
(byte-compile-file-form-make-obsolete, byte-compile-lambda)
(byte-compile-push-constant, byte-compile-cond-jump-table)
(byte-compile-define-keymap, byte-compile-annotate-call-tree):
Strip positions from symbols where they are unwanted.
(byte-compile-file-form-defvar): Strip positions from symbols using
`bare-symbol'.
(byte-compile-file-form-defmumble): New variable bare-name, a version of name
without its position.
(byte-compile-lambda): Similarly, new variable bare-arglist.
(byte-compile-free-vars-warn): New argument arg supplying position information
to byte-compile-warn-x.
(byte-compile-push-constant): Manipulation of symbol positions.
(display-call-tree): Strip positions from symbols.

* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv--analyze-function, cconv-analyze-form): Replace use of
byte-compile-warn with byte-compile-warn-x.

* lisp/emacs-lisp/cl-generic.el (cl-defmethod): New variable org-name which
  will supply position information to a new macroexp-warn-and-return.

  * lisp/emacs-lisp/cl-macs.el (cl-macs--strip-s-p-1)
  (cl-macs--strip-symbol-positions): New functions to strip positions from
  symbols in an expression.  These duplicaate similarly named functions in
  bytecomp.el.

  * lisp/emacs-lisp/macroexpand.el (macroexp--warn-wrap): Calls
  byte-compile-warn-x in place of byte-compile-warn.
  (macroexp-warn-and-return): Commented out new position parameter _arg.

* src/.gdbinit: Add in code to handle symbols with position.

* src/alloc.c (XPNTR, set_symbol_name, valid_lisp_object_p, purecopy)
(mark_char_table, mark_object, survives_gc_p, symbol_uses_obj): Use
BARE_SYMBOL_P and XBARE_SYMBOL in place of the former SYMBOLP and XSYMBOL.
(build_symbol_with_pos): New function.
(Fgarbage_collect): Bind Qsymbols_with_pos_enabled to nil around the call to
garbage_collect.

* src/data.c (Ftype_of): Add case for PVEC_SYMBOL_WITH_POS.
(Fbare_symbol_p, Fsymbol_with_pos_p, Fbare_symbol, Fsymbol_with_pos_pos)
(Fposition_symbol): New functions.
(symbols_with_pos_enabled): New boolean variable.

* src/fns.c (internal_equal, hash_lookup): Handle symbols with position.

* src/keyboard.c (recursive_edit_1): Bind Qsymbols_with_pos_enabled and
Qprint_symbols_bare to nil.

* src/lisp.h (lisp_h_PSEUDOVECTORP): New macro.
(lisp_h_BASE_EQ): New name for the former lisp_h_EQ.
(lisp_h_EQ): Extended to handle symbols with position.
(lisp_h_NILP): Now uses BASE_EQ rather than EQ.
(lisp_h_SYMBOL_WITH_POS_P, lisp_h_BARE_SYMBOL_P): New macros.
(lisp_h_SYMBOLP): Redefined to handle symbols with position.
(BARE_SYMBOL_P, BASE_EQ): New macros.
(SYMBOLP (macro)): Removed.
(SYMBOLP (function), XSYMBOL, make_lisp_symbol, builtin_lisp_symbol)
(c_symbol_p): Moved to later in file.
(struct Lisp_Symbol_With_Pos): New data type.
(pvec_type): PVEC_SYMBOL_WITH_POS: New type code.
(PSEUDOVECTORP): Redefined to use the lisp_h_PSEUDOVECTORP.
(BARE_SYMBOL_P, SYMBOL_WITH_POS_P, SYMBOLP, XSYMBOL_WITH_POS, XBARE_SYMBOL)
(XSYMBOL, make_lisp_symbol, builtin_lisp_symbol, c_symbol_p, CHECK_SYMBOL)
(BASE_EQ): New functions, or functions moved from earlier in the file.
(SYMBOL_WITH_POS_SYM, SYMBOL_WITH_POS_POS): New INLINE functions.

* src/lread.c (read0, read1, read_list, read_vector, read_internal_start)
(list2): Add a new bool parameter locate_syms.
(Fread_positioning_symbols): New function.
(Fread_from_string, read_internal_start, read0, read1, read_list): Pass around
suitable values for locate_syms.
(read1): Build symbols with position when locate_syms is true.

* src/print.c (print_vectorlike): Add handling for PVEC_SYMBOL_WITH_POS.
(print_object): Replace EQ with BASE_EQ.
(print_symbols_bare): New boolean variable.
2021-11-29 11:19:31 +00:00
..
advice.el ; More stylistic docfixes in emacs-lisp/*.el found by checkdoc 2021-09-18 13:14:50 +02:00
autoload.el Note that loaddefs.el is copied to ldefs-boot.el 2021-11-11 04:08:51 +01:00
avl-tree.el ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
backquote.el Expand the ` doc string slightly 2021-09-26 08:47:08 +02:00
backtrace.el Make results details in ert-run-tests-batch configurable 2021-11-16 08:48:24 +01:00
benchmark.el * lisp/emacs-lisp/benchmark.el (benchmark-elapse): Tweak 2021-06-11 14:06:29 -04:00
bindat.el Evaluate eql specializers 2021-08-03 18:26:15 -04:00
byte-opt.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
byte-run.el Mark def* macros for indentation 2021-10-13 21:52:57 +02:00
bytecomp.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
cconv.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
chart.el EIEIO: Promote the CLOS behavior over the EIEIO-specific behavior 2021-06-12 16:22:03 -04:00
check-declare.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
checkdoc.el * lisp/emacs-lisp/checkdoc.el (checkdoc-dired): Autoload. 2021-11-12 11:41:37 +01:00
cl-extra.el ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
cl-generic.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
cl-indent.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
cl-lib.el Move generalized variable specs from cl-lib.el to gv.el 2021-07-22 00:21:34 +02:00
cl-macs.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
cl-preloaded.el * lisp/emacs-lisp/cl-preloaded.el: Fix the format of props in slot-descs 2021-06-24 17:32:20 -04:00
cl-print.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
cl-seq.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
comp-cstr.el Don't quote nil and t in doc strings and comments 2021-09-21 22:11:43 +02:00
comp.el * lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix target dir. 2021-10-16 10:56:50 +02:00
copyright.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
crm.el Set minibuffer-completion-* variables locally in more places 2021-11-11 06:16:52 +01:00
cursor-sensor.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
debug.el Use format-prompt for many more prompts 2021-10-05 03:44:56 +02:00
derived.el Mark def* macros for indentation 2021-10-13 21:52:57 +02:00
disass.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
easy-mmode.el Mark def* macros for indentation 2021-10-13 21:52:57 +02:00
easymenu.el * lisp/emacs-lisp/easymenu.el (easy-menu-do-define): Fix bug#50051 2021-08-14 12:22:57 -04:00
edebug.el Use format-prompt for many more prompts 2021-10-05 03:44:56 +02:00
eieio-base.el ; More stylistic docfixes in emacs-lisp/*.el found by checkdoc 2021-09-18 13:14:50 +02:00
eieio-compat.el Mark def* macros for indentation 2021-10-13 21:52:57 +02:00
eieio-core.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
eieio-custom.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
eieio-datadebug.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
eieio-opt.el Use string-search instead of string-match[-p] 2021-08-09 11:35:56 +02:00
eieio-speedbar.el Use string-search instead of string-match[-p] 2021-08-09 11:35:56 +02:00
eieio.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
eldoc.el Fix eldoc usage of newly introduced variable 2021-11-18 10:35:12 +01:00
elint.el ; More stylistic docfixes in emacs-lisp/*.el found by checkdoc 2021-09-18 13:14:50 +02:00
elp.el Update elp-not-profilable 2021-10-18 10:40:08 +02:00
ert-x.el ; Fix some recent typos/thinkos. 2021-11-07 12:59:18 +02:00
ert.el Fixup for bug#51037 2021-11-18 17:03:43 +03:00
ewoc.el ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
faceup.el Don't quote nil and t in doc strings and comments 2021-09-21 22:11:43 +02:00
find-func.el Make `find-function-source-path' into obsolete alias 2021-09-14 13:44:20 +02:00
float-sup.el * lisp/emacs-lisp/float-sup.el (pi): Actually mark it as obsolete 2021-04-12 12:53:53 -04:00
generator.el Improve doc strings of a recent commit 2021-09-18 14:56:55 +03:00
generic.el Prefer defvar-local in emacs-lisp/*.el 2021-01-31 14:55:53 +01:00
gv.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
helper.el Use lexical-binding in all of lisp/emacs-lisp 2021-01-28 14:42:21 -05:00
hierarchy.el ; * etc/NEWS: Improve wording of an item. 2021-09-21 22:21:31 +02:00
inline.el * lisp/emacs-lisp/cconv.el: Improve line-nb info of unused var warnings 2021-02-26 20:24:52 -05:00
let-alist.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
lisp-mnt.el Add test for lm-website 2021-09-26 14:55:19 +02:00
lisp-mode.el Indent `closure' forms better 2021-11-25 14:41:45 +01:00
lisp.el Reformat up-list and backward-up-list doc strings 2021-09-02 10:22:52 +02:00
macroexp.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
map-ynp.el Use substitute-command-keys for literal key sequences 2021-11-22 12:04:19 +01:00
map.el * lisp/emacs-lisp/map.el: Restore compatibility with Emacs-26 2021-09-28 10:29:27 -04:00
memory-report.el Rename button-buttonize to buttonize 2021-11-04 18:14:29 +01:00
nadvice.el ; More stylistic docfixes in emacs-lisp/*.el found by checkdoc 2021-09-18 13:14:50 +02:00
package-x.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
package.el Merge from origin/emacs-28 2021-11-12 07:17:11 +01:00
pcase.el First commit of scratch/correct-warning-pos. 2021-11-29 11:19:31 +00:00
pp.el Fix pp-emacs-lisp-code for `when' and related 2021-11-07 02:44:42 +01:00
radix-tree.el Evaluate eql specializers 2021-08-03 18:26:15 -04:00
re-builder.el Use substitute-command-keys for literal key sequences 2021-11-22 12:04:19 +01:00
regexp-opt.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
regi.el Use lexical-binding in all of lisp/emacs-lisp 2021-01-28 14:42:21 -05:00
ring.el ; Remove some useless comments 2021-04-16 14:54:02 +02:00
rmc.el Fix a recent change in rmc.el 2021-05-07 17:09:44 +03:00
rx.el Add example of advanced user-defined Rx form to manual 2021-08-23 19:57:17 +02:00
seq.el Revert "Obsolete local set difference functions in favor of seq-difference" 2021-09-29 17:28:02 +02:00
shadow.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
shortdoc.el Make UCS compose/decompose functions more understandable 2021-11-19 07:46:06 +01:00
shorthands.el Move lisp/shorthands.el to lisp/emacs-lisp/shorthands.el 2021-10-29 14:37:08 +02:00
smie.el ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
subr-x.el Remove APPEND argument from add-display-text-property 2021-11-24 20:10:17 +01:00
syntax.el Give 'syntax-propertize-wholelines' a docstring. 2021-05-30 22:38:48 +02:00
tabulated-list.el Support inserting images in tabulated-list-mode columns 2021-11-02 17:44:57 +01:00
tcover-ses.el ; Normalize and add missing first and last lines 2021-04-19 12:21:01 +02:00
testcover.el ; More stylistic docfixes in emacs-lisp/*.el found by checkdoc 2021-09-18 13:14:50 +02:00
text-property-search.el Even further `text-property-search-forward' clarifications 2021-05-12 19:01:53 +02:00
thunk.el ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
timer-list.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
timer.el ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
tq.el Update copyright year to 2021 2021-01-01 01:13:56 -08:00
trace.el * lisp/emacs-lisp/trace.el (trace-values): Work outside of traced function 2021-03-02 09:13:57 -05:00
unsafep.el ; Normalize and add missing first and last lines 2021-04-19 12:21:01 +02:00
warnings.el Use string-search instead of string-match[-p] 2021-08-09 11:35:56 +02:00