/[emacs]/emacs/lisp/progmodes/flymake.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/flymake.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by lektu, Fri Jul 1 14:13:12 2005 UTC revision 1.21 by monnier, Sat Jul 2 19:36:38 2005 UTC
# Line 1445  Return first 'INCLUDE-DIRS/REL-FILE-NAME Line 1445  Return first 'INCLUDE-DIRS/REL-FILE-NAME
1445      (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s"      (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s"
1446                   (buffer-name buffer) status warning)))                   (buffer-name buffer) status warning)))
1447    
 ;;;###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  
   (if flymake-mode  
       (if (flymake-can-syntax-check-file (buffer-file-name))  
           (flymake-mode-on)  
         (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name)))  
     (flymake-mode-off)))  
   
1448  (defcustom flymake-start-syntax-check-on-find-file t  (defcustom flymake-start-syntax-check-on-find-file t
1449    "Start syntax check on find file."    "Start syntax check on find file."
1450    :group 'flymake    :group 'flymake
1451    :type 'boolean)    :type 'boolean)
1452    
1453  ;;;###autoload  ;;;###autoload
1454  (defun flymake-mode-on ()  (define-minor-mode flymake-mode
1455    "Turn flymake mode on."    "Minor mode to do on-the-fly syntax checking.
1456    (when (not flymake-mode)  When called interactively, toggles the minor mode.
1457      (make-local-variable 'after-change-functions)  With arg, turn Flymake mode on if and only if arg is positive."
1458      (setq after-change-functions (cons 'flymake-after-change-function after-change-functions))    :group 'flymake :lighter flymake-mode-line
1459      (add-hook 'after-save-hook 'flymake-after-save-hook)    (cond
     (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook)  
     ;;+(add-hook 'find-file-hook 'flymake-find-file-hook)  
   
     (flymake-report-status (current-buffer) "" "")  
   
     (setq flymake-timer  
           (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))  
   
     (setq flymake-mode t)  
     (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name (current-buffer)))  
     (when flymake-start-syntax-check-on-find-file  
       (flymake-start-syntax-check-for-current-buffer)))) ; will be started by on-load hook  
1460    
1461  ;;;###autoload     ;; Turning the mode ON.
1462  (defun flymake-mode-off ()     (flymake-mode
1463    "Turn flymake mode off."      (if (not (flymake-can-syntax-check-file buffer-file-name))
1464    (when flymake-mode          (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name))
1465      (setq after-change-functions (delq 'flymake-after-change-function  after-change-functions))        (add-hook 'after-change-functions 'flymake-after-change-function nil t)
1466      (remove-hook 'after-save-hook (function flymake-after-save-hook) t)        (add-hook 'after-save-hook 'flymake-after-save-hook nil t)
1467      (remove-hook 'kill-buffer-hook (function flymake-kill-buffer-hook) t)        (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t)
1468          ;;+(add-hook 'find-file-hook 'flymake-find-file-hook)
1469    
1470          (flymake-report-status (current-buffer) "" "")
1471            
1472          (setq flymake-timer
1473                (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
1474    
1475          (when flymake-start-syntax-check-on-find-file
1476            (flymake-start-syntax-check-for-current-buffer))))
1477    
1478       ;; Turning the mode OFF.
1479       (t
1480        (remove-hook 'after-change-functions 'flymake-after-change-function t)
1481        (remove-hook 'after-save-hook 'flymake-after-save-hook t)
1482        (remove-hook 'kill-buffer-hook 'flymake-kill-buffer-hook t)
1483      ;;+(remove-hook 'find-file-hook (function flymake-find-file-hook) t)      ;;+(remove-hook 'find-file-hook (function flymake-find-file-hook) t)
1484    
1485      (flymake-delete-own-overlays (current-buffer))      (flymake-delete-own-overlays (current-buffer))
# Line 1497  With arg, turn Flymake mode on if and on Line 1488  With arg, turn Flymake mode on if and on
1488        (cancel-timer flymake-timer)        (cancel-timer flymake-timer)
1489        (setq flymake-timer nil))        (setq flymake-timer nil))
1490    
1491      (setq flymake-is-running nil)      (setq flymake-is-running nil)))
1492      (setq flymake-mode nil)  
1493      (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name (current-buffer)))))  ;;;###autoload
1494    (defun flymake-mode-on ()
1495      "Turn flymake mode on."
1496      (flymake-mode 1)
1497      (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name)))
1498    
1499    ;;;###autoload
1500    (defun flymake-mode-off ()
1501      "Turn flymake mode off."
1502      (flymake-mode 0)
1503      (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name))
1504    
1505  (defcustom flymake-start-syntax-check-on-newline t  (defcustom flymake-start-syntax-check-on-newline t
1506    "Start syntax check if newline char was added/removed from the buffer."    "Start syntax check if newline char was added/removed from the buffer."
# Line 1532  With arg, turn Flymake mode on if and on Line 1533  With arg, turn Flymake mode on if and on
1533    ;;+    (flymake-start-syntax-check-for-current-buffer)    ;;+    (flymake-start-syntax-check-for-current-buffer)
1534    ;;+)    ;;+)
1535    (when (and (not (local-variable-p 'flymake-mode (current-buffer)))    (when (and (not (local-variable-p 'flymake-mode (current-buffer)))
1536               (flymake-can-syntax-check-file (buffer-file-name (current-buffer))))               (flymake-can-syntax-check-file buffer-file-name))
1537      (flymake-mode)      (flymake-mode)
1538      (flymake-log 3 "automatically turned ON flymake mode")))      (flymake-log 3 "automatically turned ON flymake mode")))
1539    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26