aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-07-15 18:03:36 +0200
committerLars Ingebrigtsen2021-07-15 18:03:36 +0200
commitceecac4c79df85a523a8a6bb3ace78105ff0ffe8 (patch)
treeb681348bf80ace02a510c377a1b3cde95781a893
parentfbc9a509935f87e0627c3dba704108458f2b0389 (diff)
downloademacs-ceecac4c79df85a523a8a6bb3ace78105ff0ffe8.tar.gz
emacs-ceecac4c79df85a523a8a6bb3ace78105ff0ffe8.zip
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.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/saveplace.el12
2 files changed, 14 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 6e5d358c958..bec7f9fb04c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2186,6 +2186,9 @@ summaries will include the failing condition.
2186** Miscellaneous 2186** Miscellaneous
2187 2187
2188--- 2188---
2189*** New user option 'save-place-abbreviate-file-names'.
2190
2191---
2189*** 'tabulated-list-mode' can now restore original display order. 2192*** 'tabulated-list-mode' can now restore original display order.
2190Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode', 2193Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode',
2191and that mode allow the user to sort on any column. There was 2194and that mode allow the user to sort on any column. There was
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index f654702def4..2a95b39da87 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -87,6 +87,11 @@ this happens automatically before saving `save-place-alist' to
87`save-place-file'." 87`save-place-file'."
88 :type 'boolean) 88 :type 'boolean)
89 89
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
90(defcustom save-place-save-skipped t 95(defcustom save-place-save-skipped t
91 "If non-nil, remember files matching `save-place-skip-check-regexp'. 96 "If non-nil, remember files matching `save-place-skip-check-regexp'.
92 97
@@ -177,7 +182,10 @@ file:
177 "Add current buffer filename and position to `save-place-alist'. 182 "Add current buffer filename and position to `save-place-alist'.
178Put filename and point in a cons box and then cons that onto the 183Put filename and point in a cons box and then cons that onto the
179front of the `save-place-alist', if `save-place-mode' is non-nil. 184front of the `save-place-alist', if `save-place-mode' is non-nil.
180Otherwise, just delete that file from the alist." 185Otherwise, just delete that file from the alist.
186
187If `save-place-abbreviate-file-names' is non-nil, abbreviate the
188file names."
181 ;; First check to make sure alist has been loaded in from the master 189 ;; First check to make sure alist has been loaded in from the master
182 ;; file. If not, do so, then feel free to modify the alist. It 190 ;; file. If not, do so, then feel free to modify the alist. It
183 ;; will be saved again when Emacs is killed. 191 ;; will be saved again when Emacs is killed.
@@ -195,6 +203,8 @@ Otherwise, just delete that file from the alist."
195 (or (not save-place-ignore-files-regexp) 203 (or (not save-place-ignore-files-regexp)
196 (not (string-match save-place-ignore-files-regexp 204 (not (string-match save-place-ignore-files-regexp
197 item)))) 205 item))))
206 (when save-place-abbreviate-file-names
207 (setq item (abbreviate-file-name item)))
198 (let ((cell (assoc item save-place-alist)) 208 (let ((cell (assoc item save-place-alist))
199 (position (cond ((eq major-mode 'hexl-mode) 209 (position (cond ((eq major-mode 'hexl-mode)
200 (with-no-warnings 210 (with-no-warnings