commit c55e67081e9873a32b6e665e44f3e5a9c301255f (HEAD, refs/remotes/origin/master) Author: Stephen Berman Date: Thu Jul 20 21:51:24 2023 +0200 Fix last change to wid-edit.el * lisp/wid-edit.el (widget-choose): Test for stringp instead of char-or-string-p, since substitute-command-keys should only apply to choice values that are strings. (Bug#64046, Message #37) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 234f3d9b74d..606093fd293 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -286,7 +286,7 @@ widget-choose (let ((items (mapc (lambda (x) (when (consp x) (dotimes (i (1- (length x))) - (when (char-or-string-p (nth i x)) + (when (stringp (nth i x)) (setcar (nthcdr i x) (substitute-command-keys (car (nthcdr i x)))))))) commit c601148ded734be2920044f943c44886d144cd97 Author: Alan Mackenzie Date: Thu Jul 20 19:33:42 2023 +0000 CC Mode (some languages): handle string lines ending in \\ In C, C++, Objective C, and Pike modes, regard \\ in a string at EOL as a backslash followed by an escaped newline. In the other languages, this remains regarded as an escaped backslash followed by an invalid string terminator. * lisp/progmodes/cc-defs.el (c-is-escaped, c-will-be-escaped): Amend to observe the changed notion of escaped newlines. * lisp/progmodes/cc-langs.el (c-string-escaped-newlines): Unused, removed. (c-escaped-newline-takes-precedence): New lang const and var. (c-string-innards-re-alist): Amend, using the above new lang var. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 1d7f90ed428..2cbe9ca7e92 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -425,11 +425,14 @@ c-point (defvar lookup-syntax-properties) ;XEmacs. (defmacro c-is-escaped (pos) - ;; Are there an odd number of backslashes before POS? + ;; Is the character following POS escaped? (declare (debug t)) `(save-excursion (goto-char ,pos) - (not (zerop (logand (skip-chars-backward "\\\\") 1))))) + (if (and c-escaped-newline-takes-precedence + (memq (char-after) '(?\n ?\r))) + (eq (char-before) ?\\) + (not (zerop (logand (skip-chars-backward "\\\\") 1)))))) (defmacro c-will-be-escaped (pos beg end) ;; Will the character after POS be escaped after the removal of (BEG END)? @@ -437,13 +440,23 @@ c-will-be-escaped (declare (debug t)) `(save-excursion (let ((-end- ,end) + (-pos- ,pos) count) - (goto-char ,pos) - (setq count (skip-chars-backward "\\\\" -end-)) - (when (eq (point) -end-) - (goto-char ,beg) - (setq count (+ count (skip-chars-backward "\\\\")))) - (not (zerop (logand count 1)))))) + (if (and c-escaped-newline-takes-precedence + (memq (char-after -pos-) '(?\n ?\r))) + (eq (char-before (if (eq -pos- -end-) + ,beg + -pos-)) + ?\\) + (goto-char -pos-) + (setq count + (if (> -pos- -end-) + (skip-chars-backward "\\\\" -end-) + 0)) + (when (eq (point) -end-) + (goto-char ,beg) + (setq count (+ count (skip-chars-backward "\\\\")))) + (not (zerop (logand count 1))))))) (defmacro c-will-be-unescaped (beg) ;; Would the character after BEG be unescaped? diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 3d0ad9984fa..ef7f27dc435 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1071,14 +1071,6 @@ c-identifier-last-sym-match ;; matched. t nil) -(c-lang-defconst c-string-escaped-newlines - "Set if the language support backslash escaped newlines inside string -literals." - t nil - (c c++ objc pike) t) -(c-lang-defvar c-string-escaped-newlines - (c-lang-const c-string-escaped-newlines)) - (c-lang-defconst c-multiline-string-start-char "Set if the language supports multiline string literals without escaped newlines. If t, all string literals are multiline. If a character, @@ -1095,6 +1087,18 @@ c-multiline-string-start-char (c-lang-defvar c-multiline-string-start-char (c-lang-const c-multiline-string-start-char)) +(c-lang-defconst c-escaped-newline-takes-precedence + "Set if the language resolves escaped newlines first. +This makes a difference in a string like \"...\\\\\n\". When +this variable is nil, the first backslash escapes the second, +leaving an unterminated string. When it's non-nil, the string is +continued onto the next line, and the first backslash escapes +whatever begins that next line." + t nil + (c c++ objc pike) t) +(c-lang-defvar c-escaped-newline-takes-precedence + (c-lang-const c-escaped-newline-takes-precedence)) + (c-lang-defconst c-string-innards-re-alist ;; An alist of regexps matching the innards of a string, the key being the ;; string's delimiter. @@ -1105,9 +1109,12 @@ c-string-innards-re-alist t (mapcar (lambda (delim) (cons delim - (concat "\\(\\\\\\(.\\|\n\\)\\|[^\\\n\r" - (string delim) - "]\\)*"))) + (concat + (if (c-lang-const c-escaped-newline-takes-precedence) + "\\(\\\\\\(\\\\?\n\\|.\\)\\|[^\\\n\r" + "\\(\\\\\\(\n\\|.\\)\\|[^\\\n\r") + (string delim) + "]\\)*"))) (and (or (null (c-lang-const c-multiline-string-start-char)) (c-characterp (c-lang-const c-multiline-string-start-char))) commit 5513f72d3c85ce770a89dc598d2c0b903f0a0b2b Author: Robert Pluim Date: Thu Jul 20 19:12:32 2023 +0200 ; Fix previous change diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 0daeafe13ca..b5bb7b42650 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -216,17 +216,17 @@ shr-h3 "Face for

elements." :version "28.1") -(defface shr-h4 nil +(defface shr-h4 '((t (:inherit default))) "Face for

elements." :version "28.1") -(defface shr-h5 nil +(defface shr-h5 '((t (:inherit default))) "Face for

elements." :version "28.1") -(defface shr-h6 nil +(defface shr-h6 '((t (:inherit default))) "Face for
elements." :version "28.1") diff --git a/lisp/time.el b/lisp/time.el index 0184f96fcc2..3b87859a87c 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -139,9 +139,9 @@ display-time-mail-face :version "22.1" :type '(choice (const :tag "None" nil) face)) -(defface display-time-date-and-time nil - "Face for `display-time-format'." +(defface display-time-date-and-time '((t (:inherit mode-line))) + "Face for `display-time-format'." :group 'mode-line-faces :version "30.1") commit e72afa9dbf92f45d00c87c90ead364d52f73024f Author: Eli Zaretskii Date: Thu Jul 20 19:25:43 2023 +0300 Fix defface's with no customization data * lisp/net/shr.el (shr-h4, shr-h5, shr-h6): * lisp/cedet/semantic/decorate/include.el (semantic-decoration-on-includes): * lisp/progmodes/make-mode.el (makefile-shell): * lisp/time.el (display-time-date-and-time): * lisp/nxml/nxml-mode.el (nxml-text, nxml-delimiter) (nxml-element-colon): Add face definitions (bug#64655). diff --git a/lisp/cedet/semantic/decorate/include.el b/lisp/cedet/semantic/decorate/include.el index c83de66ef0c..96bf8cec3b2 100644 --- a/lisp/cedet/semantic/decorate/include.el +++ b/lisp/cedet/semantic/decorate/include.el @@ -48,7 +48,7 @@ semantic-decoration-mouse-3 ;;; Includes that are in a happy state! ;; (defface semantic-decoration-on-includes - nil + '((t (:inherit default))) "Overlay Face used on includes that are not in some other state. Used by the decoration style: `semantic-decoration-on-includes'." :group 'semantic-faces) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 9b19a1b3980..0daeafe13ca 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -217,14 +217,17 @@ shr-h3 :version "28.1") (defface shr-h4 nil + '((t (:inherit default))) "Face for

