summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Leake <stephen_leake@stephe-leake.org>2019-07-17 09:17:36 -0700
committerStephen Leake <stephen_leake@stephe-leake.org>2019-07-17 09:17:36 -0700
commitd590b27ee4c43ba000172b4ad15762863d78aba1 (patch)
tree684152e5f0a07f6ac806f55a58e2b7cec2d8daf0
parentb8bf7255f3fbffe3293a2ed0e4ef7cc8c664d183 (diff)
downloademacs-d590b27ee4c43ba000172b4ad15762863d78aba1.tar.gz
Add xref-file-name-display
* lisp/progmodes/xref.el (xref-file-name-display): New user variable. (xref-location-group): Use it. * etc/NEWS: Mention it.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/progmodes/xref.el10
2 files changed, 12 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 76ea1df8213..afdcf56b6c0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -397,6 +397,9 @@ mode they are described in the manual "(emacs) Display".
+++
** 'progress-reporter-update' accepts a suffix string to display.
+---
+** New variable 'xref-file-name-display' controls the display of file
+names in xref buffers.
* Editing Changes in Emacs 27.1
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 44934d44ebd..8dc4f3c4714 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -98,6 +98,12 @@ This is typically the filename.")
;;;; Commonly needed location classes are defined here:
+(defcustom xref-file-name-display 'abs
+ "Style of file name display in *xref* buffers."
+ :type '(choice (const :tag "absolute file name" abs)
+ (const :tag "nondirectory file name" nondirectory))
+ :version "27.1")
+
;; FIXME: might be useful to have an optional "hint" i.e. a string to
;; search for in case the line number is slightly out of date.
(defclass xref-file-location (xref-location)
@@ -126,7 +132,9 @@ Line numbers start from 1 and columns from 0.")
(point-marker))))))
(cl-defmethod xref-location-group ((l xref-file-location))
- (oref l file))
+ (cl-ecase xref-file-name-display
+ (abs (oref l file))
+ (nondirectory (file-name-nondirectory (oref l file)))))
(defclass xref-buffer-location (xref-location)
((buffer :type buffer :initarg :buffer)