/[slime]/slime/swank.lisp
ViewVC logotype

Diff of /slime/swank.lisp

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

revision 1.215 by lgorrie, Fri Jul 16 18:12:41 2004 UTC revision 1.216 by lgorrie, Fri Jul 16 21:38:48 2004 UTC
# Line 2648  after each command.") Line 2648  after each command.")
2648      (let ((fullp (need-full-indentation-update-p *emacs-connection*)))      (let ((fullp (need-full-indentation-update-p *emacs-connection*)))
2649        (perform-indentation-update *emacs-connection* fullp))))        (perform-indentation-update *emacs-connection* fullp))))
2650    
 (defun perform-indentation-update (connection force)  
   (let* ((cache (connection.indentation-cache connection))  
          (delta (update-indentation/delta-for-emacs cache force)))  
     (when force  
       (setf (connection.indentation-cache-packages connection)  
             (list-all-packages)))  
     (when delta  
       (send-to-emacs (list :indentation-update delta)))))  
   
2651  (defun need-full-indentation-update-p (connection)  (defun need-full-indentation-update-p (connection)
2652    "Return true if the whole indentation cache should be updated.    "Return true if the whole indentation cache should be updated.
2653  This is a heuristic to avoid scanning all symbols all the time:  This is a heuristic to avoid scanning all symbols all the time:
# Line 2664  instead, we only do a full scan if the s Line 2655  instead, we only do a full scan if the s
2655    (set-difference (list-all-packages)    (set-difference (list-all-packages)
2656                    (connection.indentation-cache-packages connection)))                    (connection.indentation-cache-packages connection)))
2657    
2658    (defun perform-indentation-update (connection force)
2659      "Update the indentation cache in CONNECTION and update Emacs.
2660    If FORCE is true then start again without considering the old cache."
2661      (let ((cache (connection.indentation-cache connection)))
2662        (when force (clrhash cache))
2663        (let ((delta (update-indentation/delta-for-emacs cache force)))
2664          (setf (connection.indentation-cache-packages connection)
2665                (list-all-packages))
2666          (unless (null delta)
2667            (send-to-emacs (list :indentation-update delta))))))
2668    
2669  (defun update-indentation/delta-for-emacs (cache &optional force)  (defun update-indentation/delta-for-emacs (cache &optional force)
2670    "Update the cache and return the changes in a (SYMBOL . INDENT) list.    "Update the cache and return the changes in a (SYMBOL . INDENT) list.
2671  If FORCE is true then check all symbols, otherwise only check symbols  If FORCE is true then check all symbols, otherwise only check symbols
# Line 2691  belonging to the buffer package." Line 2693  belonging to the buffer package."
2693    
2694  (defun known-to-emacs-p (symbol)  (defun known-to-emacs-p (symbol)
2695    "Return true if Emacs has special rules for indenting SYMBOL."    "Return true if Emacs has special rules for indenting SYMBOL."
2696    (or (cl-symbol-p symbol)    (cl-symbol-p symbol))
       (let ((name (symbol-name symbol)))  
         (or (prefix-match-p "DEF" name)  
             (prefix-match-p "WITH-" name)))))  
2697    
2698  (defun symbol-indentation (symbol)  (defun symbol-indentation (symbol)
2699    "Return a form describing the indentation of SYMBOL.    "Return a form describing the indentation of SYMBOL.

Legend:
Removed from v.1.215  
changed lines
  Added in v.1.216

  ViewVC Help
Powered by ViewVC 1.1.5