From dbc044e5f772cdb55433cb7757975defeadba44e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 9 Dec 2020 08:30:09 +0100 Subject: [PATCH] Prefer setq-local in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb--check-interpreter, gdb) (gdb-init-buffer, gdb-get-buffer-create, gdb-threads-mode) (gdb-memory-mode, gdb-disassembly-mode, gdb-frames-mode): Prefer setq-local. --- lisp/progmodes/gdb-mi.el | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 903005610d7..4c248f771cd 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -744,7 +744,7 @@ NOARG must be t when this macro is used outside `gud-def'." ;; Use the old gud-gbd filter, not because it works, but because it ;; will properly display GDB's answers rather than hanging waiting for ;; answers that aren't coming. - (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter)) + (setq-local gud-marker-filter #'gud-gdb-marker-filter)) (funcall filter proc string))) (defvar gdb-control-level 0) @@ -831,8 +831,8 @@ detailed description of this mode. (let ((proc (get-buffer-process gud-comint-buffer))) (add-function :around (process-filter proc) #'gdb--check-interpreter)) - (set (make-local-variable 'gud-minor-mode) 'gdbmi) - (set (make-local-variable 'gdb-control-level) 0) + (setq-local gud-minor-mode 'gdbmi) + (setq-local gdb-control-level 0) (setq comint-input-sender 'gdb-send) (when (ring-empty-p comint-input-ring) ; cf shell-mode (let ((hfile (expand-file-name (or (getenv "GDBHISTFILE") @@ -861,9 +861,9 @@ detailed description of this mode. (and (stringp hsize) (integerp (setq hsize (string-to-number hsize))) (> hsize 0) - (set (make-local-variable 'comint-input-ring-size) hsize)) + (setq-local comint-input-ring-size hsize)) (if (stringp hfile) - (set (make-local-variable 'comint-input-ring-file-name) hfile)) + (setq-local comint-input-ring-file-name hfile)) (comint-read-input-ring t))) (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set temporary breakpoint at current line.") @@ -966,8 +966,7 @@ detailed description of this mode. (define-key gud-minor-mode-map [left-margin C-mouse-3] 'gdb-mouse-jump) - (set (make-local-variable 'gud-gdb-completion-function) - 'gud-gdbmi-completions) + (setq-local gud-gdb-completion-function 'gud-gdbmi-completions) (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point nil 'local) @@ -1141,8 +1140,8 @@ no input, and GDB is waiting for input." (lambda () (gdb-tooltip-print expr))))))) (defun gdb-init-buffer () - (set (make-local-variable 'gud-minor-mode) 'gdbmi) - (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) + (setq-local gud-minor-mode 'gdbmi) + (setq-local tool-bar-map gud-tool-bar-map) (when gud-tooltip-mode (make-local-variable 'gdb-define-alist) (gdb-create-define-alist) @@ -1558,10 +1557,10 @@ this trigger is subscribed to `gdb-buf-publisher' and called with (when mode (funcall mode)) (setq gdb-buffer-type buffer-type) (when thread - (set (make-local-variable 'gdb-thread-number) thread)) - (set (make-local-variable 'gud-minor-mode) - (buffer-local-value 'gud-minor-mode gud-comint-buffer)) - (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) + (setq-local gdb-thread-number thread)) + (setq-local gud-minor-mode + (buffer-local-value 'gud-minor-mode gud-comint-buffer)) + (setq-local tool-bar-map gud-tool-bar-map) (rename-buffer (funcall (gdb-rules-name-maker rules))) (when trigger (gdb-add-subscriber gdb-buf-publisher @@ -3364,8 +3363,7 @@ corresponding to the mode line clicked." (setq gdb-thread-position (make-marker)) (add-to-list 'overlay-arrow-variable-list 'gdb-thread-position) (setq header-line-format gdb-threads-header) - (set (make-local-variable 'font-lock-defaults) - '(gdb-threads-font-lock-keywords)) + (setq-local font-lock-defaults '(gdb-threads-font-lock-keywords)) 'gdb-invalidate-threads) (defun gdb-thread-list-handler-custom () @@ -3920,8 +3918,7 @@ DOC is an optional documentation string." (define-derived-mode gdb-memory-mode gdb-parent-mode "Memory" "Major mode for examining memory." (setq header-line-format gdb-memory-header) - (set (make-local-variable 'font-lock-defaults) - '(gdb-memory-font-lock-keywords)) + (setq-local font-lock-defaults '(gdb-memory-font-lock-keywords)) 'gdb-invalidate-memory) (defun gdb-memory-buffer-name () @@ -4013,9 +4010,8 @@ DOC is an optional documentation string." ;; TODO Rename overlay variable for disassembly mode (add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position) (setq fringes-outside-margins t) - (set (make-local-variable 'gdb-disassembly-position) (make-marker)) - (set (make-local-variable 'font-lock-defaults) - '(gdb-disassembly-font-lock-keywords)) + (setq-local gdb-disassembly-position (make-marker)) + (setq-local font-lock-defaults '(gdb-disassembly-font-lock-keywords)) 'gdb-invalidate-disassembly) (defun gdb-disassembly-handler-custom () @@ -4222,8 +4218,7 @@ member." (setq gdb-stack-position (make-marker)) (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) (setq truncate-lines t) ;; Make it easier to see overlay arrow. - (set (make-local-variable 'font-lock-defaults) - '(gdb-frames-font-lock-keywords)) + (setq-local font-lock-defaults '(gdb-frames-font-lock-keywords)) 'gdb-invalidate-frames) (defun gdb-select-frame (&optional event) -- 2.39.2