aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorAlan Mackenzie2016-03-30 16:53:36 +0000
committerAlan Mackenzie2016-03-30 16:53:36 +0000
commited19f207449c43f7f08285ada87ae7a46c61c8d1 (patch)
treefc495d64b752f276f1e8dc86427098de80789988 /lisp/progmodes
parenteabd667a9584fe5bd2422e296d256dceea67debf (diff)
parent7c1802f6ffc2704ba8042c7c1c6faa73dfa210d1 (diff)
downloademacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.tar.gz
emacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.zip
Merge branch 'emacs-25' of /home/acm/emacs/emacs.git/emacs-25 into emacs-25
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-defs.el2
-rw-r--r--lisp/progmodes/compile.el8
-rw-r--r--lisp/progmodes/elisp-mode.el2
-rw-r--r--lisp/progmodes/idlw-toolbar.el4
-rw-r--r--lisp/progmodes/prog-mode.el68
-rw-r--r--lisp/progmodes/python.el36
-rw-r--r--lisp/progmodes/ruby-mode.el49
-rw-r--r--lisp/progmodes/xref.el11
8 files changed, 52 insertions, 128 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 3b9f44e55a0..f458904c87a 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1407,7 +1407,7 @@ been put there by c-put-char-property. POINT remains unchanged."
1407 (c-state-cache-good-pos c-state-cache-good-pos) 1407 (c-state-cache-good-pos c-state-cache-good-pos)
1408 ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) 1408 ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache))
1409 ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) 1409 ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit)
1410 ;(c-state-semi-nonlit-pos-cache (copy-treec c-state-semi-nonlit-pos-cache)) 1410 ;(c-state-semi-nonlit-pos-cache (copy-tree c-state-semi-nonlit-pos-cache))
1411 ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) 1411 ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache)
1412 (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) 1412 (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert))
1413 (c-state-point-min c-state-point-min) 1413 (c-state-point-min c-state-point-min)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index b7ab408f744..0b15a283090 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1702,6 +1702,14 @@ Returns the compilation buffer created."
1702 (list "TERM=emacs" 1702 (list "TERM=emacs"
1703 (format "TERMCAP=emacs:co#%d:tc=unknown:" 1703 (format "TERMCAP=emacs:co#%d:tc=unknown:"
1704 (window-width)))) 1704 (window-width))))
1705
1706 ;; Set the EMACS variable, but
1707 ;; don't override users' setting of $EMACS.
1708 ;; Remove this hack once Bash 4.4-or-later is common,
1709 ;; since it can break 'configure'.
1710 (unless (getenv "EMACS")
1711 (list "EMACS=t"))
1712
1705 (list (format "INSIDE_EMACS=%s,compile" emacs-version)) 1713 (list (format "INSIDE_EMACS=%s,compile" emacs-version))
1706 (copy-sequence process-environment)))) 1714 (copy-sequence process-environment))))
1707 (set (make-local-variable 'compilation-arguments) 1715 (set (make-local-variable 'compilation-arguments)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 9e175a20e22..fc4501d0cbe 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -575,7 +575,7 @@ It can be quoted, or be inside a quoted form."
575 " " (cadr table-etc))) 575 " " (cadr table-etc)))
576 (cddr table-etc))))))))) 576 (cddr table-etc)))))))))
577 577
578(defun lisp-completion-at-point (_predicate) 578(defun lisp-completion-at-point (&optional _predicate)
579 (declare (obsolete elisp-completion-at-point "25.1")) 579 (declare (obsolete elisp-completion-at-point "25.1"))
580 (elisp-completion-at-point)) 580 (elisp-completion-at-point))
581 581
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el
index 0e0714e27ed..d857bfd88c3 100644
--- a/lisp/progmodes/idlw-toolbar.el
+++ b/lisp/progmodes/idlw-toolbar.el
@@ -439,7 +439,7 @@ static char * file[] = {
439\" \", 439\" \",
440\" \", 440\" \",
441\" \"};") 441\" \"};")
442 "The Cont icon.") 442 "The Cont icon.")
443 443
444(defvar idlwave-toolbar-to-here-icon 444(defvar idlwave-toolbar-to-here-icon
445 (idlwave-toolbar-make-button 445 (idlwave-toolbar-make-button
@@ -918,7 +918,7 @@ static char * file[] = {
918 (help (aref x 3)) 918 (help (aref x 3))
919 (key (vector 'tool-bar func)) 919 (key (vector 'tool-bar func))
920 (def (list 'menu-item 920 (def (list 'menu-item
921 "a" 921 ""
922 func 922 func
923 :image (symbol-value icon) 923 :image (symbol-value icon)
924 :visible show 924 :visible show
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 718b33932ed..3f25a0c0647 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -49,53 +49,6 @@
49 map) 49 map)
50 "Keymap used for programming modes.") 50 "Keymap used for programming modes.")
51 51
52(defvar prog-indentation-context nil
53 "When non-nil, provides context for indenting embedded code chunks.
54
55There are languages where part of the code is actually written in
56a sub language, e.g., a Yacc/Bison or ANTLR grammar also consists
57of plain C code. This variable enables the major mode of the
58main language to use the indentation engine of the sub-mode for
59lines in code chunks written in the sub-mode's language.
60
61When a major mode of such a main language decides to delegate the
62indentation of a line/region to the indentation engine of the sub
63mode, it should bind this variable to non-nil around the call.
64
65The non-nil value should be a list of the form:
66
67 (FIRST-COLUMN (START . END) PREVIOUS-CHUNKS)
68
69FIRST-COLUMN is the column the indentation engine of the sub-mode
70should use for top-level language constructs inside the code
71chunk (instead of 0).
72
73START and END specify the region of the code chunk. END can be
74nil, which stands for the value of `point-max'. The function
75`prog-widen' uses this to restore restrictions imposed by the
76sub-mode's indentation engine.
77
78PREVIOUS-CHUNKS, if non-nil, provides the indentation engine of
79the sub-mode with the virtual context of the code chunk. Valid
80values are:
81
82 - A string containing text which the indentation engine can
83 consider as standing in front of the code chunk. To cache the
84 string's calculated syntactic information for repeated calls
85 with the same string, the sub-mode can add text-properties to
86 the string.
87
88 A typical use case is for grammars with code chunks which are
89 to be indented like function bodies -- the string would contain
90 the corresponding function preamble.
91
92 - A function, to be called with the start position of the current
93 chunk. It should return either the region of the previous chunk
94 as (PREV-START . PREV-END), or nil if there is no previous chunk.
95
96 A typical use case are literate programming sources -- the
97 function would successively return the previous code chunks.")
98
99(defun prog-indent-sexp (&optional defun) 52(defun prog-indent-sexp (&optional defun)
100 "Indent the expression after point. 53 "Indent the expression after point.
101When interactively called with prefix, indent the enclosing defun 54When interactively called with prefix, indent the enclosing defun
@@ -109,27 +62,6 @@ instead."
109 (end (progn (forward-sexp 1) (point)))) 62 (end (progn (forward-sexp 1) (point))))
110 (indent-region start end nil)))) 63 (indent-region start end nil))))
111 64
112(defun prog-first-column ()
113 "Return the indentation column normally used for top-level constructs."
114 (or (car prog-indentation-context) 0))
115
116(defun prog-widen ()
117 "Remove restrictions (narrowing) from current code chunk or buffer.
118This function should be used instead of `widen' in any function used
119by the indentation engine to make it respect the value of
120`prog-indentation-context'.
121
122This function (like `widen') is useful inside a
123`save-restriction' to make the indentation correctly work when
124narrowing is in effect."
125 (let ((chunk (cadr prog-indentation-context)))
126 (if chunk
127 ;; No call to `widen' is necessary here, as narrow-to-region
128 ;; changes (not just narrows) the existing restrictions
129 (narrow-to-region (car chunk) (or (cdr chunk) (point-max)))
130 (widen))))
131
132
133(defvar-local prettify-symbols-alist nil 65(defvar-local prettify-symbols-alist nil
134 "Alist of symbol prettifications. 66 "Alist of symbol prettifications.
135Each element looks like (SYMBOL . CHARACTER), where the symbol 67Each element looks like (SYMBOL . CHARACTER), where the symbol
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5aeefe47a54..90097df7ef1 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -283,18 +283,6 @@
283 :version "24.3" 283 :version "24.3"
284 :link '(emacs-commentary-link "python")) 284 :link '(emacs-commentary-link "python"))
285 285
286
287;;; 24.x Compat
288
289
290(unless (fboundp 'prog-widen)
291 (defun prog-widen ()
292 (widen)))
293
294(unless (fboundp 'prog-first-column)
295 (defun prog-first-column ()
296 0))
297
298 286
299;;; Bindings 287;;; Bindings
300 288
@@ -761,7 +749,7 @@ work on `python-indent-calculate-indentation' instead."
761 (interactive) 749 (interactive)
762 (save-excursion 750 (save-excursion
763 (save-restriction 751 (save-restriction
764 (prog-widen) 752 (widen)
765 (goto-char (point-min)) 753 (goto-char (point-min))
766 (let ((block-end)) 754 (let ((block-end))
767 (while (and (not block-end) 755 (while (and (not block-end)
@@ -860,7 +848,7 @@ keyword
860 - Point is on a line starting a dedenter block. 848 - Point is on a line starting a dedenter block.
861 - START is the position where the dedenter block starts." 849 - START is the position where the dedenter block starts."
862 (save-restriction 850 (save-restriction
863 (prog-widen) 851 (widen)
864 (let ((ppss (save-excursion 852 (let ((ppss (save-excursion
865 (beginning-of-line) 853 (beginning-of-line)
866 (syntax-ppss)))) 854 (syntax-ppss))))
@@ -1007,10 +995,10 @@ current context or a list of integers. The latter case is only
1007happening for :at-dedenter-block-start context since the 995happening for :at-dedenter-block-start context since the
1008possibilities can be narrowed to specific indentation points." 996possibilities can be narrowed to specific indentation points."
1009 (save-restriction 997 (save-restriction
1010 (prog-widen) 998 (widen)
1011 (save-excursion 999 (save-excursion
1012 (pcase (python-indent-context) 1000 (pcase (python-indent-context)
1013 (`(:no-indent . ,_) (prog-first-column)) ; usually 0 1001 (`(:no-indent . ,_) 0)
1014 (`(,(or :after-line 1002 (`(,(or :after-line
1015 :after-comment 1003 :after-comment
1016 :inside-string 1004 :inside-string
@@ -1048,7 +1036,7 @@ possibilities can be narrowed to specific indentation points."
1048 (let ((opening-block-start-points 1036 (let ((opening-block-start-points
1049 (python-info-dedenter-opening-block-positions))) 1037 (python-info-dedenter-opening-block-positions)))
1050 (if (not opening-block-start-points) 1038 (if (not opening-block-start-points)
1051 (prog-first-column) ; if not found default to first column 1039 0 ; if not found default to first column
1052 (mapcar (lambda (pos) 1040 (mapcar (lambda (pos)
1053 (save-excursion 1041 (save-excursion
1054 (goto-char pos) 1042 (goto-char pos)
@@ -1066,7 +1054,7 @@ integers. Levels are returned in ascending order, and in the
1066case INDENTATION is a list, this order is enforced." 1054case INDENTATION is a list, this order is enforced."
1067 (if (listp indentation) 1055 (if (listp indentation)
1068 (sort (copy-sequence indentation) #'<) 1056 (sort (copy-sequence indentation) #'<)
1069 (nconc (number-sequence (prog-first-column) (1- indentation) 1057 (nconc (number-sequence 0 (1- indentation)
1070 python-indent-offset) 1058 python-indent-offset)
1071 (list indentation)))) 1059 (list indentation))))
1072 1060
@@ -1091,7 +1079,7 @@ minimum."
1091 (python-indent--previous-level levels (current-indentation)) 1079 (python-indent--previous-level levels (current-indentation))
1092 (if levels 1080 (if levels
1093 (apply #'max levels) 1081 (apply #'max levels)
1094 (prog-first-column))))) 1082 0))))
1095 1083
1096(defun python-indent-line (&optional previous) 1084(defun python-indent-line (&optional previous)
1097 "Internal implementation of `python-indent-line-function'. 1085 "Internal implementation of `python-indent-line-function'.
@@ -4479,7 +4467,7 @@ Optional argument INCLUDE-TYPE indicates to include the type of the defun.
4479This function can be used as the value of `add-log-current-defun-function' 4467This function can be used as the value of `add-log-current-defun-function'
4480since it returns nil if point is not inside a defun." 4468since it returns nil if point is not inside a defun."
4481 (save-restriction 4469 (save-restriction
4482 (prog-widen) 4470 (widen)
4483 (save-excursion 4471 (save-excursion
4484 (end-of-line 1) 4472 (end-of-line 1)
4485 (let ((names) 4473 (let ((names)
@@ -4662,7 +4650,7 @@ likely an invalid python file."
4662 (let ((point (python-info-dedenter-opening-block-position))) 4650 (let ((point (python-info-dedenter-opening-block-position)))
4663 (when point 4651 (when point
4664 (save-restriction 4652 (save-restriction
4665 (prog-widen) 4653 (widen)
4666 (message "Closes %s" (save-excursion 4654 (message "Closes %s" (save-excursion
4667 (goto-char point) 4655 (goto-char point)
4668 (buffer-substring 4656 (buffer-substring
@@ -4683,7 +4671,7 @@ statement."
4683With optional argument LINE-NUMBER, check that line instead." 4671With optional argument LINE-NUMBER, check that line instead."
4684 (save-excursion 4672 (save-excursion
4685 (save-restriction 4673 (save-restriction
4686 (prog-widen) 4674 (widen)
4687 (when line-number 4675 (when line-number
4688 (python-util-goto-line line-number)) 4676 (python-util-goto-line line-number))
4689 (while (and (not (eobp)) 4677 (while (and (not (eobp))
@@ -4699,7 +4687,7 @@ With optional argument LINE-NUMBER, check that line instead."
4699Optional argument LINE-NUMBER forces the line number to check against." 4687Optional argument LINE-NUMBER forces the line number to check against."
4700 (save-excursion 4688 (save-excursion
4701 (save-restriction 4689 (save-restriction
4702 (prog-widen) 4690 (widen)
4703 (when line-number 4691 (when line-number
4704 (python-util-goto-line line-number)) 4692 (python-util-goto-line line-number))
4705 (when (python-info-line-ends-backslash-p) 4693 (when (python-info-line-ends-backslash-p)
@@ -4716,7 +4704,7 @@ When current line is continuation of another return the point
4716where the continued line ends." 4704where the continued line ends."
4717 (save-excursion 4705 (save-excursion
4718 (save-restriction 4706 (save-restriction
4719 (prog-widen) 4707 (widen)
4720 (let* ((context-type (progn 4708 (let* ((context-type (progn
4721 (back-to-indentation) 4709 (back-to-indentation)
4722 (python-syntax-context-type))) 4710 (python-syntax-context-type)))
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 36c1aed529e..972bf99145e 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -368,7 +368,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
368 (exp (exp1) (exp "," exp) (exp "=" exp) 368 (exp (exp1) (exp "," exp) (exp "=" exp)
369 (id " @ " exp)) 369 (id " @ " exp))
370 (exp1 (exp2) (exp2 "?" exp1 ":" exp1)) 370 (exp1 (exp2) (exp2 "?" exp1 ":" exp1))
371 (exp2 (exp3) (exp3 "." exp2)) 371 (exp2 (exp3) (exp3 "." exp3))
372 (exp3 ("def" insts "end") 372 (exp3 ("def" insts "end")
373 ("begin" insts-rescue-insts "end") 373 ("begin" insts-rescue-insts "end")
374 ("do" insts "end") 374 ("do" insts "end")
@@ -388,7 +388,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
388 (cases (exp "then" insts) 388 (cases (exp "then" insts)
389 (cases "when" cases) (insts "else" insts)) 389 (cases "when" cases) (insts "else" insts))
390 (expseq (exp) );;(expseq "," expseq) 390 (expseq (exp) );;(expseq "," expseq)
391 (hashvals (id "=>" exp1) (hashvals "," hashvals)) 391 (hashvals (exp1 "=>" exp1) (hashvals "," hashvals))
392 (insts-rescue-insts (insts) 392 (insts-rescue-insts (insts)
393 (insts-rescue-insts "rescue" insts-rescue-insts) 393 (insts-rescue-insts "rescue" insts-rescue-insts)
394 (insts-rescue-insts "ensure" insts-rescue-insts)) 394 (insts-rescue-insts "ensure" insts-rescue-insts))
@@ -406,17 +406,18 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
406 '((right "=") 406 '((right "=")
407 (right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" 407 (right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^="
408 "<<=" ">>=" "&&=" "||=") 408 "<<=" ">>=" "&&=" "||=")
409 (left ".." "...") 409 (nonassoc ".." "...")
410 (left "+" "-")
411 (left "*" "/" "%" "**")
412 (left "&&" "||") 410 (left "&&" "||")
413 (left "^" "&" "|")
414 (nonassoc "<=>") 411 (nonassoc "<=>")
415 (nonassoc ">" ">=" "<" "<=")
416 (nonassoc "==" "===" "!=") 412 (nonassoc "==" "===" "!=")
417 (nonassoc "=~" "!~") 413 (nonassoc "=~" "!~")
414 (nonassoc ">" ">=" "<" "<=")
415 (left "^" "&" "|")
418 (left "<<" ">>") 416 (left "<<" ">>")
419 (right ".")))))) 417 (left "+" "-")
418 (left "*" "/" "%")
419 (left "**")
420 (assoc "."))))))
420 421
421(defun ruby-smie--bosp () 422(defun ruby-smie--bosp ()
422 (save-excursion (skip-chars-backward " \t") 423 (save-excursion (skip-chars-backward " \t")
@@ -443,7 +444,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
443 (member (save-excursion (ruby-smie--backward-token)) 444 (member (save-excursion (ruby-smie--backward-token))
444 '("iuwu-mod" "and" "or"))) 445 '("iuwu-mod" "and" "or")))
445 (save-excursion 446 (save-excursion
446 (forward-comment 1) 447 (forward-comment (point-max))
447 (looking-at "&?\\.")))))) 448 (looking-at "&?\\."))))))
448 449
449(defun ruby-smie--redundant-do-p (&optional skip) 450(defun ruby-smie--redundant-do-p (&optional skip)
@@ -629,19 +630,13 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
629 ;; because when `.' is inside the line, the 630 ;; because when `.' is inside the line, the
630 ;; additional indentation from it looks out of place. 631 ;; additional indentation from it looks out of place.
631 ((smie-rule-parent-p ".") 632 ((smie-rule-parent-p ".")
632 (let (smie--parent) 633 ;; Traverse up the call chain until the parent is not `.',
633 (save-excursion 634 ;; or `.' at indentation, or at eol.
634 ;; Traverse up the parents until the parent is "." at 635 (while (and (not (ruby-smie--bosp))
635 ;; indentation, or any other token. 636 (equal (nth 2 (smie-backward-sexp ".")) ".")
636 (while (and (let ((parent (smie-indent--parent))) 637 (not (ruby-smie--bosp)))
637 (goto-char (cadr parent)) 638 (forward-char -1))
638 (save-excursion 639 (smie-indent-virtual))
639 (unless (integerp (car parent)) (forward-char -1))
640 (not (ruby-smie--bosp))))
641 (progn
642 (setq smie--parent nil)
643 (smie-rule-parent-p "."))))
644 (smie-rule-parent))))
645 (t (smie-rule-parent)))))) 640 (t (smie-rule-parent))))))
646 (`(:after . ,(or `"(" "[" "{")) 641 (`(:after . ,(or `"(" "[" "{"))
647 ;; FIXME: Shouldn't this be the default behavior of 642 ;; FIXME: Shouldn't this be the default behavior of
@@ -661,7 +656,9 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
661 (`(:before . ".") 656 (`(:before . ".")
662 (if (smie-rule-sibling-p) 657 (if (smie-rule-sibling-p)
663 (and ruby-align-chained-calls 0) 658 (and ruby-align-chained-calls 0)
664 ruby-indent-level)) 659 (smie-backward-sexp ".")
660 (cons 'column (+ (current-column)
661 ruby-indent-level))))
665 (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) 662 (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure"))
666 (smie-rule-parent)) 663 (smie-rule-parent))
667 (`(:before . "when") 664 (`(:before . "when")
@@ -1377,7 +1374,7 @@ delimiter."
1377 (goto-char ruby-indent-point) 1374 (goto-char ruby-indent-point)
1378 (beginning-of-line) 1375 (beginning-of-line)
1379 (skip-syntax-forward " ") 1376 (skip-syntax-forward " ")
1380 (if (looking-at "\\.[^.]") 1377 (if (looking-at "\\.[^.]\\|&\\.")
1381 (+ indent ruby-indent-level) 1378 (+ indent ruby-indent-level)
1382 indent)))) 1379 indent))))
1383 1380
@@ -2176,7 +2173,7 @@ See `font-lock-syntax-table'.")
2176 'font-lock-string-face))) 2173 'font-lock-string-face)))
2177 ;; Perl-ish keywords. 2174 ;; Perl-ish keywords.
2178 "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" 2175 "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
2179 ;; Variables. 2176 ;; Singleton objects.
2180 (,(concat ruby-font-lock-keyword-beg-re 2177 (,(concat ruby-font-lock-keyword-beg-re
2181 "\\_<\\(nil\\|true\\|false\\)\\_>") 2178 "\\_<\\(nil\\|true\\|false\\)\\_>")
2182 1 font-lock-constant-face) 2179 1 font-lock-constant-face)
@@ -2184,7 +2181,7 @@ See `font-lock-syntax-table'.")
2184 ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" 2181 ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
2185 (0 font-lock-builtin-face)) 2182 (0 font-lock-builtin-face))
2186 ;; Symbols. 2183 ;; Symbols.
2187 ("\\(^\\|[^:]\\)\\(:@?\\(?:\\w\\|_\\)+\\)\\([!?=]\\)?" 2184 ("\\(^\\|[^:]\\)\\(:@\\{0,2\\}\\(?:\\sw\\|\\s_\\)+\\)"
2188 (2 font-lock-constant-face) 2185 (2 font-lock-constant-face)
2189 (3 (unless (and (eq (char-before (match-end 3)) ?=) 2186 (3 (unless (and (eq (char-before (match-end 3)) ?=)
2190 (eq (char-after (match-end 3)) ?>)) 2187 (eq (char-after (match-end 3)) ?>))
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 69e6a154ae5..feed0fb36d9 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -436,6 +436,8 @@ If SELECT is non-nil, select the target window."
436;;; XREF buffer (part of the UI) 436;;; XREF buffer (part of the UI)
437 437
438;; The xref buffer is used to display a set of xrefs. 438;; The xref buffer is used to display a set of xrefs.
439(defconst xref-buffer-name "*xref*"
440 "The name of the buffer to show xrefs.")
439 441
440(defmacro xref--with-dedicated-window (&rest body) 442(defmacro xref--with-dedicated-window (&rest body)
441 `(let* ((xref-w (get-buffer-window xref-buffer-name)) 443 `(let* ((xref-w (get-buffer-window xref-buffer-name))
@@ -470,6 +472,9 @@ If SELECT is non-nil, select the target window."
470 (xref--show-pos-in-buf marker buf select)) 472 (xref--show-pos-in-buf marker buf select))
471 (user-error (message (error-message-string err))))) 473 (user-error (message (error-message-string err)))))
472 474
475(defvar-local xref--window nil
476 "The original window this xref buffer was created from.")
477
473(defun xref-show-location-at-point () 478(defun xref-show-location-at-point ()
474 "Display the source of xref at point in the appropriate window, if any." 479 "Display the source of xref at point in the appropriate window, if any."
475 (interactive) 480 (interactive)
@@ -500,9 +505,6 @@ If SELECT is non-nil, select the target window."
500 (back-to-indentation) 505 (back-to-indentation)
501 (get-text-property (point) 'xref-item))) 506 (get-text-property (point) 'xref-item)))
502 507
503(defvar-local xref--window nil
504 "The original window this xref buffer was created from.")
505
506(defun xref-goto-xref () 508(defun xref-goto-xref ()
507 "Jump to the xref on the current line and select its window." 509 "Jump to the xref on the current line and select its window."
508 (interactive) 510 (interactive)
@@ -624,9 +626,6 @@ references displayed in the current *xref* buffer."
624 (t 626 (t
625 (error "No %s xref" (if backward "previous" "next")))))) 627 (error "No %s xref" (if backward "previous" "next"))))))
626 628
627(defconst xref-buffer-name "*xref*"
628 "The name of the buffer to show xrefs.")
629
630(defvar xref--button-map 629(defvar xref--button-map
631 (let ((map (make-sparse-keymap))) 630 (let ((map (make-sparse-keymap)))
632 (define-key map [(control ?m)] #'xref-goto-xref) 631 (define-key map [(control ?m)] #'xref-goto-xref)