Permalink
Browse files

Merge pull request #9 from kosh04/develop

Version 0.3.3
  • Loading branch information...
2 parents 7f44e7c + 50d520f commit ac23be40c81a360988ab803d365f1510733f6db4 @kosh04 committed Feb 26, 2016
Showing with 37 additions and 38 deletions.
  1. +11 −0 .travis.yml
  2. +1 −0 README.md
  3. +25 −38 newlisp-mode.el
View
@@ -0,0 +1,11 @@
+language: emacs-lisp
+sudo: false
+addons:
+ apt:
+ sources:
+ - cassou-emacs
+ packages:
+ - emacs24
+script:
+ - emacs --version
+ - emacs -batch -f batch-byte-compile newlisp-mode.el
View
@@ -2,6 +2,7 @@ newlisp-mode
============
[![MELPA](http://melpa.org/packages/newlisp-mode-badge.svg)](http://melpa.org/#/newlisp-mode)
+[![Build Status](https://travis-ci.org/kosh04/newlisp-mode.svg?branch=master)](https://travis-ci.org/kosh04/newlisp-mode)
This is a newLISP editing mode for Emacs.
View
@@ -1,9 +1,9 @@
;;; newlisp-mode.el --- newLISP editing mode for Emacs
-;; Copyright (C) 2008-2014 KOBAYASHI Shigeru
+;; Copyright (C) 2008-2016 KOBAYASHI Shigeru (kosh)
;; Author: KOBAYASHI Shigeru <shigeru.kb[at]gmail.com>
-;; Version: 0.3.2
+;; Version: 0.3.3
;; Created: 2008-12-15
;; Keywords: language,lisp,newlisp
;; URL: https://github.com/kosh04/newlisp-mode
@@ -43,6 +43,10 @@
;;; ChangeLog:
+;; version 0.3.3
+;; - newlisp-eval: `M-:' yield up the default keymap
+;; - implement `completion-at-point' substitute for `newlisp-complete-symbol'
+;;
;; version 0.3.2
;; - rewrite newlisp-mode for derived-mode
;; - font-lock available string brackets {} and [text] tag
@@ -159,7 +163,7 @@ If not running, then start new process."
"Eval newlisp s-expression."
(interactive "snewLISP Eval: ")
(let ((proc (newlisp-process)))
- (labels ((sendln (str)
+ (cl-labels ((sendln (str)
(comint-send-string proc (concat str "\n"))))
;; Suppress TAB completion. [Tab] -> [Space]
(if newlisp--allow-lazy-eval
@@ -386,14 +390,13 @@ You can specify a script additional ARGS, if called with a prefix arg."
(defvar newlisp-mode-map
(let ((map (make-sparse-keymap "newlisp")))
(set-keymap-parent map lisp-mode-shared-map)
- (define-key map (kbd "M-:") 'newlisp-eval)
+ (define-key map (kbd "C-c M-:") 'newlisp-eval)
(define-key map (kbd "M-C-x") 'newlisp-eval-defun)
(define-key map (kbd "C-x C-e") 'newlisp-eval-last-sexp)
(define-key map (kbd "C-c C-b") 'newlisp-eval-buffer)
(define-key map (kbd "C-c C-r") 'newlisp-eval-region)
(define-key map (kbd "C-c C-l") 'newlisp-load-file)
(define-key map (kbd "C-c C-z") 'newlisp-show-repl)
- (define-key map (kbd "C-c C-i") 'newlisp-complete-symbol) ; or ESC TAB
(define-key map (kbd "C-m") 'newline-and-indent)
(define-key map (kbd "C-c <f4>") 'newlisp-kill-process)
(define-key map (kbd "<f5>") 'newlisp-execute-file)
@@ -439,7 +442,8 @@ You can specify a script additional ARGS, if called with a prefix arg."
:group 'newlisp
:syntax-table newlisp-mode-syntax-table
(lisp-mode-variables) ; FIXME: lisp-mode independent setup
- (setq-local font-lock-defaults '(newlisp-font-lock-keywords)))
+ (setq-local font-lock-defaults '(newlisp-font-lock-keywords))
+ (add-hook 'completion-at-point-functions #'newlisp-completion-at-point nil t))
;;;###autoload (add-to-list 'auto-mode-alist '("\\.lsp$" . newlisp-mode))
;;;###autoload (add-to-list 'interpreter-mode-alist '("newlisp" . newlisp-mode))
@@ -448,31 +452,16 @@ You can specify a script additional ARGS, if called with a prefix arg."
"Locates a symbol whose name is STRING in a newLISP symbols."
(intern-soft string newlisp-obarray))
-(defun newlisp-complete-symbol ()
- "Perform completion on newLISP symbol preceding point."
- (interactive "*")
- ;; NOTE: newlisp's symbol is case-insensitive
- (let* ((completion-ignore-case nil)
- (from (save-excursion (backward-sexp) (point)))
- (to (point))
- (pattern (buffer-substring from to))
- (completion (try-completion pattern newlisp-obarray)))
- (cond ((eq completion t)
- (message "Sole completion"))
- ((null completion)
- (message "Can't find completion for \"%s\"" pattern)
- (ding))
- ((not (string= pattern completion))
- (delete-region from to)
- (insert completion))
- (:else
- (message "Making completion list...")
- (with-output-to-temp-buffer "*Completions*"
- (display-completion-list
- (all-completions pattern newlisp-obarray nil)
- pattern))
- (message "Making completion list...done"))
- )))
+(defun newlisp-completion-at-point ()
+ "Perform completion on symbol preceding point."
+ (let ((bounds (bounds-of-thing-at-point 'symbol)))
+ (when bounds
+ (list (car bounds)
+ (cdr bounds)
+ newlisp-obarray))))
+
+(define-obsolete-function-alias 'newlisp-complete-symbol
+ #'completion-at-point "0.3.3")
(defun newlisp-mode-setup ()
(setq newlisp-process-coding-system
@@ -509,6 +498,7 @@ You can specify a script additional ARGS, if called with a prefix arg."
(defindent do-while 1)
(defindent do-until 1)
(defindent if 0)
+(defindent macro 1)
;; (defun newlisp-indent-function (indent-point state)
;; ...
@@ -521,9 +511,10 @@ You can specify a script additional ARGS, if called with a prefix arg."
(defvar newlisp-manual-html
(or (dolist (path (list "/usr/share/doc/newlisp/manual_frame.html"
+ "/usr/local/share/doc/newlisp/manual_frame.html"
;; When build newlisp `make install_home'
"~/share/doc/newlisp/manual_frame.html"
- "C:/Program Files/newlisp/manual_frame.html"))
+ (expand-file-name "manual_frame.html" (getenv "NEWLISPDIR"))))
(if (file-exists-p path)
(return path)))
"http://www.newlisp.org/downloads/manual_frame.html"))
@@ -544,18 +535,14 @@ You can specify a script additional ARGS, if called with a prefix arg."
(defun newlisp-lookup-manual (keyword)
"Lookup newlisp reference manual."
(interactive
- (list (let* ((s (newlisp-find-symbol
- (current-word)
- ;; (function-called-at-point)
- ;; (thing-at-point 'symbol)
- ))
+ (list (let* ((s (newlisp-find-symbol (thing-at-point 'symbol)))
(default (and s (symbol-name s))))
;; NOTE: Type "lambda?" from minibuffer -> l a m b d a C-q ?
(completing-read (format "newLISP manual%s: "
(if default
(format " (default %s)" default)
""))
- newlisp-obarray ; (newlisp-keywords)
+ newlisp-obarray
nil t nil nil default))))
(if (equal keyword "setf") (setq keyword "setq"))
(if (equal keyword "parse-date") (setq keyword "date-parse"))

0 comments on commit ac23be4

Please sign in to comment.