On 2015-02-14T00:39:55+1100, Lawrence Bottorff said:
LB> Is this different from the distribution version?
Yes. The distribution version includes `picolisp-wiki-mode.el`,
which the GitHub version doesn't, and a running a diff on
`picolisp.el` and `inferior-picolisp.el` shows various
differences; i've included the diff outputs at the end of this
message. The files with -1 in their name are from the GitHub
version, the files with -2 in their name are from the distribution
version.
LB> BTW, the dist version doesn't seem to have a customize - mode
LB> variable for the picolisp exe or for pil. Again, the default
seems LB> to be /usr/bin/pil . How do I override this?
i guess the easiest thing to do would be to open
`inferior-picolisp.el` and modify the following line such that the
text "pil" is replaced with the full path to the `pil` executable:
(defvar picolisp-program-name "pil +"
"The name of the program used to run Picolisp." )
which for you would result in:
(defvar picolisp-program-name "/home/lawrence/opt/picoLisp/pil +"
"The name of the program used to run Picolisp." )
Alexis.
*** BEGIN DIFFS ***
** picolisp-1.el vs. picolisp-2.el **
27c27 < ---
98c98 < ---
199c199 < ---
243c243 < ---
285c285 < ---
378c378 < ---
396c396 < ---
498c498 < ---
539c539 < ---
582c582 < ---
617c617,618 < (let* ((unit (get-selection-or-unit 'word))
---
(let* ((thing (thing-at-point 'word))
(unit (get-selection-or-unit 'word))
645c646 < ---
751c752 < ---
** inferior-picolisp-1.el vs. inferior-picolisp-2.el
1,22c1,2 < ;; * inferior-picolisp.el --- picolisp repl in a buffer
< ;; ** MetaData < ;; :PROPERTIES: < ;; :copyright:
Guillermo_R._Palavecino Thorsten_Jolitz < ;; :copyright-since:
2009 < ;; :version: 1.2 < ;; :licence: GPL2+ < ;;
:licence-url: http://www.gnu.org/licenses/ < ;; :part-of-emacs:
no < ;; :git-repo: https://github.com/tj64/iorg < ;;
:git-clone: g...@github.com:tj64/iorg.git < ;; :authors:
Guillermo_R._Palavecino Thorsten_Jolitz < ;; :contact:
<grp...@gmail.com> <tjol...@gmail.com> < ;; :inspiration:
cmuscheme.el < ;; :keywords: emacs picolisp comint repl iorg <
;; :END: < < ;; ** Commentary < < ;; For comments, bug
reports, questions, etc use the picolisp mailing list, < ;; the
#picolisp channel on irc.freenode.net, or the author's emails
given < ;; above. ---
;;;;;; inferior-picolisp: Picolisp repl in a buffer. ;;;;;;
Version: 1.2
24c4,18 < ;; * Requires ---
;;; Copyright (c) 2009, 2012, 2013, Guillermo R. Palavecino,
Thorsten Jolitz ;; This file is NOT part of GNU emacs. ;;;;
Credits: ;; It's and adaptation of GNU emacs' cmuscheme.el ;;
;;;; Contact: ;; For comments, bug reports, questions, etc, you
can contact me via IRC ;; to the user named grpala (or
armadillo) on irc.freenode.net in the ;; #picolisp channel or
via email to the author's nickname at gmail.com ;; ;;;; License:
;; This work is released under the GPL 2 or (at your option) any
later ;; version.
29,30d22 < ;; * Mode definitions < ;; ** Inferior Picolisp Mode
32,33c24,26 < (define-derived-mode inferior-picolisp-mode
comint-mode "Inferior Picolisp" < "Major mode for interacting
with an inferior Picolisp process. ---
(defgroup picolisp nil
"Run an Picolisp process in a buffer." :group 'picolisp )
35,36c28,29 < The following commands are available: <
\\{inferior-picolisp-mode-map} ---
;;; INFERIOR PICOLISP MODE STUFF
;;;============================================================================
38c31,32 < An Picolisp process can be fired up with 'M-x
run-picolisp'. ---
(defconst inferior-picolisp-version "1.2"
"Verion-number of library")
40,41c34,37 < Customization: Entry to this mode runs the hooks on
`comint-mode-hook' and < `inferior-picolisp-mode-hook' (in that
order). ---
(defcustom inferior-picolisp-mode-hook nil
"*Hook for customizing inferior-picolisp mode." :type 'hook
:group 'picolisp )
43,44c39,44 < You can send text to the inferior Picolisp process
from other < buffers containing Picolisp source. ---
(defvar inferior-picolisp-mode-map
(let ((m (make-sparse-keymap)))
(define-key m "\M-\C-x" 'picolisp-send-definition) ;gnu
convention (define-key m "\C-x\C-e"
'picolisp-send-last-sexp) (define-key m "\C-c\C-l"
'picolisp-load-file) m ) )
46,47c46,47 < - `switch-to-picolisp' switches the current buffer
to the < Picolisp process buffer. ---
(defvar picolisp-local-program-name "./pil +") (defvar
picolisp-process-number 0)
49,50c49,50 < - `picolisp-send-definition' sends the current
definition to the < Picolisp process. ---
(defvar picolisp-program-name "pil +"
"The name of the program used to run Picolisp." )
52,53c52,60 < - `picolisp-send-region' sends the current region
to the < Picolisp process. ---
;; Install the process communication commands in the
picolisp-mode keymap. (define-key picolisp-mode-map "\M-\C-x"
'picolisp-send-definition);gnu convention (define-key
picolisp-mode-map "\C-x\C-e" 'picolisp-send-last-sexp);gnu
convention (define-key picolisp-mode-map "\C-c\C-e"
'picolisp-send-definition) (define-key picolisp-mode-map
"\C-c\M-e" 'picolisp-send-definition-and-go) (define-key
picolisp-mode-map "\C-c\C-r" 'picolisp-send-region) (define-key
picolisp-mode-map "\C-c\M-r" 'picolisp-send-region-and-go)
(define-key picolisp-mode-map "\C-c\C-x" 'switch-to-picolisp)
(define-key picolisp-mode-map "\C-c\C-l" 'picolisp-load-file)
55,57c62,77 < - `picolisp-send-definition-and-go' and <
`picolisp-send-region-and-go' switch to the Picolisp process <
buffer after sending their text. ---
(let ((map (lookup-key picolisp-mode-map [menu-bar picolisp])))
(define-key map [separator-eval] '("--")) (define-key map
[load-file]
'("Load Picolisp File" . picolisp-load-file) )
(define-key map [switch]
'("Switch to Picolisp" . switch-to-picolisp) )
(define-key map [send-def-go]
'("Evaluate Last Definition & Go"
. picolisp-send-definition-and-go) )
(define-key map [send-def]
'("Evaluate Last Definition" . picolisp-send-definition) )
(define-key map [send-region-go]
'("Evaluate Region & Go" . picolisp-send-region-and-go) )
(define-key map [send-region]
'("Evaluate Region" . picolisp-send-region) )
(define-key map [send-sexp]
'("Evaluate Last S-expression" . picolisp-send-last-sexp) )
)
59,60c79 < For information on running multiple processes in
multiple buffers, see < documentation for variable
`picolisp-buffer'. ---
(defvar picolisp-buffer)
62c81,82 < Commands: ---
(define-derived-mode inferior-picolisp-mode comint-mode
"Inferior Picolisp"
"Major mode for interacting with an inferior Picolisp process.
64,65c84,85 < 'Return' after the end of the process' output sends
the text from < the end of process to point. ---
The following commands are available:
\\{inferior-picolisp-mode-map}
67,68c87 < 'Return' before the end of the process' output copies
the sexp < ending at point to the end of the process' output, and
sends it. ---
An Picolisp process can be fired up with M-x run-picolisp.
70c89,90 < 'Delete' converts tabs to spaces as it moves back. ---
Customization: Entry to this mode runs the hooks on
comint-mode-hook and inferior-picolisp-mode-hook (in that
order).
72,73c92,96 < 'Tab' indents for Picolisp; with argument, shifts
rest of < expression rigidly with the current line. ---
You can send text to the inferior Picolisp process from other
buffers containing Picolisp source.
switch-to-picolisp switches the current buffer to the
Picolisp process buffer. picolisp-send-definition sends the
current definition to the Picolisp process.
picolisp-send-region sends the current region to the
Picolisp process.
75,76c98,101 < 'C-M-q' does Tab on each line starting within
following < expression. ---
picolisp-send-definition-and-go and
picolisp-send-region-and-go
switch to the Picolisp process buffer after sending
their text.
For information on running multiple processes in multiple
buffers, see documentation for variable picolisp-buffer.
77a103,111
Commands: Return after the end of the process' output sends the
text from the
end of process to point.
Return before the end of the process' output copies the sexp
ending at point
to the end of the process' output, and sends it.
Delete converts tabs to spaces as it moves back. Tab indents
for Picolisp; with argument, shifts rest
of expression rigidly with the current line.
C-M-q does Tab on each line starting within following
expression.
90,183d123 < ;; * Hooks < ;; * Variables < ;; ** Vars < < (defvar
picolisp-emacs-as-editor-p nil < "If non-nil, use `eedit.l'
instead of `edit.l'.") < < (defvar picolisp-local-program-name
"./pil +") < ;; (defvar picolisp-process-number 0) < < (defvar
picolisp-program-name "pil +" < "The name of the program used to
run Picolisp." ) < < (defvar picolisp-buffer) < < (defvar
picolisp-prev-load-dir/file nil < "Caches the last (directory
file) pair. < Caches the last pair used in the last
`picolisp-load-file' command. < Used for determining the default
in the next one." ) < < < (defvar picolisp-buffer nil "*The
current picolisp process buffer. < < MULTIPLE PROCESS SUPPORT <
==================================================================
< < inferior-picolisp.el supports, in a fairly simple fashion, <
running multiple Picolisp processes. To run multiple Picolisp <
processes, you start the first up with \\[run-picolisp]. It will <
be in a buffer named *picolisp*. Rename this buffer with <
\\[rename-buffer]. You may now start up a new process with <
another \\[run-picolisp]. It will be in a new buffer, named <
*picolisp*. You can switch between the different process buffers <
with \\[switch-to-buffer]. < < Commands that send text from
source buffers to Picolisp processes < -- like
`picolisp-send-definition' -- have to choose a process to < send
to, when you have more than one Picolisp process around. < This
is determined by the global variable `picolisp-buffer'. < Suppose
you have three inferior Picolisps running: < < Buffer
Process < foo picolisp < bar picolisp<2> <
*picolisp* picolisp<3> < < If you do a
\\[picolisp-send-definition-and-go] command on some < Picolisp
source code, what process do you send it to? < < - If you're in
a process buffer (foo, bar, or *picolisp*), < you send it to
that process. < - If you're in some other buffer (e.g., a source
file), you < send it to the process attached to buffer
`picolisp-buffer'. < < This process selection is performed by
function `picolisp-proc'. < < Whenever \\[run-picolisp] fires up
a new process, it resets < `picolisp-buffer' to be the new
process's buffer. If you only run < one process, this will do the
right thing. If you run multiple < processes, you can change
`picolisp-buffer' to another process < buffer with
\\[set-variable]. < < More sophisticated approaches are, of
course, possible. If you < find yourself needing to switch back
and forth between multiple < processes frequently, you may wish to
consider ilisp.el, a < larger, more sophisticated package for
running inferior Lisp and < Picolisp processes. The approach taken
here is for a minimal, < simple implementation. Feel free to
extend it." ) < < ;; ** Consts < < (defconst
inferior-picolisp-version "1.2" < "Verion-number of library") <
< ;; ** Customs < ;; *** Custom Groups < < (defgroup picolisp nil
< "Run an Picolisp process in a buffer." < :group 'picolisp )
< < ;; *** Custom Vars < < (defcustom
inferior-picolisp-mode-hook nil < "*Hook for customizing
inferior-picolisp mode." < :type 'hook < :group 'picolisp ) <
< (defcustom inferior-picolisp-load-hook nil < "This hook is run
when inferior-picolisp is loaded in. < This is a good place to
put keybindings." < :type 'hook < :group 'picolisp ) <
190,201c130,132 < (defcustom picolisp-source-modes
'(picolisp-mode) < "*Used to determine if a buffer contains
Picolisp source code. < If it's loaded into a buffer that is in
one of these major modes, < it's considered a picolisp source file
by `picolisp-load-file'. Used by < these commands to determine
defaults." < :type '(repeat function) < :group 'picolisp ) <
< ;; * Functions < ;; ** Non-interactive Functions < < ;; ***
Utilities ---
(defun picolisp-input-filter (str)
"Don't save anything matching
`inferior-picolisp-filter-regexp'." (not (string-match
inferior-picolisp-filter-regexp str)) )
210,234d140 < ;; *** Filters < < (defun picolisp-input-filter
(str) < "Don't save anything matching
`inferior-picolisp-filter-regexp'." < (not (string-match
inferior-picolisp-filter-regexp str)) ) < < ;; *** Deal with
PicoLisp Line Editor < < (defun picolisp-get-editor-info () <
"Find out if Emacs is used as editor." < (let* ((editor-file
(expand-file-name "editor" "~/.pil/")) <
(editor-orig-file (expand-file-name "editor-orig" "~/.pil/")) <
(ed-file < (cond < ((file-exists-p
editor-file) editor-file) < ((file-exists-p
editor-orig-file) editor-orig-file) < (t nil)))) <
(when ed-file < (with-current-buffer (find-file-noselect
ed-file) < (goto-char (point-min)) < (if
(re-search-forward "eedit" nil 'NOERROR) < (setq
picolisp-emacs-as-editor-p t) < (setq
picolisp-emacs-as-editor-p nil)) < (kill-buffer))))) <
237c143 < The line-editor is not needed when PicoLisp is run as
Emacs subprocess." ---
Not needed when PicoLisp is run as Emacs subprocess."
239,264c145,146 < ;; renaming of existing editor file <
(cond < ;; abnormal condition, something went wrong before <
((and < (member "editor" (directory-files pil-tmp-dir)) <
(member "editor-orig" (directory-files pil-tmp-dir))) < (let
((ed-size < (nth < 7 <
(file-attributes < (expand-file-name "editor"
pil-tmp-dir)))) < (ed-orig-size < (nth <
7 < (file-attributes <
(expand-file-name "editor-orig" pil-tmp-dir))))) < (if
(or (= ed-size 0) < (<= ed-size ed-orig-size)) <
(delete-file < (expand-file-name "editor"
pil-tmp-dir)) < (rename-file < (expand-file-name
"editor" pil-tmp-dir) < (expand-file-name "editor-orig"
pil-tmp-dir) < 'OK-IF-ALREADY-EXISTS)))) < ;; normal
condition, only editor file exists < ((member "editor"
(directory-files pil-tmp-dir )) ---
(and (member
"editor" (directory-files pil-tmp-dir ))
266,268c148,149 < (expand-file-name "editor"
pil-tmp-dir) < (expand-file-name "editor-orig"
pil-tmp-dir)))) < ;; after renaming, create new empty editor
file ---
(expand-file-name "editor" pil-tmp-dir) (expand-file-name
"editor-orig" pil-tmp-dir)))
270,274c151,154 < (find-file-noselect <
(expand-file-name "editor" pil-tmp-dir)) < (erase-buffer) <
(save-buffer) < (kill-buffer)))) ---
(find-file-noselect (expand-file-name "editor"
pil-tmp-dir)) (save-buffer) (kill-buffer))))
287,314d166 < ;; *** Get PicoLisp Process < < (defun
picolisp-interactively-start-process (&optional cmd) < "Start an
inferior Picolisp process. Return the process started. < Since
this command is run implicitly, always ask the user for the <
command to run." < (save-window-excursion < (run-picolisp <
(read-string "Run Picolisp: " picolisp-program-name)) ) ) < <
(defun picolisp-proc () < "Return the current Picolisp process,
starting one if necessary. < See variable `picolisp-buffer'." <
(unless (and picolisp-buffer < (get-buffer
picolisp-buffer) < (comint-check-proc
picolisp-buffer) ) < (picolisp-interactively-start-process) )
< (or (picolisp-get-process) < (error "No current process.
See variable `picolisp-buffer'") ) ) < < (defun
picolisp-get-process () < "Return the current Picolisp process
or nil if none is running." < (get-buffer-process < (if (eq
major-mode 'inferior-picolisp-mode) < (current-buffer) <
picolisp-buffer ) ) ) < < ;; ** Commands 316,317d167 < ;; ***
Start REPL < 319,325c169,192 < (defun run-picolisp-new (cmd
&optional iorg-scrape-mode-p) < "Run a new inferior Picolisp
process with command CMD. < Input and output via buffer
`*picolisp*<N>' or < `*iorg-scrape*<N>', depending on
`iorg-scrape-mode-p'." < (let* ((tmp-buf-name (make-temp-name
"noname")) < (cmdlist (split-string cmd))) <
(picolisp-get-editor-info) ---
(defun run-picolisp-new-local (cmd)
"Run a new inferior Picolisp process for a locally installed
PicoLisp, input and output via buffer `*picolisp<N>*'. Works
only as intended, when called from inside a picolisp directory,
e.g. from a dired buffer showing the top-level directory of a
local picolisp installation. Otherwise, calls a global picolisp
installation instead (with `picolisp-program-name', see function
`picolisp-interactively-start-process'). If there is a process
already running in `*picolisp<N>*', create a new process in
buffer `*picolisp<N+1>*'. With argument, allows you to edit the
command line (default is value of
`picolisp-local-program-name'). Runs the hook
`inferior-picolisp-mode-hook' \(after the `comint-mode-hook' is
run). \(Type \\[describe-mode] in the process buffer for a list
of commands.)"
(interactive (list (if current-prefix-arg
(read-string "Run Picolisp: "
picolisp-local-program-name)
picolisp-local-program-name) ) )
(setq picolisp-process-number (1+ picolisp-process-number))
(setq pl-proc-buf (concat
"picolisp<" (number-to-string
picolisp-process-number) ">"))
(let ((cmdlist (split-string cmd)))
328,354c195,200 < (apply 'make-comint <
tmp-buf-name < (car cmdlist) < nil <
;; hack for multi-word PicoLisp arguments: < ;;
separate them with '_XXX_' in the 'cmd' arg < ;;
instead of blanks < (mapcar < (lambda
(--arg) < (replace-regexp-in-string <
"_XXX_" " " --arg)) < (if picolisp-emacs-as-editor-p
< (cons "@lib/eedit.l" (cdr cmdlist)) <
(cons "@lib/edit.l" (cdr cmdlist)) ) ) ) ) < ;; avoid
racecondition between Emacs and PicoLisp < ;; TODO replace
with filter solution < (sit-for 1 'NODISP) <
(rename-buffer < (if iorg-scrape-mode-p <
"*iorg-scrape*" < "*picolisp*") < 'UNIQUE) <
(picolisp-reset-line-editor) < (if iorg-scrape-mode-p <
(iorg-scrape-mode) < (inferior-picolisp-mode))) <
(pop-to-buffer (current-buffer)) ) ---
(apply 'make-comint pl-proc-buf (car cmdlist)
nil (cdr cmdlist)))
(picolisp-reset-line-editor)
(inferior-picolisp-mode) )
(pop-to-buffer (concat "*" pl-proc-buf "*")) )
368c214 < picolisp-program-name ) ) ) ---
picolisp-program-name ) ) )
371d216 < (picolisp-get-editor-info) 373,387c218,219 <
(set-buffer < (apply 'make-comint <
"picolisp" < (car cmdlist) < nil <
;; hack for multi-word PicoLisp arguments: < ;;
separate them with '_XXX_' in the 'cmd' arg < ;;
instead of blanks < (mapcar < (lambda
(--arg) < (replace-regexp-in-string <
"_XXX_" " " --arg)) < (if picolisp-emacs-as-editor-p
< (cons "@lib/eedit.l" (cdr cmdlist)) <
(cons "@lib/edit.l" (cdr cmdlist)) ) ) ) ) ---
(set-buffer (apply 'make-comint "picolisp" (car cmdlist)
nil (cdr cmdlist) ) )
395,396d226 < ;; *** Use REPL < 402,403c232,233 <
(comint-send-string < (picolisp-proc) ---
(comint-send-string
(picolisp-proc)
423a254,265
(defun switch-to-picolisp (eob-p)
"Switch to the picolisp process buffer.
With argument, position cursor at end of buffer."
(interactive "P") (if (or (and picolisp-buffer (get-buffer
picolisp-buffer))
(picolisp-interactively-start-process) )
(pop-to-buffer picolisp-buffer)
(error "No current process buffer. See variable
`picolisp-buffer'") )
(when eob-p
(push-mark) (goto-char (point-max)) ) )
437a280,292
(defcustom picolisp-source-modes '(picolisp-mode)
"*Used to determine if a buffer contains Picolisp source code.
If it's loaded into a buffer that is in one of these major
modes, it's considered a picolisp source file by
`picolisp-load-file'. Used by these commands to determine
defaults."
:type '(repeat function) :group 'picolisp )
(defvar picolisp-prev-load-dir/file nil
"Caches the last (directory . file) pair.
Caches the last pair used in the last `picolisp-load-file'
command. Used for determining the default in the next one." )
440,451c295,303 < (interactive < (comint-get-source "Load
Picolisp file: " <
picolisp-prev-load-dir/file < ;; t because
`load' needs an exact name <
picolisp-source-modes t ) ) < ;; Check to see if buffer needs
saved. < (comint-check-source file-name) < (setq
picolisp-prev-l/c-dir/file < (cons (file-name-directory
file-name) < (file-name-nondirectory file-name) ) )
< (comint-send-string < (picolisp-proc) (concat "(load \""
file-name "\"\)\n" ) ) ) ---
(interactive (comint-get-source "Load Picolisp file: "
picolisp-prev-load-dir/file
picolisp-source-modes t ) ) ;
t because `load'
; needs
an exact
name
(comint-check-source file-name) ; Check to see if buffer needs
saved. (setq picolisp-prev-l/c-dir/file (cons
(file-name-directory file-name)
(file-name-nondirectory
file-name) ) )
(comint-send-string (picolisp-proc) (concat "(load \""
file-name "\"\)\n" )
) )
453,463d304 < (defun switch-to-picolisp (eob-p) < "Switch to the
picolisp process buffer. < With argument, position cursor at end
of buffer." < (interactive "P") < (if (or (and
picolisp-buffer (get-buffer picolisp-buffer)) <
(picolisp-interactively-start-process) ) < (pop-to-buffer
picolisp-buffer) < (error "No current process buffer. See
variable `picolisp-buffer'") ) < (when eob-p < (push-mark) <
(goto-char (point-max)) ) ) 465,466c306 < ;; * Menus and Keys < ;;
** Mode Map ---
(defvar picolisp-buffer nil "*The current picolisp process
buffer.
468,474c308,327 < (defvar inferior-picolisp-mode-map < (let ((m
(make-sparse-keymap))) < ;; gnu convention < (define-key m
"\M-\C-x" 'picolisp-send-definition) < (define-key m
"\C-x\C-e" 'picolisp-send-last-sexp) < (define-key m
"\C-c\C-l" 'picolisp-load-file) < m ) ) ---
MULTIPLE PROCESS SUPPORT
===========================================================================
inferior-picolisp.el supports, in a fairly simple fashion,
running multiple Picolisp processes. To run multiple Picolisp
processes, you start the first up with \\[run-picolisp]. It
will be in a buffer named *picolisp*. Rename this buffer with
\\[rename-buffer]. You may now start up a new process with
another \\[run-picolisp]. It will be in a new buffer, named
*picolisp*. You can switch between the different process
buffers with \\[switch-to-buffer]. Commands that send text
from source buffers to Picolisp processes -- like
`picolisp-send-definition' -- have to choose a process to send
to, when you have more than one Picolisp process around. This
is determined by the global variable `picolisp-buffer'. Suppose
you have three inferior Picolisps running:
Buffer Process foo picolisp bar
picolisp<2> *picolisp* picolisp<3>
If you do a \\[picolisp-send-definition-and-go] command on some
Picolisp source code, what process do you send it to?
476c329,333 < ;; ** Menus ---
- If you're in a process buffer (foo, bar, or *picolisp*),
you send it to that process.
- If you're in some other buffer (e.g., a source file), you
send it to the process attached to buffer `picolisp-buffer'.
This process selection is performed by function `picolisp-proc'.
478,493c335,344 < (let ((map (lookup-key picolisp-mode-map
[menu-bar picolisp]))) < (define-key map [separator-eval]
'("--")) < (define-key map [load-file] < '("Load Picolisp
File" . picolisp-load-file) ) < (define-key map [switch] <
'("Switch to Picolisp" . switch-to-picolisp) ) < (define-key map
[send-def-go] < '("Evaluate Last Definition & Go"
picolisp-send-definition-and-go) ) < (define-key map
[send-def] < '("Evaluate Last Definition"
picolisp-send-definition) ) < (define-key map [send-region-go]
< '("Evaluate Region & Go" . picolisp-send-region-and-go) ) <
(define-key map [send-region] < '("Evaluate Region"
picolisp-send-region) ) < (define-key map [send-sexp] <
'("Evaluate Last S-expression" . picolisp-send-last-sexp) ) ) ---
Whenever \\[run-picolisp] fires up a new process, it resets
`picolisp-buffer' to be the new process's buffer. If you only
run one process, this will do the right thing. If you run
multiple processes, you can change `picolisp-buffer' to another
process buffer with \\[set-variable]. More sophisticated
approaches are, of course, possible. If you find yourself
needing to switch back and forth between multiple processes
frequently, you may wish to consider ilisp.el, a larger, more
sophisticated package for running inferior Lisp and Picolisp
processes. The approach taken here is for a minimal, simple
implementation. Feel free to extend it." )
495c346,354 < ;; ** Keys ---
(defun picolisp-proc ()
"Return the current Picolisp process, starting one if
necessary.
See variable `picolisp-buffer'."
(unless (and picolisp-buffer
(get-buffer picolisp-buffer) (comint-check-proc
picolisp-buffer) )
(picolisp-interactively-start-process) )
(or (picolisp-get-process)
(error "No current process. See variable
`picolisp-buffer'") ) )
497,507c356,367 < ;; Install the process communication commands in
the picolisp-mode keymap. < ;; gnu convention < (define-key
picolisp-mode-map "\M-\C-x" 'picolisp-send-definition) < ;; gnu
convention < (define-key picolisp-mode-map "\C-x\C-e"
'picolisp-send-last-sexp) < (define-key picolisp-mode-map
"\C-c\C-e" 'picolisp-send-definition) < (define-key
picolisp-mode-map "\C-c\M-e" 'picolisp-send-definition-and-go) <
(define-key picolisp-mode-map "\C-c\C-r" 'picolisp-send-region) <
(define-key picolisp-mode-map "\C-c\M-r"
'picolisp-send-region-and-go) < (define-key picolisp-mode-map
"\C-c\C-x" 'switch-to-picolisp) < (define-key picolisp-mode-map
"\C-c\C-l" 'picolisp-load-file) ---
(defun picolisp-get-process ()
"Return the current Picolisp process or nil if none is
running." (get-buffer-process (if (eq major-mode
'inferior-picolisp-mode)
(current-buffer)
picolisp-buffer ) ) )
(defun picolisp-interactively-start-process (&optional cmd)
"Start an inferior Picolisp process. Return the process
started.
Since this command is run implicitly, always ask the user for
the command to run."
(save-window-excursion
(run-picolisp (read-string "Run Picolisp: "
picolisp-program-name)) ) )
508a369,375
;;; Do the user's customization... (defcustom
inferior-picolisp-load-hook nil
"This hook is run when inferior-picolisp is loaded in.
This is a good place to put keybindings."
:type 'hook :group 'picolisp )
510d376 < ;; * Run hooks and provide 513a380
-- END DIFFS --
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe