Hi.
Excuse me for my poor English and lack of knowledge about computers. I am a 
lawyer. Therefore I have to make a lot of batch text processing: pleadings, 
counselling in e-petions, outline of laws, etc. 

People who sold me the Common Lisp packages for law practice told me that the 
Steel Bank Common Lisp is very fast for text processing, therefore I should run 
the scripts they sold me in this particular brand of Common Lisp. They gave me 
the following explanation about how it works.  In my .emacs configuration file 
there is a small elisp program that install Evil and Steel Bank Common Lisp 
scripting. At the end of this article there is a simplified version of my 
.emacs configuration file and two examples of Steel Bank Common Lisp to test 
them.

What I would like from the members of this discussion list is the Vim 
equivalent of my .emacs configuration file, so I can run my scripts and define 
new keybindings in Common Lisp. By the way, I use the C-c p keybinding to 
change the name of the Common Lisp program that I want to run. For instance, if 
I want to run the reverse.lisp program, I type 'reverse.' somewhere on my 
document: 

reverse.

Then I press Esc to enter <N>ormal state, place the cursor on the first letter 
of the file name, and press vf.Ctrl-c p and finally d to remove the name of the 
program and exit <V>isual state.

The name of the file is removed from the text, and the program I want to use is 
installed in the C-c e keybinding. Now, I write a list and put the cursor 
inside the list and press C-c e to execute the program:

(badly sing cats)Reversed list: 
(CATS SING BADLY) 

By the way, I use Common Lisp functions in regexps too. That is the reason for 
not using arguments in my functions. An example will make things clear. Let us 
assume that I have a function without argument to convert pinyin to Chines 
ideograms. Let us put this function inside an org-mode SRC block.

#+BEGIN_SRC emacs-lisp
(defun fn()
  (cond ((equal (match-string 1) "zhong") "中")
        ((equal (match-string 1) "hua")  "华")
        (t "nada")))
; :s/\(\<[a-z]+\>\)/\,(fn)/gc
#+END_SRC

After pressing C-c C-c inside the block, I can start converting pinyin to 
Chinese characters. Of course, in the example, there is only two characters; 
since I need hundreds of them, I put the fn function in a file and only the 
code to load it goes into the SRC block.  I tried this in Vim, but it refused 
to accept the function inside the replacement expression. I mean, it did not 
accept \,(fn) in the replacement expression. The reason, I suppose is that I 
did not configure Vim to accept Common Lisp scripts.

That is all. Thank you for helping me. Since Evil is an emulation of Vim, I 
suppose that Vim is vastly superior to Evil. Therefore, I am looking forward 
for receiving the Vim configuration that accept SBCL scripting.


;; .emacs for scripting in sbcl

(setq inhibit-splash-screen t)
(add-to-list 'default-frame-alist '(height . 24))
(add-to-list 'default-frame-alist '(width . 80))
(set-default-font "Monaco 20")

(add-to-list 'load-path "~/.emacs.d/slime/")
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(add-to-list 'load-path "~/.emacs.d/evil")
(add-to-list 'load-path "~/.emacs.d/evil/lib")
(setq evil-want-C-i-jump nil)
(require 'evil)
(evil-mode 1)

;; sbcl-scripting
(setq theprogram "app.lisp")

(defun processRegion(m p)
   (call-process-region  m p
      "/usr/local/bin/sbcl"
      nil ; do not delete region
      t  ; send output to buffer
      nil ; no redisplay during output
      "--script"  theprogram))

(defun toLisp-text-object()
   (interactive)
   (save-excursion
      (beginning-of-line)
      (push-mark)
      (end-of-line)
      (processRegion (mark) (point))))

(defun change-program(m p)
   (interactive "r")
   (setq theprogram 
       (format "%slisp" (buffer-substring m p))))

(global-set-key (kbd "C-c p") 'change-program)
(global-set-key (kbd "C-c e") 'toLisp-text-object)


Put the Common Lisp programs in separate files:

;; reverse.lisp
(format t "Reversed list: ~%~a~%" 
          (reverse (read)))

(quit)

;; app.lisp
(defun apn(s)
   (cond ((null s) "not a list")
         ((consp (car s)) (append (car s) (cdr s)))
         (t (append '(cats) s)) ))

(format t "~%~a~%" (apn (read)))


-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to