aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorAlan Mackenzie2021-12-01 20:03:44 +0000
committerAlan Mackenzie2021-12-01 20:03:44 +0000
commit8f1106ddf2a3861e9c1ebb9d8fa3d4087899de81 (patch)
tree51c009f7f727cb93d6cfb681bbb2492bd7536a0e /src/data.c
parent368570b3fd09d03ac5b9276d1ca85ae813c3f385 (diff)
downloademacs-8f1106ddf2a3861e9c1ebb9d8fa3d4087899de81.tar.gz
emacs-8f1106ddf2a3861e9c1ebb9d8fa3d4087899de81.zip
Several amendments to scratch/correct-warning-pos.
The position return by read-positioning-symbols is now the position in the buffer, rather than the offset from the start of a form, enabling warning positions in other parts of the buffer to be output. * src/lisp.h (lisp_h_EQ): Add XLI casts so that it compiles cleanly. * src/data.c (Fremove_pos_from_symbol): New DEFUN. * src/lread.c (readchar_count): renamed to readchar_offset. (read_internal_start) Initialize readchar_offset to the buffer's point when STREAM is a buffer. * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): Amend to use OFFSET as a buffer position, not an offset from the start of a form. (byte-compile-warn): Remove symbol positions from any shape of ARGS, not just a symbol with position. * lisp/emacs-lisp/cconv.c (cconv-convert): In the :unused case, position the new IGNORE symbol with the VAR it has replaced. * lisp/emacs-lisp/macroexp.el (macroexp--warn-wrap, macroexp-warn-and-return): Add an extra position parameter to each. * lisp/emacs-lisp/bindat.el (bindat-type), lisp/emacs-lisp/byte-run.el (defmacro, defun), lisp/emacs-lisp/cconv.el (cconv--convert-func-body) (cconv-convert), lisp/emacs-lisp/cl-generic.el (cl-defmethod), lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet, cl-defstruct), lisp/emacs-lisp/easy-mmode.el (define-minor-mode), lisp/emacs-lisp/eieio-core.el (eieio-oref, eieio-oref-default) (eieio-oset-default), lisp/emacs-lisp/eieio.el (defclass), lisp/emacs-lisp/gv.el (gv-ref), lisp/emacs-lisp/macroexp.el (macroexp-macroexpand, macroexp--unfold-lambda, macroexp--expand-all), lisp/emacs-lisp/pcase.el (pcase-compile-patterns, pcase--u1): Add an extra position argument to each call of macroexp-warn-and-return.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/data.c b/src/data.c
index b3b157a7f39..1f2af6f4743 100644
--- a/src/data.c
+++ b/src/data.c
@@ -776,7 +776,7 @@ DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
776 776
777DEFUN ("bare-symbol", Fbare_symbol, Sbare_symbol, 1, 1, 0, 777DEFUN ("bare-symbol", Fbare_symbol, Sbare_symbol, 1, 1, 0,
778 doc: /* Extract, if need be, the bare symbol from SYM, a symbol. */) 778 doc: /* Extract, if need be, the bare symbol from SYM, a symbol. */)
779 (register Lisp_Object sym) 779 (register Lisp_Object sym)
780{ 780{
781 if (BARE_SYMBOL_P (sym)) 781 if (BARE_SYMBOL_P (sym))
782 return sym; 782 return sym;
@@ -786,12 +786,23 @@ DEFUN ("bare-symbol", Fbare_symbol, Sbare_symbol, 1, 1, 0,
786 786
787DEFUN ("symbol-with-pos-pos", Fsymbol_with_pos_pos, Ssymbol_with_pos_pos, 1, 1, 0, 787DEFUN ("symbol-with-pos-pos", Fsymbol_with_pos_pos, Ssymbol_with_pos_pos, 1, 1, 0,
788 doc: /* Extract the position from a symbol with position. */) 788 doc: /* Extract the position from a symbol with position. */)
789 (register Lisp_Object ls) 789 (register Lisp_Object ls)
790{ 790{
791 /* Type checking is done in the following macro. */ 791 /* Type checking is done in the following macro. */
792 return SYMBOL_WITH_POS_POS (ls); 792 return SYMBOL_WITH_POS_POS (ls);
793} 793}
794 794
795DEFUN ("remove-pos-from-symbol", Fremove_pos_from_symbol,
796 Sremove_pos_from_symbol, 1, 1, 0,
797 doc: /* If ARG is a symbol with position, return it without the position.
798Otherwise, return ARG unchanged. Compare with `bare-symbol'. */)
799 (register Lisp_Object arg)
800{
801 if (SYMBOL_WITH_POS_P (arg))
802 return (SYMBOL_WITH_POS_SYM (arg));
803 return arg;
804}
805
795DEFUN ("position-symbol", Fposition_symbol, Sposition_symbol, 2, 2, 0, 806DEFUN ("position-symbol", Fposition_symbol, Sposition_symbol, 2, 2, 0,
796 doc: /* Create a new symbol with position. 807 doc: /* Create a new symbol with position.
797SYM is a symbol, with or without position, the symbol to position. 808SYM is a symbol, with or without position, the symbol to position.
@@ -4193,6 +4204,7 @@ syms_of_data (void)
4193 defsubr (&Ssymbol_name); 4204 defsubr (&Ssymbol_name);
4194 defsubr (&Sbare_symbol); 4205 defsubr (&Sbare_symbol);
4195 defsubr (&Ssymbol_with_pos_pos); 4206 defsubr (&Ssymbol_with_pos_pos);
4207 defsubr (&Sremove_pos_from_symbol);
4196 defsubr (&Sposition_symbol); 4208 defsubr (&Sposition_symbol);
4197 defsubr (&Smakunbound); 4209 defsubr (&Smakunbound);
4198 defsubr (&Sfmakunbound); 4210 defsubr (&Sfmakunbound);