How can I deliver a module that requires a flymake fix, with minimal startup time (= autoload) and minimal impact on the user emacs.el?
I am working on a flymake-for-csharp module. He works with flymake, teaches him how to be more flexible with C # code files. For example, instead of just using makefile, flymake-for-csharp can also use the .csproj file or it can directly call csc.exe.
The module is working fine. Now I am trying to do this automatically.
here is the challenge.
To determine which languages flymake'd gets, flymake.el includes a list of file extensions (.java, .cs, .c, etc.) along with init and cleanup routines for each of these languages. There is an entry for C # in the default flymake.el file, but, as I said, the default C # behavior is not flexible enough. To make it more flexible, I need to replace the C # entry in alm flymake so that it points to the new initialization / cleanup logic in the flymake-for-csharp module. Am I with me?
No problem fixing alist at runtime. It looks like this:
(let (elt
(csharp-entry nil)
(masks flymake-allowed-file-name-masks))
;; Find the existing C
(while (consp masks)
(setq elt (car masks))
(if (string= "\\.cs\\'" (car elt))
(setq csharp-entry elt))
(setq masks (cdr masks)))
;; remove the original entry for C
(if csharp-entry
(setq flymake-allowed-file-name-masks
(delete csharp-entry flymake-allowed-file-name-masks)))
;; Now add a new entry for C
(setq flymake-allowed-file-name-masks
(cons
'("\\.cs\\'" flymake-for-csharp-init flymake-for-csharp-cleanup)
flymake-allowed-file-name-masks)))
The long-term solution is to convince the authors of flymake and emacs to accept the logic that is currently in flymake-for-csharp. Then alist will get more flexible init / cleanup and bob your uncle routines.
flymake-for-csharp () flymake.el. : flymake-for-csharp, alist?
, emacs.el :
(autoload 'flymake-for-csharp-init "flymake-for-csharp" nil nil)
... (eval-after-load ...
, flymake-for-csharp-init , flymake alist , #.
?
, , (require 'flymake-for-csharp) autoload. flymake-for-csharp , , -, . ? flymake-for-csharp 2 ?
, , eval-after-load flymake.el. . :
,
, flymake, (= autoload) emacs.el?