branch: externals/matlab-mode
commit 67470ee62ac03add881d62c411552262cbbec364
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
Lisp cleanups from Stefan Monnier
This commit modernizes several lisp constructs. No behavior changes.
---
.gitignore | 4 ++
company-matlab-shell.el | 2 +-
matlab-cgen.el | 35 +++++----
matlab-complete.el | 4 +-
matlab-netshell.el | 2 +-
matlab-scan.el | 6 +-
matlab-sections.el | 15 ++--
matlab-shell-gud.el | 145 ++++++++++++++++++-------------------
matlab-shell.el | 17 ++---
matlab-topic.el | 15 ++--
matlab.el | 188 +++++++++++++++++-------------------------------
mlgud.el | 61 +++++++++-------
mlint.el | 39 +++++-----
semantic-matlab.el | 4 +-
semanticdb-matlab.el | 2 +-
tlc.el | 14 ++--
16 files changed, 252 insertions(+), 301 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1952b9a850..097a6204f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,7 @@
# matlab-autoload.el (matlab-load.el was the old name) is generated
matlab-autoload.el
matlab-load.el
+
+# ELPA-generated files.
+/matlab-mode-autoloads.el
+/matlab-mode-pkg.el
diff --git a/company-matlab-shell.el b/company-matlab-shell.el
index 366dd9b626..9f44754187 100644
--- a/company-matlab-shell.el
+++ b/company-matlab-shell.el
@@ -26,7 +26,7 @@
(require 'company)
(error nil))
-(require 'cl-macs)
+(eval-when-compile (require 'cl-lib))
(require 'matlab)
(require 'matlab-shell)
diff --git a/matlab-cgen.el b/matlab-cgen.el
index c6c15963c8..29e1671907 100644
--- a/matlab-cgen.el
+++ b/matlab-cgen.el
@@ -30,29 +30,36 @@
(defvar matlab-tempo-tags nil
"List of templates used in MATLAB mode.")
+;; These functions are generated by tempo, so declare them to prevent compiler
warnings.
+(declare-function tempo-template-matlab-if "matlab-cgen.el")
+(declare-function tempo-template-matlab-if-else "matlab-cgen.el")
+(declare-function tempo-template-matlab-for "matlab-cgen.el")
+(declare-function tempo-template-matlab-switch "matlab-cgen.el")
+(declare-function tempo-template-matlab-try "matlab-cgen.el")
+(declare-function tempo-template-matlab-while "matlab-cgen.el")
+(declare-function tempo-template-matlab-function "matlab-cgen.el")
+
;; This trick allows this file to be autoloaded ONLY when the user uses the
insert prefix.
;;
;;;###autoload (autoload 'matlab-insert-map-fcn "matlab-cgen" "Keymap for C-c
C-c in matlab-ts-mode or matlab-mode" t 'keymap)
(defvar matlab-insert-map
(let ((km (make-sparse-keymap)))
- (define-key km "c" 'matlab-insert-next-case)
- (define-key km "e" 'matlab-insert-end-block)
- (define-key km "i" 'tempo-template-matlab-if)
- (define-key km "I" 'tempo-template-matlab-if-else)
- (define-key km "f" 'tempo-template-matlab-for)
- (define-key km "s" 'tempo-template-matlab-switch)
- (define-key km "t" 'tempo-template-matlab-try)
- (define-key km "w" 'tempo-template-matlab-while)
- (define-key km "F" 'tempo-template-matlab-function)
- (define-key km "'" 'matlab-stringify-region)
+ (define-key km "c" #'matlab-insert-next-case)
+ (define-key km "e" #'matlab-insert-end-block)
+ (define-key km "i" #'tempo-template-matlab-if)
+ (define-key km "I" #'tempo-template-matlab-if-else)
+ (define-key km "f" #'tempo-template-matlab-for)
+ (define-key km "s" #'tempo-template-matlab-switch)
+ (define-key km "t" #'tempo-template-matlab-try)
+ (define-key km "w" #'tempo-template-matlab-while)
+ (define-key km "F" #'tempo-template-matlab-function)
+ (define-key km "'" #'matlab-stringify-region)
km)
"Keymap used for inserting simple texts based on context.")
-(defvar matlab-insert-map-fcn nil
- "Keymap for `matlab-insert-map' (C-c C-c) in `matlab-mode'.")
-
-(fset 'matlab-insert-map-fcn (setq matlab-insert-map-fcn matlab-insert-map))
+;; FIXME: Rename to `matlab-insert-map'?
+(defalias 'matlab-insert-map-fcn matlab-insert-map)
(add-hook 'matlab-mode-hook #'matlab-cgen-hook-fcn t)
diff --git a/matlab-complete.el b/matlab-complete.el
index b3615413e7..ca128bfcb0 100644
--- a/matlab-complete.el
+++ b/matlab-complete.el
@@ -39,7 +39,7 @@
(defun matlab-uniquify-list (lst)
"Return a list that is a subset of LST where all elements are unique."
(if (fboundp 'cl-remove-duplicates)
- (cl-remove-duplicates lst :test 'string= :from-end t)
+ (cl-remove-duplicates lst :test #'string= :from-end t)
;; Else, do it by hand.
(let ((nlst nil))
(while lst
@@ -545,7 +545,7 @@ to change it temporarily."
(insert matlab-last-prefix)
(message "No completions."))))
((eq matlab-completion-technique 'complete)
- (let ((allsyms (apply 'append
+ (let ((allsyms (apply #'append
(mapcar (lambda (f) (funcall f prefix))
matlab-completion-search-state))))
(cond ((null allsyms)
diff --git a/matlab-netshell.el b/matlab-netshell.el
index 8dedd3bb39..c39f7a9127 100644
--- a/matlab-netshell.el
+++ b/matlab-netshell.el
@@ -146,7 +146,7 @@ response from some Emacs based request."
((string= "eval" cmd)
;; (message "MATLAB Evaluating remote request")
(let ((forms (read data)))
- (eval forms)))
+ (eval forms t)))
(t
(message "Unknown command from matlab: %S" cmd)
)))
diff --git a/matlab-scan.el b/matlab-scan.el
index 2431fc6fd3..3eaf98b933 100644
--- a/matlab-scan.el
+++ b/matlab-scan.el
@@ -163,7 +163,7 @@ return the cache if it finds it."
(matlab-scan-cache-put ctxt))
ctxt))
((= level 2)
- (apply 'matlab-compute-line-context-lvl-2 context))
+ (apply #'matlab-compute-line-context-lvl-2 context))
(t
nil)))
)
@@ -1375,13 +1375,13 @@ Options: START END LENGTH."
(defun matlab-scan-setup ()
"Setup use of the indent cache for the current buffer."
(interactive)
- (add-hook 'before-change-functions 'matlab-scan-before-change-fcn t)
+ (add-hook 'before-change-functions #'matlab-scan-before-change-fcn t)
(setq matlab-scan-temporal-cache nil))
(defun matlab-scan-disable ()
"Setup use of the indent cache for the current buffer."
(interactive)
- (remove-hook 'before-change-functions 'matlab-scan-before-change-fcn t)
+ (remove-hook 'before-change-functions #'matlab-scan-before-change-fcn t)
(setq matlab-scan-temporal-cache nil))
diff --git a/matlab-sections.el b/matlab-sections.el
index 24a08b1d71..25af610106 100644
--- a/matlab-sections.el
+++ b/matlab-sections.el
@@ -51,8 +51,7 @@
:overline t
:height 1.25))
"Face for \"%% code section\" headings in `matlab-sections-minor-mode'.
-This is the face used when demarcating code sections in MATLAB script files."
- :group 'matlab-sections)
+This is the face used when demarcating code sections in MATLAB script files.")
(defface matlab-sections-highlight-face
'((t :weight extra-bold))
@@ -62,7 +61,6 @@ This is the face used when demarcating code sections in
MATLAB script files."
(defcustom matlab-sections-highlight-section t
"Non-nil tells matlab-sections-minor-mode to highlight the current section."
:type 'boolean
- :group 'matlab-sections
:safe 'booleanp)
(defcustom matlab-sections-use-super-key nil
@@ -72,7 +70,6 @@ on all systems and optionally a set of keybindings using the
super
\"Windows\" logo key. The super key may not be available or work, hence
the reason for it being optional."
:type 'boolean
- :group 'matlab-sections
:safe 'booleanp)
(defcustom matlab-sections-section-break-regexp
@@ -102,19 +99,16 @@ We do not want to match comment \"blocks\" like:
Therefore, we require that the section starts with \"%%\" optionally
followed by a description that doesn't end with \"%\"."
:type 'string
- :group 'matlab-sections
:safe 'stringp)
(defvar matlab-sections-minor-mode)
-(defvar matlab-sections-overlay nil
+(defvar-local matlab-sections-overlay nil
"Overlay used by matlab-sections mode to highlight the current section.")
-(make-variable-buffer-local 'matlab-sections-overlay)
(defcustom matlab-sections-highlight-face 'matlab-sections-highlight-face
"Face with which to highlight the current section in matlab-sections mode."
:type 'face
- :group 'matlab-sections
:set (lambda (symbol value)
(set symbol value)
(dolist (buffer (buffer-list))
@@ -127,8 +121,7 @@ followed by a description that doesn't end with \"%\"."
Otherwise matlab-sections mode will highlight only in the selected
window. Setting this variable takes effect the next time you use
the command `matlab-sections-minor-mode' to turn matlab-sections mode on."
- :type 'boolean
- :group 'matlab-sections)
+ :type 'boolean)
;; Function to obtain range of current code section
@@ -431,7 +424,7 @@ This is a noop if SKIP-NONINTERACTIVE is nil and
`noninteractive' is t."
"Move the matlab-sections overlay given as OVERLAY."
(if-let ((start-end (matlab-sections-range-function)))
(move-overlay overlay (car start-end) (cdr start-end))
- (move-overlay overlay 1 1)))
+ (move-overlay overlay (point-min) (point-min))))
(defun matlab-sections-setup-section-highlight ()
"Setup section highlighting."
diff --git a/matlab-shell-gud.el b/matlab-shell-gud.el
index e684c28da1..d6fe7dc797 100644
--- a/matlab-shell-gud.el
+++ b/matlab-shell-gud.el
@@ -129,10 +129,8 @@ Disable this option if the tooltips are too slow in your
setup."
(add-to-list 'mlgud-tooltip-modes 'matlab-ts-mode)
(add-to-list 'mlgud-tooltip-modes 'matlab-mode)
- (make-local-variable 'mlgud-marker-filter)
- (setq mlgud-marker-filter 'gud-matlab-marker-filter)
- (make-local-variable 'mlgud-find-file)
- (setq mlgud-find-file 'gud-matlab-find-file)
+ (setq-local mlgud-marker-filter #'gud-matlab-marker-filter)
+ (setq-local mlgud-find-file #'gud-matlab-find-file)
(global-matlab-shell-inactive-gud-minor-mode 1)
@@ -170,8 +168,7 @@ FILE is ignored, and ARGS is returned."
;; interprets it for formatting text, and for running the debugger.
-(defvar matlab-shell-gud--marker-acc "")
-(make-variable-buffer-local 'matlab-shell-gud--marker-acc)
+(defvar-local matlab-shell-gud--marker-acc "")
(defvar gud-matlab-marker-regexp-plain-prompt "^K?>>"
"Regular expression for finding a prompt.")
@@ -181,9 +178,8 @@ FILE is ignored, and ARGS is returned."
(defvar gud-matlab-marker-regexp->> "^>>"
"Regular expression for finding a file line-number.")
-(defvar gud-matlab-dbhotlink nil
+(defvar-local gud-matlab-dbhotlink nil
"Track if we've sent a dbhotlink request.")
-(make-variable-buffer-local 'gud-matlab-dbhotlink)
(defun gud-matlab-marker-filter (string)
"Filters STRING for the Unified Debugger based on MATLAB output."
@@ -248,7 +244,7 @@ FILE is ignored, and ARGS is returned."
(let ((forms (read expression)))
(when forms
;;(message "About to evaluate forms: \"%S\""
forms)
- (eval forms)))
+ (eval forms t)))
(error
(message "Failed to evaluate dbhotlink expression:
\"%s\"" expression)
(message "Error is: %S" ERR)
@@ -475,25 +471,23 @@ LONGESTNAME specifies the how long the longest name we
can expect is."
(defvar mlg-stack-mode-map
(let ((km (make-sparse-keymap)))
- (define-key km [return] 'mlg-stack-choose)
- (define-key km "q" 'mlg-stack-quit)
- (define-key km "n" 'mlg-stack-next)
- (define-key km "p" 'mlg-stack-prev)
- (define-key km [mouse-2] 'mlg-stack-click)
- (define-key km [mouse-1] 'mlg-stack-click)
+ (define-key km [return] #'mlg-stack-choose)
+ (define-key km "q" #'mlg-stack-quit)
+ (define-key km "n" #'mlg-stack-next)
+ (define-key km "p" #'mlg-stack-prev)
+ (define-key km [mouse-2] #'mlg-stack-click)
+ (define-key km [mouse-1] #'mlg-stack-click)
km)
"Keymap used in MATLAB stack mode.")
;; Need this to fix weird problem in define-derived-mode
+;; FIXME: What problem?
(defvar mlg-stack-mode-syntax-table (make-syntax-table)
- "Syntax table used in `matlab-shell-help-mode'.")
+ "Syntax table used in `matlab-shell-help-mode'.") ;;FIXME: shell-help-mode?
(define-derived-mode mlg-stack-mode
- fundamental-mode "MStack"
- "Major mode for viewing a MATLAB stack.
-
-Commands:
-\\{mlg-stack-mode-map}"
+ fundamental-mode "MStack" ;FIXME: special-mode?
+ "Major mode for viewing a MATLAB stack."
:syntax-table mlg-stack-mode-syntax-table
(setq buffer-read-only t)
)
@@ -611,8 +605,8 @@ LONGESTNAME specifies the how long the longest name we can
expect is."
))
;; The first time breakpoints are added, make sure we can activate
breakpoints
;; when new files are opened in a buffer.
- (add-hook 'matlab-ts-mode-hook 'mlg-breakpoint-activate-buffer-opened-hook)
- (add-hook 'matlab-mode-hook 'mlg-breakpoint-activate-buffer-opened-hook)
+ (add-hook 'matlab-ts-mode-hook #'mlg-breakpoint-activate-buffer-opened-hook)
+ (add-hook 'matlab-mode-hook #'mlg-breakpoint-activate-buffer-opened-hook)
)
(defun mlg-del-breakpoint (file fcn line)
@@ -745,12 +739,15 @@ FCN is ignored."
(defvar mlg-breakpoint-mode-map
(let ((km (make-sparse-keymap)))
- (define-key km [return] 'mlg-breakpoint-choose)
- (define-key km "q" 'mlg-breakpoint-quit)
- (define-key km "n" 'mlg-breakpoint-next)
- (define-key km "p" 'mlg-breakpoint-prev)
- (define-key km [mouse-2] 'mlg-breakpoint-click)
- (define-key km [mouse-1] 'mlg-breakpoint-click)
+ ;; Don't bind `return' but RET so it also works in TTYs and doesn't
+ ;; mistakenly override another binding on RET.
+ (define-key km (kbd "RET") #'mlg-breakpoint-choose)
+ (define-key km "q" #'mlg-breakpoint-quit)
+ (define-key km "n" #'mlg-breakpoint-next)
+ (define-key km "p" #'mlg-breakpoint-prev)
+ (define-key km [mouse-2] #'mlg-breakpoint-click)
+ ;; FIXME: Use `mouse-1-click-follows-link'.
+ (define-key km [mouse-1] #'mlg-breakpoint-click)
km)
"Keymap used in MATLAB breakpoint mode.")
@@ -759,11 +756,8 @@ FCN is ignored."
"Syntax table used in `matlab-shell-help-mode'.")
(define-derived-mode mlg-breakpoint-mode
- fundamental-mode "MBreakpoints"
- "Major mode for viewing a MATLAB breakpoints.
-
-Commands:
-\\{mlg-breakpoint-mode-map}"
+ fundamental-mode "MBreakpoints" ;FIXME: special-mode?
+ "Major mode for viewing a MATLAB breakpoints."
:syntax-table mlg-breakpoint-mode-syntax-table
(setq buffer-read-only t)
)
@@ -857,30 +851,41 @@ Call debug activate/deactivate features."
;; When K prompt is active, this minor mode is applied to frame buffers so
;; that GUD commands are easy to get to.
+(declare-function mlgud-break "mlgud")
+(declare-function mlgud-remove "mlgud")
+(declare-function mlgud-cont "mlgud")
+(declare-function mlgud-next "mlgud")
+(declare-function mlgud-step "mlgud")
+(declare-function mlgud-finish "mlgud")
+(declare-function mlgud-up "mlgud")
+(declare-function mlgud-down "mlgud")
+(declare-function mlgud-list-breakpoints "mlgud")
+
(defvar matlab-shell-gud-minor-mode-map
(let ((km (make-sparse-keymap))
- (key ?\ ))
+ (key ?\s))
(while (<= key ?~)
- (define-key km (string key) 'matlab-shell-gud-mode-help-notice)
+ (define-key km (string key) #'matlab-shell-gud-mode-help-notice)
(setq key (1+ key)))
- (define-key km "h" 'matlab-shell-gud-mode-help)
+ (define-key km "h" #'matlab-shell-gud-mode-help)
;; mlgud bindings.
- (define-key km "b" 'mlgud-break)
- (define-key km "x" 'mlgud-remove)
- (define-key km "c" 'mlgud-cont)
- (define-key km " " 'mlgud-step)
- (define-key km "s" 'mlgud-step)
- (define-key km "n" 'mlgud-next)
- (define-key km "f" 'mlgud-finish)
- (define-key km "q" 'mlgud-stop-subjob)
- (define-key km "<" 'mlgud-up)
- (define-key km ">" 'mlgud-down)
- (define-key km "w" 'mlg-show-stack)
- (define-key km "v" 'mlgud-list-breakpoints)
- (define-key km "e" 'matlab-shell-gud-show-symbol-value)
-
- (define-key km "\C-x\C-q" 'matlab-shell-gud-mode-edit) ; like
toggle-read-only
+ (define-key km "b" #'mlgud-break)
+ (define-key km "x" #'mlgud-remove)
+ (define-key km "c" #'mlgud-cont)
+ (define-key km " " #'mlgud-step)
+ (define-key km "s" #'mlgud-step)
+ (define-key km "n" #'mlgud-next)
+ (define-key km "f" #'mlgud-finish)
+ (define-key km "q" #'mlgud-stop-subjob)
+ (define-key km "<" #'mlgud-up)
+ (define-key km ">" #'mlgud-down)
+ (define-key km "w" #'mlg-show-stack)
+ (define-key km "v" #'mlgud-list-breakpoints)
+ (define-key km "e" #'matlab-shell-gud-show-symbol-value)
+
+ ;; FIXME: Use `remap'?
+ (define-key km "\C-x\C-q" #'matlab-shell-gud-mode-edit) ; like
toggle-read-only
km)
"Keymap used by matlab mode maintainers.")
@@ -936,9 +941,7 @@ Debug commands are:
\\[matlab-shell-gud-show-symbol-value] - Evaluate expression
\\[mlg-show-stack] - Where am I (ebstack)
\\[mlgud-stop-subjob] - Quit (dbquit)"
- :init-value nil
:lighter " MGUD"
- :keymap matlab-shell-gud-minor-mode-map
;; Make the buffer read only
(if matlab-shell-gud-minor-mode
@@ -947,7 +950,7 @@ Debug commands are:
(when (buffer-file-name) (setq buffer-read-only t))
(when matlab-shell-debug-tooltips-p
(mlgud-tooltip-mode 1)
- (add-hook 'tooltip-functions 'gud-matlab-tooltip-tips)
+ (add-hook 'tooltip-functions #'gud-matlab-tooltip-tips nil 'local)
)
;; Replace mlgud's toolbar which keeps stomping
;; on our toolbar.
@@ -982,23 +985,23 @@ Debug commands are:
(defvar matlab-shell-inactive-gud-minor-mode-map
(let ((km (make-sparse-keymap)))
- (define-key km "\C-c\C-d\C-h" 'matlab-shell-inactive-gud-mode-help)
+ (define-key km "\C-c\C-d\C-h" #'matlab-shell-inactive-gud-mode-help)
;; mlgud bindings when debugger is inactive. When inactive, only bindings
such as mlgud-break
;; make sense. However, we also keep these bindings when the debugger is
active for consistency.
- (define-key km (kbd "C-c C-d b") 'mlgud-break)
- (define-key km (kbd "C-c C-d x") 'mlgud-remove)
- (define-key km (kbd "C-c C-d c") 'mlgud-cont)
- (define-key km (kbd "C-c C-d SPC") 'mlgud-step)
- (define-key km (kbd "C-c C-d s") 'mlgud-step)
- (define-key km (kbd "C-c C-d n") 'mlgud-next)
- (define-key km (kbd "C-c C-d f") 'mlgud-finish)
- (define-key km (kbd "C-c C-d q") 'mlgud-stop-subjob)
- (define-key km (kbd "C-c C-d <") 'mlgud-up)
- (define-key km (kbd "C-c C-d >") 'mlgud-down)
- (define-key km (kbd "C-c C-d w") 'mlg-show-stack)
- (define-key km (kbd "C-c C-d v") 'mlgud-list-breakpoints)
- (define-key km (kbd "C-c C-d e") 'matlab-shell-gud-show-symbol-value)
+ (define-key km (kbd "C-c C-d b") #'mlgud-break)
+ (define-key km (kbd "C-c C-d x") #'mlgud-remove)
+ (define-key km (kbd "C-c C-d c") #'mlgud-cont)
+ (define-key km (kbd "C-c C-d SPC") #'mlgud-step)
+ (define-key km (kbd "C-c C-d s") #'mlgud-step)
+ (define-key km (kbd "C-c C-d n") #'mlgud-next)
+ (define-key km (kbd "C-c C-d f") #'mlgud-finish)
+ (define-key km (kbd "C-c C-d q") #'mlgud-stop-subjob)
+ (define-key km (kbd "C-c C-d <") #'mlgud-up)
+ (define-key km (kbd "C-c C-d >") #'mlgud-down)
+ (define-key km (kbd "C-c C-d w") #'mlg-show-stack)
+ (define-key km (kbd "C-c C-d v") #'mlgud-list-breakpoints)
+ (define-key km (kbd "C-c C-d e") #'matlab-shell-gud-show-symbol-value)
km)
"Keymap used by matlab mode maintainers.")
@@ -1011,13 +1014,11 @@ Debug commands are:
\\[mlgud-break] - Add breakpoint (ebstop in FILE at point)
\\[mlgud-remove] - Remove breakpoint (ebclear in FILE at point)
\\[mlgud-list-breakpoints] - List breakpoints (ebstatus)"
- :init-value nil
:lighter " I-MGUD"
- :keymap matlab-shell-inactive-gud-minor-mode-map
;; Always disable tooltips, in case configured while in the mode.
(mlgud-tooltip-mode -1)
- (remove-hook 'tooltip-functions 'gud-matlab-tooltip-tips)
+ (remove-hook 'tooltip-functions #'gud-matlab-tooltip-tips)
(when (boundp 'tool-bar-map) ; not --without-x
(kill-local-variable 'tool-bar-map)))
diff --git a/matlab-shell.el b/matlab-shell.el
index 957ab61807..202885b5ec 100644
--- a/matlab-shell.el
+++ b/matlab-shell.el
@@ -191,9 +191,8 @@ In this case, comment and \n are not special, as word wrap
can get in the way.")
"Hooks run each time a prompt is seen and sent to display.
If multiple prompts are seen together, only call this once.")
-(defvar matlab-shell-prompt-hook-cookie nil
+(defvar-local matlab-shell-prompt-hook-cookie nil
"Cookie used to transfer info about detected prompts from inner filter to
outer.")
-(make-variable-buffer-local 'matlab-shell-prompt-hook-cookie)
(defvar matlab-shell-suppress-prompt-hooks nil
"Non-nil to suppress running prompt hooks.")
@@ -524,9 +523,8 @@ Try C-h f matlab-shell RET"))
(defvar matlab-shell-capturetext-end-text "</EMACSCAP>"
"Text used as simple signal for text that should be captured.")
-(defvar matlab-shell-accumulator ""
+(defvar-local matlab-shell-accumulator ""
"Accumulate text that is being captured.")
-(make-variable-buffer-local 'matlab-shell-accumulator)
(defvar matlab-shell-flush-accumulation-buffer nil
"When non-nil, flush the accumulation buffer.")
@@ -1546,9 +1544,8 @@ that doesn't exist."
(find-file file)))
(error "Command which('%s') returned empty" fcn))))
-(defvar matlab-shell-matlabroot-run nil
+(defvar-local matlab-shell-matlabroot-run nil
"Cache of MATLABROOT in this shell.")
-(make-variable-buffer-local 'matlab-shell-matlabroot-run)
(defun matlab-shell-matlabroot ()
"Get the location of this shell's root.
@@ -2085,23 +2082,21 @@ These will differ when MATLAB code directory without
notifying Emacs."
(switch-to-buffer-other-window msbn)
(message "There is not an active MATLAB process."))))
-(defvar matlab-shell-save-and-go-history '("()")
+(defvar-local matlab-shell-save-and-go-history '("()")
"Keep track of parameters passed to the MATLAB shell.")
-(defvar matlab-shell-save-and-go-command nil
+(defvar-local matlab-shell-save-and-go-command nil
"Command to use for `matlab-shell-save-and-go' instead of current buffer.
This command will override the default computed command if non-nil.
The command will be run in the shell's current directory without checks, so
you will need to make sure MATLAB's pwd is correct.
It is recommended you use directory-local or buffer-local variable settings to
control this.")
-(make-variable-buffer-local 'matlab-shell-save-and-go-command)
;; Marking as SAFE b/c we will ask to use this before doing so.
(put 'matlab-shell-save-and-go-command 'safe-local-variable #'stringp)
-(defvar matlab-shell-save-and-go-command-enabled nil
+(defvar-local matlab-shell-save-and-go-command-enabled nil
"Remember if it is safe to use `matlab-shell-save-and-go-command' in this
buffer.")
-(make-variable-buffer-local 'matlab-shell-save-and-go-command-enabled)
(put 'matlab-shell-save-and-go-command 'risky-local-variable t)
(defun matlab-shell-set-save-and-go-command (command)
diff --git a/matlab-topic.el b/matlab-topic.el
index 254a4ad072..b56258d99f 100644
--- a/matlab-topic.el
+++ b/matlab-topic.el
@@ -67,17 +67,18 @@
;; View-major-mode is an emacs20 thing. This gives us a small compatibility
;; layer.
(eval-and-compile
- (if (not (fboundp 'view-major-mode)) (defalias 'view-major-mode 'view-mode)))
+ (if (not (fboundp 'view-major-mode)) (defalias 'view-major-mode
#'view-mode)))
(defvar matlab-shell-help-mode-map
(let ((km (make-sparse-keymap)))
- (define-key km [return] 'matlab-shell-help-choose)
- (define-key km "q" 'bury-buffer)
+ (define-key km [return] #'matlab-shell-help-choose)
+ (define-key km "q" #'bury-buffer)
(define-key km [(control h) (control m)] matlab--shell-help-map)
- (if (string-match "XEmacs" emacs-version)
- (define-key km [button2] 'matlab-shell-help-click)
- (define-key km [mouse-2] 'matlab-shell-help-click)
- (define-key km [mouse-1] 'matlab-shell-help-click)
+ (if (featurep 'xemacs)
+ (define-key km [button2] #'matlab-shell-help-click)
+ (define-key km [mouse-2] #'matlab-shell-help-click)
+ ;; FIXME: Use `mouse-1-click-follows-link'.
+ (define-key km [mouse-1] #'matlab-shell-help-click)
)
(set-keymap-parent km view-mode-map)
km)
diff --git a/matlab.el b/matlab.el
index 3957927e53..913d608e34 100644
--- a/matlab.el
+++ b/matlab.el
@@ -63,6 +63,13 @@
(eval-when-compile
(require 'elec-pair))
+(declare-function matlab-shell-find-file-click "matlab-shell.el")
+(declare-function matlab-show-matlab-shell-buffer "matlab-shell.el")
+(declare-function matlab-shell-locate-fcn "matlab-shell.el")
+(declare-function matlab-shell-run-region-or-line "matlab-shell.el")
+(declare-function matlab-shell-run-region "matlab-shell.el")
+(declare-function matlab-shell-save-and-go "matlab-shell.el")
+
;;; User-changeable variables =================================================
;;
@@ -75,25 +82,21 @@
(defcustom matlab-indent-level 4
"*The basic indentation amount in `matlab-mode'."
- :group 'matlab
:type 'integer)
(defcustom matlab-continuation-indent-level 4
"*Basic indentation after continuation if no other methods are found."
- :group 'matlab
:type 'integer)
(defcustom matlab-array-continuation-indent-level 2
"*Basic indentation after continuation within an array.
Applies when no other methods are found."
- :group 'matlab
:type 'integer)
(defcustom matlab-cont-requires-ellipsis t
"*Specify if ellipses are required at the end of a line for continuation.
Future versions of MATLAB may not require ellipses ... , so a heuristic
determining if there is to be continuation is used instead."
- :group 'matlab
:type 'integer)
(defcustom matlab-case-indent-level '(2 . 2)
@@ -110,7 +113,6 @@ Note: Currently a bug exists if:
CASE-INDENT + COMMAND-INDENT != `matlab-indent-level'
so if you customize these variables, follow the above rule, and you
should be ok."
- :group 'matlab
:type 'sexp)
(defcustom matlab-indent-past-arg1-functions
@@ -119,14 +121,12 @@ should be ok."
This specialness means that all following parameters which appear on
continued lines should appear indented to line up with the second
argument, not the first argument."
- :group 'matlab
:type 'string)
(defcustom matlab-arg1-max-indent-length 15
"*The maximum length to indent when indenting past arg1.
If arg1 is exceptionally long, then only this number of characters
will be indented beyond the open paren starting the parameter list."
- :group 'matlab
:type 'integer)
(defcustom matlab-maximum-indents '(;; = is a convenience. Don't go too far
@@ -142,7 +142,6 @@ the indent engine is using, and INDENT is the maximum
indentation
allowed. Indent could be of the form (MAXIMUM . INDENT), where
MAXIMUM is the maximum allowed calculated indent, and INDENT is the
amount to use if MAXIMUM is reached."
- :group 'matlab
:type '(repeat (cons (character :tag "Open List Character")
(sexp :tag "Number (max) or cons (max indent)"))))
@@ -151,7 +150,6 @@ amount to use if MAXIMUM is reached."
When non-nil, continuation lines are aligned to the opening parenthesis if the
opening is not followed by only spaces and ellipses. When nil, continued lines
are simply indented by `matlab-continuation-indent-level'."
- :group 'matlab
:type 'boolean
)
@@ -164,7 +162,6 @@ either nil or t when the MATLAB mode is started in a buffer
based on the
file's current indentation.
If the global value is \\='MathWorks-Standard, then the local value is not
changed, and functions are indented based on `matlab-functions-have-end'."
- :group 'matlab
:type '(choice (const :tag "Always" t)
(const :tag "Never" nil)
(const :tag "Guess" guess)
@@ -178,7 +175,6 @@ changed, and functions are indented based on
`matlab-functions-have-end'."
"*If non-nil, functions-have-end minor mode is on by default.
If the value is \\='guess, then we guess if a file has end when
`matlab-mode' is initialized."
- :group 'matlab
:type 'boolean)
(make-variable-buffer-local 'matlab-functions-have-end)
@@ -415,71 +411,59 @@ If they occur within this fudge factor, we will use them.
Also, if none of the above occur, and we find a symbol to break at,
but an open paren (group) starts or ends within this fudge factor,
move there to boost the amount of fill leverage we can get."
- :group 'matlab
:type 'integer)
(defcustom matlab-fill-fudge-hard-maximum 79
"The longest line allowed when auto-filling code.
This overcomes situations where the `fill-column' plus the
`matlab-fill-fudge' is greater than some hard desired limit."
- :group 'matlab
:type 'integer)
;; TODO - matlab-ellipsis-string shouldn't be a defcustom because it cannot be
changed.
(defcustom matlab-ellipsis-string "..."
"Text used to perform continuation on code lines.
This is used to generate and identify continuation lines."
- :group 'matlab
:type 'string)
(defcustom matlab-fill-code nil
"*If true, `auto-fill-mode' causes code lines to be automatically continued."
- :group 'matlab
:type 'boolean)
(defcustom matlab-fill-count-ellipsis-flag t
"*Non-nil means to count the ellipsis when auto filling.
This effectively shortens the `fill-column' by the length of
`matlab-ellipsis-string'."
- :group 'matlab
:type 'boolean)
(defcustom matlab-fill-strings-flag t
"*Non-nil means that when auto-fill is on, strings are broken across lines.
If `matlab-fill-count-ellipsis-flag' is non nil, this shortens the
`fill-column' by the length of `matlab-ellipsis-string'."
- :group 'matlab
:type 'boolean)
(defcustom matlab-comment-column 40
"*The goal comment column in `matlab-mode' buffers."
- :group 'matlab
:type 'integer)
(defcustom matlab-comment-anti-indent 0
"*Amount of anti-indentation to use for comments in relation to code."
- :group 'matlab
:type 'integer)
(defcustom matlab-comment-line-s "% "
"*String to start comment on line by itself."
- :group 'matlab
:type 'string)
(defcustom matlab-comment-on-line-s "% "
"*String to start comment on line with code."
- :group 'matlab
:type 'string)
(defcustom matlab-comment-region-s "% $$$ "
"*String inserted by \\[matlab-comment-region] at start of each line in \
region."
- :group 'matlab
:type 'string)
(defcustom matlab-verify-on-save-flag t
"*Non-nil means to verify M whenever we save a file."
- :group 'matlab
:type 'boolean)
(defcustom matlab-mode-verify-fix-functions
@@ -487,7 +471,6 @@ region."
"List of function symbols which perform a verification and fix to M code.
Each function gets no arguments, and returns nothing. They can move
point, but it will be restored for them."
- :group 'matlab
:type '(repeat (choice :tag "Function: "
(matlab-mode-vf-functionname
matlab-mode-vf-classname
@@ -496,31 +479,26 @@ point, but it will be restored for them."
(defcustom matlab-block-verify-max-buffer-size 50000
"*Largest buffer size allowed for block verification during save."
- :group 'matlab
:type 'integer)
(defcustom matlab-mode-hook nil
"*List of functions to call on entry to MATLAB mode."
- :group 'matlab
:type 'hook)
(defcustom matlab-show-mlint-warnings nil
"*If non-nil, show mlint warnings."
- :group 'matlab
:type 'boolean)
(make-variable-buffer-local 'matlab-show-mlint-warnings)
(put 'matlab-show-mlint-warnings 'safe-local-variable #'booleanp)
(defcustom matlab-highlight-cross-function-variables nil
"*If non-nil, highlight cross-function variables."
- :group 'matlab
:type 'boolean)
(make-variable-buffer-local 'matlab-highlight-cross-function-variables)
(put 'matlab-highlight-cross-function-variables 'safe-local-variable
#'booleanp)
(defcustom matlab-return-add-semicolon nil
"*If non nil, check to see a semicolon is needed when RET is pressed."
- :group 'matlab
:type 'boolean)
(make-variable-buffer-local 'matlab-return-add-semicolon)
@@ -532,39 +510,42 @@ point, but it will be restored for them."
;;; Keybindings ===============================================================
+(declare-function matlab-insert-map-fcn "matlab-cgen.el")
+(declare-function matlab-complete-symbol "matlab-complete.el")
+
(defvar matlab-mode-map
(let ((km (make-sparse-keymap)))
;; Navigation Commands
- (define-key km [(meta a)] 'matlab-beginning-of-command)
- (define-key km [(meta e)] 'matlab-end-of-command)
+ (define-key km [(meta a)] #'matlab-beginning-of-command)
+ (define-key km [(meta e)] #'matlab-end-of-command)
;; Insert, Fill stuff
- (define-key km [(control c) (control c)] 'matlab-insert-map-fcn)
- (define-key km [(control c) (control j)] 'matlab-justify-line)
+ (define-key km [(control c) (control c)] #'matlab-insert-map-fcn)
+ (define-key km [(control c) (control j)] #'matlab-justify-line)
;; Comment Stuff
- (define-key km "%" 'matlab-electric-comment)
- (define-key km "^" 'matlab-electric-comment)
- (define-key km "}" 'matlab-electric-block-comment)
- (define-key km "{" 'matlab-electric-block-comment)
- (define-key km "\C-c;" 'matlab-comment-region)
- (define-key km "\C-c:" 'matlab-uncomment-region)
- (define-key km [(meta \;)] 'matlab-comment)
- (define-key km [(meta j)] 'matlab-comment-line-break-function)
- (define-key km [(control c) return] 'matlab-comment-return)
- (substitute-key-definition 'comment-region 'matlab-comment-region
+ (define-key km "%" #'matlab-electric-comment)
+ (define-key km "^" #'matlab-electric-comment)
+ (define-key km "}" #'matlab-electric-block-comment)
+ (define-key km "{" #'matlab-electric-block-comment)
+ (define-key km "\C-c;" #'matlab-comment-region)
+ (define-key km "\C-c:" #'matlab-uncomment-region)
+ (define-key km [(meta \;)] #'matlab-comment)
+ (define-key km [(meta j)] #'matlab-comment-line-break-function)
+ (define-key km [(control c) return] #'matlab-comment-return)
+ (substitute-key-definition #'comment-region #'matlab-comment-region
km global-map) ;torkel
;; Completion
- (define-key km "\M-\t" 'matlab-complete-symbol)
+ (define-key km "\M-\t" #'matlab-complete-symbol) ;;FIXME: Use CAPF!
;; Connecting to MATLAB Shell
- (define-key km [(control c) (control s)] 'matlab-shell-save-and-go)
- (define-key km [(control c) (control r)] 'matlab-shell-run-region)
- (define-key km [(control return)] 'matlab-shell-run-region-or-line)
- (define-key km [(control c) (control t)] 'matlab-show-line-info)
- (define-key km [(control c) ?. ] 'matlab-shell-locate-fcn)
+ (define-key km [(control c) (control s)] #'matlab-shell-save-and-go)
+ (define-key km [(control c) (control r)] #'matlab-shell-run-region)
+ (define-key km [(control return)] #'matlab-shell-run-region-or-line)
+ (define-key km [(control c) (control t)] #'matlab-show-line-info)
+ (define-key km [(control c) ?. ] #'matlab-shell-locate-fcn)
(define-key km [(control h) (control m)] matlab--shell-help-map)
- (define-key km [(meta s)] 'matlab-show-matlab-shell-buffer)
- (define-key km [(control meta mouse-2)] 'matlab-shell-find-file-click)
+ (define-key km [(meta s)] #'matlab-show-matlab-shell-buffer)
+ (define-key km [(control meta mouse-2)] #'matlab-shell-find-file-click)
;; Debugger interconnect
- (substitute-key-definition 'read-only-mode 'matlab-toggle-read-only
+ (substitute-key-definition #'read-only-mode #'matlab-toggle-read-only
km global-map)
km)
@@ -730,8 +711,7 @@ mark at the beginning of the \"%% section\" and point at
the end of the section"
;; because it's just too complex for a regular expression.
(defface matlab-region-face
'((t :inherit region))
- "*Face used to highlight a matlab region."
- :group 'matlab)
+ "*Face used to highlight a matlab region.")
(defvar matlab-unterminated-string-face 'matlab-unterminated-string-face
"Self reference for unterminated string face.")
@@ -754,20 +734,17 @@ mark at the beginning of the \"%% section\" and point at
the end of the section"
(defface matlab-unterminated-string-face
'((t :inherit font-lock-string-face
:underline t))
- "*Face used to highlight unterminated strings."
- :group 'matlab)
+ "*Face used to highlight unterminated strings.")
(defface matlab-commanddual-string-face
'((t :inherit font-lock-string-face
:slant italic))
- "*Face used to highlight command dual string equivalent."
- :group 'matlab)
+ "*Face used to highlight command dual string equivalent.")
(defface matlab-simulink-keyword-face
'((t :inherit font-lock-builtin-face
:underline t))
- "*Face used to highlight simulink specific functions."
- :group 'matlab)
+ "*Face used to highlight simulink specific functions.")
(defface matlab-nested-function-keyword-face
'((t :inherit font-lock-keyword-face
@@ -777,8 +754,7 @@ mark at the beginning of the \"%% section\" and point at
the end of the section"
(defface matlab-cross-function-variable-face
'((t :weight bold
:slant italic))
- "*Face to use for cross-function variables."
- :group 'matlab)
+ "*Face to use for cross-function variables.")
(defface matlab-ignored-comment-face
'((t :inherit font-lock-comment-face
@@ -888,14 +864,12 @@ Argument LIMIT is the maximum distance to search."
"List of handle graphics functions used in highlighting.
Customizing this variable is only useful if `regexp-opt' is available."
- :group 'matlab
:type '(repeat (string :tag "HG Keyword: ")))
(defcustom matlab-debug-list '("dbstop" "dbclear" "dbcont" "dbdown" "dbmex"
"dbstack" "dbstatus" "dbstep" "dbtype" "dbup"
"dbquit")
"List of debug commands used in highlighting."
- :group 'matlab
:type '(repeat (string :tag "Debug Keyword: ")))
(defcustom matlab-simulink-keywords
@@ -906,14 +880,12 @@ Customizing this variable is only useful if `regexp-opt'
is available."
"bdroot" "bdclose" )
;; Missing this regex "\\(mld\\|ss\\)[A-Z]\\w+\\)"
"List of keywords to highlight for simulink."
- :group 'matlab
:type '(repeat (string :tag "Debug Keyword: ")))
(defcustom matlab-constants-keyword-list
'("eps" "pi" "flintmax" "inf" "Inf" "nan" "NaN" "ans" "i" "j" "NaT" "true"
"false")
"List of constants and special variables in MATLAB."
- :group 'matlab
:type '(repeat (string :tag "Debug Keyword: ")))
(defun matlab-font-lock-regexp-opt (keywordlist)
@@ -1273,18 +1245,11 @@ Variables:
`matlab-fill-strings' Non-nil, auto-fill strings in `auto-fill-mode'.
`matlab-verify-on-save-flag' Non-nil, enable code checks on save.
`matlab-vers-on-startup' If t, show version on start-up.
- `matlab-handle-simulink' If t, enable simulink keyword highlighting.
-
-All Key Bindings:
-\\{matlab-mode-map}"
+ `matlab-handle-simulink' If t, enable simulink keyword highlighting."
:after-hook (matlab-mode-init-mlint-if-needed)
- (use-local-map matlab-mode-map)
- (setq major-mode 'matlab-mode)
- (setq mode-name "MATLAB")
(if (boundp 'whitespace-modes)
(add-to-list 'whitespace-modes 'matlab-mode))
- (setq local-abbrev-table matlab-mode-abbrev-table)
;; Syntax tables and related features are in matlab-syntax.el
;; This includes syntax table definitions, misc syntax regexps
@@ -1294,73 +1259,54 @@ All Key Bindings:
;; Indentation setup.
(setq indent-tabs-mode nil)
- (make-local-variable 'indent-line-function)
- (setq indent-line-function 'matlab-indent-line)
- (make-local-variable 'indent-region-function)
- (setq indent-region-function 'matlab-indent-region)
- (make-local-variable 'comment-column)
- (setq comment-column matlab-comment-column)
- (make-local-variable 'comment-indent-function)
- (setq comment-indent-function (lambda () nil)) ;; always use
indent-according-to-mode
- (make-local-variable 'electric-indent-functions)
- (setq electric-indent-functions 'matlab-electric-indent-function)
+ (setq-local indent-line-function #'matlab-indent-line)
+ (setq-local indent-region-function #'matlab-indent-region)
+ (setq-local comment-column matlab-comment-column)
+ (setq-local comment-indent-function (lambda () nil)) ;; always use
indent-according-to-mode
+ (setq-local electric-indent-functions #'matlab-electric-indent-function)
;; Sexp's and Defuns
- (make-local-variable 'forward-sexp-function)
- (setq forward-sexp-function 'matlab-forward-sexp-fcn)
- (make-local-variable 'beginning-of-defun-function)
- (setq beginning-of-defun-function 'matlab-beginning-of-defun)
- (make-local-variable 'end-of-defun-function)
- (setq end-of-defun-function 'matlab-skip-over-defun)
- (make-local-variable 'add-log-current-defun-function)
- (setq add-log-current-defun-function 'matlab-add-log-current-defun)
+ (setq-local forward-sexp-function #'matlab-forward-sexp-fcn)
+ (setq-local beginning-of-defun-function #'matlab-beginning-of-defun)
+ (setq-local end-of-defun-function #'matlab-skip-over-defun)
+ (setq-local add-log-current-defun-function #'matlab-add-log-current-defun)
;; Auto-Fill and Friends
- (make-local-variable 'normal-auto-fill-function)
- (setq normal-auto-fill-function 'matlab-auto-fill)
- (make-local-variable 'fill-column)
- (setq fill-column fill-column)
- (make-local-variable 'fill-paragraph-function)
- (setq fill-paragraph-function 'matlab-fill-paragraph)
- (make-local-variable 'fill-prefix)
+ (setq-local normal-auto-fill-function #'matlab-auto-fill)
+ (setq-local fill-column fill-column)
+ (setq-local fill-paragraph-function #'matlab-fill-paragraph)
;; Imenu
- (setq-local imenu-create-index-function #'matlab--imenu-index)
+ (setq-local imenu-generic-expression #'matlab--imenu-index)
;; Save hook for verifying src. This lets us change the name of
;; the function in `write-file' and have the change be saved.
;; It also lets us fix mistakes before a `save-and-go'.
- (make-local-variable 'write-contents-functions)
- (add-hook 'write-contents-functions 'matlab-mode--write-file-callback)
-
- ;; give each file it's own parameter history
- (make-local-variable 'matlab-shell-save-and-go-history)
+ (add-hook 'write-contents-functions #'matlab-mode--write-file-callback)
;; Font lock support:
- (make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults '((matlab-file-basic-font-lock-keywords
- matlab-file-gaudy-font-lock-keywords
- matlab-file-really-gaudy-font-lock-keywords
- )
- nil ; use syntax table comments/strings
- nil ; keywords are case sensitive.
- ;; This puts _ as a word constituent,
- ;; simplifying our keywords significantly
- ((?_ . "w"))))
+ (setq-local font-lock-defaults
+ '((matlab-file-basic-font-lock-keywords
+ matlab-file-gaudy-font-lock-keywords
+ matlab-file-really-gaudy-font-lock-keywords
+ )
+ nil ; use syntax table comments/strings
+ nil ; keywords are case sensitive.
+ ;; This puts _ as a word constituent,
+ ;; simplifying our keywords significantly
+ ((?_ . "w"))))
(setq font-lock-multiline 'undecided)
(add-to-list 'font-lock-extend-region-functions
#'matlab-font-lock-extend-region t)
;; Highlight parens OR if/end type blocks
- (make-local-variable 'show-paren-data-function)
- (setq show-paren-data-function 'matlab-show-paren-or-block)
+ (setq-local show-paren-data-function #'matlab-show-paren-or-block)
;; Electric pair mode needs customization around transpose
- (make-local-variable 'electric-pair-inhibit-predicate)
- (setq electric-pair-inhibit-predicate
'matlab-electric-pair-inhibit-predicate)
+ (setq-local electric-pair-inhibit-predicate
+ #'matlab-electric-pair-inhibit-predicate)
;; Electric pair mode - handle ' as string delimiter correctly
- (make-local-variable 'electric-pair-pairs)
- (setq electric-pair-pairs '((39 . 39)))
+ (setq-local electric-pair-pairs '((?\' . ?\')))
(let ((mfile-type (matlab-guess-mfile-type)))
diff --git a/mlgud.el b/mlgud.el
index 06fa084e0b..24f2e2cbdb 100644
--- a/mlgud.el
+++ b/mlgud.el
@@ -201,7 +201,7 @@ Uses `mlgud-<MINOR-MODE>-directories' to find the source
files."
(eq mlgud-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 'mlgud-keep-buffer))
buf)))
@@ -309,16 +309,21 @@ The value t means that there is no stack, and we are in
display-file mode.")
(declare-function speedbar-add-expansion-list "speedbar" (new-list))
(defvar speedbar-mode-functions-list)
+(declare-function mlgud-pp "mlgud.el")
+(declare-function gdb-var-delete "gdb-mi.el")
+(declare-function speedbar-toggle-line-expansion "speedbar.el")
+(declare-function speedbar-edit-line "speedbar.el")
+
(defun mlgud-install-speedbar-variables ()
"Install those variables used by speedbar to enhance mlgud/gdb."
(unless mlgud-speedbar-key-map
(setq mlgud-speedbar-key-map (speedbar-make-specialized-keymap))
- (define-key mlgud-speedbar-key-map "j" 'speedbar-edit-line)
- (define-key mlgud-speedbar-key-map "e" 'speedbar-edit-line)
- (define-key mlgud-speedbar-key-map "\C-m" 'speedbar-edit-line)
- (define-key mlgud-speedbar-key-map " " 'speedbar-toggle-line-expansion)
- (define-key mlgud-speedbar-key-map "D" 'gdb-var-delete)
- (define-key mlgud-speedbar-key-map "p" 'mlgud-pp))
+ (define-key mlgud-speedbar-key-map "j" #'speedbar-edit-line)
+ (define-key mlgud-speedbar-key-map "e" #'speedbar-edit-line)
+ (define-key mlgud-speedbar-key-map "\C-m" #'speedbar-edit-line)
+ (define-key mlgud-speedbar-key-map " " #'speedbar-toggle-line-expansion)
+ (define-key mlgud-speedbar-key-map "D" #'gdb-var-delete)
+ (define-key mlgud-speedbar-key-map "p" #'mlgud-pp))
(speedbar-add-expansion-list '("mlMLGUD" mlgud-speedbar-menu-items
mlgud-speedbar-key-map
@@ -392,9 +397,9 @@ required by the caller."
(value (nth 4 var)) (status (nth 5 var))
(has-more (nth 6 var)))
(put-text-property
- 0 (length expr) 'face font-lock-variable-name-face expr)
+ 0 (length expr) 'face 'font-lock-variable-name-face expr)
(put-text-property
- 0 (length type) 'face font-lock-type-face type)
+ 0 (length type) 'face 'font-lock-type-face type)
(while (string-match "\\." varnum start)
(setq depth (1+ depth)
start (1+ (match-beginning 0))))
@@ -579,16 +584,16 @@ commands.
Other commands for interacting with the debugger process are inherited from
comint mode, which see."
(setq mode-line-process '(":%s"))
- (define-key (current-local-map) "\C-c\C-l" 'mlgud-refresh)
- (set (make-local-variable 'mlgud-last-frame) nil)
+ (define-key (current-local-map) "\C-c\C-l" #'mlgud-refresh)
+ (setq-local mlgud-last-frame nil)
(if (boundp 'tool-bar-map) ; not --without-x
(setq-local tool-bar-map mlgud-tool-bar-map))
(make-local-variable 'comint-prompt-regexp)
;; Don't put repeated commands in command history many times.
- (set (make-local-variable 'comint-input-ignoredups) t)
+ (setq-local comint-input-ignoredups t)
(make-local-variable 'paragraph-start)
- (set (make-local-variable 'mlgud-delete-prompt-marker) (make-marker))
- (add-hook 'kill-buffer-hook 'mlgud-kill-buffer-hook nil t))
+ (setq-local mlgud-delete-prompt-marker (make-marker))
+ (add-hook 'kill-buffer-hook #'mlgud-kill-buffer-hook nil t))
(defun mlgud-set-buffer ()
"Set buffer for mlgud."
@@ -1094,14 +1099,15 @@ it if ARG is omitted or nil."
(require 'tooltip)
(if mlgud-tooltip-mode
(progn
- (add-hook 'change-major-mode-hook 'mlgud-tooltip-change-major-mode)
- (add-hook 'pre-command-hook 'tooltip-hide)
- (add-hook 'tooltip-functions 'mlgud-tooltip-tips)
- (define-key global-map [mouse-movement] 'mlgud-tooltip-mouse-motion))
- (unless tooltip-mode (remove-hook 'pre-command-hook 'tooltip-hide)
- (remove-hook 'change-major-mode-hook 'mlgud-tooltip-change-major-mode)
- (remove-hook 'tooltip-functions 'mlgud-tooltip-tips)
- (define-key global-map [mouse-movement] 'ignore)))
+ (add-hook 'change-major-mode-hook #'mlgud-tooltip-change-major-mode)
+ (add-hook 'pre-command-hook #'tooltip-hide)
+ (add-hook 'tooltip-functions #'mlgud-tooltip-tips)
+ (define-key global-map [mouse-movement] #'mlgud-tooltip-mouse-motion))
+ (unless tooltip-mode (remove-hook 'pre-command-hook #'tooltip-hide)
+ (remove-hook 'change-major-mode-hook #'mlgud-tooltip-change-major-mode)
+ (remove-hook 'tooltip-functions #'mlgud-tooltip-tips)
+ ;; FIXME: Maybe it wasn't `ignore' to start with?
+ (define-key global-map [mouse-movement] #'ignore)))
(mlgud-tooltip-activate-mouse-motions-if-enabled)
(if (and mlgud-comint-buffer
(buffer-name mlgud-comint-buffer); mlgud-comint-buffer might be
killed
@@ -1118,9 +1124,9 @@ it if ARG is omitted or nil."
(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 mlgud-tooltip-modes '(mlgud-mode c-mode c++-mode fortran-mode
python-mode)
@@ -1153,12 +1159,13 @@ only tooltips in the buffer containing the overlay
arrow."
(defun mlgud-tooltip-change-major-mode ()
"Function added to `change-major-mode-hook' when tooltip mode is on."
- (add-hook 'post-command-hook
'mlgud-tooltip-activate-mouse-motions-if-enabled))
+ (add-hook 'post-command-hook
+ #'mlgud-tooltip-activate-mouse-motions-if-enabled))
(defun mlgud-tooltip-activate-mouse-motions-if-enabled ()
"Reconsider for all buffers whether mouse motion events are desired."
(remove-hook 'post-command-hook
- 'mlgud-tooltip-activate-mouse-motions-if-enabled)
+ #'mlgud-tooltip-activate-mouse-motions-if-enabled)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(if (and mlgud-tooltip-mode
@@ -1266,7 +1273,7 @@ This function must return nil if it doesn't handle EVENT."
(posn-point (event-end event))
(or (and (eq mlgud-minor-mode 'gdbmi) (not gdb-active-process))
(progn (setq mlgud-tooltip-event event)
- (eval (cons 'and mlgud-tooltip-display)))))
+ (eval (cons 'and mlgud-tooltip-display) t))))
(let ((expr (tooltip-expr-to-print event)))
(when expr
(if (and (eq mlgud-minor-mode 'gdbmi)
diff --git a/mlint.el b/mlint.el
index 238dc03dd4..210c7eeb80 100644
--- a/mlint.el
+++ b/mlint.el
@@ -171,7 +171,7 @@ Argument STRING is the text to interpret."
(setq default-directory dd)
- (apply 'call-process buffer-mlint-program nil (current-buffer) nil
+ (apply #'call-process buffer-mlint-program nil (current-buffer) nil
(append flags (list fn)))
(when mlint-verbose (message "Running mlint...done"))
@@ -769,15 +769,15 @@ Highlight problems and/or cross-function variables."
;;
(defvar mlint-minor-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-c,n" 'mlint-next-buffer)
- (define-key map "\C-c,p" 'mlint-prev-buffer)
- (define-key map "\C-c,N" 'mlint-next-buffer-new)
- (define-key map "\C-c,P" 'mlint-prev-buffer-new)
- (define-key map "\C-c,g" 'mlint-buffer)
- (define-key map "\C-c,c" 'mlint-clear-warnings)
- (define-key map "\C-c, " 'mlint-show-warning)
- (define-key map "\C-c,f" 'mlint-fix-warning)
- (define-key map "\C-c,o" 'mlint-mark-ok)
+ (define-key map "\C-c,n" #'mlint-next-buffer)
+ (define-key map "\C-c,p" #'mlint-prev-buffer)
+ (define-key map "\C-c,N" #'mlint-next-buffer-new)
+ (define-key map "\C-c,P" #'mlint-prev-buffer-new)
+ (define-key map "\C-c,g" #'mlint-buffer)
+ (define-key map "\C-c,c" #'mlint-clear-warnings)
+ (define-key map "\C-c, " #'mlint-show-warning)
+ (define-key map "\C-c,f" #'mlint-fix-warning)
+ (define-key map "\C-c,o" #'mlint-mark-ok)
map)
"Minor mode keymap used when mlinting a buffer.")
@@ -804,11 +804,12 @@ Highlight problems and/or cross-function variables."
(defvar mlint-overlay-map
(let ((map (make-sparse-keymap )))
- (define-key map [down-mouse-3] 'mlint-emacs-popup-kludge)
- (define-key map [(meta n)] 'mlint-next-buffer)
- (define-key map [(meta p)] 'mlint-prev-buffer)
- (define-key map [(control meta n)] 'mlint-next-buffer-new)
- (define-key map [(control meta p)] 'mlint-prev-buffer-new)
+ ;; FIXME: Use `context-menu-functions' instead?
+ (define-key map [down-mouse-3] #'mlint-emacs-popup-kludge)
+ (define-key map [(meta n)] #'mlint-next-buffer)
+ (define-key map [(meta p)] #'mlint-prev-buffer)
+ (define-key map [(control meta n)] #'mlint-next-buffer-new)
+ (define-key map [(control meta p)] #'mlint-prev-buffer-new)
(set-keymap-parent map matlab-mode-map)
map)
"Map used in overlays marking mlint warnings.")
@@ -844,7 +845,7 @@ With prefix ARG, turn mlint minor mode on iff ARG is
positive.
(progn
(mlint-clear-nested-function-info-overlays)
(mlint-clear-warnings)
- (remove-hook 'after-save-hook 'mlint-buffer t))
+ (remove-hook 'after-save-hook #'mlint-buffer t))
;; activate mlint if possible
(if mlint-program-selection-fcn
@@ -859,7 +860,7 @@ With prefix ARG, turn mlint minor mode on iff ARG is
positive.
(if mlint-program
(progn
- (add-hook 'after-save-hook 'mlint-buffer nil t)
+ (add-hook 'after-save-hook #'mlint-buffer nil t)
(mlint-buffer))
;; Remove the mlint menu. set mlint-minor-mode variable to nil, disable
mlint keybindings
(mlint-minor-mode -1))))
@@ -877,7 +878,7 @@ That buffer will be current."
(mlint-minor-mode -1)
))
-(add-hook 'ediff-prepare-buffer-hook 'mlint-ediff-metabuffer-setup-hook)
+(add-hook 'ediff-prepare-buffer-hook #'mlint-ediff-metabuffer-setup-hook)
(defun mlint-ediff-cleanup-hook ()
"Re-enable mlint for buffers being ediffed.
@@ -892,7 +893,7 @@ find it."
(setq mlint-minor-mode-was-enabled-before nil))))
(buffer-list)))
-(add-hook 'ediff-cleanup-hook 'mlint-ediff-cleanup-hook)
+(add-hook 'ediff-cleanup-hook #'mlint-ediff-cleanup-hook)
(provide 'mlint)
;;; mlint.el ends here
diff --git a/semantic-matlab.el b/semantic-matlab.el
index 30a775347e..be9ce4e21c 100644
--- a/semantic-matlab.el
+++ b/semantic-matlab.el
@@ -464,7 +464,7 @@ Each tag returned is a semantic FUNCTION tag. See
(let ((chil (semantic-tag-components-with-overlays tag)))
(if chil
(semantic-tag-put-attribute
- tag :members (mapcar 'semantic-matlab-expand-tag chil)))
+ tag :members (mapcar #'semantic-matlab-expand-tag chil)))
(car (semantic--tag-expand tag))))
(defun semantic-matlab-parse-class (&optional limit)
@@ -844,7 +844,7 @@ This will include a list of type/field names when
applicable."
(setq semantic-parser-name "MATLAB"
;; Setup a dummy parser table to enable parsing!
semantic--parse-table t
- imenu-create-index-function 'semantic-create-imenu-index
+ imenu-create-index-function #'semantic-create-imenu-index
;; semantic-command-separation-character "."
semantic-type-relation-separator-character '(".")
semantic-symbol->name-assoc-list '((function . "Function")
diff --git a/semanticdb-matlab.el b/semanticdb-matlab.el
index 7b539daa3c..78da65cfca 100644
--- a/semanticdb-matlab.el
+++ b/semanticdb-matlab.el
@@ -212,7 +212,7 @@ to be called in local `after-save-hook'."
;; add buffer-local after-save-hook
(add-hook
'after-save-hook
- 'semanticdb-matlab-possibly-add-buffer-to-cache t t)))
+ #'semanticdb-matlab-possibly-add-buffer-to-cache t t)))
;; Helper functions
diff --git a/tlc.el b/tlc.el
index eb7ac8de64..8d99b7ca71 100644
--- a/tlc.el
+++ b/tlc.el
@@ -133,8 +133,7 @@
:group 'languages)
(defcustom tlc-mode-hook nil
- "*List of functions to call on entry to TLC mode."
- :group 'tlc
+ "List of functions to call on entry to TLC mode."
:type 'hook)
(defvar tlc--imenu-generic-expression
@@ -159,9 +158,8 @@
(defvar tlc-mode-map
(let ((km (make-sparse-keymap)))
- (define-key km "\C-m" 'tlc-return)
- (define-key km [return] 'tlc-return)
- (define-key km "\C-i" 'tlc-indent)
+ (define-key km "\C-m" #'tlc-return)
+ (define-key km "\C-i" #'tlc-indent)
km)
"Keymap for `tlc-mode'.")
@@ -176,8 +174,7 @@
(((class color) (background light)) (:foreground "DarkGreen"))
(((class color) (background dark)) (:foreground "chartreuse"))
(t (:underline t)))
- "Font Lock mode face used to highlight tlc keywords."
- :group 'tlc)
+ "Font Lock mode face used to highlight tlc keywords.")
(defcustom tlc-keywords
'("CAST" "EXISTS" "FEVAL" "FILE_EXISTS" "FORMAT"
@@ -198,8 +195,7 @@
"UINT8MAX" "UINT16MAX" "UINT32MAX"
"UINTWHITE_SPACE" "WILL_ROLL")
"Built-in function keywords to highlight in TLC."
- :type '(repeat (string :tag "keyword"))
- :group 'tlc)
+ :type '(repeat (string :tag "keyword")))
(defvar tlc-font-lock-keywords
(list