aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Stephani2017-09-19 10:29:42 +0200
committerPhilipp Stephani2017-09-24 10:02:00 +0200
commit1eb4e5c3c8e70813c8042a38a2b67be74b16500e (patch)
tree2dd4bb0690520cc15ec467b6c7561a32a088784b
parent535db535a9168ae73740f50b57210eb127c37119 (diff)
downloademacs-1eb4e5c3c8e70813c8042a38a2b67be74b16500e.tar.gz
emacs-1eb4e5c3c8e70813c8042a38a2b67be74b16500e.zip
Make FILENAME argument of 'file-name-base' mandatory
* lisp/files.el (file-name-base): Make FILENAME argument mandatory. * lisp/autoinsert.el (auto-insert-alist): * lisp/progmodes/cperl-mode.el (cperl-electric-pod): * lisp/progmodes/idlwave.el (idlwave-parse-definition): * lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes): Fix all callers.
-rw-r--r--doc/lispref/files.texi4
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/autoinsert.el10
-rw-r--r--lisp/files.el4
-rw-r--r--lisp/progmodes/cperl-mode.el2
-rw-r--r--lisp/progmodes/idlwave.el2
-rw-r--r--lisp/textmodes/reftex-ref.el2
7 files changed, 14 insertions, 13 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 6be998f0b2e..e4a4bfe5986 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2106,7 +2106,7 @@ Note that the @samp{.~3~} in the two last examples is the backup part,
2106not an extension. 2106not an extension.
2107@end defun 2107@end defun
2108 2108
2109@defun file-name-base &optional filename 2109@defun file-name-base filename
2110This function is the composition of @code{file-name-sans-extension} 2110This function is the composition of @code{file-name-sans-extension}
2111and @code{file-name-nondirectory}. For example, 2111and @code{file-name-nondirectory}. For example,
2112 2112
@@ -2114,8 +2114,6 @@ and @code{file-name-nondirectory}. For example,
2114(file-name-base "/my/home/foo.c") 2114(file-name-base "/my/home/foo.c")
2115 @result{} "foo" 2115 @result{} "foo"
2116@end example 2116@end example
2117
2118The @var{filename} argument defaults to @code{buffer-file-name}.
2119@end defun 2117@end defun
2120 2118
2121@node Relative File Names 2119@node Relative File Names
diff --git a/etc/NEWS b/etc/NEWS
index 0e62a2bbb42..aacdf79b573 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -48,6 +48,9 @@ sets the XTerm window title. The default is to set the window title.
48 48
49* Incompatible Lisp Changes in Emacs 27.1 49* Incompatible Lisp Changes in Emacs 27.1
50 50
51** The FILENAME argument to 'file-name-base' is now mandatory and no
52longer defaults to 'buffer-file-name'.
53
51 54
52* Lisp Changes in Emacs 27.1 55* Lisp Changes in Emacs 27.1
53 56
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index 2820c8a9afa..a43e068a4dc 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -141,14 +141,14 @@ If this contains a %s, that will be replaced by the matching rule."
141 " 141 "
142.\\\" You may distribute this file under the terms of the GNU Free 142.\\\" You may distribute this file under the terms of the GNU Free
143.\\\" Documentation License. 143.\\\" Documentation License.
144.TH " (file-name-base) 144.TH " (file-name-base (buffer-file-name))
145 " " (file-name-extension (buffer-file-name)) 145 " " (file-name-extension (buffer-file-name))
146 " " (format-time-string "%Y-%m-%d ") 146 " " (format-time-string "%Y-%m-%d ")
147 "\n.SH NAME\n" 147 "\n.SH NAME\n"
148 (file-name-base) 148 (file-name-base (buffer-file-name))
149 " \\- " str 149 " \\- " str
150 "\n.SH SYNOPSIS 150 "\n.SH SYNOPSIS
151.B " (file-name-base) 151.B " (file-name-base (buffer-file-name))
152 "\n" 152 "\n"
153 _ 153 _
154 " 154 "
@@ -211,7 +211,7 @@ If this contains a %s, that will be replaced by the matching rule."
211 211
212 212
213\(provide '" 213\(provide '"
214 (file-name-base) 214 (file-name-base (buffer-file-name))
215 ") 215 ")
216\;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n") 216\;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")
217 (("\\.texi\\(nfo\\)?\\'" . "Texinfo file skeleton") 217 (("\\.texi\\(nfo\\)?\\'" . "Texinfo file skeleton")
@@ -219,7 +219,7 @@ If this contains a %s, that will be replaced by the matching rule."
219 "\\input texinfo @c -*-texinfo-*- 219 "\\input texinfo @c -*-texinfo-*-
220@c %**start of header 220@c %**start of header
221@setfilename " 221@setfilename "
222 (file-name-base) ".info\n" 222 (file-name-base (buffer-file-name)) ".info\n"
223 "@settitle " str " 223 "@settitle " str "
224@c %**end of header 224@c %**end of header
225@copying\n" 225@copying\n"
diff --git a/lisp/files.el b/lisp/files.el
index c55c8097c16..fe7cb1a8a94 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4479,8 +4479,8 @@ extension, the value is \"\"."
4479 ""))))) 4479 "")))))
4480 4480
4481(defun file-name-base (&optional filename) 4481(defun file-name-base (&optional filename)
4482 "Return the base name of the FILENAME: no directory, no extension. 4482 "Return the base name of the FILENAME: no directory, no extension."
4483FILENAME defaults to `buffer-file-name'." 4483 (declare (advertised-calling-convention (filename) "27.1"))
4484 (file-name-sans-extension 4484 (file-name-sans-extension
4485 (file-name-nondirectory (or filename (buffer-file-name))))) 4485 (file-name-nondirectory (or filename (buffer-file-name)))))
4486 4486
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index abd77bd973d..e956637572c 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -2314,7 +2314,7 @@ to nil."
2314 nil t)))) ; Only one 2314 nil t)))) ; Only one
2315 (progn 2315 (progn
2316 (forward-word-strictly 1) 2316 (forward-word-strictly 1)
2317 (setq name (file-name-base) 2317 (setq name (file-name-base (buffer-file-name))
2318 p (point)) 2318 p (point))
2319 (insert " NAME\n\n" name 2319 (insert " NAME\n\n" name
2320 " - \n\n=head1 SYNOPSIS\n\n\n\n" 2320 " - \n\n=head1 SYNOPSIS\n\n\n\n"
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 9231e118907..92a42b1cb94 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -5240,7 +5240,7 @@ Can run from `after-save-hook'."
5240 class 5240 class
5241 (cond ((not (boundp 'idlwave-scanning-lib)) 5241 (cond ((not (boundp 'idlwave-scanning-lib))
5242 (list 'buffer (buffer-file-name))) 5242 (list 'buffer (buffer-file-name)))
5243; ((string= (downcase (file-name-base)) 5243; ((string= (downcase (file-name-base (buffer-file-name))
5244; (downcase name)) 5244; (downcase name))
5245; (list 'lib)) 5245; (list 'lib))
5246; (t (cons 'lib (file-name-nondirectory (buffer-file-name)))) 5246; (t (cons 'lib (file-name-nondirectory (buffer-file-name))))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index c2c5ca3de06..f9f23201b43 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -314,7 +314,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
314 (save-match-data 314 (save-match-data
315 (cond 315 (cond
316 ((equal letter "f") 316 ((equal letter "f")
317 (file-name-base)) 317 (file-name-base (buffer-file-name)))
318 ((equal letter "F") 318 ((equal letter "F")
319 (let ((masterdir (file-name-directory (reftex-TeX-master-file))) 319 (let ((masterdir (file-name-directory (reftex-TeX-master-file)))
320 (file (file-name-sans-extension (buffer-file-name)))) 320 (file (file-name-sans-extension (buffer-file-name))))