public
Description: The Nu programming language.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nu.git
An update to the emacs nu-mode (2008-04-04) from Aleksandr Skobelev.
timburks (author)
Fri Apr 04 17:40:18 -0700 2008
commit  8d1b2d601bd4b3a950dc89f49e5bd9c10ae33416
tree    ce4f4336bf6422af3957b2e1fd12ba12b31f4eff
parent  05fc793ae700fb198fd547ad77233ba10faf4684
...
26
27
28
 
 
 
 
 
 
29
30
31
...
71
72
73
74
 
75
76
77
...
169
170
171
172
 
 
173
174
175
...
348
349
350
 
 
 
351
352
353
...
576
577
578
579
 
580
581
582
583
584
585
586
587
588
 
 
 
589
590
591
592
 
593
594
595
596
597
598
599
600
 
 
 
 
 
601
602
603
604
605
606
607
608
 
609
610
611
...
693
694
695
696
697
698
 
 
699
700
701
702
703
704
705
706
707
708
709
710
711
 
 
 
 
 
712
713
714
...
872
873
874
875
 
876
877
878
 
879
880
881
...
887
888
889
890
 
 
891
892
893
...
986
987
988
989
990
 
 
 
991
992
993
...
26
27
28
29
30
31
32
33
34
35
36
37
...
77
78
79
 
80
81
82
83
...
175
176
177
 
178
179
180
181
182
...
355
356
357
358
359
360
361
362
363
...
586
587
588
 
589
590
 
591
592
593
 
594
 
 
595
596
597
598
599
600
 
601
602
 
 
 
 
 
 
 
603
604
605
606
607
608
 
 
609
610
 
 
 
611
612
613
614
...
696
697
698
 
699
 
700
701
702
703
704
705
706
707
 
 
 
 
 
 
 
708
709
710
711
712
713
714
715
...
873
874
875
 
876
877
 
 
878
879
880
881
...
887
888
889
 
890
891
892
893
894
...
987
988
989
 
 
990
991
992
993
994
995
0
@@ -26,6 +26,12 @@
0
 ;; at gmail.com.
0
 
0
 ;;; History:
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
+;;
0
 ;; 2008-04-03 Aleksandr Skobelev
0
 ;; - added support for character syntax; rewrote and optimized indentation and
0
 ;; navigation functionality
0
@@ -71,7 +77,7 @@
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
 
0
-(defconst nu-version "2008-04-03"
0
+(defconst nu-version "2008-04-04"
0
   "Nu Mode version number.")
0
 
0
 (defgroup nu nil
0
@@ -169,7 +175,8 @@ See `run-hooks'."
0
 
0
 (defvar nu-char-re "\\('\\)\\(?:\\\\\\(?:['\\\\]\\|[0-7]\\{3\\}\\|x[0-9a-fA-F]\\{2\\}\\|u[0-9a-fA-F]\\{4\\}\\)\\|\\\\?[^'\\\\xu]\\)\\('\\)")
0
 
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
+
0
 
0
 ;(defun nu-regex-syntax )
0
 
0
@@ -348,6 +355,9 @@ See `run-hooks'."
0
     '("\\(\\<\\|:\\)\\([A-Z]\\([A-Z]\\|[_0-9-]\\)+\\)\\>"
0
       2 font-lock-constant-face keep)
0
 
0
+ '("(\\s *\\(set\\|global\\)[ \t\n]+\\(\\(\\w\\|\\s_\\)+\\)[ \t\n]\\([ \t\n]*\\([;#].*[\n]\\)*[ \t\n]*\\)(NuBridgedConstant\\>"
0
+ 2 font-lock-constant-face keep)
0
+
0
     ;;VARIABLE NAMES
0
     '("^(\\s *\\(set\\|global\\)\\s +\\(\\(\\w\\|\\s_\\)+\\)"
0
       2 font-lock-variable-name-face keep)
