1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-07-21 07:58:30 +08:00
commit 0ff70f12a5
12 changed files with 164 additions and 78 deletions

View file

@ -441,6 +441,10 @@ instead of:
and another_expression): and another_expression):
do_something() 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 ** use-package
+++ +++

View file

@ -48,7 +48,7 @@
;;; Includes that are in a happy state! ;;; Includes that are in a happy state!
;; ;;
(defface semantic-decoration-on-includes (defface semantic-decoration-on-includes
nil '((t (:inherit default)))
"Overlay Face used on includes that are not in some other state. "Overlay Face used on includes that are not in some other state.
Used by the decoration style: `semantic-decoration-on-includes'." Used by the decoration style: `semantic-decoration-on-includes'."
:group 'semantic-faces) :group 'semantic-faces)

View file

@ -2330,6 +2330,7 @@ and `face'."
(from (marker-position (widget-get widget :from))) (from (marker-position (widget-get widget :from)))
(to (marker-position (widget-get widget :to)))) (to (marker-position (widget-get widget :to))))
(save-excursion (save-excursion
(custom-comment-preserve widget)
(widget-value-set widget (widget-value widget)) (widget-value-set widget (widget-value widget))
(custom-redraw-magic widget)) (custom-redraw-magic widget))
(when (and (>= pos from) (<= pos to)) (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)))) (let* ((null-comment (equal "" (widget-value widget))))
(if (or (widget-get (widget-get widget :parent) :comment-shown) (if (or (widget-get (widget-get widget :parent) :comment-shown)
(not null-comment)) (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 -- ;; `widget-default-delete' expects markers in these slots --
;; maybe it shouldn't. ;; maybe it shouldn't.
(widget-put widget :from (point-marker)) (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) (and (equal "" val)
(not (widget-get widget :comment-shown))))) (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. ;;; The `custom-variable' Widget.
(defface custom-variable-obsolete (defface custom-variable-obsolete
@ -2821,12 +2832,16 @@ try matching its doc string against `custom-guess-doc-alist'."
;; The comment field ;; The comment field
(unless (eq state 'hidden) (unless (eq state 'hidden)
(let* ((comment (get symbol 'variable-comment)) (let ((comment-widget
(comment-widget (widget-create-child-and-convert
(widget-create-child-and-convert widget 'custom-comment
widget 'custom-comment :parent widget
:parent widget :value (or
:value (or comment "")))) (and
(widget-get widget :comment-shown)
(widget-value (widget-get widget :comment-widget)))
(get symbol 'variable-comment)
""))))
(widget-put widget :comment-widget comment-widget) (widget-put widget :comment-widget comment-widget)
;; Don't push it !!! Custom assumes that the first child is the ;; Don't push it !!! Custom assumes that the first child is the
;; value one. ;; value one.
@ -3725,7 +3740,8 @@ WIDGET should be a `custom-face' widget."
`((t ,(widget-value child))) `((t ,(widget-value child)))
(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) (let ((spec (or (get face 'customized-face)
(get face 'saved-face) (get face 'saved-face)
(get face 'face-defface-spec) (get face 'face-defface-spec)
@ -3736,7 +3752,11 @@ WIDGET should be a `custom-face' widget."
;; edit it as the user has specified it. ;; edit it as the user has specified it.
(if (not (face-spec-match-p face spec (selected-frame))) (if (not (face-spec-match-p face spec (selected-frame)))
(setq spec `((t ,(face-attr-construct face (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) (defun custom-toggle-hide-face (visibility-widget &rest _ignore)
"Toggle the visibility of a `custom-face' parent widget. "Toggle the visibility of a `custom-face' parent widget.
@ -3839,12 +3859,16 @@ the present value is saved to its :shown-value property instead."
widget :visibility-widget 'custom-visibility) widget :visibility-widget 'custom-visibility)
;; The comment field ;; The comment field
(unless hiddenp (unless hiddenp
(let* ((comment (get symbol 'face-comment)) (let ((comment-widget
(comment-widget (widget-create-child-and-convert
(widget-create-child-and-convert widget 'custom-comment
widget 'custom-comment :parent widget
:parent widget :value (or
:value (or comment "")))) (and
(widget-get widget :comment-shown)
(widget-value (widget-get widget :comment-widget)))
(get symbol 'face-comment)
""))))
(widget-put widget :comment-widget comment-widget) (widget-put widget :comment-widget comment-widget)
(push comment-widget children)))) (push comment-widget children))))
@ -3856,8 +3880,8 @@ the present value is saved to its :shown-value property instead."
(unless (widget-get widget :custom-form) (unless (widget-get widget :custom-form)
(widget-put widget :custom-form custom-face-default-form)) (widget-put widget :custom-form custom-face-default-form))
(let* ((spec (or (widget-get widget :shown-value) (let* ((shown-value (widget-get widget :shown-value))
(custom-face-get-current-spec symbol))) (spec (or shown-value (custom-face-get-current-spec symbol)))
(form (widget-get widget :custom-form)) (form (widget-get widget :custom-form))
(indent (widget-get widget :indent)) (indent (widget-get widget :indent))
face-alist face-entry spec-default spec-match editor) face-alist face-entry spec-default spec-match editor)
@ -3898,7 +3922,7 @@ the present value is saved to its :shown-value property instead."
widget 'sexp :value spec)))) widget 'sexp :value spec))))
(push editor children) (push editor children)
(widget-put widget :children 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) (defun cus--face-link (widget _format)
(widget-create-child-and-convert (widget-create-child-and-convert
@ -4018,13 +4042,18 @@ This is one of `set', `saved', `changed', `themed', or `rogue'."
'changed 'changed
state))) 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. "Set the state of WIDGET, a custom-face widget.
If the user edited the widget, set the state to modified. If not, the new 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))) (let ((face (widget-value widget)))
(widget-put widget :custom-state (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) (custom-face-state face)
'modified)))) 'modified))))

