diff options
| author | Allen Li | 2018-10-24 20:48:15 -0600 |
|---|---|---|
| committer | Eli Zaretskii | 2018-11-10 11:43:39 +0200 |
| commit | 70c75167ede4c54bb796187146437120856f890b (patch) | |
| tree | 95a1234517bc263940b22dfa7b28ee52f0b27100 | |
| parent | 5578112e182e20661783a1fef2c779b8844cf082 (diff) | |
| download | emacs-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/NEWS | 5 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 16 |
2 files changed, 19 insertions, 2 deletions
| @@ -460,6 +460,11 @@ for example. | |||
| 460 | This command finds definitions of the identifier at the place of a | 460 | This command finds definitions of the identifier at the place of a |
| 461 | mouse click event, and is intended to be bound to a mouse event. | 461 | mouse 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. | ||
| 465 | Previously, setting 'xref-marker-ring-length' would only take effect | ||
| 466 | if 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) | 321 | If 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'. | ||
| 363 | VAR is the symbol `xref-marker-ring-length' and VAL is the new | ||
| 364 | value." | ||
| 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)))) |