diff options
| author | Lars Ingebrigtsen | 2021-07-15 18:03:36 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-07-15 18:03:36 +0200 |
| commit | ceecac4c79df85a523a8a6bb3ace78105ff0ffe8 (patch) | |
| tree | b681348bf80ace02a510c377a1b3cde95781a893 | |
| parent | fbc9a509935f87e0627c3dba704108458f2b0389 (diff) | |
| download | emacs-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/NEWS | 3 | ||||
| -rw-r--r-- | lisp/saveplace.el | 12 |
2 files changed, 14 insertions, 1 deletions
| @@ -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. |
| 2190 | Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode', | 2193 | Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode', |
| 2191 | and that mode allow the user to sort on any column. There was | 2194 | and 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'. |
| 178 | Put filename and point in a cons box and then cons that onto the | 183 | Put filename and point in a cons box and then cons that onto the |
| 179 | front of the `save-place-alist', if `save-place-mode' is non-nil. | 184 | 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." | ||
| 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 |