aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Li2018-10-24 20:48:15 -0600
committerEli Zaretskii2018-11-10 11:43:39 +0200
commit70c75167ede4c54bb796187146437120856f890b (patch)
tree95a1234517bc263940b22dfa7b28ee52f0b27100
parent5578112e182e20661783a1fef2c779b8844cf082 (diff)
downloademacs-70c75167ede4c54bb796187146437120856f890b.tar.gz
emacs-70c75167ede4c54bb796187146437120856f890b.zip
Add setter for 'xref-marker-ring-length'
* lisp/progmodes/xref.el (xref-marker-ring-length): Add setter. * etc/NEWS: Document last change. (Bug#32849)
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/progmodes/xref.el16
2 files changed, 19 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 668b59a20a4..e5892d718e8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -460,6 +460,11 @@ for example.
460This command finds definitions of the identifier at the place of a 460This command finds definitions of the identifier at the place of a
461mouse click event, and is intended to be bound to a mouse event. 461mouse click event, and is intended to be bound to a mouse event.
462 462
463+++
464*** Changing 'xref-marker-ring-length' works after 'xref.el' is loaded.
465Previously, setting 'xref-marker-ring-length' would only take effect
466if set before 'xref.el' was loaded.
467
463** Ecomplete 468** Ecomplete
464 469
465*** The ecomplete sorting has changed to a decay-based algorithm. 470*** The ecomplete sorting has changed to a decay-based algorithm.
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 6b1421a6f78..3b449bf9b15 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -317,8 +317,12 @@ backward."
317;;; Marker stack (M-. pushes, M-, pops) 317;;; Marker stack (M-. pushes, M-, pops)
318 318
319(defcustom xref-marker-ring-length 16 319(defcustom xref-marker-ring-length 16
320 "Length of the xref marker ring." 320 "Length of the xref marker ring.
321 :type 'integer) 321If this variable is not set through Customize, you must call
322`xref-set-marker-ring-length' for changes to take effect."
323 :type 'integer
324 :initialize #'custom-initialize-default
325 :set #'xref-set-marker-ring-length)
322 326
323(defcustom xref-prompt-for-identifier '(not xref-find-definitions 327(defcustom xref-prompt-for-identifier '(not xref-find-definitions
324 xref-find-definitions-other-window 328 xref-find-definitions-other-window
@@ -354,6 +358,14 @@ elements is negated: these commands will NOT prompt."
354(defvar xref--marker-ring (make-ring xref-marker-ring-length) 358(defvar xref--marker-ring (make-ring xref-marker-ring-length)
355 "Ring of markers to implement the marker stack.") 359 "Ring of markers to implement the marker stack.")
356 360
361(defun xref-set-marker-ring-length (var val)
362 "Set `xref-marker-ring-length'.
363VAR is the symbol `xref-marker-ring-length' and VAL is the new
364value."
365 (set-default var val)
366 (if (ring-p xref--marker-ring)
367 (ring-resize xref--marker-ring val)))
368
357(defun xref-push-marker-stack (&optional m) 369(defun xref-push-marker-stack (&optional m)
358 "Add point M (defaults to `point-marker') to the marker stack." 370 "Add point M (defaults to `point-marker') to the marker stack."
359 (ring-insert xref--marker-ring (or m (point-marker)))) 371 (ring-insert xref--marker-ring (or m (point-marker))))