Add setter for 'xref-marker-ring-length'
* lisp/progmodes/xref.el (xref-marker-ring-length): Add setter. * etc/NEWS: Document last change. (Bug#32849)
This commit is contained in:
parent
5578112e18
commit
70c75167ed
2 changed files with 19 additions and 2 deletions
5
etc/NEWS
5
etc/NEWS
|
@ -460,6 +460,11 @@ for example.
|
|||
This command finds definitions of the identifier at the place of a
|
||||
mouse click event, and is intended to be bound to a mouse event.
|
||||
|
||||
+++
|
||||
*** Changing 'xref-marker-ring-length' works after 'xref.el' is loaded.
|
||||
Previously, setting 'xref-marker-ring-length' would only take effect
|
||||
if set before 'xref.el' was loaded.
|
||||
|
||||
** Ecomplete
|
||||
|
||||
*** The ecomplete sorting has changed to a decay-based algorithm.
|
||||
|
|
|
@ -317,8 +317,12 @@ backward."
|
|||
;;; Marker stack (M-. pushes, M-, pops)
|
||||
|
||||
(defcustom xref-marker-ring-length 16
|
||||
"Length of the xref marker ring."
|
||||
:type 'integer)
|
||||
"Length of the xref marker ring.
|
||||
If this variable is not set through Customize, you must call
|
||||
`xref-set-marker-ring-length' for changes to take effect."
|
||||
:type 'integer
|
||||
:initialize #'custom-initialize-default
|
||||
:set #'xref-set-marker-ring-length)
|
||||
|
||||
(defcustom xref-prompt-for-identifier '(not xref-find-definitions
|
||||
xref-find-definitions-other-window
|
||||
|
@ -354,6 +358,14 @@ elements is negated: these commands will NOT prompt."
|
|||
(defvar xref--marker-ring (make-ring xref-marker-ring-length)
|
||||
"Ring of markers to implement the marker stack.")
|
||||
|
||||
(defun xref-set-marker-ring-length (var val)
|
||||
"Set `xref-marker-ring-length'.
|
||||
VAR is the symbol `xref-marker-ring-length' and VAL is the new
|
||||
value."
|
||||
(set-default var val)
|
||||
(if (ring-p xref--marker-ring)
|
||||
(ring-resize xref--marker-ring val)))
|
||||
|
||||
(defun xref-push-marker-stack (&optional m)
|
||||
"Add point M (defaults to `point-marker') to the marker stack."
|
||||
(ring-insert xref--marker-ring (or m (point-marker))))
|
||||
|
|
Loading…
Add table
Reference in a new issue