From: Dmitry Gutov Date: Tue, 5 May 2015 12:28:41 +0000 (+0300) Subject: Work around "Attempt to modify read-only object" X-Git-Tag: emacs-25.0.90~2199 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=755045e1eb27703a117e74bd5047928795f4a4e9;p=emacs.git 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. --- 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." (setq file (substring file 0 -1))) (xref-make-elisp-location sym type file)))) +(defvar elisp--xref-format + (let ((str "(%s %s)")) + (put-text-property 1 3 'face 'font-lock-keyword-face str) + (put-text-property 4 6 'face 'font-lock-function-name-face str) + str)) + (defun elisp--xref-find-definitions (symbol) (save-excursion - (let ((fmt "(%s %s)") - lst) - (put-text-property 1 3 'face 'font-lock-keyword-face fmt) - (put-text-property 4 6 'face 'font-lock-function-name-face fmt) + (let (lst) (dolist (type '(feature defface defvar defun)) (let ((loc (condition-case err @@ -642,7 +645,7 @@ It can be quoted, or be inside a quoted form." (xref-make-bogus-location (error-message-string err)))))) (when loc (push - (xref-make (format fmt type symbol) + (xref-make (format elisp--xref-format type symbol) loc) lst)))) lst)))