dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

sly-indentation.el (1105B)


      1 ;; -*- lexical-binding: t; -*-
      2 (require 'sly)
      3 (require 'cl-lib)
      4 (require 'sly-cl-indent "lib/sly-cl-indent")
      5 
      6 (define-sly-contrib sly-indentation
      7   "Contrib interfacing `sly-cl-indent' and SLY."
      8   (:slynk-dependencies slynk/indentation)
      9   (:on-load
     10    (setq sly--lisp-indent-current-package-function 'sly-current-package)))
     11 
     12 (defun sly-update-system-indentation (symbol indent packages)
     13   (let ((list (gethash symbol sly-common-lisp-system-indentation))
     14         (ok nil))
     15     (if (not list)
     16         (puthash symbol (list (cons indent packages))
     17                  sly-common-lisp-system-indentation)
     18       (dolist (spec list)
     19         (cond ((equal (car spec) indent)
     20                (dolist (p packages)
     21                  (unless (member p (cdr spec))
     22                    (push p (cdr spec))))
     23                (setf ok t))
     24               (t
     25                (setf (cdr spec)
     26                      (cl-set-difference (cdr spec) packages :test 'equal)))))
     27       (unless ok
     28         (puthash symbol (cons (cons indent packages) list)
     29                  sly-common-lisp-system-indentation)))))
     30 
     31 (provide 'sly-indentation)