diff options
| author | Lars Ingebrigtsen | 2022-02-14 12:00:22 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-02-14 12:00:22 +0100 |
| commit | d52d913fa032a6cd1b6422cbbd44169b318ca174 (patch) | |
| tree | d7ffaade323b584e56ef31fd1fff4846c1d82ba0 | |
| parent | 35bb4c1c3c64d09d9dea0ed7ba0314893e8f5f3c (diff) | |
| download | emacs-d52d913fa032a6cd1b6422cbbd44169b318ca174.tar.gz emacs-d52d913fa032a6cd1b6422cbbd44169b318ca174.zip | |
Don't signal errors in abbrev-table-p
* lisp/abbrev.el (abbrev-table-p): Ignore the error.
* src/lread.c (oblookup): Signal `wrong-type-argument' instead of
`error' if it turns out that we're not really in an obarray (bug#53988).
| -rw-r--r-- | lisp/abbrev.el | 3 | ||||
| -rw-r--r-- | src/lread.c | 5 | ||||
| -rw-r--r-- | test/lisp/abbrev-tests.el | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 44328a2b283..214f7435d91 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el | |||
| @@ -475,7 +475,8 @@ PROPS is a list of properties." | |||
| 475 | (defun abbrev-table-p (object) | 475 | (defun abbrev-table-p (object) |
| 476 | "Return non-nil if OBJECT is an abbrev table." | 476 | "Return non-nil if OBJECT is an abbrev table." |
| 477 | (and (obarrayp object) | 477 | (and (obarrayp object) |
| 478 | (numberp (abbrev-table-get object :abbrev-table-modiff)))) | 478 | (numberp (ignore-error 'wrong-type-argument |
| 479 | (abbrev-table-get object :abbrev-table-modiff))))) | ||
| 479 | 480 | ||
| 480 | (defun abbrev-table-empty-p (object &optional ignore-system) | 481 | (defun abbrev-table-empty-p (object &optional ignore-system) |
| 481 | "Return nil if there are no abbrev symbols in OBJECT. | 482 | "Return nil if there are no abbrev symbols in OBJECT. |
diff --git a/src/lread.c b/src/lread.c index 502db1a8de5..58b40ef37e3 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -4626,7 +4626,9 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff | |||
| 4626 | if (EQ (bucket, make_fixnum (0))) | 4626 | if (EQ (bucket, make_fixnum (0))) |
| 4627 | ; | 4627 | ; |
| 4628 | else if (!SYMBOLP (bucket)) | 4628 | else if (!SYMBOLP (bucket)) |
| 4629 | error ("Bad data in guts of obarray"); /* Like CADR error message. */ | 4629 | /* Like CADR error message. */ |
| 4630 | xsignal2 (Qwrong_type_argument, Qobarrayp, | ||
| 4631 | build_string ("Bad data in guts of obarray")); | ||
| 4630 | else | 4632 | else |
| 4631 | for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->u.s.next)) | 4633 | for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->u.s.next)) |
| 4632 | { | 4634 | { |
| @@ -5438,6 +5440,7 @@ This variable's value can only be set via file-local variables. | |||
| 5438 | See Info node `(elisp)Shorthands' for more details. */); | 5440 | See Info node `(elisp)Shorthands' for more details. */); |
| 5439 | Vread_symbol_shorthands = Qnil; | 5441 | Vread_symbol_shorthands = Qnil; |
| 5440 | DEFSYM (Qobarray_cache, "obarray-cache"); | 5442 | DEFSYM (Qobarray_cache, "obarray-cache"); |
| 5443 | DEFSYM (Qobarrayp, "obarrayp"); | ||
| 5441 | 5444 | ||
| 5442 | DEFSYM (Qmacroexp__dynvars, "macroexp--dynvars"); | 5445 | DEFSYM (Qmacroexp__dynvars, "macroexp--dynvars"); |
| 5443 | DEFVAR_LISP ("macroexp--dynvars", Vmacroexp__dynvars, | 5446 | DEFVAR_LISP ("macroexp--dynvars", Vmacroexp__dynvars, |
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el index 394eae48ee3..947178473e4 100644 --- a/test/lisp/abbrev-tests.el +++ b/test/lisp/abbrev-tests.el | |||
| @@ -301,6 +301,10 @@ | |||
| 301 | (inverse-add-abbrev table "Global" -1))) | 301 | (inverse-add-abbrev table "Global" -1))) |
| 302 | (should (string= (abbrev-expansion "text" table) "bar")))) | 302 | (should (string= (abbrev-expansion "text" table) "bar")))) |
| 303 | 303 | ||
| 304 | (ert-deftest test-abbrev-table-p () | ||
| 305 | (should-not (abbrev-table-p translation-table-vector)) | ||
| 306 | (should (abbrev-table-p (make-abbrev-table)))) | ||
| 307 | |||
| 304 | (provide 'abbrev-tests) | 308 | (provide 'abbrev-tests) |
| 305 | 309 | ||
| 306 | ;;; abbrev-tests.el ends here | 310 | ;;; abbrev-tests.el ends here |