[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 85f5be491e0: Improve flag variable names in uniquify
From: |
Stefan Kangas |
Subject: |
master 85f5be491e0: Improve flag variable names in uniquify |
Date: |
Thu, 26 Dec 2024 15:26:23 -0500 (EST) |
branch: master
commit 85f5be491e001d30b80e853ee028b80812577071
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Improve flag variable names in uniquify
* 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.
---
lisp/files.el | 2 +-
lisp/uniquify.el | 24 +++++++++++++++---------
test/lisp/uniquify-tests.el | 16 ++++++++--------
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 9144aaf0553..30e2787f9e6 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2233,7 +2233,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)
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index efe42762a6b..a3b53a88928 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -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
diff --git a/test/lisp/uniquify-tests.el b/test/lisp/uniquify-tests.el
index 9b33c9d7d47..f38f7ebe5c0 100644
--- a/test/lisp/uniquify-tests.el
+++ b/test/lisp/uniquify-tests.el
@@ -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)
@@ -101,7 +101,7 @@
(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")
@@ -109,10 +109,10 @@
(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")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 85f5be491e0: Improve flag variable names in uniquify,
Stefan Kangas <=