Skip to content

Commit ceecac4

Browse files
committed
Add new user option to abbreviate file names in save-place
* lisp/saveplace.el (save-place-abbreviate-file-names): New user option (bug#13286). (save-place-to-alist): Use it.
1 parent fbc9a50 commit ceecac4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

etc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,9 @@ summaries will include the failing condition.
21852185

21862186
** Miscellaneous
21872187

2188+
---
2189+
*** New user option 'save-place-abbreviate-file-names'.
2190+
21882191
---
21892192
*** 'tabulated-list-mode' can now restore original display order.
21902193
Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode',

lisp/saveplace.el

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ this happens automatically before saving `save-place-alist' to
8787
`save-place-file'."
8888
:type 'boolean)
8989

90+
(defcustom save-place-abbreviate-file-names nil
91+
"If non-nil, abbreviate file names before saving them."
92+
:type 'boolean
93+
:version "28.1")
94+
9095
(defcustom save-place-save-skipped t
9196
"If non-nil, remember files matching `save-place-skip-check-regexp'.
9297
@@ -177,7 +182,10 @@ file:
177182
"Add current buffer filename and position to `save-place-alist'.
178183
Put filename and point in a cons box and then cons that onto the
179184
front of the `save-place-alist', if `save-place-mode' is non-nil.
180-
Otherwise, just delete that file from the alist."
185+
Otherwise, just delete that file from the alist.
186+
187+
If `save-place-abbreviate-file-names' is non-nil, abbreviate the
188+
file names."
181189
;; First check to make sure alist has been loaded in from the master
182190
;; file. If not, do so, then feel free to modify the alist. It
183191
;; will be saved again when Emacs is killed.
@@ -195,6 +203,8 @@ Otherwise, just delete that file from the alist."
195203
(or (not save-place-ignore-files-regexp)
196204
(not (string-match save-place-ignore-files-regexp
197205
item))))
206+
(when save-place-abbreviate-file-names
207+
(setq item (abbreviate-file-name item)))
198208
(let ((cell (assoc item save-place-alist))
199209
(position (cond ((eq major-mode 'hexl-mode)
200210
(with-no-warnings

0 commit comments

Comments
 (0)