[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mmm-mode cd7d38f: Fix various compiler warnings and oth
From: |
Stefan Monnier |
Subject: |
[elpa] externals/mmm-mode cd7d38f: Fix various compiler warnings and other cosmetic details |
Date: |
Mon, 19 Mar 2018 12:22:49 -0400 (EDT) |
branch: externals/mmm-mode
commit cd7d38f0c81dedc51e4cf89be8cb4d002e6f2270
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
Fix various compiler warnings and other cosmetic details
* .gitignore: Add ELPA-generated files.
* mmm-class.el (mmm-apply-classes): Don't use add-to-list on local var.
* mmm-erb.el (mmm-erb-indent-to-region-start): Remove unused var 'indent'.
* mmm-mode.el: Fix ";;;" commenting style.
(mmm-mode-off): Don't bother restoring syntax-begin-function.
* mmm-region.el (mmm-update-mode-info): Don't bother saving
syntax-begin-function.
(mmm-refontify-maybe): Use font-lock-flush when available.
(syntax-ppss-cache, syntax-ppss-last): Declare.
* mmm-noweb.el (mmm-noweb-regions): Remove unused arg 'delim'.
* mmm-vars.el: Move defvars outside of eval-when-compile.
Add declare-functions to silence byte-compiler.
---
.gitignore | 2 ++
mmm-auto.el | 16 +++++----
mmm-class.el | 24 ++++++++------
mmm-cmds.el | 1 -
mmm-erb.el | 19 +++++------
mmm-mason.el | 4 +--
mmm-mode.el | 103 +++++++++++++++++++++++++++++-----------------------------
mmm-myghty.el | 14 ++++----
mmm-noweb.el | 20 +++++++-----
mmm-region.el | 52 +++++++++++++++++------------
mmm-vars.el | 44 +++++++++++++------------
11 files changed, 160 insertions(+), 139 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6803303..44d1bb1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@ mmm.info*
script
stamp-vti
version.texi
+mmm-mode-pkg.el
+mmm-mode-autoloads.el
diff --git a/mmm-auto.el b/mmm-auto.el
index c013175..30d46b7 100644
--- a/mmm-auto.el
+++ b/mmm-auto.el
@@ -1,6 +1,6 @@
;;; mmm-auto.el --- loading and enabling MMM Mode automatically
-;; Copyright (C) 2000-2004, 2012, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2004, 2012, 2013, 2018 Free Software Foundation, Inc.
;; Author: Michael Abraham Shulman <address@hidden>
@@ -41,6 +41,8 @@
;; functions, since it is run after all local variables and text are
;; loaded, which may not be true in certain cases for the other.)
+;; FIXME: There's now after-change-major-mode-hook which should DTRT.
+
;; In order to do this magic, we rely on the fact that there *is* a
;; hook that all major modes run when *beginning* their work. They
;; call `kill-all-local-variables' (unless they are broken), which in
@@ -137,13 +139,13 @@ everything in `mmm-major-mode-hook' will be run."
mmm-mode
(mmm-mode-off))
(add-to-list 'mmm-changed-buffers-list (current-buffer))
- (add-hook 'post-command-hook 'mmm-check-changed-buffers))
+ (add-hook 'post-command-hook #'mmm-check-changed-buffers))
-(add-hook 'change-major-mode-hook 'mmm-major-mode-change)
+(add-hook 'change-major-mode-hook #'mmm-major-mode-change)
(defun mmm-check-changed-buffers ()
"Run major mode hook for the buffers in `mmm-changed-buffers-list'."
- (remove-hook 'post-command-hook 'mmm-check-changed-buffers)
+ (remove-hook 'post-command-hook #'mmm-check-changed-buffers)
(dolist (buffer mmm-changed-buffers-list)
(when (buffer-live-p buffer)
(with-current-buffer buffer
@@ -160,11 +162,11 @@ to apply, or always if `mmm-global-mode' is t."
(when mmm-mode
(mmm-update-font-lock-buffer)))
-(add-hook 'mmm-major-mode-hook 'mmm-mode-on-maybe)
+(add-hook 'mmm-major-mode-hook #'mmm-mode-on-maybe)
-(defalias 'mmm-add-find-file-hooks 'mmm-add-find-file-hook)
+(defalias 'mmm-add-find-file-hooks #'mmm-add-find-file-hook)
(defun mmm-add-find-file-hook ()
- "Equivalent to \(setq mmm-global-mode 'maybe).
+ "Equivalent to (setq mmm-global-mode 'maybe).
This function is deprecated and may be removed in future."
(message "Warning: `mmm-add-find-file-hook' is deprecated.")
(setq mmm-global-mode 'maybe))
diff --git a/mmm-class.el b/mmm-class.el
index 9605d62..34beae9 100644
--- a/mmm-class.el
+++ b/mmm-class.el
@@ -99,7 +99,7 @@ error once all classes have been applied."
(mmm-invalid-submode-class
;; Save the name of the invalid class, so we can report them
;; all together at the end.
- (add-to-list 'invalid-classes (cl-second err)))))
+ (cl-pushnew (cl-second err) invalid-classes :test #'equal))))
(when invalid-classes
(signal 'mmm-invalid-submode-class invalid-classes))))
@@ -124,23 +124,27 @@ and interactive history."
(cl-defun mmm-ify
(&rest all &key classes handler
- submode match-submode
+ ;; Many args are marked as "unused" below, but that's only
+ ;; because they're used via `all'.
+ submode _match-submode
(start (point-min)) (stop (point-max))
- front back save-matches (case-fold-search t)
+ front back _save-matches (case-fold-search t)
(beg-sticky (not (number-or-marker-p front)))
(end-sticky (not (number-or-marker-p back)))
- include-front include-back
+ _include-front _include-back
(front-offset 0) (back-offset 0)
(front-delim nil) (back-delim nil)
(delimiter-mode mmm-delimiter-mode)
front-face back-face
- front-verify back-verify
- front-form back-form
+ _front-verify _back-verify
+ _front-form _back-form
creation-hook
- face match-face
- save-name match-name
- (front-match 0) (back-match 0)
- end-not-begin
+ face _match-face
+ _save-name _match-name
+ ;; FIXME: Since those args's arent' used directly (only passed down
+ ;; via `all'), these default values aren't obeyed!
+ (_front-match 0) (_back-match 0)
+ _end-not-begin
;insert private
&allow-other-keys
)
diff --git a/mmm-cmds.el b/mmm-cmds.el
index c3d7ad1..8887720 100644
--- a/mmm-cmds.el
+++ b/mmm-cmds.el
@@ -428,7 +428,6 @@ NAME is a symbol naming the insertion."
;-COM- @ ";\n" _ "\n" @ "<%/" str ">"
;-COM- '(apply #'mmm-ify-region 'cperl-mode (reverse skeleton-positions)))
;-COM-
-;-COM-(make-local-hook 'after-change-functions)
;-COM-(add-hook 'after-change-functions 'mmm-detect t)
;-COM-
;-COM-(defun mmm-detect (beg end length)
diff --git a/mmm-erb.el b/mmm-erb.el
index 6d3adc5..b3a5e04 100644
--- a/mmm-erb.el
+++ b/mmm-erb.el
@@ -86,11 +86,11 @@
;;;###autoload
(define-derived-mode html-erb-mode html-mode "ERB-HTML"
(setq sgml-unclosed-tags nil) ; Simplifies indentation logic.
- (set (make-local-variable 'mmm-indent-line-function) 'mmm-erb-indent-line)
+ (set (make-local-variable 'mmm-indent-line-function) #'mmm-erb-indent-line)
(add-hook 'mmm-after-syntax-propertize-functions
- 'html-erb-after-syntax-propertize nil t))
+ #'html-erb-after-syntax-propertize nil t))
-(defun html-erb-after-syntax-propertize (overlay mode beg end)
+(defun html-erb-after-syntax-propertize (overlay _mode beg end)
(when overlay
(with-silent-modifications
(funcall
@@ -147,12 +147,11 @@
(defun mmm-erb-indent-to-region-start (&optional additional-offset)
"Indent line to match start of region, possibly adding ADDITIONAL-OFFSET."
- (let ((indent (current-indentation)))
- (indent-line-to
- (save-excursion
- (goto-char (1- (overlay-start mmm-current-overlay)))
- (+ (current-indentation)
- (or additional-offset 0))))))
+ (indent-line-to
+ (save-excursion
+ (goto-char (1- (overlay-start mmm-current-overlay)))
+ (+ (current-indentation)
+ (or additional-offset 0)))))
(defun mmm-erb-indent-line-primary ()
"Indent line in primary mode."
@@ -237,7 +236,7 @@
;;;###autoload
(define-derived-mode nxml-web-mode nxml-mode "nXML-Web"
- (set (make-local-variable 'mmm-indent-line-function) 'mmm-erb-indent-line))
+ (set (make-local-variable 'mmm-indent-line-function) #'mmm-erb-indent-line))
(provide 'mmm-erb)
diff --git a/mmm-mason.el b/mmm-mason.el
index a594dde..240ddfc 100644
--- a/mmm-mason.el
+++ b/mmm-mason.el
@@ -1,6 +1,6 @@
;;; mmm-mason.el --- MMM submode class for Mason components
-;; Copyright (C) 2000-2003, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2003, 2013, 2018 Free Software Foundation, Inc.
;; Author: Michael Abraham Shulman <address@hidden>
@@ -166,7 +166,7 @@ Saves the name of the tag matched.")
(defun mmm-mason-set-mode-line ()
(setq mmm-buffer-mode-display-name "Mason"))
-(add-hook 'mmm-mason-class-hook 'mmm-mason-set-mode-line)
+(add-hook 'mmm-mason-class-hook #'mmm-mason-set-mode-line)
;;}}}
diff --git a/mmm-mode.el b/mmm-mode.el
index 7cbb125..7004bfe 100644
--- a/mmm-mode.el
+++ b/mmm-mode.el
@@ -32,52 +32,52 @@
;;; Commentary:
-;;; MMM Mode is a minor mode that allows multiple major modes to
-;;; coexist in a single buffer. Refer to the documentation of the
-;;; function `mmm-mode' for more detailed information. This file
-;;; contains mode on/off functions and the mode keymap, but mostly
-;;; just loads all the subsidiary files.
-
-;;{{{ Parameter Naming
-
-;;; Since version 0.3.7, I've tried to use a uniform scheme for naming
-;;; parameters. Here's a brief summary.
-
-;;; BEG and END refer to the beginning and end of a region.
-;;; FRONT and BACK refer to the respective delimiters of a region.
-;;; FRONT- and BACK-OFFSET are the offsets from delimiter matches.
-;;; FRONT-BEG through BACK-END are the endings of the delimiters.
-;;; START and STOP bound actions, like searching, fontification, etc.
-
-;;}}}
-;;{{{ CL and Parameters
-
-;;; Keyword parameters can be nice because it makes it easier to see
-;;; what's getting passed as what. But I try not to use them in user
-;;; functions, because CL doesn't make good documentation strings.
-;;; Similarly, any hook or callback function can't take keywords,
-;;; since Emacs as a whole doesn't use them. And for small parameter
-;;; lists, they are overkill. So I use them only for a large number of
-;;; optional parameters, such as `mmm-make-region'.
-
-;;; An exception is the various submode class application functions,
-;;; which all take all their arguments as keywords, for consistency
-;;; and so the classes alist looks nice.
-
-;;; When using keyword arguments, defaults should *always* be supplied
-;;; in all arglists. (This pertains mostly to :start and :stop
-;;; arguments, usually defaulting to (point-min) and (point-max)
-;;; respectively.) `mmm-save-keywords' should only be used for lists
-;;; with more than four arguments, such as in `mmm-ify-by-regexp'.
-
-;;; In general, while I have no qualms about using things from CL like
-;;; `cl-mapl', `cl-loop' and `cl-destructuring-bind', I try not to use
`cl-defun'
-;;; more than I have to. For one, it sometimes makes bad documentation
-;;; strings. Furthermore, to a `defun'ned function, a nil argument is
-;;; the same as no argument, so it will use its (manual) default, but
-;;; to a `cl-defun'ned function, a nil argument *is* the argument, so
-;;; any default specified in the arglist will be ignored. Confusion of
-;;; this type should be avoided when at all possible.
+;; MMM Mode is a minor mode that allows multiple major modes to
+;; coexist in a single buffer. Refer to the documentation of the
+;; function `mmm-mode' for more detailed information. This file
+;; contains mode on/off functions and the mode keymap, but mostly
+;; just loads all the subsidiary files.
+
+;{{{ Parameter Naming
+
+;; Since version 0.3.7, I've tried to use a uniform scheme for naming
+;; parameters. Here's a brief summary.
+
+;; BEG and END refer to the beginning and end of a region.
+;; FRONT and BACK refer to the respective delimiters of a region.
+;; FRONT- and BACK-OFFSET are the offsets from delimiter matches.
+;; FRONT-BEG through BACK-END are the endings of the delimiters.
+;; START and STOP bound actions, like searching, fontification, etc.
+
+;}}}
+;{{{ CL and Parameters
+
+;; Keyword parameters can be nice because it makes it easier to see
+;; what's getting passed as what. But I try not to use them in user
+;; functions, because CL doesn't make good documentation strings.
+;; Similarly, any hook or callback function can't take keywords,
+;; since Emacs as a whole doesn't use them. And for small parameter
+;; lists, they are overkill. So I use them only for a large number of
+;; optional parameters, such as `mmm-make-region'.
+
+;; An exception is the various submode class application functions,
+;; which all take all their arguments as keywords, for consistency
+;; and so the classes alist looks nice.
+
+;; When using keyword arguments, defaults should *always* be supplied
+;; in all arglists. (This pertains mostly to :start and :stop
+;; arguments, usually defaulting to (point-min) and (point-max)
+;; respectively.) `mmm-save-keywords' should only be used for lists
+;; with more than four arguments, such as in `mmm-ify-by-regexp'.
+
+;; In general, while I have no qualms about using things from CL like
+;; `cl-mapl', `cl-loop' and `cl-destructuring-bind', I try not to use
`cl-defun'
+;; more than I have to. For one, it sometimes makes bad documentation
+;; strings. Furthermore, to a `defun'ned function, a nil argument is
+;; the same as no argument, so it will use its (manual) default, but
+;; to a `cl-defun'ned function, a nil argument *is* the argument, so
+;; any default specified in the arglist will be ignored. Confusion of
+;; this type should be avoided when at all possible.
;;}}}
@@ -171,11 +171,12 @@ available through M-x customize-group RET mmm."
(mmm-set-local-variables major-mode nil)
(mmm-add-hooks)
(mmm-fixup-skeleton)
- (make-local-variable 'font-lock-fontify-region-function)
- (setq font-lock-fontify-region-function 'mmm-fontify-region)
- (set (make-local-variable 'syntax-begin-function) nil)
+ (set (make-local-variable 'font-lock-fontify-region-function)
+ #'mmm-fontify-region)
+ (when (boundp 'syntax-begin-function)
+ (set (make-local-variable 'syntax-begin-function) nil))
(set (make-local-variable 'syntax-propertize-function)
- 'mmm-syntax-propertize-function)
+ #'mmm-syntax-propertize-function)
(set (make-local-variable 'indent-line-function) mmm-indent-line-function)
(setq mmm-mode t)
(condition-case err
@@ -204,8 +205,6 @@ available through M-x customize-group RET mmm."
(mmm-update-submode-region)
(setq font-lock-fontify-region-function
(get mmm-primary-mode 'mmm-fontify-region-function))
- (set 'syntax-begin-function
- (get mmm-primary-mode 'mmm-beginning-of-syntax-function))
(mmm-update-font-lock-buffer)
(mmm-refontify-maybe)
(setq mmm-mode nil)
diff --git a/mmm-myghty.el b/mmm-myghty.el
index 075888a..d893a2f 100644
--- a/mmm-myghty.el
+++ b/mmm-myghty.el
@@ -1,6 +1,6 @@
;;; mmm-myghty.el --- MMM submode class for Myghty components
-;; Copyright (C) 2000, 2004, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2004, 2013, 2018 Free Software Foundation, Inc.
;; Author: Ben Bangert
;; Original Author: Michael Abraham Shulman <address@hidden>
@@ -28,11 +28,11 @@
;;; Commentary:
-;;; I went to the hard (sarcasm) effort of applying two global
-;;; search/replaces, and adding a few keywords for additional
-;;; blocks that Myghty introduced. Many thanks to Michael for writing
-;;; the mmm-mason without which I would never have found the time
-;;; to patch up for Myghty.
+;; I went to the hard (sarcasm) effort of applying two global
+;; search/replaces, and adding a few keywords for additional
+;; blocks that Myghty introduced. Many thanks to Michael for writing
+;; the mmm-mason without which I would never have found the time
+;; to patch up for Myghty.
;;; Code:
@@ -178,7 +178,7 @@ Saves the name of the tag matched.")
(defun mmm-myghty-set-mode-line ()
(setq mmm-buffer-mode-display-name "Myghty"))
-(add-hook 'mmm-myghty-class-hook 'mmm-myghty-set-mode-line)
+(add-hook 'mmm-myghty-class-hook #'mmm-myghty-set-mode-line)
;;}}}
diff --git a/mmm-noweb.el b/mmm-noweb.el
index 2aecb06..8d3958e 100644
--- a/mmm-noweb.el
+++ b/mmm-noweb.el
@@ -74,7 +74,7 @@ See `mmm-noweb-quote'.")
;;}}}
;;{{{ Support for mmm submode stuff
-(defun mmm-noweb-chunk (form)
+(defun mmm-noweb-chunk (_form)
"Return the noweb code mode chosen by the user.
If the next 100 characters of the buffer contain a string of the form
\"-*- MODE -*-\", then return MODE as the chosen mode, otherwise
@@ -90,12 +90,12 @@ return the value of `mmm-noweb-code-mode'."
mmm-noweb-code-mode))
mmm-noweb-code-mode))
-(defun mmm-noweb-quote (form)
+(defun mmm-noweb-quote (_form)
"Create a unique name for a quoted code region within a documentation chunk."
(or mmm-noweb-quote-mode
mmm-noweb-code-mode))
-(defun mmm-noweb-quote-name (form)
+(defun mmm-noweb-quote-name (_form)
"Create a unique name for a quoted code region within a documentation chunk."
(setq mmm-noweb-quote-number (1+ mmm-noweb-quote-number))
(concat mmm-noweb-quote-string "-"
@@ -146,8 +146,8 @@ return the value of `mmm-noweb-code-mode'."
;;}}}
;;{{{ Noweb regions
-(defun mmm-noweb-regions (start stop regexp &optional delim)
- "Return a liat of regions of the form \(NAME BEG END) that exclude
+(defun mmm-noweb-regions (start stop regexp)
+ "Return a liat of regions of the form (NAME BEG END) that exclude
names which match REGEXP."
(let* ((remove-next nil)
(regions
@@ -228,7 +228,7 @@ chunks."
(fill-paragraph justify)))
(mmm-undo-syntax-other-regions))))
-(defun mmm-noweb-fill-named-chunk (&optional justify)
+(defun mmm-noweb-fill-named-chunk (&optional _justify)
"Fill the region containing the named chunk."
(interactive "P")
(save-restriction
@@ -255,12 +255,14 @@ chunks."
(defun mmm-noweb-auto-fill-doc-mode ()
"Install the improved auto fill function, iff necessary."
(if auto-fill-function
- (setq auto-fill-function 'mmm-noweb-auto-fill-doc-chunk)))
+ ;; FIXME: Use add-function?
+ (setq auto-fill-function #'mmm-noweb-auto-fill-doc-chunk)))
(defun mmm-noweb-auto-fill-code-mode ()
"Install the default auto fill function, iff necessary."
(if auto-fill-function
- (setq auto-fill-function 'do-auto-fill)))
+ ;; FIXME: Use remove-function?
+ (setq auto-fill-function #'do-auto-fill)))
;;}}}
;;{{{ Functions on named chunks
@@ -365,7 +367,7 @@ chunks."
;; 'keymap', not 'local-map'
(overlay-put ovl 'keymap mmm-noweb-map))))
-(add-hook 'mmm-noweb-class-hook 'mmm-noweb-bind-keys)
+(add-hook 'mmm-noweb-class-hook #'mmm-noweb-bind-keys)
;; TODO: make this overlay go away if mmm is turned off
diff --git a/mmm-region.el b/mmm-region.el
index ec07853..db5dcc7 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -81,7 +81,7 @@ should be one of nil, `beg', `end', `none', or `all'.
* If TYPE is `end', return true for any overlay ending at POS but
false for any starting at POS.
* If TYPE is `all', return true for any overlay starting or ending at POS.
-* If TYPE is `none' \(or any other value), return false for any
+* If TYPE is `none' (or any other value), return false for any
overlay starting or ending at POS."
(let ((beg (overlay-start ovl))
(end (overlay-end ovl)))
@@ -105,8 +105,8 @@ should be one of nil, `beg', `end', `none', or `all'.
((and (> end pos) (< beg pos))
t))))
-;;; `mmm-overlays-in' has been retired as altogether too confusing a
-;;; name, when what is really meant is one of the following three:
+;; `mmm-overlays-in' has been retired as altogether too confusing a
+;; name, when what is really meant is one of the following three:
(defun mmm-overlays-containing (start stop)
"Return all MMM overlays containing the region START to STOP.
@@ -513,8 +513,6 @@ is non-nil, don't quit if the info is already there."
;; original values elsewhere.
(put mode 'mmm-fontify-region-function
font-lock-fontify-region-function)
- (put mode 'mmm-beginning-of-syntax-function
- syntax-begin-function)
(put mode 'mmm-syntax-propertize-function
(and (boundp 'syntax-propertize-function)
syntax-propertize-function))
@@ -561,15 +559,15 @@ different keymaps, syntax tables, local variables, etc.
for submodes."
(defun mmm-add-hooks ()
(if (featurep 'xemacs)
(make-local-hook 'post-command-hook))
- (add-hook 'post-command-hook 'mmm-update-submode-region nil t)
+ (add-hook 'post-command-hook #'mmm-update-submode-region nil t)
(when mmm-parse-when-idle
- (add-hook 'pre-command-hook 'mmm-mode-reset-timer nil t)
- (add-hook 'after-change-functions 'mmm-mode-edit nil t)))
+ (add-hook 'pre-command-hook #'mmm-mode-reset-timer nil t)
+ (add-hook 'after-change-functions #'mmm-mode-edit nil t)))
(defun mmm-remove-hooks ()
- (remove-hook 'post-command-hook 'mmm-update-submode-region t)
- (remove-hook 'pre-command-hook 'mmm-mode-reset-timer t)
- (remove-hook 'after-change-functions 'mmm-mode-edit t))
+ (remove-hook 'post-command-hook #'mmm-update-submode-region t)
+ (remove-hook 'pre-command-hook #'mmm-mode-reset-timer t)
+ (remove-hook 'after-change-functions #'mmm-mode-edit t))
;;}}}
;;{{{ Local Variables
@@ -701,18 +699,23 @@ region and mode for the previous position."
(defun mmm-refontify-maybe (&optional start stop)
"Re-fontify from START to STOP, or entire buffer, if enabled."
- (and font-lock-mode
- (if (or start stop)
- (font-lock-fontify-region (or start (point-min))
- (or stop (point-max)))
- (font-lock-fontify-buffer))))
+ (when font-lock-mode
+ (if (fboundp 'font-lock-flush)
+ (progn
+ (font-lock-flush start stop)
+ ;; FIXME: Do we really need to do this eagerly here?
+ (font-lock-ensure start stop))
+ (if (or start stop)
+ (font-lock-fontify-region (or start (point-min))
+ (or stop (point-max)))
+ (with-no-warnings (font-lock-fontify-buffer))))))
;;}}}
;;{{{ Get Submode Regions
-;;; In theory, these are general functions that have nothing to do
-;;; with font-lock, but they aren't used anywhere else, so we might as
-;;; well have them close.
+;; In theory, these are general functions that have nothing to do
+;; with font-lock, but they aren't used anywhere else, so we might as
+;; well have them close.
(defun mmm-submode-changes-in (start stop)
"Return a list of all submode-change positions from START to STOP.
@@ -789,8 +792,11 @@ of the REGIONS covers START to STOP."
(mmm-set-local-variables (or saved-mode mmm-primary-mode) saved-ovl)))
(when loudly (message nil)))
+(defvar syntax-ppss-cache)
+(defvar syntax-ppss-last)
+
(defun mmm-fontify-region-list (mode regions)
- "Fontify REGIONS, each like \(BEG END), in mode MODE."
+ "Fontify REGIONS, each like (BEG END), in mode MODE."
(save-excursion
(let ((func (get mode 'mmm-fontify-region-function))
font-lock-extend-region-functions)
@@ -807,6 +813,8 @@ of the REGIONS covers START to STOP."
mmm-current-overlay)
(save-restriction
(let ((font-lock-dont-widen t)
+ ;; FIXME: Messing with syntax-ppss-* vars should not
+ ;; be needed any more in Emacs≥26.
syntax-ppss-last syntax-ppss-cache)
;; TODO: Remove this conditional when cc-mode
;; respects submode boundaries.
@@ -840,6 +848,8 @@ calls each respective submode's
`syntax-propertize-function'."
(func (get mode 'mmm-syntax-propertize-function))
(beg (cadr elt)) (end (caddr elt))
(ovl (cadddr elt))
+ ;; FIXME: Messing with syntax-ppss-* vars should not
+ ;; be needed any more in Emacs≥26.
syntax-ppss-cache
syntax-ppss-last)
(goto-char beg)
@@ -864,7 +874,7 @@ calls each respective submode's
`syntax-propertize-function'."
;;}}}
;;{{{ Indentation
-(defvar mmm-indent-line-function 'mmm-indent-line
+(defvar mmm-indent-line-function #'mmm-indent-line
"The function to call to indent a line.
This will be the value of `indent-line-function' for the whole
buffer. It's supposed to delegate to the appropriate submode's
diff --git a/mmm-vars.el b/mmm-vars.el
index 1bd9ec2..1af7697 100644
--- a/mmm-vars.el
+++ b/mmm-vars.el
@@ -32,22 +32,26 @@
;;; Code:
(require 'mmm-compat)
+(require 'mmm-utils)
(require 'cl-lib)
;; MISCELLANEOUS
;;{{{ Shut up the Byte Compiler
;; Otherwise it complains about undefined variables.
-(eval-when-compile
- (defvar mmm-current-submode)
- (defvar mmm-save-local-variables)
- (defvar mmm-mode-string)
- (defvar mmm-submode-mode-line-format)
- (defvar mmm-mode-ext-classes-alist)
- (defvar mmm-mode-prefix-key)
- (defvar mmm-global-mode)
- (defvar mmm-primary-mode)
- (defvar mmm-classes-alist))
+(defvar mmm-current-submode)
+(defvar mmm-save-local-variables)
+(defvar mmm-mode-string)
+(defvar mmm-submode-mode-line-format)
+(defvar mmm-mode-ext-classes-alist)
+(defvar mmm-mode-prefix-key)
+(defvar mmm-global-mode)
+(defvar mmm-primary-mode)
+(defvar mmm-classes-alist)
+(defvar mmm-current-overlay)
+(declare-function mmm-apply-all "mmm-class")
+(declare-function mmm-set-class-parameter "mmm-class" (class param value))
+(declare-function mmm-get-class-parameter "mmm-class" (class param))
;;}}}
;;{{{ Error Conditions
@@ -733,7 +737,7 @@ available so that others can take advantage of the hack as
well.
Note that file local variables have *not* been processed by the time
this hook is run. If a function needs to inspect them, it should also
-be added to `find-file-hooks'. However, `find-file-hooks' is not run
+be added to `find-file-hook'. However, `find-file-hook' is not run
when creating a non-file-based buffer, or when changing major modes in
an existing buffer."
:group 'mmm
@@ -746,14 +750,14 @@ an existing buffer."
;;}}}
;;{{{ MMM Global Mode
-;;; There's a point to be made that this variable should default to
-;;; `maybe' (i.e. not nil and not t), because that's what practically
-;;; everyone wants. I subscribe, however, to the view that simply
-;;; *loading* a lisp extension should not change the (user-visible)
-;;; behavior of Emacs, until it is configured or turned on in some
-;;; way, which dictates that the default for this must be nil.
+;; There's a point to be made that this variable should default to
+;; `maybe' (i.e. not nil and not t), because that's what practically
+;; everyone wants. I subscribe, however, to the view that simply
+;; *loading* a lisp extension should not change the (user-visible)
+;; behavior of Emacs, until it is configured or turned on in some
+;; way, which dictates that the default for this must be nil.
(defcustom mmm-global-mode nil
- "*Specify in which buffers to turn on MMM Mode automatically.
+ "Specify in which buffers to turn on MMM Mode automatically.
- If nil, MMM Mode is never enabled automatically.
- If t, MMM Mode is enabled automatically in all buffers.
@@ -812,7 +816,7 @@ than it solves, but some modes require it.")
(defvar mmm-mode-buffer-dirty nil "Private variable.")
(make-variable-buffer-local 'mmm-mode-buffer-dirty)
-(defun mmm-mode-edit (beg end len)
+(defun mmm-mode-edit (_beg _end _len)
(setq mmm-mode-buffer-dirty t)
(mmm-mode-reset-timer))
@@ -1097,7 +1101,7 @@ Uses `mmm-mode-ext-classes-alist' to find submode
classes."
(setq mmm-mode-ext-classes nil))
(defun mmm-mode-ext-applies (element)
- (cl-destructuring-bind (mode ext class) element
+ (cl-destructuring-bind (mode ext _class) element
(and (if mode
(eq mode
;; If MMM is on in this buffer, use the primary mode,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/mmm-mode cd7d38f: Fix various compiler warnings and other cosmetic details,
Stefan Monnier <=