[slime-cvs] CVS slime/contrib
CVS User nsiivola
nsiivola at common-lisp.net
Sat Jun 11 14:35:16 UTC 2011
Update of /project/slime/cvsroot/slime/contrib
In directory common-lisp.net:/tmp/cvs-serv10273/contrib
Modified Files:
ChangeLog slime-cl-indent.el
Log Message:
slime-indentation: XEmacs compatibility
Kudos for Raymond Toy for being the intrepid tester.
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/06/11 14:34:59 1.478
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/06/11 14:35:15 1.479
@@ -1,5 +1,15 @@
2011-06-11 Nikodemus Siivola <nikodemus at random-state.net>
+ XEmacs compatibility.
+
+ * slime-cl-indent.el (common-lisp-style-names): New function.
+ (common-lisp-set-style): Call common-lisp-style-names instead of
+ using the hashtable directly: XEmacs doesn't like hash-tables in
+ completing-read.
+ (common-lisp-looking-back): New function.
+ (common-lisp-indent-function-1): Use common-lisp-looking-back instead
+ of looking-back: XEmacs doesn't have looking-back.
+
Refactoring named styles.
* slime-cl-indent.el (define-common-lisp-style): Not a list of hooks anymore,
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/06/11 14:34:59 1.41
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/06/11 14:35:15 1.42
@@ -348,6 +348,13 @@
(defvar common-lisp-set-style-history nil)
+(defun common-lisp-style-names ()
+ (let (names)
+ (maphash (lambda (k v)
+ (push k names))
+ common-lisp-styles)
+ names))
+
(defun common-lisp-set-style (stylename)
"Set current buffer to use the Common Lisp style STYLENAME.
STYLENAME, a string, must be an existing Common Lisp style. Styles
@@ -362,7 +369,7 @@
(list (let ((completion-ignore-case t)
(prompt "Specify Common Lisp indentation style: "))
(completing-read prompt
- common-lisp-styles nil t nil
+ (common-lisp-style-names) nil t nil
'common-lisp-set-style-history))))
(setq common-lisp-style (common-lisp-style-name (common-lisp-find-style stylename))
common-lisp-active-style nil)
@@ -691,9 +698,17 @@
have an offset of 2+1=3."
(common-lisp-indent-function-1 indent-point state))
+;;; XEmacs doesn't have looking-back, so we define a simple one. Faster to
+;;; boot, and sufficient for our needs.
+(defun common-lisp-looking-back (string)
+ (let ((len (length string)))
+ (dotimes (i len t)
+ (unless (eql (elt string (- len i 1)) (char-before (- (point) i)))
+ (return nil)))))
+
(defun common-lisp-indent-function-1 (indent-point state)
;; If we're looking at a splice, move to the first comma.
- (when (or (looking-back ",") (looking-back ",@"))
+ (when (or (common-lisp-looking-back ",") (common-lisp-looking-back ",@"))
(when (re-search-backward "[^,@'],")
(forward-char 1)))
(let ((normal-indent (current-column)))
More information about the slime-cvs
mailing list