[slime-cvs] CVS slime
CVS User trittweiler
trittweiler at common-lisp.net
Wed Feb 11 20:00:57 UTC 2009
Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv17232
Modified Files:
slime.el ChangeLog
Log Message:
* slime.el: Barf if emacs-major-version <= 20. We support 21 and up.
(slime-emacs-20-p): Removed.
* slime.el (slime-forward-reader-comment): Removed.
(slime-forward-any-comment): New; superset of above.
(slime-forward-reader-conditional): Make it understand SBCL's
#!+,#!- so it works in source files of SBCL itself, too.
(slime-current-parser-state): New.
--- /project/slime/cvsroot/slime/slime.el 2009/02/06 23:48:14 1.1120
+++ /project/slime/cvsroot/slime/slime.el 2009/02/11 20:00:57 1.1121
@@ -47,6 +47,10 @@
;;;; Dependencies and setup
(eval-and-compile
+ (when (<= emacs-major-version 20)
+ (error "Slime requires an Emacs version of 21, or above")))
+
+(eval-and-compile
(require 'cl)
(unless (fboundp 'define-minor-mode)
(require 'easy-mmode)
@@ -722,8 +726,7 @@
Single-line messages use the echo area."
(apply slime-message-function format args))
-(when (or (featurep 'xemacs)
- (= emacs-major-version 20))
+(when (or (featurep 'xemacs))
(setq slime-message-function 'slime-format-display-message))
(defun slime-format-display-message (format &rest args)
@@ -2163,8 +2166,8 @@
form (:ok VALUE) or (:abort). CLAUSES is executed
asynchronously.
-Note: don't use backquote syntax for SEXP, because Emacs20 cannot
-deal with that."
+Note: don't use backquote syntax for SEXP, because various Emacs
+versions cannot deal with that."
(let ((result (gensym)))
`(lexical-let ,(loop for var in saved-vars
collect (etypecase var
@@ -2977,8 +2980,7 @@
(putp 'slime note)
(putp 'face (slime-severity-face severity))
(putp 'severity severity)
- (unless (slime-emacs-20-p)
- (putp 'mouse-face 'highlight))
+ (putp 'mouse-face 'highlight)
(putp 'help-echo message)
overlay)))
@@ -7795,7 +7797,8 @@
(with-current-buffer (sldb-get-default-buffer)
(sldb-quit))
(slime-sync-to-top-level 1))
-
+
+;;; FIXME: reconnection is broken since the recent io-redirection changes.
(def-slime-test disconnect
()
"Close the connetion.
@@ -7916,10 +7919,11 @@
(put 'slime-point-moves-p 'lisp-indent-function 0)
(defun slime-forward-sexp (&optional count)
- "Like `forward-sexp', but understands reader-conditionals (#- and #+)."
+ "Like `forward-sexp', but understands reader-conditionals (#- and #+),
+and skips comments."
(dotimes (i (or count 1))
(while (slime-point-moves-p (slime-forward-blanks)
- (slime-forward-reader-comment)
+ (slime-forward-any-comment)
(slime-forward-reader-conditional)))
(forward-sexp)))
@@ -7931,23 +7935,20 @@
;; newlines aren't in lisp-mode's whitespace syntax class
(when (eolp) (forward-char))))))
-;; Emacs 21's forward-sexp understands #| |# comments in lisp-mode
-;; buffers, but (at least) Emacs 20's doesn't, so here it is.
-(defun slime-forward-reader-comment ()
- "Move forward over #|...|# reader comments. The comments may be nested."
- (when (looking-at "#|")
- (goto-char (match-end 0))
- (while (not (looking-at "|#"))
- (re-search-forward (regexp-opt '("|#" "#|")))
- (goto-char (match-beginning 0))
- (when (looking-at "#|") ; nested comment
- (slime-forward-reader-comment)))
- (goto-char (match-end 0))))
+(defun slime-forward-any-comment ()
+ "Skip the whole comment at point, or the comment where point is
+within. This includes nested comments (#| ... |#)."
+ (while (forward-comment 1)) ; We may be exactly in front of a semicolon.
+ (when-let (comment-start (nth 8 (slime-current-parser-state)))
+ (goto-char comment-start)
+ (while (forward-comment 1))))
(defun slime-forward-reader-conditional ()
"Move past any reader conditional (#+ or #-) at point."
- (when (or (looking-at "#\\+")
- (looking-at "#-"))
+ (when (or (looking-at "#[\\+\\-]")
+ ;; #!+, #!- are SBCL specific reader-conditional syntax.
+ ;; We need this for the source files of SBCL itself.
+ (looking-at "#![\\+\\-]"))
(goto-char (match-end 0))
(let* ((plus-conditional-p (eq (char-before) ?+))
(result (slime-eval-feature-conditional (read (current-buffer)))))
@@ -8030,9 +8031,9 @@
(save-excursion
(let ((string (thing-at-point 'slime-symbol)))
(and string
- ;; In Emacs20 (thing-at-point 'symbol) returns "" instead
- ;; of nil when called from an empty (or
- ;; narrowed-to-empty) buffer.
+ ;; (thing-at-point 'symbol) returns "" instead of nil
+ ;; when called from an empty (or narrowed-to-empty)
+ ;; buffer.
(not (equal string ""))
(substring-no-properties string))))))
@@ -8069,15 +8070,23 @@
(when (featurep 'xemacs)
(require 'overlay))
+(if (and (featurep 'emacs) (>= emacs-major-version 22))
+ ;;; N.B. The 2nd, and 6th return value cannot be relied upon.
+ (defun slime-current-parser-state () (syntax-ppss))
+ (defun slime-current-parser-state ()
+ (let ((original-pos (point)))
+ (save-excursion
+ (beginning-of-defun)
+ (parse-partial-sexp (point) original-pos)))))
+
(defun slime-split-string (string &optional separators omit-nulls)
- "This is like `split-string' in Emacs22, but also works in
-Emacs20 and 21."
+ "This is like `split-string' in Emacs22, but also works in 21."
(let ((splits (split-string string separators)))
(if omit-nulls
(setq splits (remove "" splits))
;; SPLIT-STRING in Emacs before 22.x automatically removed nulls
;; at beginning and end, so we gotta add them here again.
- (when (or (slime-emacs-20-p) (slime-emacs-21-p))
+ (when (slime-emacs-21-p)
(when (find (elt string 0) separators)
(push "" splits))
(when (find (elt string (1- (length string))) separators)
@@ -8403,10 +8412,6 @@
(and ,temp-message ,current-message
(message "%s" ,current-message)))))))
-(defun slime-emacs-20-p ()
- (and (not (featurep 'xemacs))
- (= emacs-major-version 20)))
-
(defun slime-emacs-21-p ()
(and (not (featurep 'xemacs))
(= emacs-major-version 21)))
--- /project/slime/cvsroot/slime/ChangeLog 2009/02/07 13:19:50 1.1676
+++ /project/slime/cvsroot/slime/ChangeLog 2009/02/11 20:00:57 1.1677
@@ -1,3 +1,14 @@
+2009-02-11 Tobias C. Rittweiler <tcr at freebits.de>
+
+ * slime.el: Barf if emacs-major-version <= 20. We support 21 and up.
+ (slime-emacs-20-p): Removed.
+
+ * slime.el (slime-forward-reader-comment): Removed.
+ (slime-forward-any-comment): New; superset of above.
+ (slime-forward-reader-conditional): Make it understand SBCL's
+ #!+,#!- so it works in source files of SBCL itself, too.
+ (slime-current-parser-state): New.
+
2009-02-07 Tobias C. Rittweiler <tcr at freebits.de>
In Xref, list IR1-conversion functions with :DEF-IR1-TRANSLATOR as
More information about the slime-cvs
mailing list