[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/pkg ca9d513fefe 2/2: Merge remote-tracking branch 'origin/master
From: |
Gerd Moellmann |
Subject: |
scratch/pkg ca9d513fefe 2/2: Merge remote-tracking branch 'origin/master' into scratch/pkg |
Date: |
Sat, 22 Jul 2023 08:21:52 -0400 (EDT) |
branch: scratch/pkg
commit ca9d513fefe57e3cae33db429a7501209fcd182b
Merge: 0da95fb682a 297cf9d5bf0
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
Merge remote-tracking branch 'origin/master' into scratch/pkg
---
doc/emacs/files.texi | 7 ++--
doc/lispref/files.texi | 11 +++++
doc/misc/tramp.texi | 33 ++++++++++-----
etc/EGLOT-NEWS | 7 ++--
etc/NEWS | 29 ++++++++++++--
lisp/cedet/semantic/decorate/include.el | 2 +-
lisp/cus-edit.el | 71 +++++++++++++++++++++++----------
lisp/doc-view.el | 16 +++++---
lisp/emacs-lisp/macroexp.el | 28 ++++++-------
lisp/net/shr.el | 9 +++--
lisp/net/tramp.el | 19 +++++++++
lisp/nxml/nxml-mode.el | 14 +++----
lisp/proced.el | 6 ++-
lisp/progmodes/cc-defs.el | 29 ++++++++++----
lisp/progmodes/cc-langs.el | 29 +++++++++-----
lisp/progmodes/eglot.el | 12 +++---
lisp/progmodes/make-mode.el | 2 +-
lisp/progmodes/python.el | 59 ++++++++++++++++++---------
lisp/thingatpt.el | 7 +++-
lisp/time.el | 3 +-
lisp/wid-edit.el | 2 +-
src/regex-emacs.c | 2 +-
src/search.c | 11 ++---
src/xdisp.c | 4 +-
test/lisp/emacs-lisp/macroexp-tests.el | 16 ++++++++
test/lisp/net/tramp-archive-tests.el | 14 +++++++
test/lisp/net/tramp-tests.el | 17 +++++++-
test/src/comp-tests.el | 2 +-
28 files changed, 329 insertions(+), 132 deletions(-)
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 9734223b95e..ac7751ceb53 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -2093,10 +2093,11 @@ Otherwise, Emacs uses @command{ssh}.
@end enumerate
@cindex disabling remote files
+@cindex inhibit-remote-files
@noindent
-You can entirely turn off the remote file name feature by setting the
-variable @code{tramp-mode} to @code{nil}. You can turn off the
-feature in individual cases by quoting the file name with @samp{/:}
+You can entirely turn off the remote file name feature by running
+@kbd{M-x inhibit-remote-files}. You can turn off the feature in
+individual cases by quoting the file name with @samp{/:}
(@pxref{Quoted File Names}).
@cindex @code{ange-ftp}
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 31d4aaca507..aaab4e455a0 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3698,6 +3698,17 @@ between consecutive checks. For example:
@end example
@end defopt
+@defmac without-remote-files body@dots{}
+The @code{without-remote-files} macro evaluates the @var{body} forms
+with deactivated file name handlers for remote files. Those file
+names would be handled literally.
+
+The macro should be used only in forms where it is obvious, that
+remote files cannot appear or where it is intended not to handle
+remote file names. It also reduces checks with
+@code{file-name-handler-alist}, resulting in more performant code.
+@end defmac
+
@node Format Conversion
@section File Format Conversion
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index ff2a66ae720..1d8e0095328 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -5851,16 +5851,6 @@ If you want to enable Ange FTP's syntax, add the
following form:
(tramp-change-syntax 'simplified)
@end lisp
-@item
-@vindex tramp-mode
-To disable both @value{tramp} (and Ange FTP), set @code{tramp-mode} to
-@code{nil} in @file{.emacs}. @strong{Note}, that we don't use
-@code{customize-set-variable}, in order to avoid loading @value{tramp}.
-
-@lisp
-(setq tramp-mode nil)
-@end lisp
-
@item
@vindex tramp-ignored-file-name-regexp
To deactivate @value{tramp} for some look-alike remote file names, set
@@ -5877,6 +5867,29 @@ This is needed, if you mount for example a virtual file
system on your
local host's root directory as @file{/ssh:example.com:}.
@item
+@findex inhibit-remote-files
+To disable both @value{tramp} (and Ange FTP), type @kbd{M-x
+inhibit-remote-files @key{RET}}. You can also add this to your
+@file{.emacs}.
+
+@lisp
+(inhibit-remote-files)
+@end lisp
+
+@item
+@findex without-remote-files
+If you write code, which is intended to run only for local files, you
+can use the @code{without-remote-files} macro.
+
+@lisp
+(without-remote-files @dots{})
+@end lisp
+
+This improves performance, because many primitive file name operations
+don't check any longer for Tramp file name regexps then.
+
+@item
+@findex tramp-unload-tramp
To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp @key{RET}}.
Unloading @value{tramp} resets Ange FTP plugins also.
@end itemize
diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS
index 0ccc8af3169..01f0498eb81 100644
--- a/etc/EGLOT-NEWS
+++ b/etc/EGLOT-NEWS
@@ -29,10 +29,9 @@ 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.
+For 'newline' commands, Eglot sometimes sent the wrong character code
+to the server. Also made this feature less chatty in the mode-line
+and messages buffer.
* Changes in Eglot 1.15 (29/4/2023)
diff --git a/etc/NEWS b/etc/NEWS
index 3117e907125..c2c436fb477 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -93,11 +93,12 @@ The 'tool-bar-position' frame parameter can be set to
'bottom' on all
window systems other than Nextstep.
** cl-print
+
*** You can expand the "..." truncation everywhere.
-The code that allowed "..." to be expanded in the *Backtrace* should
-now work anywhere the data is generated by `cl-print`.
+The code that allowed "..." to be expanded in the "*Backtrace*" buffer
+should now work anywhere the data is generated by 'cl-print'.
-*** hash-tables' contents can be expanded via the ellipsis
+*** hash-tables' contents can be expanded via the ellipsis.
** Modeline elements can now be right-aligned.
Anything following the symbol 'mode-line-format-right-align' in
@@ -264,6 +265,8 @@ docstring, or a comment, or (re)indents the surrounding
defun if
point is not in a comment or a string. It is by default bound to
'M-q' in 'prog-mode' and all its descendants.
+** Which Function Mode
+
+++
*** Which Function Mode can now display function names on the header line.
The new user option 'which-func-display' allows choosing where the
@@ -300,6 +303,19 @@ sessions, respectively.
It allows to kill only selected remote buffers, controlled by user
option 'tramp-cleanup-some-buffers-hook'.
++++
+*** New command 'inhibit-remote-files'.
+This command disables the handling of file names with the special
+remote file name syntax. It should be applied only when remote files
+won't be used in this Emacs instance. It provides a slightly improved
+performance of file name handling in Emacs.
+
++++
+*** New macro 'without-remote-files'.
+This macro could wrap code which handles local files only. Due to the
+temporary deactivation of remote files, it results in a slightly
+improved performance of file name handling in Emacs.
+
** EWW
+++
@@ -411,6 +427,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
+++
@@ -598,7 +618,7 @@ behavior back for any other reason, you can do that using
the
'coding-system-put' function. For example, the following restores the
previous behavior of showing 'U' in the mode line for 'koi8-u':
- (coding-system-put 'koi8-u :mnemonic ?U)
+ (coding-system-put 'koi8-u :mnemonic ?U)
+++
** Infinities and NaNs no longer act as symbols on non-IEEE platforms.
@@ -607,6 +627,7 @@ tokens like 0.0e+NaN and 1.0e+INF are no longer read as
symbols.
Instead, the Lisp reader approximates an infinity with the nearest
finite value, and a NaN with some other non-numeric object that
provokes an error if used numerically.
+
* Lisp Changes in Emacs 30.1
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 @@
;;; 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/cus-edit.el b/lisp/cus-edit.el
index 4fca5761c17..0c62dd09744 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2330,6 +2330,7 @@ and `face'."
(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 @@ If INITIAL-STRING is non-nil, use that rather than
\"Parent groups:\"."
(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 @@ If INITIAL-STRING is non-nil, use that rather than
\"Parent groups:\"."
(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 @@ try matching its doc string against
`custom-guess-doc-alist'."
;; 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.
@@ -3721,7 +3736,8 @@ WIDGET should be a `custom-face' widget."
`((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 +3748,11 @@ WIDGET should be a `custom-face' widget."
;; 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.
@@ -3835,12 +3855,16 @@ the present value is saved to its :shown-value property
instead."
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))))
@@ -3852,8 +3876,8 @@ the present value is saved to its :shown-value property
instead."
(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 +3918,7 @@ the present value is saved to its :shown-value property
instead."
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 +4038,18 @@ This is one of `set', `saved', `changed', `themed', or
`rogue'."
'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))))
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 @@ are available (see Info node `(emacs)Document View')."
: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 @@ structure is extracted by `doc-view--imenu-subtree'."
(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 @@ GOTO-PAGE-FN other than `doc-view-goto-page'."
(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 @@ toggle between displaying the document or editing it as
text.
(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
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index c4a0409ffc6..ac89697e966 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -227,21 +227,19 @@ It should normally be a symbol with position and it
defaults to FORM."
(defun macroexp-macroexpand (form env)
"Like `macroexpand' but checking obsolescence."
(let* ((macroexpand-all-environment env)
- (new-form
- (macroexpand form env)))
- (if (and (not (eq form new-form)) ;It was a macro call.
- (car-safe form)
- (symbolp (car form))
- (get (car form) 'byte-obsolete-info))
- (let* ((fun (car form))
- (obsolete (get fun 'byte-obsolete-info)))
- (macroexp-warn-and-return
- (macroexp--obsolete-warning
- fun obsolete
- (if (symbolp (symbol-function fun))
- "alias" "macro"))
- new-form (list 'obsolete fun) nil fun))
- new-form)))
+ new-form)
+ (while (not (eq form (setq new-form (macroexpand-1 form env))))
+ (let ((fun (car-safe form)))
+ (setq form
+ (if (and fun (symbolp fun)
+ (get fun 'byte-obsolete-info))
+ (macroexp-warn-and-return
+ (macroexp--obsolete-warning
+ fun (get fun 'byte-obsolete-info)
+ (if (symbolp (symbol-function fun)) "alias" "macro"))
+ new-form (list 'obsolete fun) nil fun)
+ new-form))))
+ form))
(defun macroexp--unfold-lambda (form &optional name)
(or name (setq name "anonymous lambda"))
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 9b19a1b3980..b5bb7b42650 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -216,15 +216,18 @@ temporarily blinks with this face."
"Face for <h3> elements."
:version "28.1")
-(defface shr-h4 nil
+(defface shr-h4
+ '((t (:inherit default)))
"Face for <h4> elements."
:version "28.1")
-(defface shr-h5 nil
+(defface shr-h5
+ '((t (:inherit default)))
"Face for <h5> elements."
:version "28.1")
-(defface shr-h6 nil
+(defface shr-h6
+ '((t (:inherit default)))
"Face for <h6> elements."
:version "28.1")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 55e1ca932e4..53a80c41680 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2967,6 +2967,25 @@ whether HANDLER is to be called. Add operations defined
in
(put #'tramp-unload-file-name-handlers 'tramp-autoload t)
(add-hook 'tramp-unload-hook #'tramp-unload-file-name-handlers)
+;;;###autoload
+(progn (defun inhibit-remote-files ()
+ "Deactivate remote file names."
+ (interactive)
+ (when (fboundp 'tramp-cleanup-all-connections)
+ (funcall 'tramp-cleanup-all-connections))
+ (tramp-unload-file-name-handlers)
+ (setq tramp-mode nil)))
+
+;;;###autoload
+(progn (defmacro without-remote-files (&rest body)
+ "Deactivate remote file names temporarily.
+Run BODY."
+ (declare (indent 0) (debug ((form body) body)))
+ `(let ((file-name-handler-alist (copy-tree file-name-handler-alist))
+ tramp-mode)
+ (tramp-unload-file-name-handlers)
+ ,@body)))
+
;;; File name handler functions for completion mode:
;; This function takes action since Emacs 28.1, when
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 @@ This is not used directly, but only via inheritance by
other faces."
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., <? and ?>."
@@ -230,7 +230,7 @@ This includes the `x' in hex references."
: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/proced.el b/lisp/proced.el
index 03a7f1bebdf..b3d581a49d1 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -776,12 +776,12 @@ of the process. A value of nil indicates that there are
no active refinements."
(while (string-match "[ \t\n]+" hl pos)
(setq pos (match-end 0))
(put-text-property (match-beginning 0) pos 'display
- `(space :align-to ,(+ pos base))
+ `(space :align-to (,(+ pos base) . width))
hl)))
(setq hl (replace-regexp-in-string ;; preserve text properties
"\\(%\\)" "\\1\\1"
hl)))
- (list (propertize " " 'display `(space :align-to ,base))
+ (list (propertize " " 'display `(space :align-to (,base . width)))
hl)))
(defun proced-pid-at-point ()
@@ -894,6 +894,8 @@ normal hook `proced-post-display-hook'.
(setq-local font-lock-defaults
'(proced-font-lock-keywords t nil nil beginning-of-line))
(setq-local switch-to-buffer-preserve-window-point nil)
+ ;; So that the heading scales together with the body of the table.
+ (setq-local text-scale-remap-header-line t)
(if (and (not proced-auto-update-timer) proced-auto-update-interval)
(setq proced-auto-update-timer
(run-at-time t proced-auto-update-interval
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 @@ to it is returned. This function does not modify the
point or the mark."
(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 @@ to it is returned. This function does not modify the
point or the mark."
(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 @@ Currently (2022-09) just C++ Mode uses this."
;; 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 @@ further directions."
(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 @@ further directions."
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)))
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 172fd97fdb5..ae31985a676 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2447,18 +2447,16 @@ buffer."
(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))
- ;; transform carriage return into line-feed
- (adjusted-ie (if (= last-input-event 13) 10 last-input-event)))
+ (setq eglot--last-inserted-char last-command-event)
+ (let ((ot-provider (eglot--server-capable
:documentOnTypeFormattingProvider)))
(when (and ot-provider
(ignore-errors ; github#906, some LS's send empty strings
- (or (eq adjusted-ie
+ (or (eq eglot--last-inserted-char
(seq-first (plist-get ot-provider
:firstTriggerCharacter)))
- (cl-find adjusted-ie
+ (cl-find eglot--last-inserted-char
(plist-get ot-provider :moreTriggerCharacter)
:key #'seq-first))))
- (eglot-format (point) nil adjusted-ie))))
+ (eglot-format (point) nil eglot--last-inserted-char))))
(defvar eglot--workspace-symbols-cache (make-hash-table :test #'equal)
"Cache of `workspace/Symbol' results used by `xref-find-definitions'.")
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 @@
: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/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 @@
(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 @@ position, else returns nil."
(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 @@ Some Python interpreters also require changes to
: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 @@ recursively."
(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 @@ Return non-nil if the buffer was actually modified."
(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 @@ asking."
(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))
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index f3367290dee..72acb0b749f 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -250,7 +250,8 @@ Prefer the enclosing string with fallback on sexp at point.
(goto-char (nth 8 ppss))
(cons (point) (progn (forward-sexp) (point))))
;; At the beginning of the string
- (if (eq (char-syntax (char-after)) ?\")
+ (if (let ((ca (char-after)))
+ (and ca (eq (char-syntax ca) ?\")))
(let ((bound (bounds-of-thing-at-point 'sexp)))
(and bound
(<= (car bound) (point)) (< (point) (cdr bound))
@@ -359,6 +360,10 @@ E.g.:
(and (file-exists-p filename)
filename)))
+(put 'existing-filename 'bounds-of-thing-at-point
+ (lambda ()
+ (and (thing-at-point 'existing-filename)
+ (bounds-of-thing-at-point 'filename))))
(put 'existing-filename 'thing-at-point 'thing-at-point-file-at-point)
;; Faces
diff --git a/lisp/time.el b/lisp/time.el
index 522bec46ac6..3f10deff5fd 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -139,7 +139,8 @@ make the mail indicator stand out on a color display."
:version "22.1"
:type '(choice (const :tag "None" nil) face))
-(defface display-time-date-and-time nil
+(defface display-time-date-and-time
+ '((t nil))
"Face for `display-time-format'."
:group 'mode-line-faces
:version "30.1")
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 @@ in the key vector, as in the argument of `define-key'."
(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))))))))
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 9e298b81ebb..51fc2b0558d 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -554,7 +554,7 @@ print_partial_compiled_pattern (re_char *start, re_char
*end)
fprintf (stderr, "/charset [%s",
(re_opcode_t) *(p - 1) == charset_not ? "^" : "");
- if (p + *p >= pend)
+ if (p + (*p & 0x7f) >= pend)
fputs (" !extends past end of pattern! ", stderr);
for (c = 0; c < 256; c++)
diff --git a/src/search.c b/src/search.c
index 122d6166637..3edfc0bc1a8 100644
--- a/src/search.c
+++ b/src/search.c
@@ -162,7 +162,7 @@ clear_regexp_cache (void)
/* It's tempting to compare with the syntax-table we've actually changed,
but it's not sufficient because char-table inheritance means that
modifying one syntax-table can change others at the same time. */
- if (!searchbufs[i].busy && !EQ (searchbufs[i].syntax_table, Qt))
+ if (!searchbufs[i].busy && !BASE_EQ (searchbufs[i].syntax_table, Qt))
searchbufs[i].regexp = Qnil;
}
@@ -214,10 +214,11 @@ compile_pattern (Lisp_Object pattern, struct re_registers
*regp,
&& !cp->busy
&& STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern)
&& !NILP (Fstring_equal (cp->regexp, pattern))
- && EQ (cp->buf.translate, translate)
+ && BASE_EQ (cp->buf.translate, translate)
&& cp->posix == posix
- && (EQ (cp->syntax_table, Qt)
- || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table)))
+ && (BASE_EQ (cp->syntax_table, Qt)
+ || BASE_EQ (cp->syntax_table,
+ BVAR (current_buffer, syntax_table)))
&& !NILP (Fequal (cp->f_whitespace_regexp, Vsearch_spaces_regexp))
&& cp->buf.charset_unibyte == charset_unibyte)
break;
@@ -2892,7 +2893,7 @@ Return value is undefined if the last search failed. */)
ptrdiff_t start = search_regs.start[i];
if (start >= 0)
{
- if (EQ (last_thing_searched, Qt)
+ if (BASE_EQ (last_thing_searched, Qt)
|| ! NILP (integers))
{
XSETFASTINT (data[2 * i], start);
diff --git a/src/xdisp.c b/src/xdisp.c
index 7fadc8534bc..2a2ab3b13bb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -29093,7 +29093,9 @@ calc_pixel_width_or_height (double *res, struct it *it,
Lisp_Object prop,
/* 'width': the width of FONT. */
if (EQ (prop, Qwidth))
return OK_PIXELS (font
- ? FONT_WIDTH (font)
+ ? (font->average_width
+ ? font->average_width
+ : font->space_width)
: FRAME_COLUMN_WIDTH (it->f));
#else
if (EQ (prop, Qheight) || EQ (prop, Qwidth))
diff --git a/test/lisp/emacs-lisp/macroexp-tests.el
b/test/lisp/emacs-lisp/macroexp-tests.el
index 7bb38fe58f7..d0efbfd28c1 100644
--- a/test/lisp/emacs-lisp/macroexp-tests.el
+++ b/test/lisp/emacs-lisp/macroexp-tests.el
@@ -124,4 +124,20 @@
(dyn dyn dyn dyn)
(dyn dyn dyn lex))))))
+(defmacro macroexp--test-macro1 ()
+ (declare (obsolete "new-replacement" nil))
+ 1)
+
+(defmacro macroexp--test-macro2 ()
+ '(macroexp--test-macro1))
+
+(ert-deftest macroexp--test-obsolete-macro ()
+ (should
+ (let ((res
+ (cl-letf (((symbol-function 'message) #'user-error))
+ (condition-case err
+ (macroexpand-all '(macroexp--test-macro2))
+ (user-error (error-message-string err))))))
+ (should (and (stringp res) (string-match "new-replacement" res))))))
+
;;; macroexp-tests.el ends here
diff --git a/test/lisp/net/tramp-archive-tests.el
b/test/lisp/net/tramp-archive-tests.el
index 5485b12f74f..e34e830cb83 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -988,6 +988,20 @@ This tests also `file-executable-p', `file-writable-p' and
`set-file-modes'."
code tae tramp-archive-test-file-archive
(concat tramp-archive-test-archive "foo"))))))))))
+(ert-deftest tramp-archive-test49-without-remote-files ()
+ "Check that Tramp can be suppressed."
+ (skip-unless tramp-archive-enabled)
+
+ (should (file-exists-p tramp-archive-test-archive))
+ (should-not (without-remote-files (file-exists-p
tramp-archive-test-archive)))
+ (should (file-exists-p tramp-archive-test-archive))
+
+ (inhibit-remote-files)
+ (should-not (file-exists-p tramp-archive-test-archive))
+ (tramp-register-file-name-handlers)
+ (setq tramp-mode t)
+ (should (file-exists-p tramp-archive-test-archive)))
+
(ert-deftest tramp-archive-test99-libarchive-tests ()
"Run tests of libarchive test files."
:tags '(:expensive-test :unstable)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 16afc0f477a..9bc8ad8ce39 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -8009,7 +8009,22 @@ process sentinels. They shall not disturb each other."
(mapconcat #'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
-(ert-deftest tramp-test49-unload ()
+(ert-deftest tramp-test49-without-remote-files ()
+ "Check that Tramp can be suppressed."
+ (skip-unless (tramp--test-enabled))
+
+ (should (file-remote-p ert-remote-temporary-file-directory))
+ (should-not
+ (without-remote-files (file-remote-p ert-remote-temporary-file-directory)))
+ (should (file-remote-p ert-remote-temporary-file-directory))
+
+ (inhibit-remote-files)
+ (should-not (file-remote-p ert-remote-temporary-file-directory))
+ (tramp-register-file-name-handlers)
+ (setq tramp-mode t)
+ (should (file-remote-p ert-remote-temporary-file-directory)))
+
+(ert-deftest tramp-test50-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 30dfd669ded..89b1eefb1dc 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -1530,7 +1530,7 @@ folded."
(equal (comp-mvar-typeset mvar)
comp-tests-cond-rw-expected-type))))))))
-(ert-deftest comp-tests-result-lambda ()
+(comp-deftest comp-tests-result-lambda ()
(native-compile 'comp-tests-result-lambda)
(should (eq (funcall (comp-tests-result-lambda) '(a . b)) 'a)))
;;; comp-tests.el ends here