From dfb3dcb404c75f19a3d22938c33390f362141fe2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Nov 2023 16:07:31 +0200 Subject: [PATCH 1/8] Allow listing Emoji from a read-only buffer * lisp/international/emoji.el (emoji-list): Don't barf here if the original buffer is read-inly... (emoji-list-select): ...barf here instead. (Bug#67400) (emoji-list): Doc fix. --- lisp/international/emoji.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index 8a34be91d10..4070553be55 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -103,11 +103,11 @@ and also consults the `emoji-alternate-names' alist." ;;;###autoload (defun emoji-list () - "List emojis and insert the one that's selected. + "List emojis and allow selecting and inserting one of them. Select the emoji by typing \\\\[emoji-list-select] on its picture. The glyph will be inserted into the buffer that was current when the command was invoked." - (interactive "*") + (interactive) (let ((buf (current-buffer))) (emoji--init) (switch-to-buffer (get-buffer-create "*Emoji*")) @@ -219,7 +219,9 @@ the name is not known." (let ((buf emoji--insert-buffer)) (quit-window) (if (buffer-live-p buf) - (switch-to-buffer buf) + (progn + (switch-to-buffer buf) + (barf-if-buffer-read-only)) (error "Buffer disappeared")))))) (if (not derived) ;; Glyph without derivations. From 4bb65ed77a87c146d06f6c3803bd99dbfce213f1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Nov 2023 16:43:17 +0200 Subject: [PATCH 2/8] ; * doc/lispref/minibuf.texi (Programmed Completion): Improve indexing. --- doc/lispref/minibuf.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 620c58ec6e9..67af4d0ad67 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1977,6 +1977,7 @@ the piece of the prefix and suffix covered by the completion boundaries. @xref{Basic Completion}, for the precise expected semantics of completion boundaries. +@cindex completion metadata @item metadata This specifies a request for information about the state of the current completion. The return value should have the form @@ -1993,6 +1994,8 @@ The following is a list of metadata entries that a completion function may return in response to a @code{metadata} flag argument: @table @code +@cindex @code{category}, in completion +@cindex completion category @item category The value should be a symbol describing what kind of text the completion function is trying to complete. If the symbol matches one From 86016d8ecdb3db4a1a2c6f85a4239f2fdaacd69a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Nov 2023 16:56:10 +0200 Subject: [PATCH 3/8] Mention "visual line" in user manual * doc/emacs/display.texi (Visual Line Mode): * doc/emacs/basic.texi (Continuation Lines, Moving Point): Mention "visual line". (Bug#67382) --- doc/emacs/basic.texi | 25 ++++++++++++++----------- doc/emacs/display.texi | 7 ++++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index a271cb65bdc..d41e5f2f16c 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -360,15 +360,15 @@ preserve the horizontal position, as usual. @vindex line-move-visual When a line of text in the buffer is longer than the width of the -window, Emacs usually displays it on two or more @dfn{screen lines}. -For convenience, @kbd{C-n} and @kbd{C-p} move point by screen lines, -as do the equivalent keys @kbd{@key{down}} and @kbd{@key{up}}. You -can force these commands to move according to @dfn{logical lines} -(i.e., according to the text lines in the buffer) by setting the -variable @code{line-move-visual} to @code{nil}; if a logical line -occupies multiple screen lines, the cursor then skips over the -additional screen lines. For details, see @ref{Continuation Lines}. -@xref{Variables}, for how to set variables such as +window, Emacs usually displays it on two or more @dfn{screen lines}, +a.k.a.@: @dfn{visual lines}. For convenience, @kbd{C-n} and @kbd{C-p} +move point by screen lines, as do the equivalent keys @kbd{@key{down}} +and @kbd{@key{up}}. You can force these commands to move according to +@dfn{logical lines} (i.e., according to the text lines in the buffer) +by setting the variable @code{line-move-visual} to @code{nil}; if a +logical line occupies multiple screen lines, the cursor then skips +over the additional screen lines. For details, see @ref{Continuation +Lines}. @xref{Variables}, for how to set variables such as @code{line-move-visual}. Unlike @kbd{C-n} and @kbd{C-p}, most of the Emacs commands that work @@ -596,10 +596,13 @@ lines, if any exists. @cindex wrapping @cindex line wrapping @cindex fringes, and continuation lines +@cindex logical line +@cindex screen line +@cindex visual line Sometimes, a line of text in the buffer---a @dfn{logical line}---is too long to fit in the window, and Emacs displays it as two or more -@dfn{screen lines}. This is called @dfn{line wrapping} or -@dfn{continuation}, and the long logical line is called a +@dfn{screen lines}, or @dfn{visual lines}. This is called @dfn{line +wrapping} or @dfn{continuation}, and the long logical line is called a @dfn{continued line}. On a graphical display, Emacs indicates line wrapping with small bent arrows in the left and right window fringes. On a text terminal, Emacs indicates line wrapping by displaying a diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index cc178dbe99f..d9da4c1335c 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -2010,9 +2010,10 @@ line truncation. @xref{Split Window}, for the variable @section Visual Line Mode @cindex word wrap - Another alternative to ordinary line continuation is to use -@dfn{word wrap}. Here, each long logical line is divided into two or -more screen lines, like in ordinary line continuation. However, Emacs + Another alternative to ordinary line continuation +(@pxref{Continuation Lines}) is to use @dfn{word wrap}. Here, each +long logical line is divided into two or more screen lines, or +``visual lines'', like in ordinary line continuation. However, Emacs attempts to wrap the line at word boundaries near the right window edge. (If the line's direction is right-to-left, it is wrapped at the left window edge instead.) This makes the text easier to read, as From 5a5e36d2aad77a4eb80249895d809187630eacc8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Nov 2023 17:26:09 +0200 Subject: [PATCH 4/8] ; Improve function documentation tips * doc/lispref/tips.texi (Documentation Tips): Clarify the good style of descriptions in doc strings. --- doc/lispref/tips.texi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index db9f64aa8a0..f0d4753e41b 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -631,7 +631,12 @@ first line with a capital letter and end it with a period. For a function, the first line should briefly answer the question, ``What does this function do?'' For a variable, the first line should -briefly answer the question, ``What does this value mean?'' +briefly answer the question, ``What does this value mean?'' Prefer to +answer these questions in a way that will make sense to users and +callers of the function or the variable. In particular, do @emph{not} +tell what the function does by enumerating the actions of its code; +instead, describe the role of these actions and the function's +contract. Don't limit the documentation string to one line; use as many lines as you need to explain the details of how to use the function or From 662d54775d53cceb39cc65f1275972b6272a8158 Mon Sep 17 00:00:00 2001 From: Jeremy Bryant Date: Tue, 21 Nov 2023 23:27:44 +0000 Subject: [PATCH 5/8] Add a doc string to simple.el (bug#67355) * lisp/simple.el (kill-buffer--possibly-save): Add doc string. --- lisp/simple.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/simple.el b/lisp/simple.el index b770d9d7d33..9ef348f74dc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10863,6 +10863,10 @@ If the buffer doesn't exist, create it first." (pop-to-buffer-same-window (get-scratch-buffer-create))) (defun kill-buffer--possibly-save (buffer) + "Ask the user to confirm killing of a modified BUFFER. + +If the user confirms, optionally save BUFFER that is about to be +killed." (let ((response (cadr (read-multiple-choice From f7dc0202127a73f83de52b1999a7fe05dd64fff6 Mon Sep 17 00:00:00 2001 From: George Kuzler Date: Wed, 22 Nov 2023 19:45:55 -0500 Subject: [PATCH 6/8] Fix "Text is read-only" on backspacing initial Calc input Immediately after `calc-mode' opens the minibuffer for input (because you typed a digit, "e", etc), pressing backspace should clear the minibuffer and return you to the *Calculator* buffer. Instead, it leaves the minibuffer as-is and prints the message "Text is read-only"; this is because the function used, `erase-buffer', tries to erase the read-only minibuffer prompt. Using `delete-minibuffer-contents' fixes this, since it doesn't attempt to delete the prompt. * lisp/calc/calc.el (calcDigit-backspace): Use `delete-minibuffer-contents' instead of `erase-buffer'. (Bug#67395) Copyright-paperwork-exempt: yes --- lisp/calc/calc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index f129552c9a4..06ccb0f0cfa 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -2477,7 +2477,7 @@ the United States." (defun calcDigit-backspace () (interactive) (cond ((eq last-command 'calcDigit-start) - (erase-buffer)) + (delete-minibuffer-contents)) (t (backward-delete-char 1))) (if (= (calc-minibuffer-size) 0) (progn From 99658346d1edce5248a8d8db76de772b04381e7f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Nov 2023 17:56:50 +0200 Subject: [PATCH 7/8] ; Improve documentation of desktop.el in user manual * doc/emacs/misc.texi (Saving Emacs Sessions): Mention saving minibuffer history via desktop.el. --- doc/emacs/misc.texi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 1f21a5be0b3..56cd95f82ba 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2838,8 +2838,11 @@ want it to preserve certain buffers, customize the variable @code{desktop-clear-preserve-buffers-regexp}, whose value is a regular expression matching the names of buffers not to kill. +@vindex desktop-globals-to-save If you want to save minibuffer history from one session to -another, use the @code{savehist} library. +another, use the @code{savehist} library. You can also save selected +minibuffer-history variables as part of @code{desktop-save-mode} if +you add those variables to the value of @code{desktop-globals-to-save}. @node Recursive Edit @section Recursive Editing Levels From 1978b603bc3068140833e478a8103fea1d185aec Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 24 Nov 2023 00:00:32 +0200 Subject: [PATCH 8/8] Make python-ts-mode's syntax-highlighting more standardized This was brought up in a Reddit discussion. * lisp/progmodes/python.el (python--treesit-fontify-variable): Use font-lock-variable-use-face (since it applies to references). (python-ts-mode): Move 'property' from 3rd to 4th treesit-font-lock-level. --- lisp/progmodes/python.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e17651d9275..a7944576196 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1225,7 +1225,7 @@ For NODE, OVERRIDE, START, END, and ARGS, see (when (python--treesit-variable-p node) (treesit-fontify-with-override (treesit-node-start node) (treesit-node-end node) - 'font-lock-variable-name-face override start end))) + 'font-lock-variable-use-face override start end))) ;;; Indentation @@ -6717,8 +6717,8 @@ implementations: `python-mode' and `python-ts-mode'." '(( comment definition) ( keyword string type) ( assignment builtin constant decorator - escape-sequence number property string-interpolation ) - ( bracket delimiter function operator variable))) + escape-sequence number string-interpolation ) + ( bracket delimiter function operator variable property))) (setq-local treesit-font-lock-settings python--treesit-settings) (setq-local imenu-create-index-function #'python-imenu-treesit-create-index)