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

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

This commit is contained in:
Po Lu 2023-07-07 08:45:07 +08:00
commit 7af686767a
8 changed files with 195 additions and 28 deletions

View file

@ -2275,6 +2275,16 @@ current buffer is remote.
@defvar mode-line-client
This variable is used to identify @code{emacsclient} frames.
@end defvar
@defvar mode-line-format-right-align
Anything following this symbol in @code{mode-line-format} will be
right-aligned.
@end defvar
@defvar mode-line-right-align-edge
This variable controls exactly @code{mode-line-format-right-align}
aligns content to.
@end defvar
The following three variables are used in @code{mode-line-modes}:

View file

@ -109,6 +109,12 @@ window systems other than Nextstep.
When this minor mode is enabled, buttons representing modifier keys
are displayed along the tool bar.
** Modeline elements can now be right-aligned.
Anything following the symbol 'mode-line-format-right-align' in
'mode-line-format' will be right-aligned. Exactly where it is
right-aligned to is controlled by the new user option
'mode-line-right-align-edge'.
* Editing Changes in Emacs 30.1
@ -184,6 +190,16 @@ This allows changing which type of whitespace changes are ignored when
regenerating hunks with 'diff-ignore-whitespace-hunk'. Defaults to
the previously hard-coded "-b".
** Ediff
---
*** New user option 'ediff-floating-control-frame'.
If non-nil, try making the control frame be floating rather than tiled.
Many X tiling window managers make the Ediff control frame a tiled
window equal in size to the main Emacs frame, which works poorly.
This option is useful to set if you use such a window manager.
** Buffer Selection
---

View file

