0
+;; 2008-04-04 Aleksandr Skobelev
0
+;; - fixed bug in NU-FORWARD-SEXP1 and NU-BACKWARD-SEXP1 with skipping closing parens
0
+;; and made them more PAREDIT compatible (signal an error on list bounds);
0
+;; fixed positioning of the cursur on empty line;
0
+;; changed NU-DEFUN-RE for SET form;
0
;; 2008-04-03 Aleksandr Skobelev
0
;; - added support for character syntax; rewrote and optimized indentation and
0
;; navigation functionality
0
(autoload 'run-nush "nush" "Run an inferior Nush process." t)
0
(autoload 'switch-to-nush "nush" "Switch to an inferior Nush process." t)
0
-(defconst nu-version "2008-04-0
3"
0
+(defconst nu-version "2008-04-0
4"
0
"Nu Mode version number.")
0
@@ -169,7 +175,8 @@ See `run-hooks'."
0
(defvar nu-char-re "\\('\\)\\(?:\\\\\\(?:['\\\\]\\|[0-7]\\{3\\}\\|x[0-9a-fA-F]\\{2\\}\\|u[0-9a-fA-F]\\{4\\}\\)\\|\\\\?[^'\\\\xu]\\)\\('\\)")
0
-(defvar nu-defun-re "\\(^(set\\>\\)\\|\\(^\\s *(\\(global\\|class\\|macro\\|function\\)\\>\\)")
0
+(defvar nu-defun-re "\\(^(set\\s +[$]\\w\\)\\|\\(^\\s *(\\(global\\|class\\|macro\\|function\\)\\>\\)")
0
;(defun nu-regex-syntax )
0
@@ -348,6 +355,9 @@ See `run-hooks'."
0
'("\\(\\<\\|:\\)\\([A-Z]\\([A-Z]\\|[_0-9-]\\)+\\)\\>"
0
2 font-lock-constant-face keep)
0
+ '("(\\s *\\(set\\|global\\)[ \t\n]+\\(\\(\\w\\|\\s_\\)+\\)[ \t\n]\\([ \t\n]*\\([;#].*[\n]\\)*[ \t\n]*\\)(NuBridgedConstant\\>"
0
+ 2 font-lock-constant-face keep)
0
'("^(\\s *\\(set\\|global\\)\\s +\\(\\(\\w\\|\\s_\\)+\\)"
0
2 font-lock-variable-name-face keep)
0
@@ -576,36 +586,29 @@ See `run-hooks'."
0
(let ((ch (char-after)))
0
- ;;(message (format "down in list at %d" (point)))
0
(incf nu-forward-sexp-level)
0
- (nu-skip-space-forward 'in-clear-state)
0
(and (< (point) (point-max))
0
- (= (char-after) ?\( ))))
0
+ (looking-at "[ \t]*(")))
0
+ (skip-chars-forward " \t"))
0
;; (incf nu-forward-sexp-level)
0
(while (and (< (point) (point-max))
0
(< level nu-forward-sexp-level)) (nu-forward-sexp1 'in-clear-state)))
0
- ;;(message (format "up from list at %d" (point)))
0
- (decf nu-forward-sexp-level)
0
- (nu-skip-space-forward 'in-clear-state)
0
- (and (< (point) (point-max))
0
- (= (char-after) ?\) )))))
0
+ (cond ((< 0 nu-forward-sexp-level)
0
+ (decf nu-forward-sexp-level)
0
+ ;; else signal a proper 'scan-error to satisfy paredit
0
+ (t (let ((forward-sexp-function nil)) (forward-sexp)))))
0
- ;; (decf nu-forward-sexp-level))
0
(and (= ch ?') (looking-at nu-char-re))
0
- (and (= ch ?/) (looking-at nu-regexp-re)
0
- ;; (save-excursion (nth 3 (syntax-ppss (1+ (point)))))
0
+ (and (= ch ?/) (looking-at nu-regexp-re)))
0
(nu-skip-string-forward (char-before))
0
;;(message (format "nu-forward-sexp1: skipped string from the beginning to %d" (point)))
0
@@ -693,22 +696,20 @@ See `run-hooks'."
0
(incf nu-forward-sexp-level)
0
- (nu-skip-space-backward)
0
(and (> (point) (point-min))
0
- (= (char-before) ?\) ))))
0
+ (looking-back ")[ \t]*")))
0
+ (skip-chars-backward " \t"))
0
;; (incf nu-forward-sexp-level)
0
(while (< level nu-forward-sexp-level) (nu-backward-sexp1)))
0
- (decf nu-forward-sexp-level)
0
- (nu-skip-space-backward)
0
- (and (> (point) (point-min))
0
- (= (char-before) ?\( )))))
0
+ (cond ((< 0 nu-forward-sexp-level)
0
+ (decf nu-forward-sexp-level)
0
+ ;; else signal a proper 'scan-error to satisfy paredit
0
+ (t (let ((forward-sexp-function nil)) (backward-sexp)))))
0
;; (decf nu-forward-sexp-level))
0
@@ -872,10 +873,9 @@ See `run-hooks'."
0
;; indent method keyword other than the first one
0
((and colon-col cur-sexp-keyword-p)
0
(- colon-col (- cur-sexp-end-col cur-sexp-col)))))
0
;; NU-LISP-INDENT-LINE ---------------------------------------------------------
0
(defun nu-lisp-indent-line (&optional whole-exp)
0
@@ -887,7 +887,8 @@ rigidly along with this one."
0
(and (= (point) (point-min))
0
- (lisp-indent-line whole-exp)))
0
+ (lisp-indent-line whole-exp)
0
;; NU-INDENT-SEXP --------------------------------------------------------------
0
(defun nu-indent-sexp (&optional endpos)
0
@@ -986,8 +987,9 @@ rigidly along with this one."
0
(nu-skip-space-forward)
0
- (if (or (nu-looking-at-defun)
0
- (nu-beginning-of-defun))
0
+ (when (or (and (nu-looking-at-defun) (not (nth 3 (syntax-ppss))))
0
+ (nu-beginning-of-defun))
Comments
No one has commented yet.