Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

前のコミットが反映されていなかったのでやり直し

  • Loading branch information...
commit 09badf5e005dacb76bda5e042bb36b3e387262f6 1 parent ee9ab87
@kosh04 authored
Showing with 66 additions and 58 deletions.
  1. +66 −58 newlisp.el
View
124 newlisp.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2008,2009,2010 KOBAYASHI Shigeru
;; Author: KOBAYASHI Shigeru <shigeru.kb@gmail.com>
-;; Version: 0.2
+;; Version: 0.25
;; Created: 2008-12-15
;; Keywords: language,lisp
;; URL: http://github.com/kosh04/newlisp-files/raw/master/newlisp.el
@@ -37,11 +37,15 @@
;;; Installation:
;;
;; (require 'newlisp)
-;; (push '("\\.lsp$" . newlisp-mode) auto-mode-alist)
+;; (add-to-list 'auto-mode-alist '("\\.lsp$" . newlisp-mode))
+;; (add-to-list 'interpreter-mode-alist '("newlisp" . newlisp-mode))
;; (newlisp-mode-setup) ; if needed
;;; ChangeLog:
;;
+;; 2010-06-25 version 0.25
+;; - Emacs21でも利用出来るように修正
+;;
;; 2010-02-05
;; - とりあえずライセンス適用 (GPLv3)
;;
@@ -96,7 +100,7 @@
(require 'comint) ; comint-send-string
(defgroup newlisp nil
- "newlisp source code editing functions."
+ "Newlisp source code editing functions."
:group 'newlisp
:prefix "newlisp-" ; or "nl-" ?
:version "0.2")
@@ -121,7 +125,7 @@ Otherwise maybe `shift_jis'.")
If not running, then start new process."
(let ((default-process-coding-system
(cons #1=newlisp-process-coding-system #1#))
- (switches (split-string newlisp-switches "\s")))
+ (switches (split-string newlisp-switches " ")))
(if (null newlisp-load-init-p)
(pushnew "-n" switches :test #'equal))
(get-buffer-process
@@ -148,7 +152,7 @@ If not running, then start new process."
(cond
((string-match "\n" str-sexp) ; multi-line expr
(sendln "[cmd]")
- (sleep-for 0.05) ; FIXME
+ (sleep-for 0.05) ; XXX
(sendln str-sexp)
(sendln "[/cmd]"))
(:else
@@ -205,9 +209,10 @@ This function is not available on Win32."
(defun newlisp-signal-process (&optional sigcode)
"Send a signal to newlisp process. Default signal is TERM."
(interactive "P")
+ (or sigcode (setq sigcode 15))
;; e.g. (see `kill -l`)
;; 2) SIGINT 9) SIGKILL 15) SIGTERM
- (signal-process (newlisp-process) (or sigcode 15)))
+ (signal-process (newlisp-process) sigcode))
;; eval sync
;; (defun newlisp-eval-buffer (arg)
@@ -273,8 +278,8 @@ This function is not available on Win32."
"atanh" "atom?" "base64-dec" "base64-enc" "bayes-query" "bayes-train" "begin" "beta"
"betai" "bind" "binomial" "bits" "callback" "case" "catch" "ceil" "change-dir" "char"
"chop" "clean" "close" "command-event" "cond" "cons" "constant" "context" "context?"
- "copy" "copy-file" "cos" "cosh" "count" "cpymem" "crc32" "crit-chi2" "crit-z" "current-line"
- "curry" "date" "date-value" "debug" "dec" "def-new" "default"
+ "copy" "copy-file" "cos" "cosh" "count" "cpymem" "crc32" "crit-chi2" "crit-z"
+ "current-line" "curry" "date" "date-value" "debug" "dec" "def-new" "default"
;; "define" "define-macro"
"delete" "delete-file" "delete-url" "destroy" "det" "device" "difference" "directory"
"directory?" "div" "do-until" "do-while" "doargs" "dolist" "dostring" "dotimes"
@@ -308,7 +313,7 @@ This function is not available on Win32."
;; add functions from v.10.2.0 or later
"++" "--" "extend" "module" "prefix" "term" "read" "self" "write"
;; should be avoided in new code
- "read-buffer" "write-buffer"
+ "read-buffer" "write-buffer"
;; remove functions
;; "name"
)
@@ -344,51 +349,6 @@ This function is not available on Win32."
array)
"newLISP symbol table.")
-(defsubst newlisp-find-symbol (string)
- "Locates a symbol whose name is STRING in a newLISP symbols."
- (intern-soft string newlisp-obarray))
-
-(defun newlisp-complete-symbol ()
- (interactive "*")
- (let ((emacs-lisp-mode-syntax-table newlisp-mode-syntax-table)
- (obarray newlisp-obarray))
- (lisp-complete-symbol (lambda (s)
- (newlisp-find-symbol (symbol-name s))))))
-
-(defun newlisp-mode-setup ()
- (setq newlisp-process-coding-system
- (let ((res (shell-command-to-string
- (format "%s -n -e \"%s\"" newlisp-command
- '(primitive? MAIN:utf8)))))
- (if (string-match "true" res)
- 'utf-8 'shift_jis)))
- (setq newlisp-primitive-keywords
- (car (read-from-string
- (shell-command-to-string
- (format "%s -n -e \"%s\"" newlisp-command
- '(map term (filter (lambda (s) (primitive? (eval s)))
- (symbols MAIN))))))))
- t)
-
-
-;; FIXME: This code influence other lisp-mode indent.
-(defmacro defindent (operator indentation)
- `(put ',operator 'lisp-indent-function ',indentation))
-
-(defindent define 1)
-(defindent fn 1)
-(defindent begin 0)
-(defindent local 1)
-(defindent letex 1)
-(defindent for 1)
-(defindent lambda-macro 1)
-(defindent define-macro 1)
-(defindent until 1)
-(defindent letn 1)
-(defindent dostring 1)
-(defindent doargs 1)
-(defindent dotree 1)
-
(defvar newlisp-mode-hook nil)
(defvar newlisp-mode-map
(let ((map (make-sparse-keymap "newlisp")))
@@ -432,11 +392,59 @@ This function is not available on Win32."
(setq major-mode 'newlisp-mode
mode-name "newLISP")
(use-local-map newlisp-mode-map)
- (lisp-mode-variables)
- (set-syntax-table newlisp-mode-syntax-table)
+ (lisp-mode-variables newlisp-mode-syntax-table)
+ ;; (set-syntax-table newlisp-mode-syntax-table)
;; (set (make-local-variable (quote font-lock-defaults)) '(fn t nil nil fn))
;; (set (make-local-variable 'font-lock-keywords-case-fold-search) nil)
- (run-mode-hooks 'newlisp-mode-hook))
+ ;; (set (make-local-variable 'comment-start) "# ")
+ (if (fboundp 'run-mode-hooks)
+ (run-mode-hooks 'newlisp-mode-hook)
+ (run-hooks 'newlisp-mode-hook)))
+
+(defsubst newlisp-find-symbol (string)
+ "Locates a symbol whose name is STRING in a newLISP symbols."
+ (intern-soft string newlisp-obarray))
+
+(defun newlisp-complete-symbol ()
+ (interactive "*")
+ (let ((emacs-lisp-mode-syntax-table newlisp-mode-syntax-table)
+ (obarray newlisp-obarray))
+ (lisp-complete-symbol (lambda (s)
+ (newlisp-find-symbol (symbol-name s))))))
+
+(defun newlisp-mode-setup ()
+ (setq newlisp-process-coding-system
+ (let ((res (shell-command-to-string
+ (format "%s -n -e \"%s\"" newlisp-command
+ '(primitive? MAIN:utf8)))))
+ (if (string-match "true" res)
+ 'utf-8 'shift_jis)))
+ (setq newlisp-primitive-keywords
+ (car (read-from-string
+ (shell-command-to-string
+ (format "%s -n -e \"%s\"" newlisp-command
+ '(map term (filter (lambda (s) (primitive? (eval s)))
+ (symbols MAIN))))))))
+ t)
+
+
+;; FIXME: This code influence other lisp-mode indent.
+(defmacro defindent (operator indentation)
+ `(put ',operator 'lisp-indent-function ',indentation))
+
+(defindent define 1)
+(defindent fn 1)
+(defindent begin 0)
+(defindent local 1)
+(defindent letex 1)
+(defindent for 1)
+(defindent lambda-macro 1)
+(defindent define-macro 1)
+(defindent until 1)
+(defindent letn 1)
+(defindent dostring 1)
+(defindent doargs 1)
+(defindent dotree 1)
;; $ html2txt $NEWLISPDIR/newlisp_manual.html -o newlisp_manual.txt
;; or use www-browser [File] -> [Save Page As (Text)]
@@ -478,7 +486,7 @@ This function is not available on Win32."
(if default
(format " (default %s)" default)
""))
- (newlisp-keywords)
+ newlisp-obarray ;(newlisp-keywords)
nil t nil nil default))))
(if (equal keyword "setf")
(setq keyword "setq"))
Please sign in to comment.
Something went wrong with that request. Please try again.