0
@@ -576,36 +586,29 @@ See `run-hooks'."
0
 
0
                   (let ((ch (char-after)))
0
                     (cond ; not in string
0
-
0
+
0
                      ((= ch ?\()
0
- ;;(message (format "down in list at %d" (point)))
0
                       (while (progn
0
                                (incf nu-forward-sexp-level)
0
                                (forward-char)
0
- (nu-skip-space-forward 'in-clear-state)
0
                                (and (< (point) (point-max))
0
- (= (char-after) ?\( ))))
0
-
0
+ (looking-at "[ \t]*(")))
0
+ (skip-chars-forward " \t"))
0
+
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
-
0
+
0
                      ((= ch ?\))
0
- ;;(message (format "up from list at %d" (point)))
0
- (while (progn
0
- (decf nu-forward-sexp-level)
0
- (forward-char)
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
+ (forward-char))
0
+ ;; else signal a proper 'scan-error to satisfy paredit
0
+ (t (let ((forward-sexp-function nil)) (forward-sexp)))))
0
                      
0
- ;; (decf nu-forward-sexp-level))
0
-
0
                      ((when (or (= ch ?\")
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
- ))
0
+ (and (= ch ?/) (looking-at nu-regexp-re)))
0
                         (forward-char)
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
                     (while (progn
0
                              (incf nu-forward-sexp-level)
0
                              (backward-char)
0
- (nu-skip-space-backward)
0
                              (and (> (point) (point-min))
0
- (= (char-before) ?\) ))))
0
+ (looking-back ")[ \t]*")))
0
+ (skip-chars-backward " \t"))
0
                    
0
                     ;; (incf nu-forward-sexp-level)
0
                     (while (< level nu-forward-sexp-level) (nu-backward-sexp1)))
0
                
0
                
0
                    ((= cb ?\( )
0
-
0
- (while (progn
0
- (decf nu-forward-sexp-level)
0
- (backward-char)
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
+ (backward-char))
0
+ ;; else signal a proper 'scan-error to satisfy paredit
0
+ (t (let ((forward-sexp-function nil)) (backward-sexp)))))
0
 
0
                    ;; (decf nu-forward-sexp-level))
0
                 
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
- )))
0
+ ))))
0
           
0
- lisp-indent)))))
0
-
0
+ lisp-indent))))
0
 
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
             (beginning-of-line)
0
             (and (= (point) (point-min))
0
                  (looking-at "#!")))
0
- (lisp-indent-line whole-exp)))
0
+ (lisp-indent-line whole-exp)
0
+ ))
0
 
0
 ;; NU-INDENT-SEXP --------------------------------------------------------------
0
 (defun nu-indent-sexp (&optional endpos)
0
@@ -986,8 +987,9 @@ rigidly along with this one."
0
 
0
   (nu-skip-space-forward)
0
   
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))
0
+
0
       (nu-forward-sexp1)))
0
 
0
 
...
232
233
234
235
236
237
238
 
 
 
 
239
240
241
...
255
256
257
258
259
260
261
 
 
 
 
262
263
264
...
232
233
234
 
 
 
 
235
236
237
238
239
240
241
...
255
256
257
 
 
 
 
258
259
260
261
262
263
264
0
@@ -232,10 +232,10 @@ order. Return nil if no start file found."
0
   "Send the current definition to the inferior Nush process."
0
   (interactive)
0
   (save-excursion
0
- (end-of-defun)
0
- (let ((end (point)))
0
- (beginning-of-defun)
0
- (nush-send-region (point) end))))
0
+ (beginning-of-defun)
0
+ (let ((beg (point)))
0
+ (end-of-defun)
0
+ (nush-send-region beg (point)))))
0
 
0
 (defun nush-send-last-sexp ()
0
   "Send the previous sexp to the inferior Nush process."
0
@@ -255,10 +255,10 @@ order. Return nil if no start file found."
0
   "Switch to the nush process buffer.
0
 With argument, position cursor at end of buffer."
0
   (interactive "P")
0
- (if (or (and nush-buffer (get-buffer nush-buffer))
0
- (run-nush)
0
-;; (nush-interactively-start-process)
0
- )
0
+ (if (or (and nush-buffer
0
+ (get-buffer nush-buffer)
0
+ (get-buffer-process nush-buffer))
0
+ (run-nush))
0
       (pop-to-buffer nush-buffer)
0
       (error "No current process buffer. See variable `nush-buffer'"))
0
   (when eob-p

Comments

    No one has commented yet.