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):
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
+++

View file

@ -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)

View file

@ -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.
@ -3725,7 +3740,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)
@ -3736,7 +3752,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.
@ -3839,12 +3859,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))))
@ -3856,8 +3880,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)
@ -3898,7 +3922,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
@ -4018,13 +4042,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))))

View file

@ -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")
@ -1958,9 +1960,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)))
@ -2009,7 +2012,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
@ -2284,7 +2287,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)
;; Replace the tool bar map with `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."
: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")

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."
:group 'nxml-faces)
(defface nxml-delimiter
nil
"Face used to highlight delimiters.
This is not used directly, but only via inheritance by other faces."
(defface nxml-text
'((t (:inherit default)))
"Face used to highlight text."
:group 'nxml-faces)
(defface nxml-text
nil
"Face used to highlight text."
(defface nxml-delimiter
'((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-processing-instruction-delimiter
@ -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)

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.
(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?

View file

@ -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)))

View file

@ -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."

View file

@ -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))

View file

@ -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 (:inherit mode-line)))
"Face for `display-time-format'."
:group 'mode-line-faces
: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)
(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))))))))