View file

@ -147,6 +147,8 @@
(require 'filenotify) (require 'filenotify)
(eval-when-compile (require 'subr-x)) (eval-when-compile (require 'subr-x))
(autoload 'imenu-unavailable-error "imenu")
;;;; Customization Options ;;;; Customization Options
(defgroup doc-view nil (defgroup doc-view nil
@ -214,7 +216,7 @@ are available (see Info node `(emacs)Document View')."
:type 'boolean :type 'boolean
:version "30.1") :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." "Whether to generate an imenu outline when \"mutool\" is available."
:type 'boolean :type 'boolean
:version "29.1") :version "29.1")
@ -1958,9 +1960,10 @@ structure is extracted by `doc-view--imenu-subtree'."
(let ((fn (or file-name (buffer-file-name)))) (let ((fn (or file-name (buffer-file-name))))
(when fn (when fn
(let ((outline nil) (let ((outline nil)
(fn (shell-quote-argument (expand-file-name fn)))) (fn (expand-file-name fn)))
(with-temp-buffer (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)) (goto-char (point-min))
(while (re-search-forward doc-view--outline-rx nil t) (while (re-search-forward doc-view--outline-rx nil t)
(push `((level . ,(length (match-string 1))) (push `((level . ,(length (match-string 1)))
@ -2009,7 +2012,7 @@ GOTO-PAGE-FN other than `doc-view-goto-page'."
(defun doc-view-imenu-setup () (defun doc-view-imenu-setup ()
"Set up local state in the current buffer for imenu, if needed." "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 (setq-local imenu-create-index-function #'doc-view-imenu-index
imenu-submenus-on-top nil imenu-submenus-on-top nil
imenu-sort-function nil imenu-sort-function nil
@ -2284,7 +2287,10 @@ toggle between displaying the document or editing it as text.
(setq mode-name "DocView" (setq mode-name "DocView"
buffer-read-only t buffer-read-only t
major-mode 'doc-view-mode) 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) (doc-view-initiate-display)
;; Replace the tool bar map with `doc-view-tool-bar-map'. ;; Replace the tool bar map with `doc-view-tool-bar-map'.
(setq-local tool-bar-map doc-view-tool-bar-map) (setq-local tool-bar-map doc-view-tool-bar-map)

View file

@ -216,15 +216,18 @@ temporarily blinks with this face."
"Face for <h3> elements." "Face for <h3> elements."
:version "28.1") :version "28.1")
(defface shr-h4 nil (defface shr-h4
'((t (:inherit default)))
"Face for <h4> elements." "Face for <h4> elements."
:version "28.1") :version "28.1")
(defface shr-h5 nil (defface shr-h5
'((t (:inherit default)))
"Face for <h5> elements." "Face for <h5> elements."
:version "28.1") :version "28.1")
(defface shr-h6 nil (defface shr-h6
'((t (:inherit default)))
"Face for <h6> elements." "Face for <h6> elements."
:version "28.1") :version "28.1")

View file

@ -151,15 +151,15 @@ This is not used directly, but only via inheritance by other faces."
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) :group 'nxml-faces)
(defface nxml-delimiter (defface nxml-text
nil '((t (:inherit default)))
"Face used to highlight delimiters. "Face used to highlight text."
This is not used directly, but only via inheritance by other faces."
:group 'nxml-faces) :group 'nxml-faces)
(defface nxml-text (defface nxml-delimiter
nil '((t (:inherit nxml-text)))
"Face used to highlight text." "Face used to highlight delimiters.
This is not used directly, but only via inheritance by other faces."
:group 'nxml-faces) :group 'nxml-faces)
(defface nxml-processing-instruction-delimiter (defface nxml-processing-instruction-delimiter
@ -230,7 +230,7 @@ This includes the `x' in hex references."
:group 'nxml-faces) :group 'nxml-faces)
(defface nxml-element-colon (defface nxml-element-colon
nil '((t (:inherit nxml-delimiter)))
"Face used for the colon in element names." "Face used for the colon in element names."
:group 'nxml-faces) :group 'nxml-faces)

View file

@ -425,11 +425,14 @@ to it is returned. This function does not modify the point or the mark."
(defvar lookup-syntax-properties) ;XEmacs. (defvar lookup-syntax-properties) ;XEmacs.
(defmacro c-is-escaped (pos) (defmacro c-is-escaped (pos)
;; Are there an odd number of backslashes before POS? ;; Is the character following POS escaped?
(declare (debug t)) (declare (debug t))
`(save-excursion `(save-excursion
(goto-char ,pos) (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) (defmacro c-will-be-escaped (pos beg end)
;; Will the character after POS be escaped after the removal of (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)) (declare (debug t))
`(save-excursion `(save-excursion
(let ((-end- ,end) (let ((-end- ,end)
(-pos- ,pos)
count) count)
(goto-char ,pos) (if (and c-escaped-newline-takes-precedence
(setq count (skip-chars-backward "\\\\" -end-)) (memq (char-after -pos-) '(?\n ?\r)))
(when (eq (point) -end-) (eq (char-before (if (eq -pos- -end-)
(goto-char ,beg) ,beg
(setq count (+ count (skip-chars-backward "\\\\")))) -pos-))
(not (zerop (logand count 1)))))) ?\\)
(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) (defmacro c-will-be-unescaped (beg)
;; Would the character after BEG be unescaped? ;; Would the character after BEG be unescaped?

View file

@ -1071,14 +1071,6 @@ Currently (2022-09) just C++ Mode uses this."
;; matched. ;; matched.
t nil) 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 (c-lang-defconst c-multiline-string-start-char
"Set if the language supports multiline string literals without escaped "Set if the language supports multiline string literals without escaped
newlines. If t, all string literals are multiline. If a character, 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-defvar c-multiline-string-start-char
(c-lang-const 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 (c-lang-defconst c-string-innards-re-alist
;; An alist of regexps matching the innards of a string, the key being the ;; An alist of regexps matching the innards of a string, the key being the
;; string's delimiter. ;; string's delimiter.
@ -1105,9 +1109,12 @@ further directions."
t (mapcar (lambda (delim) t (mapcar (lambda (delim)
(cons (cons
delim delim
(concat "\\(\\\\\\(.\\|\n\\)\\|[^\\\n\r" (concat
(string delim) (if (c-lang-const c-escaped-newline-takes-precedence)
"]\\)*"))) "\\(\\\\\\(\\\\?\n\\|.\\)\\|[^\\\n\r"
"\\(\\\\\\(\n\\|.\\)\\|[^\\\n\r")
(string delim)
"]\\)*")))
(and (and
(or (null (c-lang-const c-multiline-string-start-char)) (or (null (c-lang-const c-multiline-string-start-char))
(c-characterp (c-lang-const c-multiline-string-start-char))) (c-characterp (c-lang-const c-multiline-string-start-char)))

View file

@ -105,7 +105,7 @@
:version "22.1") :version "22.1")
(defface makefile-shell (defface makefile-shell
() '((t (:inherit default)))
;;'((((class color) (min-colors 88) (background light)) (:background "seashell1")) ;;'((((class color) (min-colors 88) (background light)) (:background "seashell1"))
;; (((class color) (min-colors 88) (background dark)) (:background "seashell4"))) ;; (((class color) (min-colors 88) (background dark)) (:background "seashell4")))
"Face to use for additionally highlighting Shell commands in Font-Lock mode." "Face to use for additionally highlighting Shell commands in Font-Lock mode."

View file

@ -297,11 +297,18 @@
(defcustom python-interpreter "python" (defcustom python-interpreter "python"
"Python interpreter for noninteractive use. "Python interpreter for noninteractive use.
To customize the Python shell, modify `python-shell-interpreter' Some Python interpreters also require changes to
instead." `python-interpreter-args'.
To customize the Python interpreter for interactive use, modify
`python-shell-interpreter' instead."
:version "29.1" :version "29.1"
:type 'string) :type 'string)
(defcustom python-interpreter-args ""
"Arguments for the Python interpreter for noninteractive use."
:version "30.1"
:type 'string)
;;; Bindings ;;; Bindings
@ -2558,7 +2565,7 @@ position, else returns nil."
(cond ((executable-find "python3") "python3") (cond ((executable-find "python3") "python3")
((executable-find "python") "python") ((executable-find "python") "python")
(t "python3")) (t "python3"))
"Default Python interpreter for shell. "Python interpreter for interactive use.
Some Python interpreters also require changes to Some Python interpreters also require changes to
`python-shell-interpreter-args'. In particular, setting `python-shell-interpreter-args'. In particular, setting
@ -2573,11 +2580,12 @@ Some Python interpreters also require changes to
:safe 'stringp) :safe 'stringp)
(defcustom python-shell-interpreter-args "-i" (defcustom python-shell-interpreter-args "-i"
"Default arguments for the Python interpreter." "Arguments for the Python interpreter for interactive use."
:type 'string) :type 'string)
(defcustom python-shell-interpreter-interactive-arg "-i" (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 :type 'string
:version "24.4") :version "24.4")
@ -6505,18 +6513,25 @@ recursively."
(let* ((temp (current-buffer)) (let* ((temp (current-buffer))
(status (if (bufferp source) (status (if (bufferp source)
(with-current-buffer source (with-current-buffer source
(call-process-region (point-min) (point-max) (apply #'call-process-region
python-interpreter (point-min) (point-max)
nil (list temp nil) nil python-interpreter
"-c" python--list-imports nil (list temp nil) nil
(or name ""))) (append
(split-string-shell-command
python-interpreter-args)
`("-c" ,python--list-imports)
(list (or name "")))))
(with-current-buffer buffer (with-current-buffer buffer
(apply #'call-process (apply #'call-process
python-interpreter python-interpreter
nil (list temp nil) nil nil (list temp nil) nil
"-c" python--list-imports (append
(or name "") (split-string-shell-command
(mapcar #'file-local-name source))))) python-interpreter-args)
`("-c" ,python--list-imports)
(list (or name ""))
(mapcar #'file-local-name source))))))
lines) lines)
(python--list-imports-check-status status) (python--list-imports-check-status status)
(goto-char (point-min)) (goto-char (point-min))
@ -6559,7 +6574,11 @@ Return non-nil if the buffer was actually modified."
(point-min) (point-max) (point-min) (point-max)
python-interpreter python-interpreter
nil (list temp nil) nil nil (list temp nil) nil
"-m" "isort" "-" args)) (append
(split-string-shell-command
python-interpreter-args)
'("-m" "isort" "-")
args)))
(tick (buffer-chars-modified-tick))) (tick (buffer-chars-modified-tick)))
(unless (eq 0 status) (unless (eq 0 status)
(error "%s exited with status %s (maybe isort is missing?)" (error "%s exited with status %s (maybe isort is missing?)"
@ -6629,10 +6648,14 @@ asking."
(with-temp-buffer (with-temp-buffer
(let ((temp (current-buffer))) (let ((temp (current-buffer)))
(with-current-buffer buffer (with-current-buffer buffer
(call-process-region (point-min) (point-max) (apply #'call-process-region
python-interpreter (point-min) (point-max)
nil temp nil python-interpreter
"-m" "pyflakes")) nil temp nil
(append
(split-string-shell-command
python-interpreter-args)
'("-m" "pyflakes"))))
(goto-char (point-min)) (goto-char (point-min))
(when (looking-at-p ".* No module named pyflakes$") (when (looking-at-p ".* No module named pyflakes$")
(error "%s couldn't find pyflakes" python-interpreter)) (error "%s couldn't find pyflakes" python-interpreter))

View file

@ -139,7 +139,8 @@ make the mail indicator stand out on a color display."
:version "22.1" :version "22.1"
:type '(choice (const :tag "None" nil) face)) :type '(choice (const :tag "None" nil) face))
(defface display-time-date-and-time nil (defface display-time-date-and-time
'((t (:inherit mode-line)))
"Face for `display-time-format'." "Face for `display-time-format'."
:group 'mode-line-faces :group 'mode-line-faces
:version "30.1") :version "30.1")

View file

@ -289,7 +289,7 @@ in the key vector, as in the argument of `define-key'."
(let ((items (mapc (lambda (x) (let ((items (mapc (lambda (x)
(when (consp x) (when (consp x)
(dotimes (i (1- (length x))) (dotimes (i (1- (length x)))
(when (char-or-string-p (nth i x)) (when (stringp (nth i x))
(setcar (nthcdr i x) (setcar (nthcdr i x)
(substitute-command-keys (substitute-command-keys
(car (nthcdr i x)))))))) (car (nthcdr i x))))))))