diff options
| author | Dmitry Gutov | 2021-10-19 17:32:35 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2021-10-19 17:33:08 +0300 |
| commit | cd4bb985406e66e9cd1a5424b49d48818a99311d (patch) | |
| tree | 6ec1ade827c45a3b18bd846e75842e489c245ec8 | |
| parent | f6826800ea1b2176a7166044d9f769c22a0c9330 (diff) | |
| download | emacs-cd4bb985406e66e9cd1a5424b49d48818a99311d.tar.gz emacs-cd4bb985406e66e9cd1a5424b49d48818a99311d.zip | |
Fix Emacs 26 support in xref.el
* lisp/progmodes/xref.el (xref--defstruct): New macro.
(xref-item, xref-match-item): Use it in definitions.
| -rw-r--r-- | lisp/progmodes/xref.el | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 52a4e0c5435..8c8687c0d6b 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -195,16 +195,23 @@ is not known." | |||
| 195 | 195 | ||
| 196 | ;;; Cross-reference | 196 | ;;; Cross-reference |
| 197 | 197 | ||
| 198 | (cl-defstruct (xref-item | 198 | (defmacro xref--defstruct (name &rest fields) |
| 199 | (:constructor xref-make (summary location)) | 199 | (declare (indent 1)) |
| 200 | (:noinline t)) | 200 | `(cl-defstruct ,(if (>= emacs-major-version 27) |
| 201 | name | ||
| 202 | (remq (assq :noinline name) name)) | ||
| 203 | ,@fields)) | ||
| 204 | |||
| 205 | (xref--defstruct (xref-item | ||
| 206 | (:constructor xref-make (summary location)) | ||
| 207 | (:noinline t)) | ||
| 201 | "An xref item describes a reference to a location somewhere." | 208 | "An xref item describes a reference to a location somewhere." |
| 202 | summary location) | 209 | summary location) |
| 203 | 210 | ||
| 204 | (cl-defstruct (xref-match-item | 211 | (xref--defstruct (xref-match-item |
| 205 | (:include xref-item) | 212 | (:include xref-item) |
| 206 | (:constructor xref-make-match (summary location length)) | 213 | (:constructor xref-make-match (summary location length)) |
| 207 | (:noinline t)) | 214 | (:noinline t)) |
| 208 | "A match xref item describes a search result." | 215 | "A match xref item describes a search result." |
| 209 | length) | 216 | length) |
| 210 | 217 | ||