; Fix example in the Flymake manual
* doc/misc/flymake.texi (An annotated example backend): Fix the example. (Bug#64070)
This commit is contained in:
parent
0a1459f1d9
commit
84d2da003e
1 changed files with 9 additions and 0 deletions
|
@ -738,9 +738,13 @@ The following code needs lexical binding (@pxref{Using Lexical
|
||||||
Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
|
Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
@group
|
||||||
;;; ruby-flymake.el --- A ruby Flymake backend -*- lexical-binding: t; -*-
|
;;; ruby-flymake.el --- A ruby Flymake backend -*- lexical-binding: t; -*-
|
||||||
|
(require 'cl-lib)
|
||||||
(defvar-local ruby--flymake-proc nil)
|
(defvar-local ruby--flymake-proc nil)
|
||||||
|
@end group
|
||||||
|
|
||||||
|
@group
|
||||||
(defun ruby-flymake (report-fn &rest _args)
|
(defun ruby-flymake (report-fn &rest _args)
|
||||||
;; Not having a ruby interpreter is a serious problem which should cause
|
;; Not having a ruby interpreter is a serious problem which should cause
|
||||||
;; the backend to disable itself, so an @code{error} is signaled.
|
;; the backend to disable itself, so an @code{error} is signaled.
|
||||||
|
@ -754,7 +758,9 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
|
||||||
;;
|
;;
|
||||||
(when (process-live-p ruby--flymake-proc)
|
(when (process-live-p ruby--flymake-proc)
|
||||||
(kill-process ruby--flymake-proc))
|
(kill-process ruby--flymake-proc))
|
||||||
|
@end group
|
||||||
|
|
||||||
|
@group
|
||||||
;; Save the current buffer, the narrowing restriction, remove any
|
;; Save the current buffer, the narrowing restriction, remove any
|
||||||
;; narrowing restriction.
|
;; narrowing restriction.
|
||||||
;;
|
;;
|
||||||
|
@ -820,11 +826,14 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
|
||||||
;;
|
;;
|
||||||
(process-send-region ruby--flymake-proc (point-min) (point-max))
|
(process-send-region ruby--flymake-proc (point-min) (point-max))
|
||||||
(process-send-eof ruby--flymake-proc))))
|
(process-send-eof ruby--flymake-proc))))
|
||||||
|
@end group
|
||||||
|
|
||||||
|
@group
|
||||||
(defun ruby-setup-flymake-backend ()
|
(defun ruby-setup-flymake-backend ()
|
||||||
(add-hook 'flymake-diagnostic-functions 'ruby-flymake nil t))
|
(add-hook 'flymake-diagnostic-functions 'ruby-flymake nil t))
|
||||||
|
|
||||||
(add-hook 'ruby-mode-hook 'ruby-setup-flymake-backend)
|
(add-hook 'ruby-mode-hook 'ruby-setup-flymake-backend)
|
||||||
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@node The legacy Proc backend
|
@node The legacy Proc backend
|
||||||
|
|
Loading…
Add table
Reference in a new issue