diff options
Diffstat (limited to 'lisp/progmodes/gud.el')
-rw-r--r-- | lisp/progmodes/gud.el | 304 |
1 files changed, 229 insertions, 75 deletions
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index eb114acdabc..08814ebcaaa 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -50,6 +50,30 @@ (defvar hl-line-mode) (defvar hl-line-sticky-flag) +(declare-function gdb-tooltip-print "gdb-mi" (expr)) +(declare-function gdb-tooltip-print-1 "gdb-mi" (expr)) +(declare-function gud-pp "gdb-mi" (arg)) +(declare-function gdb-var-delete "gdb-mi" ()) +(declare-function speedbar-toggle-line-expansion "gud" ()) +(declare-function speedbar-edit-line "gud" ()) +;; FIXME: The declares below are necessary because we don't call `gud-def' +;; at toplevel, so the compiler doesn't know under which circumstances +;; they're defined. +(declare-function gud-statement "gud" (arg)) +(declare-function gud-until "gud" (arg)) +(declare-function gud-pv "gud" (arg)) +(declare-function gud-print "gud" (arg)) +(declare-function gud-down "gud" (arg)) +(declare-function gud-up "gud" (arg)) +(declare-function gud-jump "gud" (arg)) +(declare-function gud-finish "gud" (arg)) +(declare-function gud-cont "gud" (arg)) +(declare-function gud-next "gud" (arg)) +(declare-function gud-stepi "gud" (arg)) +(declare-function gud-step "gud" (arg)) +(declare-function gud-remove "gud" (arg)) +(declare-function gud-tbreak "gud" (arg)) +(declare-function gud-break "gud" (arg)) ;; ====================================================================== ;; GUD commands must be visible in C buffers visited by GUD @@ -64,10 +88,9 @@ pdb (Python), and jdb." (defcustom gud-key-prefix "\C-x\C-a" "Prefix of all GUD commands valid in C buffers." - :type 'key-sequence - :group 'gud) + :type 'key-sequence) -(global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh) +(global-set-key (vconcat gud-key-prefix "\C-l") #'gud-refresh) ;; (define-key ctl-x-map " " 'gud-break); backward compatibility hack (defvar gud-marker-filter nil) @@ -151,10 +174,11 @@ Used to gray out relevant toolbar icons.") (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 + ([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))) + (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) @@ -186,13 +210,15 @@ Used to gray out relevant toolbar icons.") (bound-and-true-p gdb-active-process)) :visible (and (string-equal (buffer-local-value - 'gud-target-name gud-comint-buffer) "emacs") + '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 + ([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))) + :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 @@ -294,6 +320,32 @@ Used to gray out relevant toolbar icons.") (tool-bar-local-item-from-menu (car x) (cdr x) map gud-minor-mode-map)))) +(defvar gud-gdb-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("i" . gud-stepi) + ("c" . gud-cont) + ("l" . gud-refresh) + ("f" . gud-finish) + ("<" . gud-up) + (">" . gud-down))) + (define-key map key cmd)) + map) + "Keymap to repeat `gud-gdb' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + +(defun gud-set-repeat-map-property (keymap-symbol) + "Set the `repeat-map' property of relevant gud commands to KEYMAP-SYMBOL. + +KEYMAP-SYMBOL is a symbol corresponding to some +`<FOO>-repeat-map', a keymap containing gud commands that may be +repeated when `repeat-mode' is on." + (map-keymap-internal (lambda (_ cmd) + (put cmd 'repeat-map keymap-symbol)) + (symbol-value keymap-symbol))) + + (defun gud-file-name (f) "Transform a relative file name to an absolute file name. Uses `gud-<MINOR-MODE>-directories' to find the source files." @@ -333,7 +385,7 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files." (eq gud-minor-mode 'gdbmi)) (make-local-variable 'gdb-define-alist) (unless gdb-define-alist (gdb-create-define-alist)) - (add-hook 'after-save-hook 'gdb-create-define-alist nil t)) + (add-hook 'after-save-hook #'gdb-create-define-alist nil t)) (make-local-variable 'gud-keep-buffer)) buf))) @@ -380,8 +432,8 @@ we're in the GUD buffer)." `(gud-call ,cmd arg) ;; Unused lexical warning if cmd does not use "arg". cmd)))) - ,(if key `(local-set-key ,(concat "\C-c" key) ',func)) - ,(if key `(global-set-key (vconcat gud-key-prefix ,key) ',func)))) + ,(if key `(local-set-key ,(concat "\C-c" key) #',func)) + ,(if key `(global-set-key (vconcat gud-key-prefix ,key) #',func)))) ;; Where gud-display-frame should put the debugging arrow; a cons of ;; (filename . line-number). This is set by the marker-filter, which scans @@ -447,12 +499,12 @@ The value t means that there is no stack, and we are in display-file mode.") "Install those variables used by speedbar to enhance gud/gdb." (unless gud-speedbar-key-map (setq gud-speedbar-key-map (speedbar-make-specialized-keymap)) - (define-key gud-speedbar-key-map "j" 'speedbar-edit-line) - (define-key gud-speedbar-key-map "e" 'speedbar-edit-line) - (define-key gud-speedbar-key-map "\C-m" 'speedbar-edit-line) - (define-key gud-speedbar-key-map " " 'speedbar-toggle-line-expansion) - (define-key gud-speedbar-key-map "D" 'gdb-var-delete) - (define-key gud-speedbar-key-map "p" 'gud-pp)) + (define-key gud-speedbar-key-map "j" #'speedbar-edit-line) + (define-key gud-speedbar-key-map "e" #'speedbar-edit-line) + (define-key gud-speedbar-key-map "\C-m" #'speedbar-edit-line) + (define-key gud-speedbar-key-map " " #'speedbar-toggle-line-expansion) + (define-key gud-speedbar-key-map "D" #'gdb-var-delete) + (define-key gud-speedbar-key-map "p" #'gud-pp)) (speedbar-add-expansion-list '("GUD" gud-speedbar-menu-items gud-speedbar-key-map @@ -622,8 +674,7 @@ required by the caller." (defcustom gud-gud-gdb-command-name "gdb --fullname" "Default command to run an executable under GDB in text command mode. The option \"--fullname\" must be included in this value." - :type 'string - :group 'gud) + :type 'string) (defvar gud-gdb-marker-regexp ;; This used to use path-separator instead of ":"; @@ -785,11 +836,13 @@ the buffer in which this command was invoked." (gud-def gud-until "until %l" "\C-u" "Continue to current line.") (gud-def gud-run "run" nil "Run the program.") + (gud-set-repeat-map-property 'gud-gdb-repeat-map) + (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point nil 'local) - (setq-local gud-gdb-completion-function 'gud-gdb-completions) + (setq-local gud-gdb-completion-function #'gud-gdb-completions) - (local-set-key "\C-i" 'completion-at-point) + (local-set-key "\C-i" #'completion-at-point) (setq comint-prompt-regexp "^(.*gdb[+]?) *") (setq paragraph-start comint-prompt-regexp) (setq gdb-first-prompt t) @@ -984,6 +1037,18 @@ SKIP is the number of chars to skip on each line, it defaults to 0." (defvar gud-sdb-lastfile nil) +(defvar gud-sdb-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("i" . gud-stepi) + ("c" . gud-cont) + ("l" . gud-refresh))) + (define-key map key cmd)) + map) + "Keymap to repeat `sdb' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + (defun gud-sdb-marker-filter (string) (setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) string)) @@ -1054,6 +1119,8 @@ and source-file directory for your debugger." (gud-def gud-cont "c" "\C-r" "Continue with display.") (gud-def gud-print "%e/" "\C-p" "Evaluate C expression at point.") + (gud-set-repeat-map-property 'gud-sdb-repeat-map) + (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") (setq paragraph-start comint-prompt-regexp) (run-hooks 'sdb-mode-hook) @@ -1074,8 +1141,7 @@ The file names should be absolute, or relative to the directory containing the executable being debugged." :type '(choice (const :tag "Current Directory" nil) (repeat :value ("") - directory)) - :group 'gud) + directory))) (defun gud-dbx-massage-args (_file args) (nconc (let ((directories gud-dbx-directories) @@ -1213,6 +1279,23 @@ whereby $stopformat=1 produces an output format compatible with ;; whereby `set $stopformat=1' reportedly produces output compatible ;; with `gud-dbx-marker-filter', which we prefer. +(defvar gud-dbx-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("i" . gud-stepi) + ("c" . gud-cont) + ("l" . gud-refresh) + ("<" . gud-up) + (">" . gud-down))) + (define-key map key cmd)) + (when (or gud-mips-p + gud-irix-p) + (define-key map "f" 'gud-finish)) + map) + "Keymap to repeat `dbx' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + ;; The process filter is also somewhat ;; unreliable, sometimes not spotting the markers; I don't know ;; whether there's anything that can be done about that.] @@ -1360,6 +1443,8 @@ and source-file directory for your debugger." (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") (gud-def gud-run "run" nil "Run the program.") + (gud-set-repeat-map-property 'gud-dbx-repeat-map) + (setq comint-prompt-regexp "^[^)\n]*dbx) *") (setq paragraph-start comint-prompt-regexp) (run-hooks 'dbx-mode-hook) @@ -1371,6 +1456,21 @@ and source-file directory for your debugger." ;; History of argument lists passed to xdb. (defvar gud-xdb-history nil) +(defvar gud-xdb-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("i" . gud-stepi) + ("c" . gud-cont) + ("l" . gud-refresh) + ("f" . gud-finish) + ("<" . gud-up) + (">" . gud-down))) + (define-key map key cmd)) + map) + "Keymap to repeat `xdb' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + (defcustom gud-xdb-directories nil "A list of directories that xdb should search for source code. If nil, only source files in the program directory @@ -1380,8 +1480,7 @@ The file names should be absolute, or relative to the directory containing the executable being debugged." :type '(choice (const :tag "Current Directory" nil) (repeat :value ("") - directory)) - :group 'gud) + directory))) (defun gud-xdb-massage-args (_file args) (nconc (let ((directories gud-xdb-directories) @@ -1437,6 +1536,8 @@ directories if your program contains sources from more than one directory." (gud-def gud-finish "bu\\t" "\C-f" "Finish executing current function.") (gud-def gud-print "p %e" "\C-p" "Evaluate C expression at point.") + (gud-set-repeat-map-property 'gud-xdb-repeat-map) + (setq comint-prompt-regexp "^>") (setq paragraph-start comint-prompt-regexp) (run-hooks 'xdb-mode-hook)) @@ -1447,6 +1548,17 @@ directories if your program contains sources from more than one directory." ;; History of argument lists passed to perldb. (defvar gud-perldb-history nil) +(defvar gud-perldb-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("c" . gud-cont) + ("l" . gud-refresh))) + (define-key map key cmd)) + map) + "Keymap to repeat `perldb' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + (defun gud-perldb-massage-args (_file args) "Convert a command line as would be typed normally to run perldb into one that invokes an Emacs-enabled debugging session. @@ -1563,8 +1675,7 @@ into one that invokes an Emacs-enabled debugging session. (defcustom gud-perldb-command-name "perl -d" "Default command to execute a Perl script under debugger." - :type 'string - :group 'gud) + :type 'string) ;;;###autoload (defun perldb (command-line) @@ -1590,6 +1701,7 @@ and source-file directory for your debugger." (gud-def gud-print "p %e" "\C-p" "Evaluate perl expression at point.") (gud-def gud-until "c %l" "\C-u" "Continue to current line.") + (gud-set-repeat-map-property 'gud-perldb-repeat-map) (setq comint-prompt-regexp "^ DB<+[0-9]+>+ ") (setq paragraph-start comint-prompt-regexp) @@ -1618,6 +1730,20 @@ and source-file directory for your debugger." (defvar gud-pdb-marker-regexp-start "^> ") +(defvar gud-pdb-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("c" . gud-cont) + ("l" . gud-refresh) + ("f" . gud-finish) + ("<" . gud-up) + (">" . gud-down))) + (define-key map key cmd)) + map) + "Keymap to repeat `pdb' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + ;; There's no guarantee that Emacs will hand the filter the entire ;; marker at once; it could be broken up across several strings. We ;; might even receive a big chunk with several markers in it. If we @@ -1677,8 +1803,7 @@ and source-file directory for your debugger." (if (executable-find "pdb") "pdb" "python -m pdb") "Command that executes the Python debugger." :version "27.1" - :type 'string - :group 'gud) + :type 'string) ;;;###autoload (defun pdb (command-line) @@ -1708,6 +1833,8 @@ directory and source-file directory for your debugger." (gud-def gud-print "p %e" "\C-p" "Evaluate Python expression at point.") (gud-def gud-statement "!%e" "\C-e" "Execute Python statement at point.") + (gud-set-repeat-map-property 'gud-pdb-repeat-map) + ;; (setq comint-prompt-regexp "^(.*pdb[+]?) *") (setq comint-prompt-regexp "^(Pdb) *") (setq paragraph-start comint-prompt-regexp) @@ -1721,6 +1848,19 @@ directory and source-file directory for your debugger." (defvar gud-guiler-lastfile nil) +(defvar gud-guiler-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("l" . gud-refresh) + ("f" . gud-finish) + ("<" . gud-up) + (">" . gud-down))) + (define-key map key cmd)) + map) + "Keymap to repeat `guiler' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + (defun gud-guiler-marker-filter (string) (setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) string)) @@ -1759,8 +1899,7 @@ directory and source-file directory for your debugger." "File name for executing the Guile debugger. This should be an executable on your path, or an absolute file name." :version "25.1" - :type 'string - :group 'gud) + :type 'string) ;;;###autoload (defun guiler (command-line) @@ -1787,6 +1926,8 @@ and source-file directory for your debugger." (gud-def gud-down ",down" ">" "Down one stack frame.") (gud-def gud-print "%e" "\C-p" "Evaluate Guile expression at point.") + (gud-set-repeat-map-property 'gud-guiler-repeat-map) + (setq comint-prompt-regexp "^scheme@([^>]+> ") (setq paragraph-start comint-prompt-regexp) (run-hooks 'guiler-mode-hook)) @@ -1883,8 +2024,7 @@ and source-file directory for your debugger." (defcustom gud-jdb-command-name "jdb" "Command that executes the Java debugger." - :type 'string - :group 'gud) + :type 'string) (defcustom gud-jdb-use-classpath t "If non-nil, search for Java source files in classpath directories. @@ -1899,8 +2039,7 @@ and parsing all Java files for class information. Set to nil to use `gud-jdb-directories' to scan java sources for class information on jdb startup (original method)." - :type 'boolean - :group 'gud) + :type 'boolean) (defvar gud-jdb-classpath nil "Java/jdb classpath directories list. @@ -2175,9 +2314,9 @@ extension EXTN. Normally EXTN is given as the regular expression (setq gud-jdb-analysis-buffer (get-buffer-create " *gud-jdb-scratch*")) (prog1 (apply - 'nconc + #'nconc (mapcar - 'gud-jdb-build-class-source-alist-for-file + #'gud-jdb-build-class-source-alist-for-file sources)) (kill-buffer gud-jdb-analysis-buffer) (setq gud-jdb-analysis-buffer nil))) @@ -2234,6 +2373,21 @@ extension EXTN. Normally EXTN is given as the regular expression ;; Note: Reset to this value every time a prompt is seen (defvar gud-jdb-lowest-stack-level 999) +(defvar gud-jdb-repeat-map + (let ((map (make-sparse-keymap))) + (pcase-dolist (`(,key . ,cmd) '(("n" . gud-next) + ("s" . gud-step) + ("i" . gud-stepi) + ("c" . gud-cont) + ("f" . gud-finish) + ("<" . gud-up) + (">" . gud-down) + ("l" . gud-refresh))) + (define-key map key cmd)) + map) + "Keymap to repeat `jdb' stepping instructions `C-x C-a C-n n n'. +Used in `repeat-mode'.") + (defun gud-jdb-find-source-using-classpath (p) "Find source file corresponding to fully qualified class P. Convert P from jdb's output, converted to a pathname @@ -2244,13 +2398,14 @@ relative to a classpath directory." ;; name relative to classpath (filename (concat - (mapconcat 'identity + (mapconcat #'identity (split-string ;; Eliminate any subclass references in the class ;; name string. These start with a "$" (if (string-match "\\$.*" p) (replace-match "" t t p) p) - "\\.") "/") + "\\.") + "/") ".java")) (cplist (append gud-jdb-sourcepath gud-jdb-classpath)) found-file) @@ -2272,7 +2427,7 @@ during jdb initialization depending on the value of "Parse the classpath list and convert each item to an absolute pathname." (mapcar (lambda (s) (if (string-match "[/\\]$" s) (replace-match "" nil nil s) s)) - (mapcar 'file-truename + (mapcar #'file-truename (split-string string (concat "[ \t\n\r,\"" path-separator "]+"))))) @@ -2441,6 +2596,8 @@ gud, see `gud-mode'." (gud-def gud-print "print %e" "\C-p" "Print value of expression at point.") (gud-def gud-pstar "dump %e" nil "Print all object information at point.") + (gud-set-repeat-map-property 'gud-jdb-repeat-map) + (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ") (setq paragraph-start comint-prompt-regexp) (run-hooks 'jdb-mode-hook) @@ -2451,7 +2608,7 @@ gud, see `gud-mode'." (if (string-match "-attach" command-line) (gud-call "classpath")) (fset 'gud-jdb-find-source - 'gud-jdb-find-source-using-classpath)) + #'gud-jdb-find-source-using-classpath)) ;; Else create and bind the class/source association list as well ;; as the source file list. @@ -2459,8 +2616,8 @@ gud, see `gud-mode'." (gud-jdb-build-class-source-alist (setq gud-jdb-source-files (gud-jdb-build-source-files-list gud-jdb-directories - "\\.java$")))) - (fset 'gud-jdb-find-source 'gud-jdb-find-source-file))) + "\\.java\\'")))) + (fset 'gud-jdb-find-source #'gud-jdb-find-source-file))) ;; ;; End of debugger-specific information @@ -2571,7 +2728,7 @@ Commands: \\{gud-mode-map}" (setq mode-line-process '(":%s")) - (define-key (current-local-map) "\C-c\C-l" 'gud-refresh) + (define-key (current-local-map) "\C-c\C-l" #'gud-refresh) (setq-local gud-last-frame nil) (if (boundp 'tool-bar-map) ; not --without-x (setq-local tool-bar-map gud-tool-bar-map)) @@ -2580,11 +2737,10 @@ Commands: (setq-local comint-input-ignoredups t) (make-local-variable 'paragraph-start) (setq-local gud-delete-prompt-marker (make-marker)) - (add-hook 'kill-buffer-hook 'gud-kill-buffer-hook nil t)) + (add-hook 'kill-buffer-hook #'gud-kill-buffer-hook nil t)) (defcustom gud-chdir-before-run t "Non-nil if GUD should `cd' to the debugged executable." - :group 'gud :type 'boolean) ;; Perform initializations common to all debuggers. @@ -2648,7 +2804,7 @@ Commands: (setq w (cdr w))) ;; Tramp has already been loaded if we are here. (if w (setcar w (setq file (file-local-name file))))) - (apply 'make-comint (concat "gud" filepart) program nil + (apply #'make-comint (concat "gud" filepart) program nil (if massage-args (funcall massage-args file args) args)) ;; Since comint clobbered the mode, we don't set it until now. (gud-mode) @@ -2658,8 +2814,8 @@ Commands: (if find-file (setq-local gud-find-file find-file)) (setq gud-last-last-frame nil) - (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter) - (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel) + (set-process-filter (get-buffer-process (current-buffer)) #'gud-filter) + (set-process-sentinel (get-buffer-process (current-buffer)) #'gud-sentinel) (gud-set-buffer)) (defun gud-set-buffer () @@ -2994,7 +3150,7 @@ Obeying it means displaying in another window the specified file and line." (buffer-substring (region-beginning) (region-end)) (apply gud-find-expr-function args)))) (save-match-data - (if (string-match "\n" expr) + (if (string-search "\n" expr) (error "Expression must not include a newline")) (with-current-buffer gud-comint-buffer (save-excursion @@ -3180,10 +3336,11 @@ class of the file (using s to separate nested class ids)." (while (and cplist (not class-found)) (if (string-match (car cplist) f) (setq class-found - (mapconcat 'identity + (mapconcat #'identity (split-string (substring f (+ (match-end 0) 1)) - "/") "."))) + "/") + "."))) (setq cplist (cdr cplist))) ;; if f is visited by a java(cc-mode) buffer, walk up the ;; syntactic information chain and collect any 'inclass @@ -3222,7 +3379,7 @@ class of the file (using s to separate nested class ids)." )) (string-match (concat (car nclass) "$") class-found) (setq class-found - (replace-match (mapconcat 'identity nclass "$") + (replace-match (mapconcat #'identity nclass "$") t t class-found))))) (if (not class-found) (message "gud-find-class: class for file %s not found!" f)) @@ -3356,7 +3513,7 @@ Treats actions as defuns." (setq-local outline-regexp "[ \t]") (setq-local imenu-generic-expression '((nil "^define[ \t]+\\(\\w+\\)" 1))) - (setq-local indent-line-function 'gdb-script-indent-line) + (setq-local indent-line-function #'gdb-script-indent-line) (setq-local beginning-of-defun-function #'gdb-script-beginning-of-defun) (setq-local end-of-defun-function @@ -3387,14 +3544,14 @@ Treats actions as defuns." (require 'tooltip) (if gud-tooltip-mode (progn - (add-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode) - (add-hook 'pre-command-hook 'tooltip-hide) - (add-hook 'tooltip-functions 'gud-tooltip-tips) - (define-key global-map [mouse-movement] 'gud-tooltip-mouse-motion)) - (unless tooltip-mode (remove-hook 'pre-command-hook 'tooltip-hide) - (remove-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode) - (remove-hook 'tooltip-functions 'gud-tooltip-tips) - (define-key global-map [mouse-movement] 'ignore))) + (add-hook 'change-major-mode-hook #'gud-tooltip-change-major-mode) + (add-hook 'pre-command-hook #'tooltip-hide) + (add-hook 'tooltip-functions #'gud-tooltip-tips) + (define-key global-map [mouse-movement] #'gud-tooltip-mouse-motion)) + (unless tooltip-mode (remove-hook 'pre-command-hook #'tooltip-hide) + (remove-hook 'change-major-mode-hook #'gud-tooltip-change-major-mode) + (remove-hook 'tooltip-functions #'gud-tooltip-tips) + (define-key global-map [mouse-movement] #'ignore))) (gud-tooltip-activate-mouse-motions-if-enabled) (if (and gud-comint-buffer (buffer-name gud-comint-buffer); gud-comint-buffer might be killed @@ -3411,15 +3568,14 @@ Treats actions as defuns." (make-local-variable 'gdb-define-alist) (gdb-create-define-alist) (add-hook 'after-save-hook - 'gdb-create-define-alist nil t)))))) + #'gdb-create-define-alist nil t)))))) (kill-local-variable 'gdb-define-alist) - (remove-hook 'after-save-hook 'gdb-create-define-alist t)))) + (remove-hook 'after-save-hook #'gdb-create-define-alist t)))) (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode python-mode) "List of modes for which to enable GUD tooltips." :type '(repeat (symbol :tag "Major mode")) - :group 'gud :group 'tooltip) (defcustom gud-tooltip-display @@ -3431,13 +3587,11 @@ Forms in the list are combined with AND. The default is to display only tooltips in the buffer containing the overlay arrow." :type 'sexp :risky t - :group 'gud :group 'tooltip) (defcustom gud-tooltip-echo-area nil "Use the echo area instead of frames for GUD tooltips." :type 'boolean - :group 'gud :group 'tooltip) (make-obsolete-variable 'gud-tooltip-echo-area @@ -3447,12 +3601,12 @@ only tooltips in the buffer containing the overlay arrow." (defun gud-tooltip-change-major-mode () "Function added to `change-major-mode-hook' when tooltip mode is on." - (add-hook 'post-command-hook 'gud-tooltip-activate-mouse-motions-if-enabled)) + (add-hook 'post-command-hook #'gud-tooltip-activate-mouse-motions-if-enabled)) (defun gud-tooltip-activate-mouse-motions-if-enabled () "Reconsider for all buffers whether mouse motion events are desired." (remove-hook 'post-command-hook - 'gud-tooltip-activate-mouse-motions-if-enabled) + #'gud-tooltip-activate-mouse-motions-if-enabled) (dolist (buffer (buffer-list)) (with-current-buffer buffer (if (and gud-tooltip-mode @@ -3561,7 +3715,7 @@ This function must return nil if it doesn't handle EVENT." (posn-point (event-end event)) (or (and (eq gud-minor-mode 'gdbmi) (not gdb-active-process)) (progn (setq gud-tooltip-event event) - (eval (cons 'and gud-tooltip-display))))) + (eval (cons 'and gud-tooltip-display) t)))) (let ((expr (tooltip-expr-to-print event))) (when expr (if (and (eq gud-minor-mode 'gdbmi) @@ -3591,10 +3745,10 @@ so they have been disabled.")) (gdb-input (concat "server macro expand " expr "\n") - `(lambda () (gdb-tooltip-print-1 ,expr))) + (lambda () (gdb-tooltip-print-1 expr))) (gdb-input (concat cmd "\n") - `(lambda () (gdb-tooltip-print ,expr)))) + (lambda () (gdb-tooltip-print expr)))) (add-function :override (process-filter process) #'gud-tooltip-process-output) (gud-basic-call cmd)) |