@ -304,6 +304,70 @@ Normally nil in most modes, since there is no process to display.")
;;;###autoload
(put 'mode-line-process 'risky-local-variable t)
(defcustom mode-line-right-align-edge 'window
"Where function `mode-line-format-right-align' should align to.
Internally, that function uses `:align-to' in a display property,
so aligns to the left edge of the given area. See info node
`(elisp)Pixel Specification'.
Must be set to a symbol. Acceptable values are:
- `window': align to extreme right of window, regardless of margins
or fringes
- `right-fringe': align to right-fringe
- `right-margin': align to right-margin"
:type '(choice (const right-margin)
(const right-fringe)
(const window))
:group 'mode-line
:version "30.1")
(defun mode--line-format-right-align ()
"Right-align all following mode-line constructs.
When the symbol `mode-line-format-right-align' appears in
`mode-line-format', return a string of one space, with a display
property to make it appear long enough to align anything after
that symbol to the right of the rendered mode line. Exactly how
far to the right is controlled by `mode-line-right-align-edge'.
It is important that the symbol `mode-line-format-right-align' be
included in `mode-line-format' (and not another similar construct
such as `(:eval (mode-line-format-right-align)'). This is because
the symbol `mode-line-format-right-align' is processed by
`format-mode-line' as a variable."
(let* ((rest (cdr (memq 'mode-line-format-right-align
mode-line-format)))
(rest-str (format-mode-line `("" ,@rest)))
(rest-width (string-pixel-width rest-str)))
(propertize " " 'display
;; The `right' spec doesn't work on TTY frames
;; when windows are split horizontally (bug#59620)
(if (and (display-graphic-p)
(not (eq mode-line-right-align-edge 'window)))
`(space :align-to (- ,mode-line-right-align-edge
(,rest-width)))
`(space :align-to (,(- (window-pixel-width)
(window-scroll-bar-width)
(window-right-divider-width)
(* (or (cdr (window-margins)) 1)
(frame-char-width))
;; Manually account for value of
;; `mode-line-right-align-edge' even
;; when display is non-graphical
(pcase mode-line-right-align-edge
('right-margin
(or (cdr (window-margins)) 0))
('right-fringe
;; what here?
(or (cadr (window-fringes)) 0))
(_ 0))
rest-width)))))))
(defvar mode-line-format-right-align '(:eval (mode--line-format-right-align))
"Mode line construct to right align all following constructs.")
;;;###autoload
(put 'mode-line-format-right-align 'risky-local-variable t)
(defun bindings--define-key (map key item)
"Define KEY in keymap MAP according to ITEM from a menu.
This is like `define-key', but it takes the definition from the

View file

@ -1305,23 +1305,33 @@ or \"${ foo }\" will not.")
"A sequence for recommended version number schemes in Perl.")
(defconst cperl--single-attribute-rx
`(sequence word-start
,cperl--basic-identifier-rx
`(sequence ,cperl--basic-identifier-rx
(optional (sequence "("
(0+ (not (in ")")))
")")))
(0+ (or (sequence "\\" not-newline)
(not (any "()\\"))
(sequence "("
(zero-or-more
(not
(any "()\\")))
")")))
")")))
"A regular expression for a single attribute, without leading colon.
It may have parameters in parens, but parens within the
parameter's value are not supported. This regexp does not have
It may have parameters in parens, one level of parens within the
parameter's value is supported. This regexp does not have
capture groups.")
(defconst cperl--attribute-list-rx
`(sequence ":"
(0+ (sequence
,cperl--ws*-rx
,cperl--single-attribute-rx
,cperl--ws*-rx
(optional ":"))))
(optional
,cperl--ws*-rx
,cperl--single-attribute-rx
(0+ (sequence
(or (sequence ,cperl--ws*-rx
":"
,cperl--ws*-rx)
,cperl--ws+-rx)
,cperl--single-attribute-rx))
(optional ":")))
"A regular expression for an attribute list.
Attribute lists may only occur in certain declarations. A colon
is required before the first attribute but optional between
@ -3607,7 +3617,7 @@ Should be called with the point before leading colon of an attribute."
"\\)"
(if after-first "?" "")
;; No space between name and paren allowed...
"\\(\\sw+\\)" ; 3=name
(rx (group (eval cperl--basic-identifier-rx))) ; 3=name
"\\((\\)?")) ; 4=optional paren
(and (match-beginning 1)
(cperl-postpone-fontification

View file

@ -237,6 +237,7 @@ Only used for files that Emacs can't find.")
(defvar gdb-source-file-list nil
"List of source files for the current executable.")
(defvar gdb-first-done-or-error t)
(defvar gdb-target-async-checked nil)
(defvar gdb-source-window-list nil
"List of windows used for displaying source files.
Sorted in most-recently-visited-first order.")
@ -453,9 +454,7 @@ valid signal handlers.")
(const :tag "Unlimited" nil))
:version "22.1")
;; This is disabled by default because we don't really support
;; asynchronous execution of the debuggee; see bug#63084. FIXME.
(defcustom gdb-non-stop-setting nil
(defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt))
"If non-nil, GDB sessions are expected to support the non-stop mode.
When in the non-stop mode, stopped threads can be examined while
other threads continue to execute.
@ -470,7 +469,7 @@ don't support the non-stop mode.
GDB session needs to be restarted for this setting to take effect."
:type 'boolean
:group 'gdb-non-stop
:version "29.1")
:version "30.1")
(defcustom gdb-debuginfod-enable-setting
;; debuginfod servers are only for ELF executables, and elfutils, of
@ -1069,6 +1068,7 @@ detailed description of this mode.
gdb-handler-list '()
gdb-prompt-name nil
gdb-first-done-or-error t
gdb-target-async-checked nil
gdb-buffer-fringe-width (car (window-fringes))
gdb-debug-log nil
gdb-source-window-list nil
@ -1078,7 +1078,8 @@ detailed description of this mode.
gdb-threads-list '()
gdb-breakpoints-list '()
gdb-register-names '()
gdb-non-stop gdb-non-stop-setting
gdb-supports-non-stop nil
gdb-non-stop nil
gdb-debuginfod-enable gdb-debuginfod-enable-setting)
;;
(gdbmi-bnf-init)
@ -1110,7 +1111,7 @@ detailed description of this mode.
(gdb-input "-gdb-set interactive-mode on" 'ignore))
(gdb-input "-gdb-set height 0" 'ignore)
(when gdb-non-stop
(when gdb-non-stop-setting
(gdb-input "-gdb-set non-stop 1" 'gdb-non-stop-handler))
(gdb-input "-enable-pretty-printing" 'ignore)
@ -1145,16 +1146,30 @@ detailed description of this mode.
(setq gdb-non-stop nil)
(setq gdb-supports-non-stop nil))
(setq gdb-supports-non-stop t)
(gdb-input "-gdb-set target-async 1" 'ignore)
;; Try to use "mi-async" first, needs GDB 7.7 onwards. Note if
;; "mi-async" is not available, GDB is still running in "sync"
;; mode, "No symbol" for "mi-async" must appear before other
;; commands.
(gdb-input "-gdb-set mi-async 1" 'gdb-set-mi-async-handler)))
(defun gdb-set-mi-async-handler()
(goto-char (point-min))
(if (re-search-forward "No symbol" nil t)
(gdb-input "-gdb-set target-async 1" 'ignore)))
(defun gdb-try-check-target-async-support()
(when (and gdb-non-stop-setting gdb-supports-non-stop
(not gdb-target-async-checked))
(gdb-input "-list-target-features" 'gdb-check-target-async)))
(defun gdb-check-target-async ()
(goto-char (point-min))
(unless (re-search-forward "async" nil t)
(if (re-search-forward "async" nil t)
(setq gdb-non-stop t)
(message
"Target doesn't support non-stop mode. Turning it off.")
(setq gdb-non-stop nil)
(gdb-input "-gdb-set non-stop 0" 'ignore)))
(gdb-input "-gdb-set non-stop 0" 'ignore))
(setq gdb-target-async-checked t))
(defun gdb-delchar-or-quit (arg)
"Delete ARG characters or send a quit command to GDB.
@ -2652,6 +2667,14 @@ Sets `gdb-thread-number' to new id."
(defun gdb-starting (_output-field _result)
;; CLI commands don't emit ^running at the moment so use gdb-running too.
(setq gdb-inferior-status "running")
;; Set `gdb-non-stop' when `gdb-last-command' is a CLI background
;; running command e.g. "run &", attach &" or a MI command
;; e.g. "-exec-run" or "-exec-attach".
(when (or (string-match "&\s*$" gdb-last-command)
(string-match "^-" gdb-last-command))
(gdb-try-check-target-async-support))
(gdb-force-mode-line-update
(propertize gdb-inferior-status 'face font-lock-type-face))
(setq gdb-active-process t)
@ -2722,6 +2745,10 @@ current thread and update GDB buffers."
;; Print "(gdb)" to GUD console
(when gdb-first-done-or-error
;; If running target with a non-background CLI command
;; e.g. "run" (no trailing '&'), target async feature can only
;; be checked when when the program stops for the first time
(gdb-try-check-target-async-support)
(setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
;; In non-stop, we update information as soon as another thread gets

View file

@ -6446,8 +6446,14 @@ REPORT-FN is Flymake's callback function."
;;; Import management
(defconst python--list-imports "\
from isort import find_imports_in_stream, find_imports_in_paths
from sys import argv, stdin
from sys import argv, exit, stdin
try:
from isort import find_imports_in_stream, find_imports_in_paths
except ModuleNotFoundError:
exit(1)
except ImportError:
exit(2)
query, files, result = argv[1] or None, argv[2:], {}
@ -6501,9 +6507,13 @@ recursively."
(or name "")
(mapcar #'file-local-name source)))))
lines)
(unless (eq 0 status)
(cond
((eq 1 status)
(error "%s exited with status %s (maybe isort is missing?)"
python-interpreter status))
((eq 2 status)
(error "%s exited with status %s (maybe isort version is <5.7.0?)"
python-interpreter status)))
(goto-char (point-min))
(while (not (eobp))
(push (buffer-substring-no-properties (point) (pos-eol))
@ -6546,9 +6556,13 @@ Return non-nil if the buffer was actually modified."
nil (list temp nil) nil
"-m" "isort" "-" args))
(tick (buffer-chars-modified-tick)))
(unless (eq 0 status)
(cond
((eq 1 status)
(error "%s exited with status %s (maybe isort is missing?)"
python-interpreter status))
((eq 2 status)
(error "%s exited with status %s (maybe isort version is <5.7.0?)"
python-interpreter status)))
(replace-buffer-contents temp)
(not (eq tick (buffer-chars-modified-tick)))))))))

View file

@ -69,6 +69,16 @@ provided functions are written."
(function :tag "Other function"))
:version "24.3")
(defcustom ediff-floating-control-frame nil
"If non-nil, try making the control frame be floating rather than tiled.
If your X window manager makes the Ediff control frame a tiled one,
set this to a non-nil value, and Emacs will try to make it floating.
This only has effect on X displays."
:type '(choice (const :tag "Control frame floats" t)
(const :tag "Control frame has default WM behavior" nil))
:version "30.1")
(ediff-defvar-local ediff-multiframe nil
"Indicates if we are in a multiframe setup.")
@ -873,6 +883,16 @@ Create a new splittable frame if none is found."
(not (ediff-frame-has-dedicated-windows (window-frame wind)))
)))
(defun ediff-frame-make-utility (frame)
(let ((x-fast-protocol-requests t))
(x-change-window-property
"_NET_WM_WINDOW_TYPE" '("_NET_WM_WINDOW_TYPE_UTILITY")
frame "ATOM" 32 t)
(x-change-window-property
"WM_TRANSIENT_FOR"
(list (string-to-number (frame-parameter nil 'window-id)))
frame "WINDOW" 32 t)))
;; Prepare or refresh control frame
(defun ediff-setup-control-frame (ctl-buffer designated-minibuffer-frame)
(let ((window-min-height 1)
@ -948,6 +968,8 @@ Create a new splittable frame if none is found."
(goto-char (point-min))
(modify-frame-parameters ctl-frame adjusted-parameters)
(when (and ediff-floating-control-frame (eq (window-system ctl-frame) 'x))
(ediff-frame-make-utility ctl-frame))
(make-frame-visible ctl-frame)
;; This works around a bug in 19.25 and earlier. There, if frame gets

View file

@ -484,12 +484,16 @@ Also includes valid cases with whitespace in strange places."
(skip-unless (eq cperl-test-mode #'cperl-mode))
(let ((valid
'(":" ":foo" ": bar()" ":baz(quux):"
":isa(Foo)does(Bar)" ":isa(Foo):does(Bar)" ":isa(Foo):does(Bar):"
":_" ":_foo"
":isa(Foo) does(Bar)" ":isa(Foo):does(Bar)"
":isa(Foo):does(Bar):"
": isa(Foo::Bar) : does(Bar)"))
(invalid
'(":foo + bar" ; not an identifier
"::foo" ; not an attribute list
": foo(bar : : baz" ; too many colons
": baz (quux)"))) ; no space allowed before "("
": foo(bar)baz" ; need a separator
": baz (quux)"))) ; no space allowed before "("
(cperl-test--validate-regexp (rx (eval cperl--attribute-list-rx))
valid invalid)))