diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/bindings.el | 2 | ||||
-rw-r--r-- | lisp/bs.el | 67 | ||||
-rw-r--r-- | lisp/calc/calc-units.el | 42 | ||||
-rw-r--r-- | lisp/comint.el | 10 | ||||
-rw-r--r-- | lisp/cus-edit.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 7 | ||||
-rw-r--r-- | lisp/eshell/em-alias.el | 4 | ||||
-rw-r--r-- | lisp/eshell/esh-arg.el | 32 | ||||
-rw-r--r-- | lisp/ldefs-boot.el | 318 | ||||
-rw-r--r-- | lisp/progmodes/gdb-mi.el | 69 | ||||
-rw-r--r-- | lisp/progmodes/gud.el | 223 | ||||
-rw-r--r-- | lisp/server.el | 134 | ||||
-rw-r--r-- | lisp/transient.el | 30 | ||||
-rw-r--r-- | lisp/use-package/bind-key.el | 19 | ||||
-rw-r--r-- | lisp/vc/vc-git.el | 63 |
16 files changed, 396 insertions, 629 deletions
diff --git a/lisp/bindings.el b/lisp/bindings.el index c1ad5f7520e..a3f51ebb315 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -670,6 +670,8 @@ or not." "Return the value of symbol VAR if it is bound, else nil. Note that if `lexical-binding' is in effect, this function isn't meaningful if it refers to a lexically bound variable." + (unless (symbolp var) + (signal 'wrong-type-argument (list 'symbolp var))) `(and (boundp (quote ,var)) ,var)) ;; Use mode-line-mode-menu for local minor-modes only. diff --git a/lisp/bs.el b/lisp/bs.el index 1fd31fb3b85..d7eed8f661d 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -420,9 +420,6 @@ naming a sort behavior. Default is \"by nothing\" which means no sorting." Non-nil means to show all buffers. Otherwise show buffers defined by current configuration `bs-current-configuration'.") -(defvar bs--window-config-coming-from nil - "Window configuration before starting Buffer Selection Menu.") - (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" "Regular expression specifying which buffers never to show. A buffer whose name matches this regular expression will never be @@ -491,7 +488,22 @@ Used internally, only.") "<mouse-2>" #'bs-mouse-select "<mouse-3>" #'bs-mouse-select-other-frame) -;; ---------------------------------------------------------------------- +(defcustom bs-default-action-list '((display-buffer-below-selected) + (window-height . window-min-height)) + "Default action list for showing the '*bs-selection*' buffer. + +This list will be passed to `pop-to-buffer' as its ACTION argument. +It should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is +an action function or a list of action functions and ALIST is an +action alist. Each such action function should accept two +arguments: a buffer to display and an alist of the same form as +ALIST. See `display-buffer' for details." + :type display-buffer--action-custom-type + :risky t + :version "30.1" + :group 'bs) + +; ---------------------------------------------------------------------- ;; Functions ;; ---------------------------------------------------------------------- @@ -668,20 +680,11 @@ apply it. (add-hook 'kill-buffer-hook 'bs--remove-hooks nil t) (add-hook 'change-major-mode-hook 'bs--remove-hooks nil t)) -(defun bs--restore-window-config () - "Restore window configuration on the current frame." - (when bs--window-config-coming-from - (let ((frame (selected-frame))) - (unwind-protect - (set-window-configuration bs--window-config-coming-from) - (select-frame frame))) - (setq bs--window-config-coming-from nil))) - (defun bs-kill () "Let buffer disappear and reset window configuration." (interactive) (bury-buffer (current-buffer)) - (bs--restore-window-config)) + (quit-window)) (defun bs-abort () "Ding and leave Buffer Selection Menu without a selection." @@ -742,7 +745,7 @@ Leave Buffer Selection Menu." (interactive) (let ((buffer (bs--current-buffer))) (bury-buffer (current-buffer)) - (bs--restore-window-config) + (quit-window) (switch-to-buffer buffer) (when bs--marked-buffers ;; Some marked buffers for selection @@ -765,7 +768,7 @@ Leave Buffer Selection Menu." (interactive) (let ((buffer (bs--current-buffer))) (bury-buffer (current-buffer)) - (bs--restore-window-config) + (quit-window) (switch-to-buffer-other-window buffer))) (defun bs-tmp-select-other-window () @@ -781,7 +784,7 @@ Leave Buffer Selection Menu." (interactive) (let ((buffer (bs--current-buffer))) (bury-buffer (current-buffer)) - (bs--restore-window-config) + (quit-window) (switch-to-buffer-other-frame buffer))) (defun bs-mouse-select-other-frame (event) @@ -1166,7 +1169,18 @@ Select buffer *buffer-selection* and display buffers according to current configuration `bs-current-configuration'. Set window height, fontify buffer and move point to current buffer." (setq bs-current-list list) - (switch-to-buffer (get-buffer-create "*buffer-selection*")) + (let* ((window-combination-limit 'window-size) + (bs-buf (get-buffer-create "*buffer-selection*")) + (bs-win (progn + (pop-to-buffer bs-buf bs-default-action-list) + (selected-window)))) + ;; Delete other windows showing *buffer-selection*. + ;; Done after pop-to-buffer, instead of just calling delete-windows-on, + ;; to allow display-buffer-reuse(-mode)?-window to be used in ALIST. + (dolist (w (get-buffer-window-list bs-buf 'not t)) + (unless (eq w bs-win) + (with-demoted-errors "Error deleting window: %S" + (delete-window w))))) (bs-mode) (let* ((inhibit-read-only t) (map-fun (lambda (entry) @@ -1438,21 +1452,8 @@ for buffer selection." ;; Only when not in buffer *buffer-selection* ;; we have to set the buffer we started the command (setq bs--buffer-coming-from (current-buffer))) - (let ((liste (bs-buffer-list)) - (active-window (get-window-with-predicate - (lambda (w) - (string= (buffer-name (window-buffer w)) - "*buffer-selection*")) - nil (selected-frame)))) - (if active-window - (select-window active-window) - (bs--restore-window-config) - (setq bs--window-config-coming-from (current-window-configuration)) - (when (> (window-height) 7) - ;; Errors would mess with the window configuration (bug#10882). - (ignore-errors (select-window (split-window-below))))) - (bs-show-in-buffer liste) - (bs-message-without-log "%s" (bs--current-config-message))))) + (bs-show-in-buffer (bs-buffer-list)) + (bs-message-without-log "%s" (bs--current-config-message)))) (defun bs--configuration-name-for-prefix-arg (prefix) "Convert prefix argument PREFIX to a name of a buffer configuration. diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 42156b94606..cc1f5085a7c 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -319,28 +319,28 @@ that the combined units table will be rebuilt.") (defvar math-unit-prefixes '( ( ?Q (^ 10 30) "quetta" ) ( ?R (^ 10 27) "ronna" ) - ( ?Y (^ 10 24) "Yotta" ) - ( ?Z (^ 10 21) "Zetta" ) - ( ?E (^ 10 18) "Exa" ) - ( ?P (^ 10 15) "Peta" ) - ( ?T (^ 10 12) "Tera" ) - ( ?G (^ 10 9) "Giga" ) - ( ?M (^ 10 6) "Mega" ) - ( ?k (^ 10 3) "Kilo" ) - ( ?K (^ 10 3) "Kilo" ) - ( ?h (^ 10 2) "Hecto" ) - ( ?H (^ 10 2) "Hecto" ) - ( ?D (^ 10 1) "Deka" ) + ( ?Y (^ 10 24) "yotta" ) + ( ?Z (^ 10 21) "zetta" ) + ( ?E (^ 10 18) "exa" ) + ( ?P (^ 10 15) "peta" ) + ( ?T (^ 10 12) "tera" ) + ( ?G (^ 10 9) "giga" ) + ( ?M (^ 10 6) "mega" ) + ( ?k (^ 10 3) "kilo" ) + ( ?K (^ 10 3) "kilo" ) + ( ?h (^ 10 2) "hecto" ) + ( ?H (^ 10 2) "hecto" ) + ( ?D (^ 10 1) "deka" ) ( 0 (^ 10 0) nil ) - ( ?d (^ 10 -1) "Deci" ) - ( ?c (^ 10 -2) "Centi" ) - ( ?m (^ 10 -3) "Milli" ) - ( ?u (^ 10 -6) "Micro" ) - ( ?μ (^ 10 -6) "Micro" ) - ( ?n (^ 10 -9) "Nano" ) - ( ?p (^ 10 -12) "Pico" ) - ( ?f (^ 10 -15) "Femto" ) - ( ?a (^ 10 -18) "Atto" ) + ( ?d (^ 10 -1) "deci" ) + ( ?c (^ 10 -2) "centi" ) + ( ?m (^ 10 -3) "milli" ) + ( ?u (^ 10 -6) "micro" ) + ( ?μ (^ 10 -6) "micro" ) + ( ?n (^ 10 -9) "nano" ) + ( ?p (^ 10 -12) "pico" ) + ( ?f (^ 10 -15) "femto" ) + ( ?a (^ 10 -18) "atto" ) ( ?z (^ 10 -21) "zepto" ) ( ?y (^ 10 -24) "yocto" ) ( ?r (^ 10 -27) "ronto" ) diff --git a/lisp/comint.el b/lisp/comint.el index f0bb8da4355..7ba423e65de 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -4121,9 +4121,15 @@ function called, or nil, if no function was called (if BEG = END)." (save-restriction (let ((beg2 beg1) (end2 end1)) - (when (= beg2 beg) + (when (and (= beg2 beg) + (> beg2 (point-min)) + (eq is-output + (eq (get-text-property (1- beg2) 'field) 'output))) (setq beg2 (field-beginning beg2))) - (when (= end2 end) + (when (and (= end2 end) + (< end2 (point-max)) + (eq is-output + (eq (get-text-property (1+ end2) 'field) 'output))) (setq end2 (field-end end2))) ;; Narrow to the whole field surrounding the region (narrow-to-region beg2 end2)) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 0e09e99da95..94a9165453f 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1238,7 +1238,7 @@ Show the buffer in another window, but don't select it." (unless (eq symbol basevar) (message "`%s' is an alias for `%s'" symbol basevar)))) -(defvar customize-changed-options-previous-release "28.2" +(defvar customize-changed-options-previous-release "29.1" "Version for `customize-changed' to refer back to by default.") ;; Packages will update this variable, so make it available. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 43a2ed92059..95e78ceab6a 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2052,7 +2052,8 @@ info node `(cl) Function Bindings' for details. (dolist (binding bindings) (let ((var (make-symbol (format "--cl-%s--" (car binding)))) (args-and-body (cdr binding))) - (if (and (= (length args-and-body) 1) (symbolp (car args-and-body))) + (if (and (= (length args-and-body) 1) + (macroexp-copyable-p (car args-and-body))) ;; Optimize (cl-flet ((fun var)) body). (setq var (car args-and-body)) (push (list var (if (= (length args-and-body) 1) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 2df390ecbeb..7d54a84687b 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -417,6 +417,8 @@ No problems result if this variable is not bound. `(defvar ,keymap-sym (let ((m ,keymap)) (cond ((keymapp m) m) + ;; FIXME: `easy-mmode-define-keymap' is obsolete, + ;; so this form should also be obsolete somehow. ((listp m) (with-suppressed-warnings ((obsolete easy-mmode-define-keymap)) @@ -682,6 +684,7 @@ Valid keywords and arguments are: :group Ignored. :suppress Non-nil to call `suppress-keymap' on keymap, `nodigits' to suppress digits as prefix arguments." + (declare (obsolete define-keymap "29.1")) (let (inherit dense suppress) (while args (let ((key (pop args)) @@ -722,9 +725,7 @@ The M, BS, and ARGS arguments are as per that function. DOC is the constant's documentation. This macro is deprecated; use `defvar-keymap' instead." - ;; FIXME: Declare obsolete in favor of `defvar-keymap'. It is still - ;; used for `gud-menu-map' and `gud-minor-mode-map', so fix that first. - (declare (doc-string 3) (indent 1)) + (declare (doc-string 3) (indent 1) (obsolete defvar-keymap "29.1")) `(defconst ,m (easy-mmode-define-keymap ,bs nil (if (boundp ',m) ,m) ,(cons 'list args)) ,doc)) diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el index 9ad218d5988..9b75c7a1237 100644 --- a/lisp/eshell/em-alias.el +++ b/lisp/eshell/em-alias.el @@ -183,7 +183,9 @@ file named by `eshell-aliases-file'.") (pcomplete-here (eshell-alias-completions pcomplete-stub))) (defun eshell-read-aliases-list () - "Read in an aliases list from `eshell-aliases-file'." + "Read in an aliases list from `eshell-aliases-file'. +This is useful after manually editing the contents of the file." + (interactive) (let ((file eshell-aliases-file)) (when (file-readable-p file) (setq eshell-command-aliases-list diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 48ac3e2bd4d..cfec04e183d 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el @@ -377,20 +377,24 @@ after are both returned." (when (eshell-looking-at-backslash-return (point)) (throw 'eshell-incomplete ?\\)) (forward-char 2) ; Move one char past the backslash. - (if (eq (char-before) ?\n) - ;; Escaped newlines are extra-special: they expand to an empty - ;; token to allow for continuing Eshell commands across - ;; multiple lines. - 'eshell-empty-token - ;; If the char is in a quote, backslash only has special meaning - ;; if it is escaping a special char. - (if eshell-current-quoted - (if (memq (char-before) eshell-special-chars-inside-quoting) - (list 'eshell-escape-arg (char-to-string (char-before))) - (concat "\\" (char-to-string (char-before)))) - (if (memq (char-before) eshell-special-chars-outside-quoting) - (list 'eshell-escape-arg (char-to-string (char-before))) - (char-to-string (char-before))))))) + (let ((special-chars (if eshell-current-quoted + eshell-special-chars-inside-quoting + eshell-special-chars-outside-quoting))) + (cond + ;; Escaped newlines are extra-special: they expand to an empty + ;; token to allow for continuing Eshell commands across + ;; multiple lines. + ((eq (char-before) ?\n) + 'eshell-empty-token) + ((memq (char-before) special-chars) + (list 'eshell-escape-arg (char-to-string (char-before)))) + ;; If the char is in a quote, backslash only has special + ;; meaning if it is escaping a special char. Otherwise, the + ;; result is the literal string "\c". + (eshell-current-quoted + (concat "\\" (char-to-string (char-before)))) + (t + (char-to-string (char-before))))))) (defun eshell-parse-literal-quote () "Parse a literally quoted string. Nothing has special meaning!" diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 5765d2d4feb..1c049107f00 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -1944,85 +1944,6 @@ Major mode for editing BibTeX style files. (register-definition-prefixes "bibtex-style" '("bibtex-style-")) -;;; Generated autoloads from use-package/bind-key.el - -(push (purecopy '(bind-key 2 4 1)) package--builtin-versions) -(autoload 'bind-key "bind-key" "\ -Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed). - -KEY-NAME may be a vector, in which case it is passed straight to -`define-key'. Or it may be a string to be interpreted as -spelled-out keystrokes, e.g., \"C-c C-z\". See the documentation -of `edmacro-mode' for details. - -COMMAND must be an interactive function or lambda form. - -KEYMAP, if present, should be a keymap variable or symbol. -For example: - - (bind-key \"M-h\" #\\='some-interactive-function my-mode-map) - - (bind-key \"M-h\" #\\='some-interactive-function \\='my-mode-map) - -If PREDICATE is non-nil, it is a form evaluated to determine when -a key should be bound. It must return non-nil in such cases. -Emacs can evaluate this form at any time that it does redisplay -or operates on menu data structures, so you should write it so it -can safely be called at any time. - -(fn KEY-NAME COMMAND &optional KEYMAP PREDICATE)" nil t) -(autoload 'unbind-key "bind-key" "\ -Unbind the given KEY-NAME, within the KEYMAP (if specified). -See `bind-key' for more details. - -(fn KEY-NAME &optional KEYMAP)" nil t) -(autoload 'bind-key* "bind-key" "\ -Similar to `bind-key', but overrides any mode-specific bindings. - -(fn KEY-NAME COMMAND &optional PREDICATE)" nil t) -(autoload 'bind-keys "bind-key" "\ -Bind multiple keys at once. - -Accepts keyword arguments: -:map MAP - a keymap into which the keybindings should be - added -:prefix KEY - prefix key for these bindings -:prefix-map MAP - name of the prefix map that should be created - for these bindings -:prefix-docstring STR - docstring for the prefix-map variable -:menu-name NAME - optional menu string for prefix map -:repeat-docstring STR - docstring for the repeat-map variable -:repeat-map MAP - name of the repeat map that should be created - for these bindings. If specified, the - `repeat-map' property of each command bound - (within the scope of the `:repeat-map' keyword) - is set to this map. -:exit BINDINGS - Within the scope of `:repeat-map' will bind the - key in the repeat map, but will not set the - `repeat-map' property of the bound command. -:continue BINDINGS - Within the scope of `:repeat-map' forces the - same behavior as if no special keyword had - been used (that is, the command is bound, and - it's `repeat-map' property set) -:filter FORM - optional form to determine when bindings apply - -The rest of the arguments are conses of keybinding string and a -function symbol (unquoted). - -(fn &rest ARGS)" nil t) -(autoload 'bind-keys* "bind-key" "\ -Bind multiple keys at once, in `override-global-map'. -Accepts the same keyword arguments as `bind-keys' (which see). - -This binds keys in such a way that bindings are not overridden by -other modes. See `override-global-mode'. - -(fn &rest ARGS)" nil t) -(autoload 'describe-personal-keybindings "bind-key" "\ -Display all the personal keybindings defined by `bind-key'." t) -(register-definition-prefixes "bind-key" '("bind-key" "compare-keybindings" "get-binding-description" "override-global-m" "personal-keybindings")) - - ;;; Generated autoloads from emacs-lisp/bindat.el (register-definition-prefixes "bindat" '("bindat-")) @@ -2920,11 +2841,9 @@ and corresponding effects. ;;; Generated autoloads from progmodes/c-ts-mode.el -(autoload 'c-ts-base-mode "c-ts-mode" "\ +(autoload 'c-ts-mode--base-mode "c-ts-mode" "\ Major mode for editing C, powered by tree-sitter. -\\{c-ts-mode-map} - (fn)" t) (autoload 'c-ts-mode "c-ts-mode" "\ Major mode for editing C, powered by tree-sitter. @@ -2934,7 +2853,7 @@ Major mode for editing C, powered by tree-sitter. Major mode for editing C++, powered by tree-sitter. (fn)" t) -(register-definition-prefixes "c-ts-mode" '("c-ts-mode-")) +(register-definition-prefixes "c-ts-mode" '("c-ts-")) ;;; Generated autoloads from calendar/cal-bahai.el @@ -7978,16 +7897,6 @@ it is disabled. (register-definition-prefixes "doc-view" '("doc-view-")) -;;; Generated autoloads from progmodes/dockerfile-ts-mode.el - -(add-to-list 'auto-mode-alist `(,(rx (| (: "Dockerfile" (32 "." (* nonl))) (: "." (any "dD") "ockerfile")) eol) . dockerfile-ts-mode)) -(autoload 'dockerfile-ts-mode "dockerfile-ts-mode" "\ -Major mode for editing Dockerfiles, powered by tree-sitter. - -(fn)" t) -(register-definition-prefixes "dockerfile-ts-mode" '("dockerfile-ts-mode--")) - - ;;; Generated autoloads from play/doctor.el (autoload 'doctor "doctor" "\ @@ -8187,6 +8096,7 @@ Valid keywords and arguments are: `nodigits' to suppress digits as prefix arguments. (fn BS &optional NAME M ARGS)") +(make-obsolete 'easy-mmode-define-keymap 'define-keymap "29.1") (autoload 'easy-mmode-defmap "easy-mmode" "\ Define a constant M whose value is the result of `easy-mmode-define-keymap'. The M, BS, and ARGS arguments are as per that function. DOC is @@ -8197,6 +8107,7 @@ This macro is deprecated; use `defvar-keymap' instead. (fn M BS DOC &rest ARGS)" nil t) (function-put 'easy-mmode-defmap 'doc-string-elt 3) (function-put 'easy-mmode-defmap 'lisp-indent-function 1) +(make-obsolete 'easy-mmode-defmap 'defvar-keymap "29.1") (autoload 'easy-mmode-defsyntax "easy-mmode" "\ Define variable ST as a syntax-table. CSS contains a list of syntax specifications of the form (CHAR . SYNTAX). @@ -11366,12 +11277,6 @@ This is used only in conjunction with `expand-add-abbrevs'." t) (register-definition-prefixes "srecode/expandproto" '("srecode-")) -;;; Generated autoloads from external-completion.el - -(push (purecopy '(external-completion 0 1)) package--builtin-versions) -(register-definition-prefixes "external-completion" '("external-completion-")) - - ;;; Generated autoloads from cedet/srecode/extract.el (register-definition-prefixes "srecode/extract" '("srecode-extract")) @@ -23472,11 +23377,11 @@ regular package, but it will not remove a VC package. (autoload 'package-vc-checkout "package-vc" "\ Clone the sources for PKG-DESC into DIRECTORY and visit that directory. Unlike `package-vc-install', this does not yet set up the package -for use with Emacs; use `package-vc-install-from-checkout' for -setting the package up after this function finishes. Optional -argument REV means to clone a specific version of the package; it -defaults to the last version available from the package's -repository. If REV has the special value +for use with Emacs; use `package-vc-link-directory' for setting +the package up after this function finishes. +Optional argument REV means to clone a specific version of the +package; it defaults to the last version available from the +package's repository. If REV has the special value `:last-release' (interactively, the prefix argument), that stands for the last released version of the package. @@ -25065,7 +24970,7 @@ Open profile FILENAME. ;;; Generated autoloads from progmodes/project.el -(push (purecopy '(project 0 9 2)) package--builtin-versions) +(push (purecopy '(project 0 8 3)) package--builtin-versions) (autoload 'project-current "project" "\ Return the project instance in DIRECTORY, defaulting to `default-directory'. @@ -25077,8 +24982,8 @@ project instance. The \"transient\" project instance is a special kind of value which denotes a project rooted in that directory and includes all -the files under the directory except for those that match entries -in `vc-directory-exclusion-list' or `grep-find-ignored-files'. +the files under the directory except for those that should be +ignored (per `project-ignores'). See the doc string of `project-find-functions' for the general form of the project instance object. @@ -32970,19 +32875,11 @@ FRAC should be the inverse of the fractional value; for example, a value of ;;; Generated autoloads from progmodes/typescript-ts-mode.el (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) -(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) -(autoload 'typescript-ts-base-mode "typescript-ts-mode" "\ -Major mode for editing TypeScript. - -(fn)" t) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode)) (autoload 'typescript-ts-mode "typescript-ts-mode" "\ Major mode for editing TypeScript. (fn)" t) -(autoload 'tsx-ts-mode "typescript-ts-mode" "\ -Major mode for editing TypeScript. - -(fn)" t) (register-definition-prefixes "typescript-ts-mode" '("typescript-ts-mode-")) @@ -33709,195 +33606,6 @@ is \"www.fsf.co.uk\". (register-definition-prefixes "url-vars" '("url-")) -;;; Generated autoloads from use-package/use-package.el - -(push (purecopy '(use-package 2 4 4)) package--builtin-versions) - - -;;; Generated autoloads from use-package/use-package-bind-key.el - -(autoload 'use-package-autoload-keymap "use-package-bind-key" "\ -Load PACKAGE and bind key sequence invoking this function to KEYMAP-SYMBOL. -Then simulate pressing the same key sequence a again, so that the -next key pressed is routed to the newly loaded keymap. - -This function supports use-package's :bind-keymap keyword. It -works by binding the given key sequence to an invocation of this -function for a particular keymap. The keymap is expected to be -defined by the package. In this way, loading the package is -deferred until the prefix key sequence is pressed. - -(fn KEYMAP-SYMBOL PACKAGE OVERRIDE)") -(autoload 'use-package-normalize-binder "use-package-bind-key" "\ - - -(fn NAME KEYWORD ARGS)") -(defalias 'use-package-normalize/:bind 'use-package-normalize-binder) -(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder) -(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode) -(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode) -(autoload 'use-package-handler/:bind "use-package-bind-key" "\ - - -(fn NAME KEYWORD ARGS REST STATE &optional BIND-MACRO)") -(defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder) -(defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder) -(autoload 'use-package-handler/:bind-keymap "use-package-bind-key" "\ - - -(fn NAME KEYWORD ARGS REST STATE &optional OVERRIDE)") -(autoload 'use-package-handler/:bind-keymap* "use-package-bind-key" "\ - - -(fn NAME KEYWORD ARG REST STATE)") -(register-definition-prefixes "use-package-bind-key" '("use-package-handler/:bind*")) - - -;;; Generated autoloads from use-package/use-package-core.el - -(autoload 'use-package "use-package-core" "\ -Declare an Emacs package by specifying a group of configuration options. - -For the full documentation, see Info node `(use-package) top'. -Usage: - - (use-package package-name - [:keyword [option]]...) - -:init Code to run before PACKAGE-NAME has been loaded. -:config Code to run after PACKAGE-NAME has been loaded. Note that - if loading is deferred for any reason, this code does not - execute until the lazy load has occurred. -:preface Code to be run before everything except `:disabled'; this - can be used to define functions for use in `:if', or that - should be seen by the byte-compiler. - -:mode Form to be added to `auto-mode-alist'. -:magic Form to be added to `magic-mode-alist'. -:magic-fallback Form to be added to `magic-fallback-mode-alist'. -:interpreter Form to be added to `interpreter-mode-alist'. - -:commands Define autoloads for commands that will be defined by the - package. This is useful if the package is being lazily - loaded, and you wish to conditionally call functions in your - `:init' block that are defined in the package. -:autoload Similar to :commands, but it for no-interactive one. -:hook Specify hook(s) to attach this package to. - -:bind Bind keys, and define autoloads for the bound commands. -:bind* Bind keys, and define autoloads for the bound commands, - *overriding all minor mode bindings*. -:bind-keymap Bind a key prefix to an auto-loaded keymap defined in the - package. This is like `:bind', but for keymaps. -:bind-keymap* Like `:bind-keymap', but overrides all minor mode bindings - -:defer Defer loading of a package -- this is implied when using - `:commands', `:bind', `:bind*', `:mode', `:magic', `:hook', - `:magic-fallback', or `:interpreter'. This can be an integer, - to force loading after N seconds of idle time, if the package - has not already been loaded. -:demand Prevent the automatic deferred loading introduced by constructs - such as `:bind' (see `:defer' for the complete list). - -:after Delay the effect of the use-package declaration - until after the named libraries have loaded. - Before they have been loaded, no other keyword - has any effect at all, and once they have been - loaded it is as if `:after' was not specified. - -:if EXPR Initialize and load only if EXPR evaluates to a non-nil value. -:disabled The package is ignored completely if this keyword is present. -:defines Declare certain variables to silence the byte-compiler. -:functions Declare certain functions to silence the byte-compiler. -:load-path Add to the `load-path' before attempting to load the package. -:diminish Support for diminish.el (if installed). -:delight Support for delight.el (if installed). -:custom Call `Custom-set' or `set-default' with each variable - definition without modifying the Emacs `custom-file'. - (compare with `custom-set-variables'). -:custom-face Call `custom-set-faces' with each face definition. -:ensure Loads the package using package.el if necessary. -:pin Pin the package to an archive. - -(fn NAME &rest ARGS)" nil t) -(function-put 'use-package 'lisp-indent-function 'defun) -(register-definition-prefixes "use-package-core" '("use-package-")) - - -;;; Generated autoloads from use-package/use-package-delight.el - -(autoload 'use-package-normalize/:delight "use-package-delight" "\ -Normalize arguments to delight. - -(fn NAME KEYWORD ARGS)") -(autoload 'use-package-handler/:delight "use-package-delight" "\ - - -(fn NAME KEYWORD ARGS REST STATE)") -(register-definition-prefixes "use-package-delight" '("use-package-normalize-delight")) - - -;;; Generated autoloads from use-package/use-package-diminish.el - -(autoload 'use-package-normalize/:diminish "use-package-diminish" "\ - - -(fn NAME KEYWORD ARGS)") -(autoload 'use-package-handler/:diminish "use-package-diminish" "\ - - -(fn NAME KEYWORD ARG REST STATE)") -(register-definition-prefixes "use-package-diminish" '("use-package-normalize-diminish")) - - -;;; Generated autoloads from use-package/use-package-ensure.el - -(autoload 'use-package-normalize/:ensure "use-package-ensure" "\ - - -(fn NAME KEYWORD ARGS)") -(autoload 'use-package-handler/:ensure "use-package-ensure" "\ - - -(fn NAME KEYWORD ENSURE REST STATE)") -(register-definition-prefixes "use-package-ensure" '("use-package-")) - - -;;; Generated autoloads from use-package/use-package-ensure-system-package.el - -(push (purecopy '(use-package-ensure-system-package 0 2)) package--builtin-versions) -(autoload 'use-package-normalize/:ensure-system-package "use-package-ensure-system-package" "\ -Turn ARGS into a list of conses of the form (PACKAGE-NAME . INSTALL-COMMAND). - -(fn NAME-SYMBOL KEYWORD ARGS)") -(autoload 'use-package-handler/:ensure-system-package "use-package-ensure-system-package" "\ -Execute the handler for `:ensure-system-package' keyword in `use-package'. - -(fn NAME KEYWORD ARG REST STATE)") -(register-definition-prefixes "use-package-ensure-system-package" '("use-package-ensure-system-package-")) - - -;;; Generated autoloads from use-package/use-package-jump.el - -(autoload 'use-package-jump-to-package-form "use-package-jump" "\ -Attempt to find and jump to the `use-package' form that loaded PACKAGE. -This will only find the form if that form actually required -PACKAGE. If PACKAGE was previously required then this function -will jump to the file that originally required PACKAGE instead. - -(fn PACKAGE)" t) -(register-definition-prefixes "use-package-jump" '("use-package-find-require")) - - -;;; Generated autoloads from use-package/use-package-lint.el - -(autoload 'use-package-lint "use-package-lint" "\ -Check for errors in `use-package' declarations. -For example, if the module's `:if' condition is met, but even -with the specified `:load-path' the module cannot be found." t) -(register-definition-prefixes "use-package-lint" '("use-package-lint-declaration")) - - ;;; Generated autoloads from userlock.el (put 'create-lockfiles 'safe-local-variable 'booleanp) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index e8d8f9104e4..eb0e5b0481c 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1113,13 +1113,13 @@ no input, and GDB is waiting for input." (process-live-p proc) (not gud-running) (= (point) (marker-position (process-mark proc)))) - ;; Sending an EOF does not work with GDB-MI; submit an - ;; explicit quit command. - (progn - (if (> gdb-control-level 0) - (process-send-eof proc) - (insert "quit") - (comint-send-input t t))) + ;; Exit a recursive reading loop or quit. + (if (> gdb-control-level 0) + (process-send-eof proc) + ;; Sending an EOF does not work with GDB-MI; submit an + ;; explicit quit command. + (insert "quit") + (comint-send-input t t)) (delete-char arg)))) (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") @@ -4355,6 +4355,24 @@ member." :group 'gud :version "29.1") +(defcustom gdb-locals-table-row-config `((name . 20) + (type . 20) + (value . ,gdb-locals-value-limit)) + "Configuration for table rows in the local variable display. + +An alist that controls the display of the name, type and value of +local variables inside the currently active stack-frame. The key +controls which column to change whereas the value determines the +maximum number of characters to display in each column. A value +of 0 means there is no limit. + +Additionally, the order the element in the alist determines the +left-to-right display order of the properties." + :type '(alist :key-type 'symbol :value-type 'integer) + :group 'gud + :version "30.1") + + (defvar gdb-locals-values-table (make-hash-table :test #'equal) "Mapping of local variable names to a string with their value.") @@ -4384,12 +4402,9 @@ member." (defun gdb-locals-value-filter (value) "Filter function for the local variable VALUE." - (let* ((no-nl (replace-regexp-in-string "\n" " " value)) - (str (replace-regexp-in-string "[[:space:]]+" " " no-nl)) - (limit gdb-locals-value-limit)) - (if (>= (length str) limit) - (concat (substring str 0 limit) "...") - str))) + (let* ((no-nl (replace-regexp-in-string "\n" " " (or value "<Unknown>"))) + (str (replace-regexp-in-string "[[:space:]]+" " " no-nl))) + str)) (defun gdb-edit-locals-value (&optional event) "Assign a value to a variable displayed in the locals buffer." @@ -4403,6 +4418,22 @@ member." (gud-basic-call (concat "-gdb-set variable " var " = " value))))) + +(defun gdb-locals-table-columns-list (alist) + "Format and arrange the columns in locals display based on ALIST." + (let (columns) + (dolist (config gdb-locals-table-row-config columns) + (let* ((key (car config)) + (max (cdr config)) + (prop (alist-get key alist))) + (when prop + (if (and (> max 0) (length> prop max)) + (push (propertize (string-truncate-left prop max) 'help-echo prop) + columns) + (push prop columns))))) + (nreverse columns))) + + ;; Complex data types are looked up in `gdb-locals-values-table'. (defun gdb-locals-handler-custom () "Handler to rebuild the local variables table buffer." @@ -4431,12 +4462,14 @@ member." help-echo "mouse-2: edit value" local-map ,gdb-edit-locals-map-1) value)) + (setf (gdb-table-right-align table) t) + (setq name (propertize name 'font-lock-face font-lock-variable-name-face)) + (setq type (propertize type 'font-lock-face font-lock-type-face)) (gdb-table-add-row table - (list - (propertize type 'font-lock-face font-lock-type-face) - (propertize name 'font-lock-face font-lock-variable-name-face) - value) + (gdb-locals-table-columns-list `((name . ,name) + (type . ,type) + (value . ,value))) `(gdb-local-variable ,local)))) (insert (gdb-table-string table " ")) (setq mode-name @@ -5124,6 +5157,8 @@ This arrangement depends on the values of variable (defun gdb-reset () "Exit a debugging session cleanly. Kills the gdb buffers, and resets variables and the source buffers." + ;; Save GDB history + (comint-write-input-ring) ;; The gdb-inferior buffer has a pty hooked up to the main gdb ;; process. This pty must be deleted explicitly. (let ((pty (get-process "gdb-inferior"))) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 143fa8c6798..6ffcf497b93 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -159,143 +159,96 @@ Used to gray out relevant toolbar icons.") (t (comint-interrupt-subjob))))) -(easy-mmode-defmap gud-menu-map - '(([help] "Info (debugger)" . gud-goto-info) - ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode - :enable (and (not emacs-basic-display) - (display-graphic-p) - (fboundp 'x-show-tip)) - :visible (memq gud-minor-mode - '(gdbmi guiler dbx sdb xdb pdb)) - :button (:toggle . gud-tooltip-mode)) - ([refresh] "Refresh" . gud-refresh) - ([run] menu-item "Run" gud-run - :enable (not gud-running) - :visible (or (memq gud-minor-mode '(gdb dbx jdb)) - (and (eq gud-minor-mode 'gdbmi) - (or (not (gdb-show-run-p)) - (bound-and-true-p - gdb-active-process))))) - ([go] . (menu-item (if (bound-and-true-p gdb-active-process) - "Continue" "Run") - gud-go - :visible (and (eq gud-minor-mode 'gdbmi) - (gdb-show-run-p)))) - ([stop] menu-item "Stop" gud-stop-subjob - :visible (or (not (memq gud-minor-mode '(gdbmi pdb))) - (and (eq gud-minor-mode 'gdbmi) - (gdb-show-stop-p)))) - ([until] menu-item "Continue to selection" gud-until - :enable (not gud-running) - :visible (and (memq gud-minor-mode '(gdbmi gdb perldb)) - (gud-tool-bar-item-visible-no-fringe))) - ([remove] menu-item "Remove Breakpoint" gud-remove - :enable (not gud-running) - :visible (gud-tool-bar-item-visible-no-fringe)) - ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak - :enable (not gud-running) - :visible (memq gud-minor-mode - '(gdbmi gdb sdb xdb))) - ([break] menu-item "Set Breakpoint" gud-break - :enable (not gud-running) - :visible (gud-tool-bar-item-visible-no-fringe)) - ([up] menu-item "Up Stack" gud-up - :enable (not gud-running) - :visible (memq gud-minor-mode - '(gdbmi gdb guiler dbx xdb jdb pdb))) - ([down] menu-item "Down Stack" gud-down - :enable (not gud-running) - :visible (memq gud-minor-mode - '(gdbmi gdb guiler dbx xdb jdb pdb))) - ([pp] menu-item "Print S-expression" gud-pp - :enable (and (not gud-running) - (bound-and-true-p gdb-active-process)) - :visible (and (string-equal - (buffer-local-value - 'gud-target-name gud-comint-buffer) - "emacs") - (eq gud-minor-mode 'gdbmi))) - ([print*] . (menu-item (if (eq gud-minor-mode 'jdb) - "Dump object" - "Print Dereference") - gud-pstar - :enable (not gud-running) - :visible (memq gud-minor-mode '(gdbmi gdb jdb)))) - ([print] menu-item "Print Expression" gud-print - :enable (not gud-running)) - ([watch] menu-item "Watch Expression" gud-watch - :enable (not gud-running) - :visible (eq gud-minor-mode 'gdbmi)) - ([finish] menu-item "Finish Function" gud-finish - :enable (not gud-running) - :visible (memq gud-minor-mode - '(gdbmi gdb guiler xdb jdb pdb))) - ([stepi] menu-item "Step Instruction" gud-stepi - :enable (not gud-running) - :visible (memq gud-minor-mode '(gdbmi gdb dbx))) - ([nexti] menu-item "Next Instruction" gud-nexti - :enable (not gud-running) - :visible (memq gud-minor-mode '(gdbmi gdb dbx))) - ([step] menu-item "Step Line" gud-step - :enable (not gud-running)) - ([next] menu-item "Next Line" gud-next - :enable (not gud-running)) - ([cont] menu-item "Continue" gud-cont - :enable (not gud-running) - :visible (not (eq gud-minor-mode 'gdbmi)))) - "Menu for `gud-mode'." - :name "Gud") - -(easy-mmode-defmap gud-minor-mode-map - (append - `(([menu-bar debug] . ("Gud" . ,gud-menu-map))) - ;; Get tool bar like functionality from the menu bar on a text only - ;; terminal. - (unless window-system - `(([menu-bar down] - . (,(propertize "down" 'face 'font-lock-doc-face) . gud-down)) - ([menu-bar up] - . (,(propertize "up" 'face 'font-lock-doc-face) . gud-up)) - ([menu-bar finish] - . (,(propertize "finish" 'face 'font-lock-doc-face) . gud-finish)) - ([menu-bar step] - . (,(propertize "step" 'face 'font-lock-doc-face) . gud-step)) - ([menu-bar next] - . (,(propertize "next" 'face 'font-lock-doc-face) . gud-next)) - ([menu-bar until] menu-item - ,(propertize "until" 'face 'font-lock-doc-face) gud-until - :visible (memq gud-minor-mode '(gdbmi gdb perldb))) - ([menu-bar cont] menu-item - ,(propertize "cont" 'face 'font-lock-doc-face) gud-cont - :visible (not (eq gud-minor-mode 'gdbmi))) - ([menu-bar run] menu-item - ,(propertize "run" 'face 'font-lock-doc-face) gud-run - :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) - ([menu-bar go] menu-item - ,(propertize " go " 'face 'font-lock-doc-face) gud-go - :visible (and (eq gud-minor-mode 'gdbmi) - (gdb-show-run-p))) - ([menu-bar stop] menu-item - ,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob - :visible (or (and (eq gud-minor-mode 'gdbmi) - (gdb-show-stop-p)) - (not (eq gud-minor-mode 'gdbmi)))) - ([menu-bar print] - . (,(propertize "print" 'face 'font-lock-doc-face) . gud-print)) - ([menu-bar tools] . undefined) - ([menu-bar buffer] . undefined) - ([menu-bar options] . undefined) - ([menu-bar edit] . undefined) - ([menu-bar file] . undefined)))) - "Map used in visited files.") +(defvar-keymap gud-mode-map + ;; Will inherit from comint-mode via define-derived-mode. + :doc "`gud-mode' keymap.") -(setf (alist-get 'gud-minor-mode minor-mode-map-alist) - gud-minor-mode-map) +(defvar-keymap gud-minor-mode-map + :parent gud-mode-map) -(defvar gud-mode-map - ;; Will inherit from comint-mode via define-derived-mode. - (make-sparse-keymap) - "`gud-mode' keymap.") +(easy-menu-define gud-menu-map gud-mode-map + "Menu for `gud-mode'." + '("Gud" + ["Continue" gud-cont + :enable (not gud-running) + :visible (not (eq gud-minor-mode 'gdbmi))] + ["Next Line" gud-next + :enable (not gud-running)] + ["Step Line" gud-step + :enable (not gud-running)] + ["Next Instruction" gud-nexti + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdb dbx))] + ["Step Instruction" gud-stepi + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdb dbx))] + ["Finish Function" gud-finish + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdb guiler xdb jdb pdb))] + ["Watch Expression" gud-watch + :enable (not gud-running) + :visible (eq gud-minor-mode 'gdbmi)] + ["Print Expression" gud-print + :enable (not gud-running)] + ["Dump object-Derefenrece" gud-pstar + :label (if (eq gud-minor-mode 'jdb) + "Dump object" + "Print Dereference") + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdb jdb))] + ["Print S-expression" gud-pp + :enable (and (not gud-running) + (bound-and-true-p gdb-active-process)) + :visible (and (string-equal + (buffer-local-value + 'gud-target-name gud-comint-buffer) + "emacs") + (eq gud-minor-mode 'gdbmi))] + ["Down Stack" gud-down + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdb guiler dbx xdb jdb pdb))] + ["Up Stack" gud-up + :enable (not gud-running) + :visible (memq gud-minor-mode + '(gdbmi gdb guiler dbx xdb jdb pdb))] + ["Set Breakpoint" gud-break + :enable (not gud-running) + :visible (gud-tool-bar-item-visible-no-fringe)] + ["Temporary Breakpoint" gud-tbreak + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdb sdb xdb))] + ["Remove Breakpoint" gud-remove + :enable (not gud-running) + :visible (gud-tool-bar-item-visible-no-fringe)] + ["Continue to selection" gud-until + :enable (not gud-running) + :visible (and (memq gud-minor-mode '(gdbmi gdb perldb)) + (gud-tool-bar-item-visible-no-fringe))] + ["Stop" gud-stop-subjob + :visible (or (not (memq gud-minor-mode '(gdbmi pdb))) + (and (eq gud-minor-mode 'gdbmi) + (gdb-show-stop-p)))] + ["Continue-Run" gud-go + :label (if (bound-and-true-p gdb-active-process) + "Continue" "Run") + :visible (and (eq gud-minor-mode 'gdbmi) + (gdb-show-run-p))] + ["Run" gud-run + :enable (not gud-running) + :visible (or (memq gud-minor-mode '(gdb dbx jdb)) + (and (eq gud-minor-mode 'gdbmi) + (or (not (gdb-show-run-p)) + (bound-and-true-p + gdb-active-process))))] + ["Refresh" gud-refresh] + ["Show GUD tooltips" gud-tooltip-mode + :enable (and (not emacs-basic-display) + (display-graphic-p) + (fboundp 'x-show-tip)) + :visible (memq gud-minor-mode + '(gdbmi guiler dbx sdb xdb pdb)) + :button (:toggle . gud-tooltip-mode)] + ["Info (debugger)" gud-goto-info])) (setf (alist-get 'gud-minor-mode minor-mode-map-alist) gud-minor-mode-map) diff --git a/lisp/server.el b/lisp/server.el index fd740d126df..8f4ca4cbc6c 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -273,6 +273,11 @@ If nil, no instructions are displayed." :version "28.1" :type 'boolean) +(defvar server-stop-automatically) ; Defined below to avoid recursive load. + +(defvar server-stop-automatically--timer nil + "The timer object for `server-stop-automatically--maybe-kill-emacs'.") + ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir @@ -636,7 +641,8 @@ anyway." (setq stopped-p t server-process nil server-mode nil - global-minor-modes (delq 'server-mode global-minor-modes))) + global-minor-modes (delq 'server-mode global-minor-modes)) + (server-apply-stop-automatically)) (unwind-protect ;; Delete the socket files made by previous server ;; invocations. @@ -757,6 +763,7 @@ the `server-process' variable." (list :family 'local :service server-file :plist '(:authenticated t))))) + (server-apply-stop-automatically) (unless server-process (error "Could not start server process")) (server-log "Started server") (process-put server-process :server-file server-file) @@ -1769,9 +1776,6 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)." (when server-raise-frame (select-frame-set-input-focus (window-frame))))) -(defvar server-stop-automatically nil - "Internal status variable for `server-stop-automatically'.") - ;;;###autoload (defun server-save-buffers-kill-terminal (arg) ;; Called from save-buffers-kill-terminal in files.el. @@ -1779,11 +1783,19 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)." With ARG non-nil, silently save all file-visiting buffers, then kill. If emacsclient was started with a list of filenames to edit, then -only these files will be asked to be saved." - (let ((proc (frame-parameter nil 'client))) +only these files will be asked to be saved. + +When running Emacs as a daemon and with +`server-stop-automatically' (which see) set to `kill-terminal' or +`delete-frame', this function may call `save-buffers-kill-emacs' +if there are no other active clients." + (let ((stop-automatically + (and (daemonp) + (memq server-stop-automatically '(kill-terminal delete-frame)))) + (proc (frame-parameter nil 'client))) (cond ((eq proc 'nowait) ;; Nowait frames have no client buffer list. - (if (length> (frame-list) (if server-stop-automatically 2 1)) + (if (length> (frame-list) (if stop-automatically 2 1)) ;; If there are any other frames, only delete this one. ;; When `server-stop-automatically' is set, don't count ;; the daemon frame. @@ -1792,7 +1804,7 @@ only these files will be asked to be saved." ;; If we're the last frame standing, kill Emacs. (save-buffers-kill-emacs arg))) ((processp proc) - (if (or (not server-stop-automatically) + (if (or (not stop-automatically) (length> server-clients 1) (seq-some (lambda (frame) @@ -1818,31 +1830,14 @@ only these files will be asked to be saved." (save-buffers-kill-emacs arg))) (t (error "Invalid client frame"))))) -(defun server-stop-automatically--handle-delete-frame (frame) - "Handle deletion of FRAME when `server-stop-automatically' is used." - (when server-stop-automatically - (if (if (and (processp (frame-parameter frame 'client)) - (eq this-command 'save-buffers-kill-terminal)) - (progn - (dolist (f (frame-list)) - (when (and (eq (frame-parameter frame 'client) - (frame-parameter f 'client)) - (not (eq frame f))) - (set-frame-parameter f 'client nil) - (let ((server-stop-automatically nil)) - (delete-frame f)))) - (if (cddr (frame-list)) - (let ((server-stop-automatically nil)) - (delete-frame frame) - nil) - t)) - (null (cddr (frame-list)))) - (let ((server-stop-automatically nil)) - (save-buffers-kill-emacs) - (delete-frame frame))))) +(defun server-stop-automatically--handle-delete-frame (_frame) + "Handle deletion of FRAME when `server-stop-automatically' is `delete-frame'." + (when (null (cddr (frame-list))) + (let ((server-stop-automatically nil)) + (save-buffers-kill-emacs)))) (defun server-stop-automatically--maybe-kill-emacs () - "Handle closing of Emacs daemon when `server-stop-automatically' is used." + "Handle closing of Emacs daemon when `server-stop-automatically' is `empty'." (unless (cdr (frame-list)) (when (and (not (memq t (mapcar (lambda (b) @@ -1856,41 +1851,70 @@ only these files will be asked to be saved." (process-list))))) (kill-emacs)))) -;;;###autoload -(defun server-stop-automatically (arg) - "Automatically stop server as specified by ARG. - -If ARG is the symbol `empty', stop the server when it has no +(defun server-apply-stop-automatically () + "Apply the current value of `server-stop-automatically'. +This function adds or removes the necessary helpers to manage +stopping the Emacs server automatically, depending on the whether +the server is running or not. This function only applies when +running Emacs as a daemon." + (when (daemonp) + (let (empty-timer-p delete-frame-p) + (when server-process + (pcase server-stop-automatically + ('empty (setq empty-timer-p t)) + ('delete-frame (setq delete-frame-p t)))) + ;; Start or stop the timer. + (if empty-timer-p + (unless server-stop-automatically--timer + (setq server-stop-automatically--timer + (run-with-timer + 10 2 + #'server-stop-automatically--maybe-kill-emacs))) + (when server-stop-automatically--timer + (cancel-timer server-stop-automatically--timer) + (setq server-stop-automatically--timer nil))) + ;; Add or remove the delete-frame hook. + (if delete-frame-p + (add-hook 'delete-frame-functions + #'server-stop-automatically--handle-delete-frame) + (remove-hook 'delete-frame-functions + #'server-stop-automatically--handle-delete-frame)))) + ;; Return the current value of `server-stop-automatically'. + server-stop-automatically) + +(defcustom server-stop-automatically nil + "If non-nil, stop the server under the requested conditions. + +If this is the symbol `empty', stop the server when it has no remaining clients, no remaining unsaved file-visiting buffers, and no running processes with a `query-on-exit' flag. -If ARG is the symbol `delete-frame', ask the user when the last +If this is the symbol `delete-frame', ask the user when the last frame is deleted whether each unsaved file-visiting buffer must be saved and each running process with a `query-on-exit' flag can be stopped, and if so, stop the server itself. -If ARG is the symbol `kill-terminal', ask the user when the +If this is the symbol `kill-terminal', ask the user when the terminal is killed with \\[save-buffers-kill-terminal] \ whether each unsaved file-visiting buffer must be saved and each running process with a `query-on-exit' -flag can be stopped, and if so, stop the server itself. - -Any other value of ARG will cause this function to signal an error. +flag can be stopped, and if so, stop the server itself." + :type '(choice + (const :tag "Never" nil) + (const :tag "When no clients, unsaved files, or processes" + empty) + (const :tag "When killing last terminal" kill-terminal) + (const :tag "When killing last terminal or frame" delete-frame)) + :set (lambda (symbol value) + (set-default symbol value) + (server-apply-stop-automatically)) + :version "29.1") -This function is meant to be called from the user init file." - (when (daemonp) - (setq server-stop-automatically arg) - (cond - ((eq arg 'empty) - (setq server-stop-automatically nil) - (run-with-timer 10 2 - #'server-stop-automatically--maybe-kill-emacs)) - ((eq arg 'delete-frame) - (add-hook 'delete-frame-functions - #'server-stop-automatically--handle-delete-frame)) - ((eq arg 'kill-terminal)) - (t - (error "Unexpected argument"))))) +;;;###autoload +(defun server-stop-automatically (value) + "Automatically stop the Emacs server as specified by VALUE. +This sets the variable `server-stop-automatically' (which see)." + (setopt server-stop-automatically value)) (define-key ctl-x-map "#" 'server-edit) diff --git a/lisp/transient.el b/lisp/transient.el index 0919c2c3ef0..1cab697eecb 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -6,7 +6,7 @@ ;; URL: https://github.com/magit/transient ;; Keywords: extensions -;; Package-Version: 0.3.7 +;; Package-Version: 0.3.7.50 ;; Package-Requires: ((emacs "26.1")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -2199,7 +2199,7 @@ value. Otherwise return CHILDREN as is." (delayed (if transient--exitp (apply-partially #'transient--post-exit this-command) #'transient--resume-override)) - post-command abort-minibuffer) + outside-interactive post-command abort-minibuffer) (unless abort-only (setq post-command (lambda () "@transient--delay-post-command" @@ -2211,7 +2211,9 @@ value. Otherwise return CHILDREN as is." (equal (ignore-errors (string-to-multibyte (this-command-keys))) - (format "\M-x%s\r" this-command)))))) + (format "\M-x%s\r" this-command)) + ;; Minibuffer used outside `interactive'. + (and outside-interactive 'post-cmd))))) (transient--debug 'post-command-hook "act: %s" act) (when act (remove-hook 'transient--post-command-hook post-command) @@ -2220,12 +2222,15 @@ value. Otherwise return CHILDREN as is." (add-hook 'transient--post-command-hook post-command)) (setq abort-minibuffer (lambda () "@transient--delay-post-command" - (let ((act (and (or (memq this-command transient--abort-commands) - (equal (this-command-keys) "")) - (= (minibuffer-depth) depth)))) + (let ((act (and (= (minibuffer-depth) depth) + (or (memq this-command transient--abort-commands) + (equal (this-command-keys) "") + (prog1 nil + (setq outside-interactive t)))))) (transient--debug 'abort-minibuffer - "mini: %s|%s, act %s" (minibuffer-depth) depth act) + "mini: %s|%s, act: %s" (minibuffer-depth) depth + (or act (and outside-interactive '->post-cmd))) (when act (remove-hook 'transient--post-command-hook post-command) (remove-hook 'minibuffer-exit-hook abort-minibuffer) @@ -2407,6 +2412,10 @@ If there is no parent prefix, then behave like `transient--do-exit'." (transient--stack-zap) transient--exit) +(defun transient--do-leave () + "Call the command without exporting variables and exit the transient." + transient--stay) + (defun transient--do-push-button () "Call the command represented by the activated button. Use that command's pre-command to determine transient behavior." @@ -3376,7 +3385,7 @@ have a history of their own.") (insert ?\n) (insert (propertize " " 'display `(space :align-to (,(nth (1+ c) cc))))))) - (insert (make-string (- (nth c cc) (current-column)) ?\s)) + (insert (make-string (max 1 (- (nth c cc) (current-column))) ?\s)) (when-let ((cell (nth r (nth c columns)))) (insert cell)) (when (= c (1- cs)) @@ -4119,7 +4128,10 @@ we stop there." 'face 'transient-value)) (cl-defmethod transient-prompt ((obj transient-lisp-variable)) - (format "Set %s: " (oref obj variable))) + (if (and (slot-boundp obj 'prompt) + (oref obj prompt)) + (cl-call-next-method obj) + (format "Set %s: " (oref obj variable)))) (defun transient-lisp-variable--reader (prompt initial-input _history) (read--expression prompt initial-input)) diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index a5d6a5f45bb..0d4c3de5d11 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el @@ -447,7 +447,7 @@ This binds keys in such a way that bindings are not overridden by other modes. See `override-global-mode'." (macroexp-progn (bind-keys-form args 'override-global-map))) -(defun get-binding-description (elem) +(defun bind-key--get-binding-description (elem) (cond ((listp elem) (cond @@ -474,7 +474,7 @@ other modes. See `override-global-mode'." (t "#<byte-compiled lambda>"))) -(defun compare-keybindings (l r) +(defun bind-key--compare-keybindings (l r) (let* ((regex bind-key-segregation-regexp) (lgroup (and (string-match regex (caar l)) (match-string 0 (caar l)))) @@ -517,7 +517,7 @@ other modes. See `override-global-mode'." (setq personal-keybindings (sort personal-keybindings (lambda (l r) - (car (compare-keybindings l r)))))) + (car (bind-key--compare-keybindings l r)))))) (if (not (eq (cdar last-binding) (cdar binding))) (princ (format "\n\n%s: %s\n%s\n\n" @@ -525,7 +525,7 @@ other modes. See `override-global-mode'." (make-string (+ 21 (car bind-key-column-widths) (cdr bind-key-column-widths)) ?-))) (if (and last-binding - (cdr (compare-keybindings last-binding binding))) + (cdr (bind-key--compare-keybindings last-binding binding))) (princ "\n"))) (let* ((key-name (caar binding)) @@ -534,10 +534,10 @@ other modes. See `override-global-mode'." (read-kbd-macro key-name))) (command (nth 1 binding)) (was-command (nth 2 binding)) - (command-desc (get-binding-description command)) + (command-desc (bind-key--get-binding-description command)) (was-command-desc (and was-command - (get-binding-description was-command))) - (at-present-desc (get-binding-description at-present))) + (bind-key--get-binding-description was-command))) + (at-present-desc (bind-key--get-binding-description at-present))) (let ((line (format (format "%%-%ds%%-%ds%%s\n" (car bind-key-column-widths) @@ -555,6 +555,11 @@ other modes. See `override-global-mode'." (setq last-binding binding))))) +(define-obsolete-function-alias 'get-binding-description + 'bind-key--get-binding-description "30.1") +(define-obsolete-function-alias 'compare-keybindings + 'bind-key--compare-keybindings "30.1") + (provide 'bind-key) ;; Local Variables: diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 38e9d5f9c91..83138a6d107 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -136,12 +136,19 @@ If nil, use the value of `vc-annotate-switches'. If t, use no switches." ;;;###autoload(put 'vc-git-annotate-switches 'safe-local-variable (lambda (switches) (equal switches "-w"))) (defcustom vc-git-log-switches nil - "String or list of strings specifying switches for Git log under VC." + "String or list of strings giving Git log switches for non-shortlogs." :type '(choice (const :tag "None" nil) (string :tag "Argument String") (repeat :tag "Argument List" :value ("") string)) :version "28.1") +(defcustom vc-git-shortlog-switches nil + "String or list of strings giving Git log switches for shortlogs." + :type '(choice (const :tag "None" nil) + (string :tag "Argument String") + (repeat :tag "Argument List" :value ("") string)) + :version "30.1") + (defcustom vc-git-resolve-conflicts t "When non-nil, mark conflicted file as resolved upon saving. That is performed after all conflict markers in it have been @@ -1325,7 +1332,8 @@ If LIMIT is a revision string, use it as an end-revision." ,(format "--pretty=tformat:%s" (car vc-git-root-log-format)) "--abbrev-commit")) - (ensure-list vc-git-log-switches) + (ensure-list + (if shortlog vc-git-shortlog-switches vc-git-log-switches)) (when (numberp limit) (list "-n" (format "%s" limit))) (when start-revision @@ -1340,16 +1348,16 @@ If LIMIT is a revision string, use it as an end-revision." (defun vc-git-log-outgoing (buffer remote-location) (vc-setup-buffer buffer) - (vc-git-command - buffer 'async nil - "log" - "--no-color" "--graph" "--decorate" "--date=short" - (format "--pretty=tformat:%s" (car vc-git-root-log-format)) - "--abbrev-commit" - (concat (if (string= remote-location "") - "@{upstream}" - remote-location) - "..HEAD"))) + (apply #'vc-git-command buffer 'async nil + `("log" + "--no-color" "--graph" "--decorate" "--date=short" + ,(format "--pretty=tformat:%s" (car vc-git-root-log-format)) + "--abbrev-commit" + ,@(ensure-list vc-git-shortlog-switches) + ,(concat (if (string= remote-location "") + "@{upstream}" + remote-location) + "..HEAD")))) (defun vc-git-log-incoming (buffer remote-location) (vc-setup-buffer buffer) @@ -1359,15 +1367,15 @@ If LIMIT is a revision string, use it as an end-revision." ;; so remove everything except a repository name. (replace-regexp-in-string "/.*" "" remote-location))) - (vc-git-command - buffer 'async nil - "log" - "--no-color" "--graph" "--decorate" "--date=short" - (format "--pretty=tformat:%s" (car vc-git-root-log-format)) - "--abbrev-commit" - (concat "HEAD.." (if (string= remote-location "") - "@{upstream}" - remote-location)))) + (apply #'vc-git-command buffer 'async nil + `("log" + "--no-color" "--graph" "--decorate" "--date=short" + ,(format "--pretty=tformat:%s" (car vc-git-root-log-format)) + "--abbrev-commit" + ,@(ensure-list vc-git-shortlog-switches) + ,(concat "HEAD.." (if (string= remote-location "") + "@{upstream}" + remote-location))))) (defun vc-git-log-search (buffer pattern) "Search the log of changes for PATTERN and output results into BUFFER. @@ -1378,6 +1386,7 @@ Display all entries that match log messages in long format. With a prefix argument, ask for a command to run that will output log entries." (let ((args `("log" "--no-color" "-i" + ,@(ensure-list vc-git-log-switches) ,(format "--grep=%s" (or pattern ""))))) (when current-prefix-arg (setq args (cdr (split-string @@ -1425,11 +1434,11 @@ log entries." `((,log-view-message-re (1 'change-log-acknowledgment))) ;; Handle the case: ;; user: foo@bar - '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" + '(("^\\(?:Author\\|Commit\\):[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" (1 'change-log-email)) ;; Handle the case: ;; user: FirstName LastName <foo@bar> - ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" + ("^\\(?:Author\\|Commit\\):[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" (1 'change-log-name) (2 'change-log-email)) ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" @@ -1440,7 +1449,7 @@ log entries." ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)" (1 'change-log-acknowledgment) (2 'change-log-acknowledgment)) - ("^\\(?:Date: \\|AuthorDate: \\)\\(.+\\)" (1 'change-log-date)) + ("^\\(?:Date: \\|AuthorDate: \\|CommitDate: \\)\\(.+\\)" (1 'change-log-date)) ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) @@ -1462,7 +1471,11 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-expanded-log-entry (revision) (with-temp-buffer - (apply #'vc-git-command t nil nil (list "log" revision "-1" "--no-color" "--")) + (apply #'vc-git-command t nil nil + `("log" + ,revision + "-1" "--no-color" ,@(ensure-list vc-git-log-switches) + "--")) (goto-char (point-min)) (unless (eobp) ;; Indent the expanded log entry. |