]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve flag variable names in uniquify
authorStefan Kangas <stefankangas@gmail.com>
Thu, 26 Dec 2024 20:17:28 +0000 (21:17 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:39:27 +0000 (16:39 +0100)
* lisp/uniquify.el (uniquify-after-kill-buffer-flag)
(uniquify-trailing-separator-flag): Rename from
'uniquify-after-kill-buffer-p' and 'uniquify-trailing-separator-p', to
better adhere to our conventions.  Update all users and leave old names
as obsolete variable aliases.

(cherry picked from commit 85f5be491e001d30b80e853ee028b80812577071)

lisp/files.el
lisp/uniquify.el
test/lisp/uniquify-tests.el

index 321dec36acd52d11e389ce94d816b5b8e8275007..dc0643090a452e2c10dd75030f89791f828f8902 100644 (file)
@@ -2282,7 +2282,7 @@ this function prepends a \"|\" to the final result if necessary."
          (lastname (if (string= lastname "") ; FILENAME is a root directory
                        filename lastname))
          (lastname (cond
-                    ((not (and uniquify-trailing-separator-p
+                    ((not (and uniquify-trailing-separator-flag
                                (file-directory-p filename)))
                      lastname)
                     ((eq uniquify-buffer-name-style 'forward)
index efe42762a6b1d356d2127f9546f053569621de5e..a3b53a88928ceb6f4d3f983fdaed6462a4c20a5d 100644 (file)
@@ -124,15 +124,18 @@ you can set, browse the `uniquify' custom group."
   :version "24.4"
   :require 'uniquify)
 
-(defcustom uniquify-after-kill-buffer-p t
+(define-obsolete-variable-alias 'uniquify-after-kill-buffer-p
+  'uniquify-after-kill-buffer-flag "31.1")
+(defcustom uniquify-after-kill-buffer-flag t
   "If non-nil, rerationalize buffer names after a buffer has been killed."
-  :type 'boolean)
+  :type 'boolean
+  :version "31.1")
 
 (defcustom uniquify-ignore-buffers-re nil
   "Regular expression matching buffer names that should not be uniquified.
-For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify rename
-draft buffers even if `uniquify-after-kill-buffer-p' is non-nil and the
-visited file name isn't the same as that of the buffer."
+For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify
+rename draft buffers even if `uniquify-after-kill-buffer-flag' is
+non-nil and the visited file name isn't the same as that of the buffer."
   :type '(choice (const :tag "Uniquify all buffers" nil) regexp))
 
 (defcustom uniquify-min-dir-content 0
@@ -147,12 +150,15 @@ When `uniquify-buffer-name-style' is `reverse', separates all
 file name components (default \"\\\")."
   :type '(choice (const nil) string))
 
-(defcustom uniquify-trailing-separator-p nil
-  "If non-nil, add a file name separator to Dired buffer names.
+(define-obsolete-variable-alias 'uniquify-trailing-separator-p
+  'uniquify-trailing-separator-flag "31.1")
+(defcustom uniquify-trailing-separator-flag nil
+  "Non-nil means add a file name separator to Dired buffer names.
 If `uniquify-buffer-name-style' is `forward', add the separator at the end;
 if it is `reverse', add the separator at the beginning; otherwise, this
 variable is ignored."
-  :type 'boolean)
+  :type 'boolean
+  :version "31.1")
 
 (defcustom uniquify-strip-common-suffix
   ;; Using it when uniquify-min-dir-content>0 doesn't make much sense.
@@ -466,7 +472,7 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil."
 (defun uniquify-kill-buffer-function ()
   "Re-rationalize buffer names, ignoring current buffer.
 For use on `kill-buffer-hook'."
-  (and uniquify-after-kill-buffer-p
+  (and uniquify-after-kill-buffer-flag
        (uniquify-maybe-rerationalize-w/o-cb)))
 
 ;; Ideally we'd like to add it buffer-locally, but that doesn't work
index 9b33c9d7d4768a5158a3ba255375ba5406e9aed6..f38f7ebe5c014cd6c2e796111280472277683961 100644 (file)
@@ -66,7 +66,7 @@
       (make-directory b-path 'parents)
       (let ((uniquify-buffer-name-style 'forward)
             (uniquify-strip-common-suffix t)
-            (uniquify-trailing-separator-p nil))
+            (uniquify-trailing-separator-flag nil))
         (let ((bufs (list (find-file-noselect a-path)
                           (find-file-noselect b-path))))
           (should (equal (mapcar #'buffer-name bufs)
@@ -74,7 +74,7 @@
           (mapc #'kill-buffer bufs)))
       (let ((uniquify-buffer-name-style 'forward)
             (uniquify-strip-common-suffix nil)
-            (uniquify-trailing-separator-p t))
+            (uniquify-trailing-separator-flag t))
         (let ((bufs (list (find-file-noselect a-path)
                           (find-file-noselect b-path))))
           (should (equal (mapcar #'buffer-name bufs)
@@ -82,7 +82,7 @@
           (mapc #'kill-buffer bufs)))
       (let ((uniquify-buffer-name-style 'forward)
             (uniquify-strip-common-suffix t)
-            (uniquify-trailing-separator-p t))
+            (uniquify-trailing-separator-flag t))
         (let ((bufs (list (find-file-noselect a-path)
                           (find-file-noselect b-path))))
           (should (equal (mapcar #'buffer-name bufs)
@@ -92,7 +92,7 @@
 (ert-deftest uniquify-rename-to-dir ()
   "Giving a buffer a name which matches a directory doesn't rename the buffer"
   (let ((uniquify-buffer-name-style 'forward)
-        (uniquify-trailing-separator-p t))
+        (uniquify-trailing-separator-flag t))
       (save-excursion
         (find-file "../README")
         (rename-buffer "lisp" t)
 
 (ert-deftest uniquify-separator-style-reverse ()
   (let ((uniquify-buffer-name-style 'reverse)
-        (uniquify-trailing-separator-p t))
+        (uniquify-trailing-separator-flag t))
     (save-excursion
       (should (file-directory-p "../lib-src"))
       (find-file "../lib-src")
       (kill-buffer))))
 
 (ert-deftest uniquify-separator-ignored ()
-  "If uniquify-buffer-name-style isn't forward or reverse,
-uniquify-trailing-separator-p is ignored"
+  "If `uniquify-buffer-name-style' isn't forward or reverse,
+`uniquify-trailing-separator-flag' is ignored."
   (let ((uniquify-buffer-name-style 'post-forward-angle-brackets)
-        (uniquify-trailing-separator-p t))
+        (uniquify-trailing-separator-flag t))
     (save-excursion
       (should (file-directory-p "../lib-src"))
       (find-file "../lib-src")