emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ceecac4: Add new user option to abbreviate file names in save-pla


From: Lars Ingebrigtsen
Subject: master ceecac4: Add new user option to abbreviate file names in save-place
Date: Thu, 15 Jul 2021 12:04:31 -0400 (EDT)

branch: master
commit ceecac4c79df85a523a8a6bb3ace78105ff0ffe8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 etc/NEWS          |  3 +++
 lisp/saveplace.el | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6e5d358..bec7f9f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2186,6 +2186,9 @@ summaries will include the failing condition.
 ** Miscellaneous
 
 ---
+*** New user option 'save-place-abbreviate-file-names'.
+
+---
 *** 'tabulated-list-mode' can now restore original display order.
 Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode',
 and that mode allow the user to sort on any column.  There was
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index f654702..2a95b39 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -87,6 +87,11 @@ this happens automatically before saving `save-place-alist' 
to
 `save-place-file'."
   :type 'boolean)
 
+(defcustom save-place-abbreviate-file-names nil
+  "If non-nil, abbreviate file names before saving them."
+  :type 'boolean
+  :version "28.1")
+
 (defcustom save-place-save-skipped t
   "If non-nil, remember files matching `save-place-skip-check-regexp'.
 
@@ -177,7 +182,10 @@ file:
   "Add current buffer filename and position to `save-place-alist'.
 Put filename and point in a cons box and then cons that onto the
 front of the `save-place-alist', if `save-place-mode' is non-nil.
-Otherwise, just delete that file from the alist."
+Otherwise, just delete that file from the alist.
+
+If `save-place-abbreviate-file-names' is non-nil, abbreviate the
+file names."
   ;; First check to make sure alist has been loaded in from the master
   ;; file.  If not, do so, then feel free to modify the alist.  It
   ;; will be saved again when Emacs is killed.
@@ -195,6 +203,8 @@ Otherwise, just delete that file from the alist."
                (or (not save-place-ignore-files-regexp)
                    (not (string-match save-place-ignore-files-regexp
                                       item))))
+      (when save-place-abbreviate-file-names
+        (setq item (abbreviate-file-name item)))
       (let ((cell (assoc item save-place-alist))
             (position (cond ((eq major-mode 'hexl-mode)
                             (with-no-warnings



reply via email to

[Prev in Thread] Current Thread [Next in Thread]