summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/elisp-mode.el3
-rw-r--r--lisp/progmodes/f90.el12
-rw-r--r--lisp/progmodes/flymake-proc.el2
-rw-r--r--lisp/progmodes/flymake.el61
-rw-r--r--lisp/progmodes/python.el5
5 files changed, 55 insertions, 28 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 99a4841e318..41415943a58 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1693,7 +1693,8 @@ current buffer state and calls REPORT-FN when done."
(when (eq (process-status proc) 'exit)
(unwind-protect
(cond
- ((not (eq proc elisp-flymake--byte-compile-process))
+ ((not (eq proc (with-current-buffer source-buffer
+ elisp-flymake--byte-compile-process)))
(flymake-log :warning "byte-compile process %s obsolete" proc))
((zerop (process-exit-status proc))
(elisp-flymake--byte-compile-done report-fn
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index 6421ba60dce..72156288eba 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -909,6 +909,8 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
"Regexp matching the definition of a derived type.")
+;; Maybe this should include "class default", but the constant is no
+;; longer used.
(defconst f90-typeis-re
"\\_<\\(class\\|type\\)[ \t]*is[ \t]*("
"Regexp matching a CLASS/TYPE IS statement.")
@@ -955,10 +957,14 @@ Used in the F90 entry in `hs-special-modes-alist'.")
;; Avoid F2003 "type is" in "select type",
;; and also variables of derived type "type (foo)".
;; "type, foo" must be a block (?).
+ ;; And a partial effort to avoid "class default".
"\\(?:type\\|class\\)[ \t,]\\("
- "[^i(!\n\"& \t]\\|" ; not-i(
+ "[^id(!\n\"& \t]\\|" ; not-id(
"i[^s!\n\"& \t]\\|" ; i not-s
- "is\\(?:\\sw\\|\\s_\\)\\)\\|"
+ "d[^e!\n\"& \t]\\|" ; d not-e
+ "de[^f!\n\"& \t]\\|" ; de not-f
+ "def[^a!\n\"& \t]\\|" ; def not-a
+ "\\(?:is\\|default\\)\\(?:\\sw\\|\\s_\\)\\)\\|"
;; "abstract interface" is F2003; "submodule" is F2008.
"program\\|\\(?:abstract[ \t]*\\)?interface\\|\\(?:sub\\)?module\\|"
;; "enum", but not "enumerator".
@@ -1454,7 +1460,7 @@ if all else fails."
(not (or (looking-at "end")
(looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
\\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\
-\\(?:class\\|type\\)[ \t]*is\\|\
+\\(?:class\\|type\\)[ \t]*is\\|class[ \t]*default\\|\
block\\|critical\\|enum\\|associate\\)\\_>")
(looking-at "\\(program\\|\\(?:sub\\)?module\\|\
\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>")
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index ab60855b217..a9caef4fc8e 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -20,7 +20,7 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 8c9c4b211a2..3c588f02fa6 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -20,7 +20,7 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
@@ -48,7 +48,8 @@
(require 'thingatpt) ; end-of-thing
(require 'warnings) ; warning-numeric-level, display-warning
(require 'compile) ; for some faces
-(require 'subr-x) ; when-let*, if-let*, hash-table-keys, hash-table-values
+;; when-let*, if-let*, hash-table-keys, hash-table-values:
+(eval-when-compile (require 'subr-x))
(defgroup flymake nil
"Universal on-the-fly syntax checker."
@@ -228,6 +229,29 @@ TYPE is a key to `flymake-diagnostic-types-alist' and TEXT is a
description of the problem detected in this region."
(flymake--diag-make :buffer buffer :beg beg :end end :type type :text text))
+;;;###autoload
+(defun flymake-diagnostics (&optional beg end)
+ "Get Flymake diagnostics in region determined by BEG and END.
+
+If neither BEG or END is supplied, use the whole buffer,
+otherwise if BEG is non-nil and END is nil, consider only
+diagnostics at BEG."
+ (mapcar (lambda (ov) (overlay-get ov 'flymake-diagnostic))
+ (flymake--overlays :beg beg :end end)))
+
+(defmacro flymake--diag-accessor (public internal thing)
+ "Make PUBLIC an alias for INTERNAL, add doc using THING."
+ `(defsubst ,public (diag)
+ ,(format "Get Flymake diagnostic DIAG's %s." (symbol-name thing))
+ (,internal diag)))
+
+(flymake--diag-accessor flymake-diagnostic-buffer flymake--diag-buffer buffer)
+(flymake--diag-accessor flymake-diagnostic-text flymake--diag-text text)
+(flymake--diag-accessor flymake-diagnostic-type flymake--diag-type type)
+(flymake--diag-accessor flymake-diagnostic-beg flymake--diag-beg beg)
+(flymake--diag-accessor flymake-diagnostic-end flymake--diag-end end)
+(flymake--diag-accessor flymake-diagnostic-backend flymake--diag-backend backend)
+
(cl-defun flymake--overlays (&key beg end filter compare key)
"Get flymake-related overlays.
If BEG is non-nil and END is nil, consider only `overlays-at'
@@ -238,7 +262,7 @@ verify FILTER, a function, and sort them by COMPARE (using KEY)."
(widen)
(let ((ovs (cl-remove-if-not
(lambda (ov)
- (and (overlay-get ov 'flymake)
+ (and (overlay-get ov 'flymake-diagnostic)
(or (not filter)
(funcall filter ov))))
(if (and beg (null end))
@@ -498,18 +522,15 @@ associated `flymake-category' return DEFAULT."
(default-maybe 'help-echo
(lambda (_window _ov pos)
(mapconcat
- (lambda (ov)
- (overlay-get ov 'flymake-text))
- (flymake--overlays :beg pos)
+ #'flymake--diag-text
+ (flymake-diagnostics pos)
"\n")))
(default-maybe 'severity (warning-numeric-level :error))
(default-maybe 'priority (+ 100 (overlay-get ov 'severity))))
;; Some properties can't be overridden.
;;
(overlay-put ov 'evaporate t)
- (overlay-put ov 'flymake t)
- (overlay-put ov 'flymake-text (flymake--diag-text diagnostic))
- (overlay-put ov 'flymake--diagnostic diagnostic)))
+ (overlay-put ov 'flymake-diagnostic diagnostic)))
;; Nothing in Flymake uses this at all any more, so this is just for
;; third-party compatibility.
@@ -600,7 +621,7 @@ not expected."
(lambda (ov)
(eq backend
(flymake--diag-backend
- (overlay-get ov 'flymake--diagnostic))))))
+ (overlay-get ov 'flymake-diagnostic))))))
(mapc (lambda (diag)
(flymake--highlight-line diag)
(setf (flymake--diag-backend diag) backend))
@@ -899,7 +920,7 @@ applied."
(lambda (ov)
(let ((diag (overlay-get
ov
- 'flymake--diagnostic)))
+ 'flymake-diagnostic)))
(and diag
(or (not filter)
(memq (flymake--diag-type diag)
@@ -1089,13 +1110,13 @@ applied."
(interactive (list (point) t))
(let* ((id (or (tabulated-list-get-id pos)
(user-error "Nothing at point")))
- (overlay (plist-get id :overlay)))
- (with-current-buffer (overlay-buffer overlay)
+ (diag (plist-get id :diagnostic)))
+ (with-current-buffer (flymake--diag-buffer diag)
(with-selected-window
(display-buffer (current-buffer) other-window)
- (goto-char (overlay-start overlay))
- (pulse-momentary-highlight-region (overlay-start overlay)
- (overlay-end overlay)
+ (goto-char (flymake--diag-beg diag))
+ (pulse-momentary-highlight-region (flymake--diag-beg diag)
+ (flymake--diag-end diag)
'highlight))
(current-buffer))))
@@ -1108,18 +1129,16 @@ POS can be a buffer position or a button"
(defun flymake--diagnostics-buffer-entries ()
(with-current-buffer flymake--diagnostics-buffer-source
- (cl-loop for ov in (flymake--overlays)
- for diag = (overlay-get ov
- 'flymake--diagnostic)
+ (cl-loop for diag in (flymake-diagnostics)
for (line . col) =
(save-excursion
- (goto-char (overlay-start ov))
+ (goto-char (flymake--diag-beg diag))
(cons (line-number-at-pos)
(- (point)
(line-beginning-position))))
for type = (flymake--diag-type diag)
collect
- (list (list :overlay ov
+ (list (list :diagnostic diag
:line line
:severity (flymake--lookup-type-property
type
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f79d9a47d31..895117b9ee3 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3304,8 +3304,9 @@ the full statement in the case of imports."
(defcustom python-shell-completion-native-disabled-interpreters
;; PyPy's readline cannot handle some escape sequences yet. Native
;; completion was found to be non-functional for IPython (see
- ;; Bug#25067).
- (list "pypy" "ipython")
+ ;; Bug#25067). Native completion doesn't work on w32 (Bug#28580).
+ (if (eq system-type 'windows-nt) '("")
+ '("pypy" "ipython"))
"List of disabled interpreters.
When a match is found, native completion is disabled."
:version "25.1"