elements." :version "28.1") (defface shr-h5 nil + '((t (:inherit default))) "Face for

elements." :version "28.1") (defface shr-h6 nil + '((t (:inherit default))) "Face for
elements." :version "28.1") diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 3869d0327fd..67d136b5a66 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -151,17 +151,17 @@ nxml-ref This is not used directly, but only via inheritance by other faces." :group 'nxml-faces) +(defface nxml-text + '((t (:inherit default))) + "Face used to highlight text." + :group 'nxml-faces) + (defface nxml-delimiter - nil + '((t (:inherit nxml-text))) "Face used to highlight delimiters. This is not used directly, but only via inheritance by other faces." :group 'nxml-faces) -(defface nxml-text - nil - "Face used to highlight text." - :group 'nxml-faces) - (defface nxml-processing-instruction-delimiter '((t (:inherit nxml-delimiter))) "Face used for the delimiters of processing instructions, i.e., ." @@ -230,7 +230,7 @@ nxml-element-prefix :group 'nxml-faces) (defface nxml-element-colon - nil + '((t (:inherit nxml-delimiter))) "Face used for the colon in element names." :group 'nxml-faces) diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 5ea03b9e852..308ba69cb9a 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -105,7 +105,7 @@ makefile-targets :version "22.1") (defface makefile-shell - () + '((t (:inherit default))) ;;'((((class color) (min-colors 88) (background light)) (:background "seashell1")) ;; (((class color) (min-colors 88) (background dark)) (:background "seashell4"))) "Face to use for additionally highlighting Shell commands in Font-Lock mode." diff --git a/lisp/time.el b/lisp/time.el index 522bec46ac6..0184f96fcc2 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -141,6 +141,7 @@ display-time-mail-face (defface display-time-date-and-time nil "Face for `display-time-format'." + '((t (:inherit mode-line))) :group 'mode-line-faces :version "30.1") commit 65108998b1ee0b42b57d478ba3b51f9040f04cd4 Author: Morgan J. Smith Date: Tue Jul 11 14:08:24 2023 -0400 docview: imenu: check return value of 'mutool' While 'mutool' supports many filetypes, 'mutool show' only supports PDF files. This would lead to cryptic imenu errors when opening other file types (like EPUB) since we would parse the error output. During my testing this caused 'imenu--index-alist' to have a value of '(nil). * lisp/doc-view.el (doc-view--pdf-outline): Error when 'mutool' returns an error. Use 'call-process' to get the return value and remove the call to 'shell-quote-argument' as 'call-process' doesn't want any escapes. (doc-view-mode): Handle possible error from 'doc-view-imenu-setup'. (doc-view-imenu-enabled): Remove superfluous (and ... t). (doc-view-imenu-setup): Remove check for mutool already ensured by 'doc-view-imenu-enabled' being non-nil. (Bug#64516) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index b14655fb274..847601872f5 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -147,6 +147,8 @@ (require 'filenotify) (eval-when-compile (require 'subr-x)) +(autoload 'imenu-unavailable-error "imenu") + ;;;; Customization Options (defgroup doc-view nil @@ -214,7 +216,7 @@ doc-view-mupdf-use-svg :type 'boolean :version "30.1") -(defcustom doc-view-imenu-enabled (and (executable-find "mutool") t) +(defcustom doc-view-imenu-enabled (executable-find "mutool") "Whether to generate an imenu outline when \"mutool\" is available." :type 'boolean :version "29.1") @@ -1910,9 +1912,10 @@ doc-view--pdf-outline (let ((fn (or file-name (buffer-file-name)))) (when fn (let ((outline nil) - (fn (shell-quote-argument (expand-file-name fn)))) + (fn (expand-file-name fn))) (with-temp-buffer - (insert (shell-command-to-string (format "mutool show %s outline" fn))) + (unless (= 0 (call-process "mutool" nil (current-buffer) nil "show" fn "outline")) + (imenu-unavailable-error "Unable to create imenu index using `mutool'")) (goto-char (point-min)) (while (re-search-forward doc-view--outline-rx nil t) (push `((level . ,(length (match-string 1))) @@ -1961,7 +1964,7 @@ doc-view-imenu-index (defun doc-view-imenu-setup () "Set up local state in the current buffer for imenu, if needed." - (when (and doc-view-imenu-enabled (executable-find "mutool")) + (when doc-view-imenu-enabled (setq-local imenu-create-index-function #'doc-view-imenu-index imenu-submenus-on-top nil imenu-sort-function nil @@ -2236,7 +2239,10 @@ doc-view-mode (setq mode-name "DocView" buffer-read-only t major-mode 'doc-view-mode) - (doc-view-imenu-setup) + (condition-case imenu-error + (doc-view-imenu-setup) + (imenu-unavailable (message "imenu support unavailable: %s" + (cadr imenu-error)))) (doc-view-initiate-display) ;; Switch off view-mode explicitly, because doc-view-mode is the ;; canonical view mode for PDF/PS/DVI files. This could be commit 3c041e3e964008b8627854235188d16ff7a59839 Author: Matthias Meulien Date: Thu Jul 13 23:38:41 2023 +0200 Custom var python-interpreter-args (bug#64397) * lisp/progmodes/python.el (python-interpreter): Mention new variable in documentation. (python-interpreter-args): New custom variable. (python-shell-interpreter, python-shell-interpreter-args) (python-shell-interpreter-interactive-arg): Improve documentation. (python--list-imports, python--do-isort) (python-fix-imports): Make process use customisable arguments. diff --git a/etc/NEWS b/etc/NEWS index 3117e907125..d1af3b1b866 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -411,6 +411,10 @@ instead of: and another_expression): do_something() +*** New user option 'python-interpreter-args'. +This allows the user to specify command line arguments to the non +interactive Python interpreter specified by 'python-interpreter'. + ** use-package +++ diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a23339a2180..52e5a36f4b0 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -297,11 +297,18 @@ python (defcustom python-interpreter "python" "Python interpreter for noninteractive use. -To customize the Python shell, modify `python-shell-interpreter' -instead." +Some Python interpreters also require changes to +`python-interpreter-args'. + +To customize the Python interpreter for interactive use, modify +`python-shell-interpreter' instead." :version "29.1" :type 'string) +(defcustom python-interpreter-args "" + "Arguments for the Python interpreter for noninteractive use." + :version "30.1" + :type 'string) ;;; Bindings @@ -2558,7 +2565,7 @@ python-shell-interpreter (cond ((executable-find "python3") "python3") ((executable-find "python") "python") (t "python3")) - "Default Python interpreter for shell. + "Python interpreter for interactive use. Some Python interpreters also require changes to `python-shell-interpreter-args'. In particular, setting @@ -2573,11 +2580,12 @@ python-shell-internal-buffer-name :safe 'stringp) (defcustom python-shell-interpreter-args "-i" - "Default arguments for the Python interpreter." + "Arguments for the Python interpreter for interactive use." :type 'string) (defcustom python-shell-interpreter-interactive-arg "-i" - "Interpreter argument to force it to run interactively." + "Interpreter argument to force it to run interactively. +This is used only for prompt detection." :type 'string :version "24.4") @@ -6505,18 +6513,25 @@ python--list-imports (let* ((temp (current-buffer)) (status (if (bufferp source) (with-current-buffer source - (call-process-region (point-min) (point-max) - python-interpreter - nil (list temp nil) nil - "-c" python--list-imports - (or name ""))) + (apply #'call-process-region + (point-min) (point-max) + python-interpreter + nil (list temp nil) nil + (append + (split-string-shell-command + python-interpreter-args) + `("-c" ,python--list-imports) + (list (or name ""))))) (with-current-buffer buffer (apply #'call-process python-interpreter nil (list temp nil) nil - "-c" python--list-imports - (or name "") - (mapcar #'file-local-name source))))) + (append + (split-string-shell-command + python-interpreter-args) + `("-c" ,python--list-imports) + (list (or name "")) + (mapcar #'file-local-name source)))))) lines) (python--list-imports-check-status status) (goto-char (point-min)) @@ -6559,7 +6574,11 @@ python--do-isort (point-min) (point-max) python-interpreter nil (list temp nil) nil - "-m" "isort" "-" args)) + (append + (split-string-shell-command + python-interpreter-args) + '("-m" "isort" "-") + args))) (tick (buffer-chars-modified-tick))) (unless (eq 0 status) (error "%s exited with status %s (maybe isort is missing?)" @@ -6629,10 +6648,14 @@ python-fix-imports (with-temp-buffer (let ((temp (current-buffer))) (with-current-buffer buffer - (call-process-region (point-min) (point-max) - python-interpreter - nil temp nil - "-m" "pyflakes")) + (apply #'call-process-region + (point-min) (point-max) + python-interpreter + nil temp nil + (append + (split-string-shell-command + python-interpreter-args) + '("-m" "pyflakes")))) (goto-char (point-min)) (when (looking-at-p ".* No module named pyflakes$") (error "%s couldn't find pyflakes" python-interpreter)) commit a5a8de4099bd246a85cc776fff2e9a8b4608d40b Author: Mauro Aranda Date: Sat Jul 15 18:54:14 2023 -0300 Preserve comments when redrawing a widget (Bug#64649) * lisp/cus-edit.el (custom-comment-preserve): New function. (custom-redraw): Use it. (custom-comment-create): Make sure :comment-shown is set to t if the comment widget gets created. (custom-face-value-create, custom-variable-value-create): Recreate the custom-comment widget with the preserved value, if any. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 4934694be14..0c62dd09744 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -2330,6 +2330,7 @@ custom-redraw (from (marker-position (widget-get widget :from))) (to (marker-position (widget-get widget :to)))) (save-excursion + (custom-comment-preserve widget) (widget-value-set widget (widget-value widget)) (custom-redraw-magic widget)) (when (and (>= pos from) (<= pos to)) @@ -2509,7 +2510,9 @@ custom-comment-create (let* ((null-comment (equal "" (widget-value widget)))) (if (or (widget-get (widget-get widget :parent) :comment-shown) (not null-comment)) - (widget-default-create widget) + (progn + (widget-default-create widget) + (widget-put (widget-get widget :parent) :comment-shown t)) ;; `widget-default-delete' expects markers in these slots -- ;; maybe it shouldn't. (widget-put widget :from (point-marker)) @@ -2542,6 +2545,14 @@ custom-comment-invisible-p (and (equal "" val) (not (widget-get widget :comment-shown))))) +;; This is useful when we want to redraw a widget, but we want to preserve +;; edits made by the user in the comment widget. (See Bug#64649) +(defun custom-comment-preserve (widget) + "Preserve the comment that belongs to WIDGET." + (when (widget-get widget :comment-shown) + (let ((comment-widget (widget-get widget :comment-widget))) + (widget-put comment-widget :value (widget-value comment-widget))))) + ;;; The `custom-variable' Widget. (defface custom-variable-obsolete @@ -2821,12 +2832,16 @@ custom-variable-value-create ;; The comment field (unless (eq state 'hidden) - (let* ((comment (get symbol 'variable-comment)) - (comment-widget - (widget-create-child-and-convert - widget 'custom-comment - :parent widget - :value (or comment "")))) + (let ((comment-widget + (widget-create-child-and-convert + widget 'custom-comment + :parent widget + :value (or + (and + (widget-get widget :comment-shown) + (widget-value (widget-get widget :comment-widget))) + (get symbol 'variable-comment) + "")))) (widget-put widget :comment-widget comment-widget) ;; Don't push it !!! Custom assumes that the first child is the ;; value one. @@ -3840,12 +3855,16 @@ custom-face-value-create widget :visibility-widget 'custom-visibility) ;; The comment field (unless hiddenp - (let* ((comment (get symbol 'face-comment)) - (comment-widget - (widget-create-child-and-convert - widget 'custom-comment - :parent widget - :value (or comment "")))) + (let ((comment-widget + (widget-create-child-and-convert + widget 'custom-comment + :parent widget + :value (or + (and + (widget-get widget :comment-shown) + (widget-value (widget-get widget :comment-widget))) + (get symbol 'face-comment) + "")))) (widget-put widget :comment-widget comment-widget) (push comment-widget children)))) commit bcb5bdc2e9abd58b8e946109a319986daec66ace Author: Mauro Aranda Date: Mon Jul 10 10:47:23 2023 -0300 Pass original spec just after creating the face-widget * lisp/cus-edit.el (custom-face-get-current-spec-unfiltered): New function, extracted from custom-face-get-current-spec. (custom-face-get-current-spec): Use it. (custom-face-state-set): Take an optional argument, to decide if we should check against a filtered or unfiltered spec. (custom-face-value-create): Use the new optional argument. (Bug#64347) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 4fca5761c17..4934694be14 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -3721,7 +3721,8 @@ custom-face-widget-to-spec `((t ,(widget-value child))) (widget-value child))))) -(defun custom-face-get-current-spec (face) +(defun custom-face-get-current-spec-unfiltered (face) + "Return the current spec for face FACE, without filtering it." (let ((spec (or (get face 'customized-face) (get face 'saved-face) (get face 'face-defface-spec) @@ -3732,7 +3733,11 @@ custom-face-get-current-spec ;; edit it as the user has specified it. (if (not (face-spec-match-p face spec (selected-frame))) (setq spec `((t ,(face-attr-construct face (selected-frame)))))) - (custom-pre-filter-face-spec spec))) + spec)) + +(defun custom-face-get-current-spec (face) + "Return the current spec for face FACE, filtering it." + (custom-pre-filter-face-spec (custom-face-get-current-spec-unfiltered face))) (defun custom-toggle-hide-face (visibility-widget &rest _ignore) "Toggle the visibility of a `custom-face' parent widget. @@ -3852,8 +3857,8 @@ custom-face-value-create (unless (widget-get widget :custom-form) (widget-put widget :custom-form custom-face-default-form)) - (let* ((spec (or (widget-get widget :shown-value) - (custom-face-get-current-spec symbol))) + (let* ((shown-value (widget-get widget :shown-value)) + (spec (or shown-value (custom-face-get-current-spec symbol))) (form (widget-get widget :custom-form)) (indent (widget-get widget :indent)) face-alist face-entry spec-default spec-match editor) @@ -3894,7 +3899,7 @@ custom-face-value-create widget 'sexp :value spec)))) (push editor children) (widget-put widget :children children) - (custom-face-state-set widget)))))) + (custom-face-state-set widget (not shown-value))))))) (defun cus--face-link (widget _format) (widget-create-child-and-convert @@ -4014,13 +4019,18 @@ custom-face-state 'changed state))) -(defun custom-face-state-set (widget) +(defun custom-face-state-set (widget &optional no-filter) "Set the state of WIDGET, a custom-face widget. If the user edited the widget, set the state to modified. If not, the new -state is one of the return values of `custom-face-state'." +state is one of the return values of `custom-face-state'. +Optional argument NO-FILTER means to check against an unfiltered spec." (let ((face (widget-value widget))) (widget-put widget :custom-state - (if (face-spec-match-p face (custom-face-widget-to-spec widget)) + (if (face-spec-match-p + face + (if no-filter + (custom-face-get-current-spec-unfiltered face) + (custom-face-widget-to-spec widget))) (custom-face-state face) 'modified)))) commit f9bbe3189b0eee627c3d8bca3221882cf0c29b26 Merge: 7ff41bf8ed8 4bd8e8c6d2b Author: Po Lu Date: Thu Jul 20 19:50:45 2023 +0800 Merge from origin/emacs-29 4bd8e8c6d2b ; * src/xdisp.c: Fix wording in commentary. 3af27a4b815 Improve commentary in nsfns.m 5de5e4b4d0a Fix typos and ommissions in cus-edit.el 9d93c6ba14a ; * src/xdisp.c: Fix typos in the commentary. 86f2d6d62fc ; * src/xdisp.c: Improve commentary. (Bug#64596) ac075176bf0 ; * admin/notes/bugtracker: Fix punctuation. 81518534471 ; * admin/notes/bugtracker: Use 'e.g.' throughout the doc... f063f79a493 Convert NUL-containing NSString objects to Lisp strings c... d172cd59854 ; * doc/lispref/keymaps.texi (Modifying Menus): Add cross... 927e8b470fc ; * doc/lispref/keymaps.texi (Extended Menu Items): Add @... 77f489421ec ; * src/xdisp.c: Minor improvements of the commentary. ce3f9fba1a3 ; Improve accuracy of out-out-order message insertion 17073af84d7 ; Improve robustness of package-report-bug commit 4bd8e8c6d2b75d678c13ae34c401668d3e8eecc7 Author: Eli Zaretskii Date: Thu Jul 20 13:23:01 2023 +0300 ; * src/xdisp.c: Fix wording in commentary. diff --git a/src/xdisp.c b/src/xdisp.c index 5a014e87e6c..fdb4acd71bf 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -78,8 +78,7 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. At its highest level, redisplay can be divided into 3 distinct steps, all of which are visible in `redisplay_internal': - . decide which windows on which frames need their windows - considered for redisplay + . decide which frames need their windows to be considered for redisplay . for each window whose display might need to be updated, compute a structure, called "glyph matrix", which describes how it should look on display commit 7ff41bf8ed8439c949af4cdd3ae8d01c8cdf997f Author: João Távora Date: Thu Jul 20 05:02:12 2023 -0500 Eglot: fix textDocument/onTypeFormatting for 'newline' command In the newline command, last-input-event is 13 (carriage return), but most, if not all, language servers that support documentOnTypeFormattingProvider expect 10 (linefeed) to be the trigger, so convert 13 to 10 for the purposes of the textDocument/onTypeFormatting request. Also make this common edit silent in the mode-line/messages. * lisp/progmodes/eglot.el (eglot--post-self-insert-hook): Convert linefeed to carriage return. (eglot-format): Pass SILENT to eglot--apply-text-edits. (eglot--apply-text-edits): Take new optional SILENT arg. * etc/EGLOT-NEWS: Mention change diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 6a2e9051ddc..0ccc8af3169 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -27,6 +27,13 @@ watching requests. This change slightly reduces the number of file watcher objects requested from the operating system, which can be a problem, particularly on Mac OS. See github#1228 and github#1226. +** Fixed "onTypeFormatting" feature + +This feature wasn't triggered for the 'newline' command because +language servers often expect 10 (linefeed) to be the trigger +character, but 'newline' emits 13 (carriage return). Also made this +feature less chatty in the mode-line and messages buffer. + * Changes in Eglot 1.15 (29/4/2023) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1df3a8844f8..172fd97fdb5 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2448,15 +2448,17 @@ eglot--last-inserted-char (defun eglot--post-self-insert-hook () "Set `eglot--last-inserted-char', maybe call on-type-formatting." (setq eglot--last-inserted-char last-input-event) - (let ((ot-provider (eglot--server-capable :documentOnTypeFormattingProvider))) + (let ((ot-provider (eglot--server-capable :documentOnTypeFormattingProvider)) + ;; transform carriage return into line-feed + (adjusted-ie (if (= last-input-event 13) 10 last-input-event))) (when (and ot-provider (ignore-errors ; github#906, some LS's send empty strings - (or (eq last-input-event + (or (eq adjusted-ie (seq-first (plist-get ot-provider :firstTriggerCharacter))) - (cl-find last-input-event + (cl-find adjusted-ie (plist-get ot-provider :moreTriggerCharacter) :key #'seq-first)))) - (eglot-format (point) nil last-input-event)))) + (eglot-format (point) nil adjusted-ie)))) (defvar eglot--workspace-symbols-cache (make-hash-table :test #'equal) "Cache of `workspace/Symbol' results used by `xref-find-definitions'.") @@ -2973,7 +2975,9 @@ eglot-format :insertSpaces (if indent-tabs-mode :json-false t) :insertFinalNewline (if require-final-newline t :json-false) :trimFinalNewlines (if delete-trailing-lines t :json-false)) - args))))) + args)) + nil + on-type-format))) (defvar eglot-cache-session-completions t "If non-nil Eglot caches data during completion sessions.") @@ -3380,8 +3384,9 @@ eglot-imenu (((SymbolInformation)) (eglot--imenu-SymbolInformation res)) (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res)))))) -(cl-defun eglot--apply-text-edits (edits &optional version) - "Apply EDITS for current buffer if at VERSION, or if it's nil." +(cl-defun eglot--apply-text-edits (edits &optional version silent) + "Apply EDITS for current buffer if at VERSION, or if it's nil. +If SILENT, don't echo progress in mode-line." (unless edits (cl-return-from eglot--apply-text-edits)) (unless (or (not version) (equal version eglot--versioned-identifier)) (jsonrpc-error "Edits on `%s' require version %d, you have %d" @@ -3389,10 +3394,11 @@ eglot--apply-text-edits (atomic-change-group (let* ((change-group (prepare-change-group)) (howmany (length edits)) - (reporter (make-progress-reporter - (format "[eglot] applying %s edits to `%s'..." - howmany (current-buffer)) - 0 howmany)) + (reporter (unless silent + (make-progress-reporter + (format "[eglot] applying %s edits to `%s'..." + howmany (current-buffer)) + 0 howmany))) (done 0)) (mapc (pcase-lambda (`(,newText ,beg . ,end)) (let ((source (current-buffer))) @@ -3404,12 +3410,14 @@ eglot--apply-text-edits (save-restriction (narrow-to-region beg end) (replace-buffer-contents temp))) - (eglot--reporter-update reporter (cl-incf done))))))) + (when reporter + (eglot--reporter-update reporter (cl-incf done)))))))) (mapcar (eglot--lambda ((TextEdit) range newText) (cons newText (eglot--range-region range 'markers))) (reverse edits))) (undo-amalgamate-change-group change-group) - (progress-reporter-done reporter)))) + (when reporter + (progress-reporter-done reporter))))) (defun eglot--apply-workspace-edit (wedit &optional confirm) "Apply the workspace edit WEDIT. If CONFIRM, ask user first." commit 3af27a4b815906c2ee38cbaf3a765289b3df061a Author: Po Lu Date: Thu Jul 20 16:01:34 2023 +0800 Improve commentary in nsfns.m * src/nsfns.m (lispString): Avoid C++ comment and make the commentary actually relevant to the reason `make_string' is used. diff --git a/src/nsfns.m b/src/nsfns.m index 5ae2cc77bb2..fe565a423aa 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3829,7 +3829,11 @@ handled fairly well by the NS libraries (displayed with distinct /* Make a Lisp string from an NSString. */ - (Lisp_Object)lispString { - // make_string behaves predictably and correctly with UTF-8 input. + /* `make_string' creates a string with a given length, instead of + searching for a trailing NULL byte to determine its end. This is + important because this function is called to convert NSString + objects containing clipboard data, which can contain NUL bytes, + into Lisp strings. (bug#64697) */ return make_string ([self UTF8String], [self lengthOfBytesUsingEncoding: NSUTF8StringEncoding]); } commit 5de5e4b4d0a0d90240ca055d29f264be39831e16 Author: Po Lu Date: Thu Jul 20 15:55:07 2023 +0800 Fix typos and ommissions in cus-edit.el * lisp/cus-edit.el (custom-display): Add missing display types. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 0373842de09..9ec10e63221 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -3533,7 +3533,11 @@ 'custom-display (const :format "PGTK " :sibling-args (:help-echo "\ Pure-GTK interface.") - ns) + pgtk) + (const :format "Haiku " + :sibling-args (:help-echo "\ +Haiku interface.") + haiku) (const :format "DOS " :sibling-args (:help-echo "\ Plain MS-DOS.") commit 9d93c6ba14aa0bdb312553ebbda751fe70c14852 Author: Eli Zaretskii Date: Wed Jul 19 19:28:48 2023 +0300 ; * src/xdisp.c: Fix typos in the commentary. diff --git a/src/xdisp.c b/src/xdisp.c index 3a347c1f923..5a014e87e6c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -109,11 +109,11 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. matrix', or `current matrix', in redisplay terminology. For buffer parts that have been changed since the last redisplay, - `redisplay_window' constructs a second glyph matrix is constructed, - the so called `desired glyph matrix' or short `desired matrix'. It - does so in the most optimal way possible, avoiding the examination - of text that didn't change, reusing portions of the current matrix - if possible, etc. It could, in particular, decide that a window + `redisplay_window' constructs a second glyph matrix, the so called + `desired glyph matrix' or short `desired matrix'. It does so in + the most optimal way possible, avoiding the examination of text + that didn't change, reusing portions of the current matrix if + possible, etc. It could, in particular, decide that a window doesn't need to be redisplayed at all. This second step of redisplay also updates the parts of the desired @@ -123,9 +123,9 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. In the third and last step, the current and desired matrix are then compared to find a cheap way to update the display, e.g. by reusing part of the display by scrolling lines. The actual update of the - display of each window by comparing the desired and the current - matrix is done by `update_window', which calls functions which draw - to the glass (those functions are specific to the type of the + display of each window, by comparing the desired and the current + matrix, is done by `update_window', which calls functions which + draw to the glass (those functions are specific to the type of the window's frame: X, w32, NS, etc.). Once the display of a window on the glass has been updated, its commit 86f2d6d62fce90d19815503e3e99ac9c4d4585af Author: Eli Zaretskii Date: Wed Jul 19 17:54:53 2023 +0300 ; * src/xdisp.c: Improve commentary. (Bug#64596) diff --git a/src/xdisp.c b/src/xdisp.c index aa63742e23d..3a347c1f923 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21,17 +21,17 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. Redisplay. - Emacs separates the task of updating the display from code - modifying global state, e.g. buffer text. This way functions - operating on buffers don't also have to be concerned with updating - the display. - - Updating the display is triggered by the Lisp interpreter when it - decides it's time to do it. This is done either automatically for - you as part of the interpreter's command loop or as the result of - calling Lisp functions like `sit-for'. The C function - `redisplay_internal' in xdisp.c is the only entry into the inner - redisplay code. + Emacs separates the task of updating the display -- which we call + "redisplay" -- from the code modifying global state, e.g. buffer + text. This way functions operating on buffers don't also have to + be concerned with updating the display as result of their + operations. + + Redisplay is triggered by the Lisp interpreter when it decides it's + time to do it. This is done either automatically for you as part + of the interpreter's command loop, or as the result of calling Lisp + functions like `sit-for'. The C function `redisplay_internal' in + xdisp.c is the only entry into the inner redisplay code. The following diagram shows how redisplay code is invoked. As you can see, Lisp calls redisplay and vice versa. @@ -75,35 +75,68 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. and to make these changes visible. Preferably it would do that in a moderately intelligent way, i.e. fast. - Changes in buffer text can be deduced from window and buffer + At its highest level, redisplay can be divided into 3 distinct + steps, all of which are visible in `redisplay_internal': + + . decide which windows on which frames need their windows + considered for redisplay + . for each window whose display might need to be updated, compute + a structure, called "glyph matrix", which describes how it + should look on display + . actually update the display of windows on the glass where the + newly obtained glyph matrix differs from the one produced by the + previous redisplay cycle + + The first of these steps is done by `redisplay_internal' itself, by + looping through all the frames and testing their various flags, + such as their visibility. The result of this could be that only + the selected window on the selected frame must be redisplayed, or + it could conclude that other windows need to be considered as well. + + The second step considers each window that might need to be + redisplayed. This could be only the selected window, or the window + trees of one or more frames. The function which considers a window + and decides whether it actually needs redisplay is + `redisplay_window'. It does so by looking at the changes in + position of point, in buffer text, in text properties, overlays, + etc. These changes can be deduced from window and buffer structures, and from some global variables like `beg_unchanged' and - `end_unchanged'. The contents of the display are additionally - recorded in a `glyph matrix', a two-dimensional matrix of glyph - structures. Each row in such a matrix corresponds to a line on the - display, and each glyph in a row corresponds to a column displaying - a character, an image, or what else. This matrix is called the - `current glyph matrix' or `current matrix' in redisplay - terminology. - - For buffer parts that have been changed since the last update, a - second glyph matrix is constructed, the so called `desired glyph - matrix' or short `desired matrix'. Current and desired matrix are - then compared to find a cheap way to update the display, e.g. by - reusing part of the display by scrolling lines. The actual update - of the display of each window by comparing the desired and the - current matrix is done by `update_window', which calls functions - which draw to the glass (those functions are specific to the type - of the window's frame: X, w32, NS, etc.). + `end_unchanged'. The current contents of the display are recorded + in a `glyph matrix', a two-dimensional matrix of glyph structures. + Each row in such a matrix corresponds to a line on the display, and + each glyph in a row corresponds to a column displaying a character, + an image, or what else. This matrix is called the `current glyph + matrix', or `current matrix', in redisplay terminology. + + For buffer parts that have been changed since the last redisplay, + `redisplay_window' constructs a second glyph matrix is constructed, + the so called `desired glyph matrix' or short `desired matrix'. It + does so in the most optimal way possible, avoiding the examination + of text that didn't change, reusing portions of the current matrix + if possible, etc. It could, in particular, decide that a window + doesn't need to be redisplayed at all. + + This second step of redisplay also updates the parts of the desired + matrix that correspond to the mode lines, header lines, and + tab-lines of the windows which need that; see `display_mode_lines'. + + In the third and last step, the current and desired matrix are then + compared to find a cheap way to update the display, e.g. by reusing + part of the display by scrolling lines. The actual update of the + display of each window by comparing the desired and the current + matrix is done by `update_window', which calls functions which draw + to the glass (those functions are specific to the type of the + window's frame: X, w32, NS, etc.). Once the display of a window on the glass has been updated, its desired matrix is used to update the corresponding rows of the current matrix, and then the desired matrix is discarded. You will find a lot of redisplay optimizations when you start - looking at the innards of redisplay. The overall goal of all these - optimizations is to make redisplay fast because it is done - frequently. Some of these optimizations are implemented by the - following functions: + looking at the innards of `redisplay_window'. The overall goal of + all these optimizations is to make redisplay fast because it is + done frequently. Some of these optimizations are implemented by + the following functions: . try_cursor_movement @@ -142,16 +175,17 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. Note that there's one more important optimization up Emacs's sleeve, but it is related to actually redrawing the potentially - changed portions of the window/frame, not to reproducing the - desired matrices of those potentially changed portions. Namely, - the function update_frame and its subroutines, which you will find - in dispnew.c, compare the desired matrices with the current - matrices, and only redraw the portions that changed. So it could - happen that the functions in this file for some reason decide that - the entire desired matrix needs to be regenerated from scratch, and - still only parts of the Emacs display, or even nothing at all, will - be actually delivered to the glass, because update_frame has found - that the new and the old screen contents are similar or identical. + changed portions of the window/frame as part of the third step, not + to generating the desired matrices of those potentially changed + portions. Namely, the function `update_frame' and its subroutines, + which you will find in dispnew.c, compare the desired matrices with + the current matrices, and only redraw the portions that changed. + So it could happen that the functions in this file for some reason + decide that the entire desired matrix needs to be regenerated from + scratch, and still only parts of the Emacs display, or even nothing + at all, will be actually delivered to the glass, because + `update_frame' has found that the new and the old screen contents + are similar or identical. Desired matrices. @@ -161,7 +195,7 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. redisplay tries to optimize its work, and thus only generates glyphs for rows that need to be updated on the screen. Rows that don't need to be updated are left "disabled", and their contents - should be ignored. + in the desired matrix should be ignored. The function `display_line' is the central function to look at if you are interested in how the rows of the desired matrix are commit ac075176bf077ad79272e3d6c032c0658e4e19fc Author: Eli Zaretskii Date: Wed Jul 19 15:05:52 2023 +0300 ; * admin/notes/bugtracker: Fix punctuation. diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index d1edad17177..b47061884d6 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -39,7 +39,7 @@ tags 123 moreinfo|unreproducible|wontfix|patch|notabug For a list of all bugs, see https://debbugs.gnu.org/db/pa/lemacs.html This is a static page, updated once a day. There is also a dynamic -list, generated on request. This accepts various options, e.g. to see +list, generated on request. This accepts various options, e.g., to see the most recent bugs: https://debbugs.gnu.org/cgi/pkgreport.cgi?newest=100 @@ -98,7 +98,7 @@ you might want to have a dialog with the owner address, outside of normal bug reporting.) ** When reporting a new bug, to send a Cc to another address -(e.g. bug-cc-mode@gnu.org), do NOT just use a Cc: header. +(e.g., bug-cc-mode@gnu.org), do NOT just use a Cc: header. Instead, use "X-Debbugs-Cc:". This ensures the Cc address(es) will get a mail with the bug report number in. If you do not do this, each reply in the subsequent discussion might end up creating a new bug. @@ -230,7 +230,7 @@ Version: 23.0.60 Severity: minor This can also include tags, or any X-Debbugs- setting. -Some things (e.g. submitter) don't seem to work here. +Some things (e.g., submitter) don't seem to work here. Otherwise, send mail to the control server, control@debbugs.gnu.org. At the start of the message body, supply the desired commands, one per @@ -259,12 +259,12 @@ where VERSION is XX.YY numerical version number, like 42.1. *** To reopen a closed bug: reopen 123 -*** Bugs can be tagged in various ways (e.g. wontfix, patch, etc). +*** Bugs can be tagged in various ways (e.g., wontfix, patch, etc). The available tags are: patch wontfix moreinfo unreproducible fixed notabug help security confirmed easy See https://debbugs.gnu.org/Developer#tags The list of tags can be prefixed with +, - or =, meaning to add (the -default), remove, or reset the tags. E.g.: +default), remove, or reset the tags. E.g.: tags 123 + wontfix @@ -311,7 +311,7 @@ This will add a usertag "any-tag-you-like" to bug#1234. The tag will be associated with the user "emacs". If you omit the first line, the tag will be associated with your email address. -The syntax of the usertags command is the same as that of tags (e.g. wrt +The syntax of the usertags command is the same as that of tags (e.g., wrt the optional [=+-] argument). b) In an initial submission, in the pseudo-header: @@ -346,10 +346,10 @@ This works just like a normal tags search, but with the addition of a https://debbugs.gnu.org/cgi/pkgreport.cgi?users=emacs;tag=calendar *** To merge bugs: -E.g. when bad replies create a bunch of new bugs for the same report. -Bugs must all be in the same state (e.g. same package(s) and severity +e.g., when bad replies create a bunch of new bugs for the same report. +Bugs must all be in the same state (e.g., same package(s) and severity -- see 'reassign' and 'severity' below), but need not have the same -tags (tags are merged). E.g.: +tags (tags are merged). E.g.: merge 123 124 125 ... @@ -558,7 +558,7 @@ debbugs-submit. Approved mail is passed on to the tracker. tracker, since mail from whitelisted senders goes straight through.) NOTE: An alternative to this would be to use listhelper AT nongnu.org -as a moderator address. E.g. the emacs-bug-tracker list uses this. +as a moderator address. E.g., the emacs-bug-tracker list uses this. It does basic spam processing on the moderator requests and automatically rejects the obviously bogus ones. Someone still has to accept the good ones though. The advantage of this would not be having commit 815185344713aafb314c6c413ba9f146a7ff017f Author: Arash Esbati Date: Tue Jul 18 23:07:01 2023 +0200 ; * admin/notes/bugtracker: Use 'e.g.' throughout the document. diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index deb06f552cc..d1edad17177 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -39,7 +39,7 @@ tags 123 moreinfo|unreproducible|wontfix|patch|notabug For a list of all bugs, see https://debbugs.gnu.org/db/pa/lemacs.html This is a static page, updated once a day. There is also a dynamic -list, generated on request. This accepts various options, eg to see +list, generated on request. This accepts various options, e.g. to see the most recent bugs: https://debbugs.gnu.org/cgi/pkgreport.cgi?newest=100 @@ -138,7 +138,8 @@ The "maintainer email address" is "bug-gnu-emacs@gnu.org" in most cases. ** To not get acknowledgment mail from the tracker, add an "X-Debbugs-No-Ack:" header (with any value). If you use Gnus, -you can add an element to gnus-posting-styles to do this automatically, eg: +you can add an element to gnus-posting-styles to do this automatically, +e.g.: ("gnu-emacs\\(-pretest\\)?-bug" ("X-Debbugs-No-Ack" "yes")) @@ -222,7 +223,7 @@ Mail-Followup-To: 123@debbugs.gnu.org, person-who-closed ** Setting bug parameters. There are two ways to set the parameters of bugs in the database (tags, severity level, etc). When you report a new bug, you can -provide a "pseudo-header" at the start of the report, eg: +provide a "pseudo-header" at the start of the report, e.g.: Package: emacs Version: 23.0.60 @@ -258,7 +259,7 @@ where VERSION is XX.YY numerical version number, like 42.1. *** To reopen a closed bug: reopen 123 -*** Bugs can be tagged in various ways (eg wontfix, patch, etc). +*** Bugs can be tagged in various ways (e.g. wontfix, patch, etc). The available tags are: patch wontfix moreinfo unreproducible fixed notabug help security confirmed easy See https://debbugs.gnu.org/Developer#tags @@ -310,7 +311,7 @@ This will add a usertag "any-tag-you-like" to bug#1234. The tag will be associated with the user "emacs". If you omit the first line, the tag will be associated with your email address. -The syntax of the usertags command is the same as that of tags (eg wrt +The syntax of the usertags command is the same as that of tags (e.g. wrt the optional [=+-] argument). b) In an initial submission, in the pseudo-header: @@ -340,12 +341,12 @@ than one email address, but it does not seem to work for me.) **** To find bugs tagged with a specific usertag: This works just like a normal tags search, but with the addition of a -"users" field. Eg: +"users" field. E.g.: https://debbugs.gnu.org/cgi/pkgreport.cgi?users=emacs;tag=calendar *** To merge bugs: -Eg when bad replies create a bunch of new bugs for the same report. +E.g. when bad replies create a bunch of new bugs for the same report. Bugs must all be in the same state (e.g. same package(s) and severity -- see 'reassign' and 'severity' below), but need not have the same tags (tags are merged). E.g.: @@ -557,7 +558,7 @@ debbugs-submit. Approved mail is passed on to the tracker. tracker, since mail from whitelisted senders goes straight through.) NOTE: An alternative to this would be to use listhelper AT nongnu.org -as a moderator address. Eg the emacs-bug-tracker list uses this. +as a moderator address. E.g. the emacs-bug-tracker list uses this. It does basic spam processing on the moderator requests and automatically rejects the obviously bogus ones. Someone still has to accept the good ones though. The advantage of this would not be having commit f063f79a4933f21dc72c6a24b60f98197543d3de Author: Mattias Engdegård Date: Tue Jul 18 15:42:55 2023 +0200 Convert NUL-containing NSString objects to Lisp strings correctly This cures the inability to paste text containing NUL from other applications on macOS, introduced by mistake in 7e3c2b553f (bug#64697). * src/nsfns.m ([NSString lispString]): Use make_string instead of build_string which relies on NUL-termination. diff --git a/src/nsfns.m b/src/nsfns.m index 8804a7df7cf..5ae2cc77bb2 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3829,7 +3829,9 @@ handled fairly well by the NS libraries (displayed with distinct /* Make a Lisp string from an NSString. */ - (Lisp_Object)lispString { - return build_string ([self UTF8String]); + // make_string behaves predictably and correctly with UTF-8 input. + return make_string ([self UTF8String], + [self lengthOfBytesUsingEncoding: NSUTF8StringEncoding]); } @end commit d172cd59854699c00de3b57a91e48ff70a4210f8 Author: Eli Zaretskii Date: Tue Jul 18 16:17:15 2023 +0300 ; * doc/lispref/keymaps.texi (Modifying Menus): Add cross-references. diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 66bb834192c..24b7738caff 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -3172,14 +3172,15 @@ Modifying Menus @defun keymap-set-after map key binding &optional after Define a binding in @var{map} for @var{key}, with value @var{binding}, -just like @code{define-key}, but position the binding in @var{map} after -the binding for the event @var{after}. The argument @var{key} should -represent a single menu item or key, and @var{after} should be a -single event type---a symbol or a character, not a sequence. The new -binding goes after the binding for @var{after}. If @var{after} is -@code{t} or is omitted, then the new binding goes last, at the end of -the keymap. However, new bindings are added before any inherited -keymap. +just like @code{keymap-set} (@pxref{Changing Key Bindings}), but +position the binding in @var{map} after the binding for the event +@var{after}. The argument @var{key} should represent a single menu +item or key, and should satisfy @code{key-valid-p} (@pxref{Key +Sequences}). @var{after} should be a single event type---a symbol or +a character, not a sequence. The new binding goes after the binding +for @var{after}. If @var{after} is @code{t} or is omitted, then the +new binding goes last, at the end of the keymap. However, new +bindings are added before any inherited keymap. Here is an example: commit 927e8b470fc342fcdefa68a75ce01f3a45300dc7 Author: Eli Zaretskii Date: Tue Jul 18 15:57:01 2023 +0300 ; * doc/lispref/keymaps.texi (Extended Menu Items): Add @pxref. diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 9e36d6716b9..66bb834192c 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -2506,7 +2506,8 @@ Extended Menu Items separator lines and the like. The tail of the list, @var{item-property-list}, has the form of a -property list which contains other information. +property list (@pxref{Property Lists}) which contains other +information. Here is a table of the properties that are supported: commit 77f489421ec2958351cda612ddccf53581f41a74 Author: Eli Zaretskii Date: Tue Jul 18 14:58:09 2023 +0300 ; * src/xdisp.c: Minor improvements of the commentary. diff --git a/src/xdisp.c b/src/xdisp.c index 763af7d3bc8..aa63742e23d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -107,31 +107,33 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc. . try_cursor_movement - This function tries to update the display if the text in the - window did not change and did not scroll, only point moved, and - it did not move off the displayed portion of the text. + This optimization is applicable if the text in the window did + not change and did not scroll, only point moved, and it did not + move off the displayed portion of the text. In that case, the + window's glyph matrix is still valid, and only the position of + the cursor might need to be updated. . try_window_reusing_current_matrix - This function reuses the current matrix of a window when text - has not changed, but the window start changed (e.g., due to + This function reuses the current glyph matrix of a window when + text has not changed, but the window start changed (e.g., due to scrolling). . try_window_id - This function attempts to redisplay a window by reusing parts of - its existing display. It finds and reuses the part that was not - changed, and redraws the rest. (The "id" part in the function's - name stands for "insert/delete", not for "identification" or - somesuch.) + This function attempts to update a window's glyph matrix by + reusing parts of its current glyph matrix. It finds and reuses + the part that was not changed, and regenerates the rest. (The + "id" part in the function's name stands for "insert/delete", not + for "identification" or somesuch.) . try_window - This function performs the full, unoptimized, redisplay of a - single window assuming that its fonts were not changed and that - the cursor will not end up in the scroll margins. (Loading - fonts requires re-adjustment of dimensions of glyph matrices, - which makes this method impossible to use.) + This function performs the full, unoptimized, generation of a + single window's glyph matrix, assuming that its fonts were not + changed and that the cursor will not end up in the scroll + margins. (Loading fonts requires re-adjustment of dimensions of + glyph matrices, which makes this method impossible to use.) The optimizations are tried in sequence (some can be skipped if it is known that they are not applicable). If none of the commit ce3f9fba1a32260ff837d689ac6928a75bab86d9 Author: Philip Kaludercic Date: Mon Jul 17 22:02:38 2023 +0200 ; Improve accuracy of out-out-order message insertion * lisp/net/rcirc.el (rcirc-print): Do not ignore the return value of 'next-single-property-change'. diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index cf1b952086a..1ddffe8dec9 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2059,7 +2059,7 @@ rcirc-print (point-min))) (when (let ((then (get-text-property (point) 'rcirc-time))) (and then (not (time-less-p time then)))) - (next-single-property-change (point) 'hard) + (goto-char (next-single-property-change (point) 'hard)) (forward-char 1) (throw 'exit nil)))) (goto-char (line-beginning-position)) commit 17073af84d7eaedc81d84fc16f8aa0db215c6a31 Author: Spencer Baugh Date: Sun Jul 9 12:59:50 2023 -0400 ; Improve robustness of package-report-bug * lisp/emacs-lisp/package.el (package-report-bug): Do not assume that every entry in 'custom-current-group-alist' has a non-nil entry for a filename. It is possible for a group to not be associated with any file, e.g. when a 'defgroup' form is evaluated using 'eval-expression'. (bug#64543) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 3e6acd9b388..58ca19f7fe2 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4637,13 +4637,14 @@ package-report-bug vars) (dolist-with-progress-reporter (group custom-current-group-alist) "Scanning for modified user options..." - (dolist (ent (get (cdr group) 'custom-group)) - (when (and (custom-variable-p (car ent)) - (boundp (car ent)) - (not (eq (custom--standard-value (car ent)) - (default-toplevel-value (car ent)))) - (file-in-directory-p (car group) (package-desc-dir desc))) - (push (car ent) vars)))) + (when (and (car group) + (file-in-directory-p (car group) (package-desc-dir desc))) + (dolist (ent (get (cdr group) 'custom-group)) + (when (and (custom-variable-p (car ent)) + (boundp (car ent)) + (not (eq (custom--standard-value (car ent)) + (default-toplevel-value (car ent))))) + (push (car ent) vars))))) (dlet ((reporter-prompt-for-summary-p t)) (reporter-submit-bug-report maint name vars))))