diff options
| author | Dmitry Gutov | 2015-05-05 15:28:41 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-05-05 15:28:41 +0300 |
| commit | 755045e1eb27703a117e74bd5047928795f4a4e9 (patch) | |
| tree | ad154babfe38a1dd0a047a200b37b4892ab41ac3 | |
| parent | fbe7fb054755b9bfe1375691d3c774cb84236859 (diff) | |
| download | emacs-755045e1eb27703a117e74bd5047928795f4a4e9.tar.gz emacs-755045e1eb27703a117e74bd5047928795f4a4e9.zip | |
Work around "Attempt to modify read-only object"
* lisp/progmodes/elisp-mode.el (elisp--xref-format): Extract from
elisp--xref-find-definitions, to work around "Attempt to modify
read-only object" error.
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index f085dcfbef3..dac807e4334 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -628,12 +628,15 @@ It can be quoted, or be inside a quoted form." | |||
| 628 | (setq file (substring file 0 -1))) | 628 | (setq file (substring file 0 -1))) |
| 629 | (xref-make-elisp-location sym type file)))) | 629 | (xref-make-elisp-location sym type file)))) |
| 630 | 630 | ||
| 631 | (defvar elisp--xref-format | ||
| 632 | (let ((str "(%s %s)")) | ||
| 633 | (put-text-property 1 3 'face 'font-lock-keyword-face str) | ||
| 634 | (put-text-property 4 6 'face 'font-lock-function-name-face str) | ||
| 635 | str)) | ||
| 636 | |||
| 631 | (defun elisp--xref-find-definitions (symbol) | 637 | (defun elisp--xref-find-definitions (symbol) |
| 632 | (save-excursion | 638 | (save-excursion |
| 633 | (let ((fmt "(%s %s)") | 639 | (let (lst) |
| 634 | lst) | ||
| 635 | (put-text-property 1 3 'face 'font-lock-keyword-face fmt) | ||
| 636 | (put-text-property 4 6 'face 'font-lock-function-name-face fmt) | ||
| 637 | (dolist (type '(feature defface defvar defun)) | 640 | (dolist (type '(feature defface defvar defun)) |
| 638 | (let ((loc | 641 | (let ((loc |
| 639 | (condition-case err | 642 | (condition-case err |
| @@ -642,7 +645,7 @@ It can be quoted, or be inside a quoted form." | |||
| 642 | (xref-make-bogus-location (error-message-string err)))))) | 645 | (xref-make-bogus-location (error-message-string err)))))) |
| 643 | (when loc | 646 | (when loc |
| 644 | (push | 647 | (push |
| 645 | (xref-make (format fmt type symbol) | 648 | (xref-make (format elisp--xref-format type symbol) |
| 646 | loc) | 649 | loc) |
| 647 | lst)))) | 650 | lst)))) |
| 648 | lst))) | 651 | lst))) |