unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4310: Flymake standardizing(slightly) patch
@ 2009-09-02  5:25 Jimmy Yuen Ho Wong
  2009-09-03  6:02 ` Glenn Morris
  2016-02-28  6:44 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Jimmy Yuen Ho Wong @ 2009-09-02  5:25 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

Hi Emacs LISPers!

I'm not sure if this issue has been raised before (searching the mailing 
list comes up nothing), but here it goes:

I was frustrated with the fact that flymake-mode is the one minor-mode 
that I use often and complicated enough but doesn't come with anyway to 
extend it with hooks or keymaps. So I've patch the trunk flymake.el to 
be a little more emacsy.

I've added a default keymap and a minor-mode hook to flymake, I was 
hoping this will make it into the next Emacs version.

Comments welcome.

Jimmy Yuen Ho Wong

P.S The attached patch is in git format.

[-- Attachment #2: flymake.el.patch --]
[-- Type: text/plain, Size: 1634 bytes --]

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 69eac56..cbd7dd5 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1322,12 +1322,30 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
   :group 'flymake
   :type 'boolean)
 
+(defvar flymake-prefix-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "s" 'flymake-start-syntax-check)
+    (define-key map "n" 'flymake-goto-next-error)
+    (define-key map "p" 'flymake-goto-prev-error)
+    (define-key map "m" 'flymake-display-err-menu-for-current-line)
+    map))
+
+(defvar flymake-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c;" flymake-prefix-map)
+    map)
+  "The keymap provides the default flymake-mode bindings.")
+
+(defvar flymake-mode-hook nil
+  "Mode hook for `flymake-mode`. This hook is run __before__
+syntax check happens, but after all the initialization is done.")
+
 ;;;###autoload
 (define-minor-mode flymake-mode
   "Minor mode to do on-the-fly syntax checking.
 When called interactively, toggles the minor mode.
 With arg, turn Flymake mode on if and only if arg is positive."
-  :group 'flymake :lighter flymake-mode-line
+  :group 'flymake :lighter flymake-mode-line :keymap flymake-mode-map
   (cond
 
    ;; Turning the mode ON.
@@ -1344,6 +1362,8 @@ With arg, turn Flymake mode on if and only if arg is positive."
       (setq flymake-timer
             (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
 
+      (run-hooks 'flymake-mode-hook)
+
       (when flymake-start-syntax-check-on-find-file
         (flymake-start-syntax-check))))
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-27 17:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-02  5:25 bug#4310: Flymake standardizing(slightly) patch Jimmy Yuen Ho Wong
2009-09-03  6:02 ` Glenn Morris
2009-09-03 12:23   ` Jimmy Yuen Ho Wong
2009-09-03 13:43     ` Stefan Monnier
2009-09-04  5:13   ` Kevin Rodgers
2016-02-28  6:44 ` Lars Ingebrigtsen
2019-06-27 17:52   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).