summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-07-28 14:56:24 +0200
committerStefan Kangas <stefan@marxist.se>2022-07-28 14:56:24 +0200
commit7b55a3dab66aa25ddb6c89d8d7f3b6c86a097de6 (patch)
treef640d01a13084e420e51c10b374112b55fd90632
parent0db604a91499496b8f39d9b19e6eadb06f52cb0f (diff)
parent23112f89f9c0a253a6f30e566d7e4b4e3a3fe8ca (diff)
downloademacs-7b55a3dab66aa25ddb6c89d8d7f3b6c86a097de6.tar.gz
Merge from origin/emacs-28
23112f89f9 ; Improve documentation of 'file-name-with-extension' 4be938169d Release the desktop lock in 'kill-emacs-hook' 4ea1f6c7f8 ; * doc/lispref/tips.texi (Documentation Tips): Fix typos.... # Conflicts: # doc/lispref/tips.texi
-rw-r--r--doc/lispref/tips.texi4
-rw-r--r--lisp/desktop.el12
-rw-r--r--lisp/files.el12
3 files changed, 18 insertions, 10 deletions
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index d03698d354f..9faf3f33ba8 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -712,7 +712,7 @@ two exceptions: write @code{t} and @code{nil} without surrounding
punctuation. For example:
@example
- CODE can be `lambda', nil, or t.
+CODE can be `lambda', nil, or t.
@end example
Note that when Emacs displays these doc strings, Emacs will usually
@@ -868,7 +868,7 @@ find an alternate phrasing that conveys the meaning.
@item
Try to avoid using abbreviations such as ``e.g.'' (for ``for
example''), ``i.e.'' (for ``that is''), ``no.'' (for ``number''),
-``c.f.'' (for ``in contrast to'') and ``w.r.t.'' (for ``with respect
+``cf.'' (for ``in contrast to'') and ``w.r.t.'' (for ``with respect
to'') as much as possible. It is almost always clearer and easier to
read the expanded version.@footnote{We do use these occasionally, but
try not to overdo it.}
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 850d2a86efa..a0931e053eb 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -791,7 +791,10 @@ if different)."
;; ----------------------------------------------------------------------------
(unless noninteractive
- (add-hook 'kill-emacs-query-functions #'desktop-kill))
+ (add-hook 'kill-emacs-query-functions #'desktop-kill)
+ ;; Certain things should be done even if
+ ;; `kill-emacs-query-functions' are not called.
+ (add-hook 'kill-emacs-hook #'desktop--on-kill))
(defun desktop-kill ()
"If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
@@ -818,12 +821,15 @@ is nil, ask the user where to save the desktop."
(file-error
(unless (yes-or-no-p "Error while saving the desktop. Ignore? ")
(signal (car err) (cdr err))))))
+ (desktop--on-kill)
+ t)
+
+(defun desktop--on-kill ()
;; If we own it, we don't anymore.
(when (eq (emacs-pid) (desktop-owner))
;; Allow exiting Emacs even if we can't delete the desktop file.
(ignore-error 'file-error
- (desktop-release-lock)))
- t)
+ (desktop-release-lock))))
;; ----------------------------------------------------------------------------
(defun desktop-list* (&rest args)
diff --git a/lisp/files.el b/lisp/files.el
index 37ed796a687..bea0c13d25f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5119,14 +5119,16 @@ extension, the value is \"\"."
"")))))
(defun file-name-with-extension (filename extension)
- "Set the EXTENSION of a FILENAME.
+ "Return FILENAME modified to have the specified EXTENSION.
The extension (in a file name) is the part that begins with the last \".\".
+This function removes any existing extension from FILENAME, and then
+appends EXTENSION to it.
-Trims a leading dot from the EXTENSION so that either \"foo\" or
-\".foo\" can be given.
+EXTENSION may include the leading dot; if it doesn't, this function
+will provide it.
-Errors if the FILENAME or EXTENSION are empty, or if the given
-FILENAME has the format of a directory.
+It is an error if FILENAME or EXTENSION is empty, or if FILENAME
+is in the form of a directory name according to `directory-name-p'.
See also `file-name-sans-extension'."
(let ((extn (string-trim-left extension "[.]")))