summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poly-lock.el26
-rw-r--r--polymode-base.el2
-rw-r--r--polymode-classes.el8
-rw-r--r--polymode-compat.el18
-rw-r--r--polymode-core.el45
-rw-r--r--polymode-debug.el27
-rw-r--r--polymode-export.el5
-rw-r--r--polymode-methods.el8
-rw-r--r--polymode-tangle.el2
-rw-r--r--polymode-test-utils.el2
-rw-r--r--polymode-weave.el3
-rw-r--r--polymode.el34
-rw-r--r--template/poly-xyz.el2
-rw-r--r--template/targets/utils.el43
-rw-r--r--tests/compat-tests.el8
-rw-r--r--tests/define-tests.el2
-rw-r--r--tests/poly-modes-tests.el3
-rw-r--r--tests/span-matcher-tests.el4
18 files changed, 145 insertions, 97 deletions
diff --git a/poly-lock.el b/poly-lock.el
index e6547b4..9869260 100644
--- a/poly-lock.el
+++ b/poly-lock.el
@@ -1,6 +1,6 @@
;;; poly-lock.el --- Font lock sub-system for polymode -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -121,14 +121,14 @@ switched on."
;; register extra functionality. [Unfortunately `jit-lock-register'
;; calls `jit-lock-mode' which we don't want. Hence the advice. TOTHINK:
;; Simply add-hook to `jit-lock-functions'?]
- (jit-lock-register 'font-lock-fontify-region)
+ (jit-lock-register #'font-lock-fontify-region)
;; don't allow other functions
(setq-local fontification-functions '(poly-lock-function))
- (setq-local font-lock-flush-function 'poly-lock-flush)
- (setq-local font-lock-fontify-buffer-function 'poly-lock-flush)
- (setq-local font-lock-ensure-function 'poly-lock-fontify-now)
+ (setq-local font-lock-flush-function #'poly-lock-flush)
+ (setq-local font-lock-fontify-buffer-function #'poly-lock-flush)
+ (setq-local font-lock-ensure-function #'poly-lock-fontify-now)
;; There are some more, jit-lock doesn't change those, neither do we:
;; font-lock-unfontify-region-function (defaults to font-lock-default-unfontify-region)
@@ -144,19 +144,19 @@ switched on."
(font-lock-default-function arg)
;; Must happen after call to `font-lock-default-function'
- (remove-hook 'after-change-functions 'font-lock-after-change-function t)
- (remove-hook 'after-change-functions 'jit-lock-after-change t)
- (add-hook 'after-change-functions 'poly-lock-after-change nil t)
+ (remove-hook 'after-change-functions #'font-lock-after-change-function t)
+ (remove-hook 'after-change-functions #'jit-lock-after-change t)
+ (add-hook 'after-change-functions #'poly-lock-after-change nil t)
;; Reusing jit-lock var becuase modes populate it directly. We are using
;; this in `poly-lock-after-change' below. Taken from `jit-lock
;; initialization.
(add-hook 'jit-lock-after-change-extend-region-functions
- 'font-lock-extend-jit-lock-region-after-change
+ #'font-lock-extend-jit-lock-region-after-change
nil t))
- (remove-hook 'after-change-functions 'poly-lock-after-change t)
- (remove-hook 'fontification-functions 'poly-lock-function t))
+ (remove-hook 'after-change-functions #'poly-lock-after-change t)
+ (remove-hook 'fontification-functions #'poly-lock-function t))
(current-buffer))
(defvar poly-lock-chunk-size 2500
@@ -492,7 +492,7 @@ Assumes widen buffer. Sets `jit-lock-start' and `jit-lock-end'."
(put-text-property jit-lock-start jit-lock-end 'fontified nil))))))))))
(defun poly-lock-after-change (beg end old-len)
- "Mark changed region with 'fontified nil.
+ "Mark changed region with `fontified' nil.
Extend the region to spans which need to be updated. BEG, END and
OLD-LEN are as in `after-change-functions'. When
`poly-lock-defer-after-change' is non-nil (the default), run fontification"
@@ -546,7 +546,7 @@ OLD-LEN are as in `after-change-functions'. When
(declare-function pm-get-adjust-face "polymode-methods")
(defvar poly-lock--extra-span-props (when (fboundp 'set-face-extend) (list :extend t)))
(defun poly-lock-adjust-span-face (span)
- "Adjust 'face property of SPAN..
+ "Adjust `face' property of SPAN..
How adjustment is made is defined in :adjust-face slot of the
SPAN's chunkmode."
(interactive "r")
diff --git a/polymode-base.el b/polymode-base.el
index b3dd741..1085e20 100644
--- a/polymode-base.el
+++ b/polymode-base.el
@@ -1,6 +1,6 @@
;;; polymode-base.el --- Root Host and Polymode Configuration Objects -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
diff --git a/polymode-classes.el b/polymode-classes.el
index b509446..fd83341 100644
--- a/polymode-classes.el
+++ b/polymode-classes.el
@@ -1,6 +1,6 @@
;;; polymode-classes.el --- Core polymode classes -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -295,7 +295,7 @@ the trailing white spaces if any.")
(adjust-face
:initarg :adjust-face
:initform nil
- :type (or number face list)
+ :type (or number symbol list)
:custom (choice number face sexp)
:documentation
"Fontification adjustment for the body of the chunk.
@@ -435,7 +435,7 @@ forward). See `pm-forward-sexp-tail-matcher' for an example.")
(head-adjust-face
:initarg :head-adjust-face
:initform 'bold
- :type (or number face list)
+ :type (or number symbol list)
:custom (choice number face sexp)
:documentation
"Head's face adjustment.
@@ -443,7 +443,7 @@ Can be a number, a list of properties or a face.")
(tail-adjust-face
:initarg :tail-adjust-face
:initform nil
- :type (or null number face list)
+ :type (or null number symbol list)
:custom (choice (const :tag "From Head" nil)
number face sexp)
:documentation
diff --git a/polymode-compat.el b/polymode-compat.el
index 227a022..fa392e9 100644
--- a/polymode-compat.el
+++ b/polymode-compat.el
@@ -2,7 +2,7 @@
;;
;; Author: Vitalie Spinu
;; Maintainer: Vitalie Spinu
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Version: 0.1
;; URL: https://github.com/polymode/polymode
;; Keywords: emacs
@@ -183,7 +183,7 @@ are passed to ORIG-FUN."
-;;; LSP (lsp-mode and elglot)
+;;; LSP (lsp-mode and eglot)
;;
;; Emacs modifications `after-change-functions' to LSP insertions
;; https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_didChange
@@ -328,7 +328,7 @@ are passed to ORIG-FUN."
(or (car (get-text-property beg :pm-span))
(car (get-text-property end :pm-span))))
(add-hook 'flyspell-incorrect-hook
- 'pm--flyspel-dont-highlight-in-chunkmodes nil t)
+ #'pm--flyspel-dont-highlight-in-chunkmodes nil t)
;;; C/C++/Java
(pm-around-advice 'c-before-context-fl-expand-region #'pm-override-output-cons)
@@ -475,8 +475,8 @@ This is done by modifying `uniquify-buffer-base-name' to `pm--core-buffer-name'.
(null buffer-undo-tree))
(setq buffer-undo-tree (make-undo-tree))))
-(eval-after-load 'undo-tree
- '(add-hook 'polymode-init-inner-hook 'polymode-init-undo-tree-maybe))
+(with-eval-after-load 'undo-tree
+ (add-hook 'polymode-init-inner-hook #'polymode-init-undo-tree-maybe))
;;; EVIL
@@ -490,8 +490,8 @@ This is done by modifying `uniquify-buffer-base-name' to `pm--core-buffer-name'.
(with-current-buffer new-buffer
(evil-change-state old-state))))))
-(eval-after-load 'evil-core
- '(add-hook 'polymode-after-switch-buffer-hook 'polymode-switch-buffer-keep-evil-state-maybe))
+(with-eval-after-load 'evil-core
+ (add-hook 'polymode-after-switch-buffer-hook #'polymode-switch-buffer-keep-evil-state-maybe))
;;; HL line
@@ -507,8 +507,8 @@ This is done by modifying `uniquify-buffer-base-name' to `pm--core-buffer-name'.
(hl-line-unhighlight))
(when global-hl-line-mode
(global-hl-line-unhighlight))))
-(eval-after-load 'hl-line
- '(add-hook 'polymode-after-switch-buffer-hook 'polymode-switch-buffer-hl-unhighlight))
+(with-eval-after-load 'hl-line
+ (add-hook 'polymode-after-switch-buffer-hook #'polymode-switch-buffer-hl-unhighlight))
;;; YAS
diff --git a/polymode-core.el b/polymode-core.el
index 1fd25ec..602809f 100644
--- a/polymode-core.el
+++ b/polymode-core.el
@@ -1,6 +1,6 @@
;; polymode-core.el --- Core initialization and utilities for polymode -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -121,9 +121,9 @@
(defvar-local polymode-default-inner-mode nil
"Inner mode for chunks with unspecified modes.
Intended to be used as local variable in polymode buffers. A
-special value 'host means use the host mode.")
+special value `host' means use the host mode.")
;;;###autoload
-(put 'polymode-default-inner-mode 'safe-local-variable 'symbolp)
+(put 'polymode-default-inner-mode 'safe-local-variable #'symbolp)
(defgroup polymode nil
"Object oriented framework for multiple modes based on indirect buffers"
@@ -196,7 +196,7 @@ will cause installation of `ess-julia-mode' in markdown ```julia chunks."
"An alist of abbreviation mappings from mode names to their abbreviations.
Used to compute mode post-fixes in buffer names. Example:
- (add-to-list 'polymode-mode-abbrevs-aliases '(\"ess-r\" . \"R\"))")
+ (add-to-list \\='polymode-mode-abbrevs-aliases \\='(\"ess-r\" . \"R\"))")
(defvar polymode-before-switch-buffer-hook nil
"Hook run just before switching to a different polymode buffer.
@@ -388,6 +388,8 @@ case TYPE is ignored."
(t 'tail)))
(t (error "Type must be one of nil, 'host, 'head, 'tail or 'body")))))))
+(defvar pm-use-cache t)
+
(defun pm-cache-span (span)
;; cache span
(when pm-use-cache
@@ -572,8 +574,7 @@ the front)."
(not (eq span (get-text-property (1- beg) :pm-span)))))
(pm--chop-span (copy-sequence span) omin omax))))))))
-(define-obsolete-function-alias 'pm-get-innermost-span 'pm-innermost-span "2018-08")
-(defvar pm-use-cache t)
+(define-obsolete-function-alias 'pm-get-innermost-span #'pm-innermost-span "2018-08")
(defun pm-innermost-span (&optional pos no-cache)
"Get span object at POS.
If NO-CACHE is non-nil, don't use cache and force re-computation
@@ -592,7 +593,7 @@ defaults to point. Guarantied to return a non-empty span."
(defun pm-span-to-range (span)
(and span (cons (nth 1 span) (nth 2 span))))
-(define-obsolete-function-alias 'pm-get-innermost-range 'pm-innermost-range "2018-08")
+(define-obsolete-function-alias 'pm-get-innermost-range #'pm-innermost-range "2018-08")
(defun pm-innermost-range (&optional pos no-cache)
(pm-span-to-range (pm-innermost-span pos no-cache)))
@@ -617,7 +618,7 @@ MATCHER is one of the forms accepted by \=`pm-inner-chunkmode''s
(match-end (cdr matcher))))))
(t (error "Head and tail matchers must be either regexp strings, cons cells or functions"))))
-(defun pm-forward-sexp-tail-matcher (arg)
+(defun pm-forward-sexp-tail-matcher (_arg)
"A simple tail matcher for a common closing-sexp character.
Use this matcher if an inner mode is delimited by a closing
construct like ${...}, xyz[...], html! {...} etc. In order to
@@ -1375,13 +1376,13 @@ Placed with high priority in `after-change-functions' hook."
(when (buffer-live-p buff)
(with-current-buffer buff
;; micro-optimization to avoid calling the flush twice
- (when (memq 'syntax-ppss-flush-cache before-change-functions)
- (remove-hook 'before-change-functions 'syntax-ppss-flush-cache t))
+ (when (memq #'syntax-ppss-flush-cache before-change-functions)
+ (remove-hook 'before-change-functions #'syntax-ppss-flush-cache t))
;; need to be the first to avoid breaking preceding hooks
(unless (eq (car after-change-functions)
- 'polymode-flush-syntax-ppss-cache)
- (delq 'polymode-flush-syntax-ppss-cache after-change-functions)
- (setq after-change-functions (cons 'polymode-flush-syntax-ppss-cache
+ #'polymode-flush-syntax-ppss-cache)
+ (delq #'polymode-flush-syntax-ppss-cache after-change-functions)
+ (setq after-change-functions (cons #'polymode-flush-syntax-ppss-cache
after-change-functions)))
(syntax-ppss-flush-cache beg end)
;; Check if something has changed our hooks. (Am I theoretically paranoid or
@@ -1587,9 +1588,9 @@ If FUN is a list, apply ADVICE to each element of it."
(defun polymode-inhibit-in-indirect-buffers (orig-fun &rest args)
"Don't run ORIG-FUN (with ARGS) in polymode indirect buffers (aka inner modes).
Use this function to around advice delicate functions:
- (advice-add #'xyz :around #'polymode-inhibit-in-indirect-buffers)
+ (advice-add \\='xyz :around #\\='polymode-inhibit-in-indirect-buffers)
or with `pm-around-advice' which allows for multiple advises at once:
- (pm-around-advice '(foo bar) #'polymode-inhibit-in-indirect-buffers)"
+ (pm-around-advice \\='(foo bar) #\\='polymode-inhibit-in-indirect-buffers)"
(unless (and polymode-mode (buffer-base-buffer))
(apply orig-fun args)))
@@ -1597,10 +1598,10 @@ or with `pm-around-advice' which allows for multiple advises at once:
"Switch to base buffer and apply ORIG-FUN to ARGS.
Use this function to around advice of functions that should run
in base buffer only like this:
- (advice-add #'foo :around #'polymode-with-current-base-buffer)
+ (advice-add \\='foo :around #\\='polymode-with-current-base-buffer)
or with `pm-around-advice' which allows for multiple advises at
once:
- (pm-around-advice '(foo bar) #'polymode-with-current-base-buffer)"
+ (pm-around-advice \\='(foo bar) #\\='polymode-with-current-base-buffer)"
(if (and polymode-mode
(not pm--killed)
(buffer-live-p (buffer-base-buffer)))
@@ -1627,9 +1628,9 @@ once:
;; Most importat Core
;; (pm-around-advice #'kill-buffer #'polymode-with-current-base-buffer)
-(pm-around-advice #'find-alternate-file #'polymode-with-current-base-buffer)
-(pm-around-advice #'write-file #'polymode-with-current-base-buffer)
-(pm-around-advice #'basic-save-buffer #'polymode-with-current-base-buffer)
+(pm-around-advice 'find-alternate-file #'polymode-with-current-base-buffer)
+(pm-around-advice 'write-file #'polymode-with-current-base-buffer)
+(pm-around-advice 'basic-save-buffer #'polymode-with-current-base-buffer)
;;; FILL
@@ -1803,9 +1804,9 @@ ARG is the same as in `forward-paragraph'"
;; (when polymode-mode
;; (pm--reset-ppss-cache (pm-innermost-span pos))))
-;; (advice-add #'syntax-ppss :before #'polymode-reset-ppss-cache)
+;; (advice-add 'syntax-ppss :before #'polymode-reset-ppss-cache)
;; (unless pm--emacs>26
-;; (advice-add #'syntax-ppss :before #'polymode-reset-ppss-cache))
+;; (advice-add 'syntax-ppss :before #'polymode-reset-ppss-cache))
;; (defun polymode-restrict-syntax-propertize-extension (orig-fun beg end)
;; (if (and polymode-mode pm/polymode)
diff --git a/polymode-debug.el b/polymode-debug.el
index 5266020..008253c 100644
--- a/polymode-debug.el
+++ b/polymode-debug.el
@@ -1,6 +1,6 @@
;;; polymode-debug.el --- Interactive debugging utilities for polymode -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2016-2018 Vitalie Spinu
+;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -81,21 +81,20 @@
Key bindings:
\\{pm-debug-minor-mode-map}"
- nil
- " PMDBG"
+ :lighter " PMDBG"
:group 'polymode
(if pm-debug-minor-mode
(progn
;; this is global hook. No need to complicate with local hooks
- (add-hook 'post-command-hook 'pm-debug-highlight-current-span)
- ;; (add-hook 'before-save-hook 'pm-debug-beore-change -99 t)
- ;; (add-hook 'after-save-hook 'pm-debug-after-change -99)
+ (add-hook 'post-command-hook #'pm-debug-highlight-current-span)
+ ;; (add-hook 'before-save-hook #'pm-debug-beore-change -99 t)
+ ;; (add-hook 'after-save-hook #'pm-debug-after-change -99)
)
- ;; (remove-hook 'before-save-hook 'pm-debug-beore-change)
- ;; (remove-hook 'after-save-hook 'pm-debug-after-change)
+ ;; (remove-hook 'before-save-hook #'pm-debug-beore-change)
+ ;; (remove-hook 'after-save-hook #'pm-debug-after-change)
(delete-overlay pm--underline-overlay)
(delete-overlay pm--highlight-overlay)
- (remove-hook 'post-command-hook 'pm-debug-highlight-current-span)))
+ (remove-hook 'post-command-hook #'pm-debug-highlight-current-span)))
;; use to track point movements (#295)
(defun pm--debug-report-point (msg &optional r)
@@ -105,7 +104,9 @@ Key bindings:
(pm-base-buffer) (with-current-buffer (pm-base-buffer) (point))
(buffer-name) (point)
(get-buffer-window (pm-base-buffer))
- (with-current-buffer (pm-base-buffer) (window-point)) (window-point))))
+ (with-current-buffer (pm-base-buffer) (window-point))
+ ;; FIXME: This arg is not used.
+ (window-point))))
;; (defun pm-debug-beore-change (&rest r)
;; (pm--debug-report-point "|before|" this-command))
@@ -468,8 +469,8 @@ currently traced functions."
;;;###autoload
(defun pm-debug-relevant-variables (&optional out-type)
"Get the relevant polymode variables.
-If OUT-TYPE is 'buffer, print the variables in the dedicated
-buffer, if 'message issue a message, if nil just return a list of values."
+If OUT-TYPE is `buffer', print the variables in the dedicated buffer,
+if `message' issue a message, if nil just return a list of values."
(interactive (list 'buffer))
(let* ((cbuff (current-buffer))
(vars (cl-loop for v on pm-debug-relevant-variables by #'cddr
@@ -588,7 +589,7 @@ On prefix NO-CACHE don't use cached spans."
(save-excursion
(goto-char (point-max))
(insert "\n")
- (insert (apply 'format (concat "%f [%s at %d]: " msg)
+ (insert (apply #'format (concat "%f [%s at %d]: " msg)
(float-time) cbuf cpos args))))))
(provide 'polymode-debug)
diff --git a/polymode-export.el b/polymode-export.el
index 86091d1..ac4ce72 100644
--- a/polymode-export.el
+++ b/polymode-export.el
@@ -1,6 +1,6 @@
;;; polymode-export.el --- Exporting facilities for polymodes -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -31,6 +31,7 @@
(require 'polymode-core)
(require 'polymode-classes)
+(eval-when-compile (require 'polymode-weave)) ;Silence "unknown slot from-to".
(defgroup polymode-export nil
"Polymode Exporters"
@@ -39,7 +40,6 @@
(defcustom polymode-exporter-output-file-format "%s-exported"
"Format of the exported files.
%s is substituted with the current file name sans extension."
- :group 'polymode-export
:type 'string)
(defclass pm-exporter (pm-root)
@@ -442,7 +442,6 @@ for each polymode in CONFIGS."
:function 'pm-default-shell-export-function
:sentinel 'pm-default-shell-export-sentinel)
"Pandoc exporter."
- :group 'polymode-export
:type 'object)
(provide 'polymode-export)
diff --git a/polymode-methods.el b/polymode-methods.el
index eadd92c..0fd9841 100644
--- a/polymode-methods.el
+++ b/polymode-methods.el
@@ -1,6 +1,6 @@
;;; polymode-methods.el --- Methods for polymode classes -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -201,7 +201,7 @@ initialized. Return the buffer."
(add-hook 'after-change-functions #'polymode-after-change 95 t)
;; FONT LOCK (see poly-lock.el)
- (setq-local font-lock-function 'poly-lock-mode)
+ (setq-local font-lock-function #'poly-lock-mode)
;; Font lock is a globalized minor mode and is thus initialized in
;; `after-change-major-mode-hook' within `run-mode-hooks'. As a result
;; poly-lock won't get installed if polymode is installed as a minor mode or
@@ -328,7 +328,7 @@ Create and initialize the buffer if does not exist yet.")
Return a list of three elements (TYPE BEG END OBJECT) where TYPE
is a symbol representing the type of the span surrounding
POS (head, tail, body). BEG and END are the coordinates of the
-span. OBJECT is a suitable object which is 'responsible' for this
+span. OBJECT is a suitable object which is `responsible' for this
span. This is an object that could be dispatched upon with
`pm-select-buffer'. Should return nil if there is no SUBMODE
specific span around POS. Not to be used in programs directly;
@@ -343,7 +343,7 @@ Host modes usually do not compute spans."
(cl-defmethod pm-get-span ((chunkmode pm-inner-chunkmode) &optional pos)
"Return a list of the form (TYPE POS-START POS-END SELF).
-TYPE can be 'body, 'head or 'tail. SELF is the CHUNKMODE."
+TYPE can be `body', `head' or `tail'. SELF is the CHUNKMODE."
(with-slots (head-matcher tail-matcher head-mode tail-mode) chunkmode
(let ((span (pm--span-at-point head-matcher tail-matcher pos
(eieio-oref chunkmode 'can-overlap))))
diff --git a/polymode-tangle.el b/polymode-tangle.el
index 2e76807..7f46a1e 100644
--- a/polymode-tangle.el
+++ b/polymode-tangle.el
@@ -1,6 +1,6 @@
;;; polymode-tangle.el --- Tangling facilities for polymodes (stump) -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
diff --git a/polymode-test-utils.el b/polymode-test-utils.el
index 9e198cb..6f8141c 100644
--- a/polymode-test-utils.el
+++ b/polymode-test-utils.el
@@ -1,6 +1,6 @@
;;; polymode-test-utils.el --- Testing utilities for polymode -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2018-2019, Vitalie Spinu
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
diff --git a/polymode-weave.el b/polymode-weave.el
index 49b4b23..a06d389 100644
--- a/polymode-weave.el
+++ b/polymode-weave.el
@@ -1,6 +1,6 @@
;;; polymode-weave.el --- Weaving facilities for polymodes -*- lexical-binding: t -*-
;;
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Vitalie Spinu
;; URL: https://github.com/polymode/polymode
;;
@@ -38,7 +38,6 @@
(defcustom polymode-weaver-output-file-format "%s-woven"
"Format of the weaved files.
%s is substituted with the current file name sans extension."
- :group 'polymode-weave
:type 'string)
(defclass pm-weaver (pm-root)
diff --git a/polymode.el b/polymode.el
index f0bd626..6845ebd 100644
--- a/polymode.el
+++ b/polymode.el
@@ -1,8 +1,8 @@
;;; polymode.el --- Extensible framework for multiple major modes -*- lexical-binding: t -*-
;;
;; Author: Vitalie Spinu
-;; Maintainer: Vitalie Spinu
-;; Copyright (C) 2013-2019, Vitalie Spinu
+;; Maintainer: Vitalie Spinu <spinuvit@gmail.com>
+;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Version: 0.2.2
;; Package-Requires: ((emacs "25"))
;; URL: https://github.com/polymode/polymode
@@ -56,22 +56,22 @@ Not effective after loading the polymode library.")
;; eval
(define-key map "v" 'polymode-eval-map)
;; navigation
- (define-key map "\C-n" 'polymode-next-chunk)
- (define-key map "\C-p" 'polymode-previous-chunk)
- (define-key map "\C-\M-n" 'polymode-next-chunk-same-type)
- (define-key map "\C-\M-p" 'polymode-previous-chunk-same-type)
+ (define-key map "\C-n" #'polymode-next-chunk)
+ (define-key map "\C-p" #'polymode-previous-chunk)
+ (define-key map "\C-\M-n" #'polymode-next-chunk-same-type)
+ (define-key map "\C-\M-p" #'polymode-previous-chunk-same-type)
;; chunk manipulation
- (define-key map "\M-k" 'polymode-kill-chunk)
- (define-key map "\M-m" 'polymode-mark-or-extend-chunk)
- (define-key map "\C-t" 'polymode-toggle-chunk-narrowing)
+ (define-key map "\M-k" #'polymode-kill-chunk)
+ (define-key map "\M-m" #'polymode-mark-or-extend-chunk)
+ (define-key map "\C-t" #'polymode-toggle-chunk-narrowing)
;; backends
- (define-key map "e" 'polymode-export)
- (define-key map "E" 'polymode-set-exporter)
- (define-key map "w" 'polymode-weave)
- (define-key map "W" 'polymode-set-weaver)
- (define-key map "t" 'polymode-tangle)
- (define-key map "T" 'polymode-set-tangler)
- (define-key map "$" 'polymode-show-process-buffer)
+ (define-key map "e" #'polymode-export)
+ (define-key map "E" #'polymode-set-exporter)
+ (define-key map "w" #'polymode-weave)
+ (define-key map "W" #'polymode-set-weaver)
+ (define-key map "t" #'polymode-tangle)
+ (define-key map "T" #'polymode-set-tangler)
+ (define-key map "$" #'polymode-show-process-buffer)
map)
"Polymode prefix map.
Lives on `polymode-prefix-key' in polymode buffers.")
@@ -658,7 +658,7 @@ most frequently used slots are:
(define-minor-mode polymode-minor-mode
"Polymode minor mode, used to make everything work."
- nil " PM")
+ :lighter " PM")
(define-derived-mode poly-head-tail-mode prog-mode "HeadTail"
"Default major mode for polymode head and tail spans."
diff --git a/template/poly-xyz.el b/template/poly-xyz.el
index d4669fc..dda40c0 100644
--- a/template/poly-xyz.el
+++ b/template/poly-xyz.el
@@ -2,7 +2,7 @@
;;
;; Author: Vitalie Spinu
;; Maintainer: Vitalie Spinu
-;; Copyright (C) 2018 Vitalie Spinu
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
;; Version: 0.1
;; Package-Requires: ((emacs "25") (polymode "__POLYMODE_VERSION__"))
;; URL: https://github.com/polymode/__MODULE__
diff --git a/template/targets/utils.el b/template/targets/utils.el
index 9b4e84d..77a2368 100644
--- a/template/targets/utils.el
+++ b/template/targets/utils.el
@@ -1,3 +1,29 @@
+;;; targets/utils.el --- Utility functions for Polymode makefile -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Vitalie Spinu
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; FIXME: This file should be folded into the (merged) poly-targets.el
+
+;;; Code:
+
(defun polymode-library-deps (file)
(let ((deps (let ((file (expand-file-name "targets/deps")))
@@ -9,18 +35,21 @@
(insert-file-contents file)
(goto-char (point-min))
(when (re-search-forward "Package-Requires:" nil t)
- (car (read-from-string (buffer-substring (point) (point-at-eol))))))))
+ (car (read-from-string
+ (buffer-substring (point) (point-at-eol))))))))
(delq 'emacs (delete-dups (append deps (mapcar #'car deps-requires))))))
(defun polymode-add-deps-to-load-path (file)
;; add .ELPA packages
- (let ((elpa-dirs (directory-files (expand-file-name (format ".ELPA/%s" emacs-version)) t)))
+ (let ((elpa-dirs (directory-files
+ (expand-file-name emacs-version ".ELPA") t)))
(setq load-path (append elpa-dirs load-path)))
;; add all poly* and deps in the parent directory and overate any in the .ELPA
(let* ((deps (cons 'poly (polymode-library-deps file)))
(regx (format "^\\(%s\\)" (mapconcat #'symbol-name deps "\\|")))
- (local-dirs (directory-files (file-name-directory (directory-file-name default-directory))
+ (local-dirs (directory-files (file-name-directory
+ (directory-file-name default-directory))
t regx)))
(setq load-path (append local-dirs load-path))))
@@ -47,13 +76,17 @@
(dolist (package deps)
(if (package-installed-p package)
(when (package-outdated-p package)
- (package-install-from-archive (cadr (assq package package-archive-contents))))
+ (package-install-from-archive
+ (cadr (assq package package-archive-contents))))
(package-install package)))
(message "INSTALLED DEPS: %s"
(mapconcat
(lambda (pkg)
(format "%s:%S" pkg
- (package-desc-version (cadr (assq pkg package-archive-contents)))))
+ (package-desc-version
+ (cadr (assq pkg package-archive-contents)))))
deps
" "))))
+
+;;; targets/utils.el ends here
diff --git a/tests/compat-tests.el b/tests/compat-tests.el
index c8b97da..1607efb 100644
--- a/tests/compat-tests.el
+++ b/tests/compat-tests.el
@@ -1,4 +1,8 @@
-(require 'poly-markdown)
+;;; compat-tests.el -- Tests for Polymode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+(require 'poly-markdown nil t) ;Don't fail if not installed.
(define-innermode poly-test-markdown-inline-python-innermode poly-markdown-inline-code-innermode
:head-matcher (cons "[^`]\\(`py \\)" 1)
@@ -12,6 +16,7 @@
poly-test-markdown-inline-python-innermode))
(ert-deftest compat/lsp/lsp-text ()
+ (skip-unless (fboundp 'poly-markdown-mode))
(let ((markdown-enable-math t))
(pm-test-run-on-file poly-test-markdown-mode "test.md"
;; python
@@ -106,6 +111,7 @@
(ert-deftest compat/indent/double-poly-mode-init-preserves-original-functions ()
+ (skip-unless (fboundp 'poly-markdown-mode))
(pm-test-run-on-file poly-test-markdown-mode "test.md"
(goto-char (point-min))
(pm-switch-to-buffer)
diff --git a/tests/define-tests.el b/tests/define-tests.el
index 26f7278..976ab44 100644
--- a/tests/define-tests.el
+++ b/tests/define-tests.el
@@ -1,5 +1,7 @@
;;; mode-init-tests.el --- Various initialization tests -*- lexical-binding: t -*-
+;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
+
(require 'polymode)
(require 'polymode-test-utils)
diff --git a/tests/poly-modes-tests.el b/tests/poly-modes-tests.el
index 0a093e1..43e4b6f 100644
--- a/tests/poly-modes-tests.el
+++ b/tests/poly-modes-tests.el
@@ -1,3 +1,6 @@
+;;; poly-modes-tests.el -- Tests for Polymode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
;; load all tests from individual poly-xyz repositories located in the parent of
;; this repository
diff --git a/tests/span-matcher-tests.el b/tests/span-matcher-tests.el
index bd36d06..6557f47 100644
--- a/tests/span-matcher-tests.el
+++ b/tests/span-matcher-tests.el
@@ -1,3 +1,7 @@
+;;; poly-modes-tests.el -- Tests for Polymode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
+
(require 'polymode-test-utils)
(defvar markdown-inline-head-fun-matcher (pm-fun-matcher (cons "[^`]\\(`{?[[:alpha:]+-]+\\)[ \t]" 1)))