Commit 487c3438 authored by Pascal Bourguignon's avatar Pascal Bourguignon

First checkin.

parents
2003-01-18 Pascal Bourguignon <pjb@informatimago.com>
* pjb-sources.el: Added pjb-add-change-log-entry
2001-03-19 Pascal J. Bourguignon <pjb@imaginet.fr>
cvs tag: PJB-1
* pjb-pgp.el: Made it work on read-only buffers, creating a
temporary buffer for output.
#******************************************************************************
#FILE: Makefile
#LANGUAGE: make
#SYSTEM: UNIX
#USER-INTERFACE: None
#DESCRIPTION
#USAGE
#AUTHORS
# <PJB> Pascal J. Bourguignon
#MODIFICATIONS
# 2003-01-17 <PJB> Added this header comment.
#BUGS
#LEGAL
# GPL
#
# Copyright Pascal J. Bourguignon 2003 - 2003
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
#******************************************************************************
TARGET := $(shell uname)
PREFIX := /usr/local
MAKEDIR := $(HOME)/src/public/common/makedir
SHARE_LISP=$(shell get-directory SHARE_LISP)
MODULE=emacs
PACKAGE_PATH=com/informatimago/emacs
PACKAGES=$(SHARE_LISP)/packages
EMACS_FLAGS= -l .emacs # -l pjb-cl.el
AWK = $(shell which awk)
# .el.elc: ; @echo '' ; echo Compiling $< ; emacs -batch -q $(EMACSFLAGS) -f batch-byte-compile $< 2>&1 | egrep -v -e 'Loading .*/fns-'
# See also .emacs in this directory with the load-path used to compile.
EMACS_SOURCES=\
pjb-advices.el \
pjb-asm7090.el \
pjb-banks.el \
pjb-bourse.el \
pjb-c.el \
pjb-cl.el \
pjb-cl-faces.el \
pjb-cl-magic.el \
pjb-class.el \
pjb-constants.el \
pjb-cvs.el \
pjb-cvspass.el \
pjb-erc.el \
pjb-font.el \
pjb-dot.el \
pjb-dodo.el \
pjb-emacs.el \
pjb-computer-paper.el \
pjb-euro.el \
pjb-graph.el \
pjb-i2p-expression.el \
pjb-layers.el \
pjb-list.el \
pjb-mail.el \
pjb-make-depends.el \
pjb-objc-mode.el \
pjb-object.el \
pjb-pgp.el \
pjb-queue.el \
pjb-roman.el \
pjb-s2p-expression.el \
pjb-secouer.el \
pjb-selftrade.el \
pjb-server.el \
pjb-sources.el \
pjb-state-coding.el \
pjb-shell.el \
pjb-strings.el \
pjb-transpose.el \
pjb-utilities.el \
pjb-vm-kill-file.el \
pjb-work.el \
pjb-worldfact.el
EMACS_OBJECTS=$(EMACS_SOURCES:.el=.elc)
LISP_OBJECTS=$(EMACS_OBJECTS)
all::$(EMACS_OBJECTS) #summary.html
-@chmod a+r *
install::install-packages
TRACE=@
LISP_SOURCE_SUFFIXES= .el .lisp
LISP_OBJECT_SUFFIXES= .elc .fas .lib .x86f .fasl
.SUFFIXES:: $(LISP_SOURCE_SUFFIXES) $(LISP_OBJECT_SUFFIXES)
# ------------------------------------------------------------------------
# EMACS:
# ------------------------------------------------------------------------
EMACS=emacs
EMACS_FLAGS_DEFAULT=
%.elc : %.el
@ echo "Generating $@"
$(TRACE) $(EMACS) -batch -q $(EMACS_FLAGS) -f batch-byte-compile $< 2>&1 \
| $(AWK) 'BEGIN{s=0;} /Loading .*fns-/{next;} /Warning: Function .* from cl package/{s=1;next;} {if(s==0){print $0}else{s=0;next;}}'
# See also .emacs in this directory with the load-path used to compile.
# ------------------------------------------------------------------------
# Compiling & installing lisp packages:
#
# Targets: install-packages
# Input: LISP_SOURCES CLISP_SOURCES CMUCL_SOURCES SBCL_SOURCES EMACS_SOURCES
# Output: $(PACKAGES)/$(PACKAGE_PATH)/*
install-packages :: do-install
do-install :: $(EMACS_SOURCES) \
$(CMUCL_SOURCES) \
$(LISP_SOURCES) \
$(SBCL_SOURCES)
@ echo "Installing packages: $(LISP_SOURCES) $(EMACS_SOURCES) $(CLISP_SOURCES) $(CMUCL_SOURCES) $(SBCL_SOURCES)" | fmt
$(TRACE) umask 022 ;\
for f in $(LISP_SOURCES) $(LISP_OBJECTS) \
$(EMACS_SOURCES) $(CLISP_SOURCES) \
$(CMUCL_SOURCES) $(SBCL_SOURCES) ; do \
install -v -p -m 644 $$f $(PACKAGES)/$(PACKAGE_PATH)/$$f ;\
done
summary summary.html:$(EMACS_SOURCES)
@ true echo $(EMACS_SOURCES) ; echo $(EMACS_SOURCES:.el=)
@ clisp -q -x "(defparameter *sources* (quote ($(EMACS_SOURCES:.el=))))" \
-x "(load \"compile.lisp\")" -on-error debug
# ------------------------------------------------------------------------
# Cleaning:
clean::
-rm -f $(LISP_OBJECT_SUFFIXES:%=*%)
cleanall::
$(TRACE) for p in $(LISP_PROGRAMS) $(CLISP_PROGRAMS) $(SBCL_PROGRAMS) \
$(CMUCL_PROGRAMS) $(EMACS_PROGRAMS) NONE ; do \
[ "$$p" = NONE ] || $(MAKE) $(MFLAGS) $${p}-clean PGMNAME=$$p ;\
done
#include $(MAKEDIR)/lisp
#-include Makefile.depend
#
#install::install-packages
#
# depend Makefile.depend :: $(EMACS_SOURCES)
# touch Makefile.depend
# depend Makefile.depend :: $(EMACS_SOURCES)
# ./make-depends -I. $(EMACS_SOURCES:.el=.elc) >> Makefile.depend
#### Makefile -- -- ####
# -*- mode: makefile -*-
### clisp -ansi -q -x (SETF *LOAD-VERBOSE* NIL) (PROG1 (VALUES) (LOAD "/home/pjb/src/public/common/makedir/../common-lisp/make-depends.lisp")) (PROG1 (VALUES) (FORMAT T "~&") (COM.INFORMATIMAGO.COMMON-LISP.MAKE-DEPENDS:MAKE-DEPENDS '( "pjb-advices.elc" "pjb-asm7090.elc" "pjb-banks.elc" "pjb-bourse.elc" "pjb-c.elc" "pjb-cl.elc" "pjb-cl-faces.elc" "pjb-cl-magic.elc" "pjb-class.elc" "pjb-constants.elc" "pjb-cvs.elc" "pjb-cvspass.elc" "pjb-dot.elc" "pjb-emacs.elc" "pjb-computer-paper.elc" "pjb-euro.elc" "pjb-graph.elc" "pjb-i2p-expression.elc" "pjb-layers.elc" "pjb-list.elc" "pjb-mail.elc" "pjb-make-depends.elc" "pjb-objc-mode.elc" "pjb-object.elc" "pjb-pgp.elc" "pjb-queue.elc" "pjb-roman.elc" "pjb-s2p-expression.elc" "pjb-secouer.elc" "pjb-selftrade.elc" "pjb-server.elc" "pjb-sources.elc" "pjb-state-coding.elc" "pjb-shell.elc" "pjb-strings.elc" "pjb-transpose.elc" "pjb-utilities.elc" "pjb-vm-kill-file.elc" "pjb-work.elc" "pjb-worldfact.elc") '() '() '() :IDF NIL :VERBOSE T )) (EXT:QUIT)
# Processing pjb-advices.elc
pjb-advices.elc :: pjb-advices.el
# Processing pjb-asm7090.elc
pjb-asm7090.elc :: pjb-asm7090.el
# Processing pjb-banks.elc
pjb-banks.elc :: pjb-banks.el
# Processing pjb-bourse.elc
pjb-bourse.elc :: pjb-bourse.el
# Processing pjb-c.elc
pjb-c.elc :: pjb-c.el
# Processing pjb-cl.elc
pjb-cl.elc :: pjb-cl.el
# Processing pjb-cl-faces.elc
pjb-cl-faces.elc :: pjb-cl-faces.el
# Processing pjb-cl-magic.elc
pjb-cl-magic.elc :: pjb-cl-magic.el
# Processing pjb-class.elc
pjb-class.elc :: pjb-class.el
# Processing pjb-constants.elc
pjb-constants.elc :: pjb-constants.el
# Processing pjb-cvs.elc
pjb-cvs.elc :: pjb-cvs.el
# Processing pjb-cvspass.elc
pjb-cvspass.elc :: pjb-cvspass.el
# Processing pjb-dot.elc
pjb-dot.elc :: pjb-dot.el
# Processing pjb-emacs.elc
pjb-emacs.elc :: pjb-emacs.el
# Processing pjb-computer-paper.elc
pjb-computer-paper.elc :: pjb-computer-paper.el
# Processing pjb-euro.elc
pjb-euro.elc :: pjb-euro.el
# Processing pjb-graph.elc
pjb-graph.elc :: pjb-graph.el
# Processing pjb-i2p-expression.elc
pjb-i2p-expression.elc :: pjb-i2p-expression.el
# Processing pjb-layers.elc
pjb-layers.elc :: pjb-layers.el
# Processing pjb-list.elc
pjb-list.elc :: pjb-list.el
# Processing pjb-mail.elc
pjb-mail.elc :: pjb-mail.el
# Processing pjb-make-depends.elc
pjb-make-depends.elc :: pjb-make-depends.el
# Processing pjb-objc-mode.elc
pjb-objc-mode.elc :: pjb-objc-mode.el
# Processing pjb-object.elc
pjb-object.elc :: pjb-object.el
# Processing pjb-pgp.elc
pjb-pgp.elc :: pjb-pgp.el
# Processing pjb-queue.elc
pjb-queue.elc :: pjb-queue.el
# Processing pjb-roman.elc
pjb-roman.elc :: pjb-roman.el
# Processing pjb-s2p-expression.elc
pjb-s2p-expression.elc :: pjb-s2p-expression.el
# Processing pjb-secouer.elc
pjb-secouer.elc :: pjb-secouer.el
# Processing pjb-selftrade.elc
pjb-selftrade.elc :: pjb-selftrade.el
# Processing pjb-server.elc
pjb-server.elc :: pjb-server.el
# Processing pjb-sources.elc
pjb-sources.elc :: pjb-sources.el
# Processing pjb-state-coding.elc
pjb-state-coding.elc :: pjb-state-coding.el
# Processing pjb-shell.elc
pjb-shell.elc :: pjb-shell.el
# Processing pjb-strings.elc
pjb-strings.elc :: pjb-strings.el
# Processing pjb-transpose.elc
pjb-transpose.elc :: pjb-transpose.el
# Processing pjb-utilities.elc
pjb-utilities.elc :: pjb-utilities.el
# Processing pjb-vm-kill-file.elc
pjb-vm-kill-file.elc :: pjb-vm-kill-file.el
# Processing pjb-work.elc
pjb-work.elc :: pjb-work.el
# Processing pjb-worldfact.elc
pjb-worldfact.elc :: pjb-worldfact.el
Occurences of interactive:
'(
( 29 pjb-sources.el )
( 28 pjb-emacs.el )
( 20 pjb-pgp.el )
( 14 pjb-advices.el )
( 9 pjb-utilities.el )
( 9 pjb-banks.el )
( 9 pjb-banks-old.el )
( 8 pjb-cl.el )
( 6 pjb-layers.el )
( 5 pjb-work.el )
( 5 pjb-roman.el )
( 4 pjb-mail.el )
( 4 pjb-euro.el )
( 2 pjb-walk.el )
( 2 pjb-transpose.el )
( 2 pjb-s2p-expression.el )
( 2 pjb-objc-mode.el )
( 2 pjb-i2p-expression.el )
( 2 pjb-cvspass.el )
( 1 pjb-vm-kill-file.el )
( 1 pjb-selftrade.el )
( 1 pjb-secouer.el )
( 1 pjb-constants.el )
( 1 pjb-c.el )
( 1 html-update-index.el )
;;----------------------------------------
( 0 pjb-bourse-test.el )
( 0 pjb-bourse.el )
( 0 pjb-class.el )
( 0 pjb-cvs.el )
( 0 pjb-invoices.el )
( 0 pjb-make-depends.el )
( 0 pjb-object.el )
( 0 pjb-prolog-mode.el )
( 0 pjb-server.el )
( 0 pjb-state-coding.el )
( 0 pjb-worldfact.el )
( 0 pjb-queue.el )
( 0 pjb-graph.el )
( 0 pjb-list.el )
( 0 pjb-strings.el )
)
Files where no or few interactive occur could be written in COMMON-LISP.
Actually, some have been converted (pjb-list, pjb-strings, pjb-graph).
\ No newline at end of file
;;;;****************************************************************************
;;;;FILE: compile.lisp
;;;;LANGUAGE: Common-Lisp
;;;;SYSTEM: Common-Lisp
;;;;USER-INTERFACE: NONE
;;;;DESCRIPTION
;;;;
;;;; Supplements the emacs Makefile.
;;;;
;;;; Usage: (load "compile.lisp")
;;;;
;;;;AUTHORS
;;;; <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
;;;;MODIFICATIONS
;;;; 2006-08-01 <PJB> Created to generate summary.html
;;;;BUGS
;;;;LEGAL
;;;; GPL
;;;;
;;;; Copyright Pascal J. Bourguignon 2006 - 2006
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License
;;;; as published by the Free Software Foundation; either version
;;;; 2 of the License, or (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be
;;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;;; PURPOSE. See the GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public
;;;; License along with this program; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA
;;;;****************************************************************************
;; (defpackage "COM.INFORMATIMAGO.COMMON-LISP.COMPILE"
;; (:use "COMMON-LISP")
;; (:export "MAIN"))
;; (in-package "COM.INFORMATIMAGO.COMMON-LISP.COMPILE")
;;; Not used yet:
(defvar *PREFIX* "/usr/local/")
(defvar *MODULE* "emacs")
(defvar *PACKAGE-PATH* "com/informatimago/emacs")
;;; ----
(load "init.lisp")
;; package.lisp is loaded by init.lisp.
;;(package:load-package :com.informatimago.common-lisp.make-depends)
(setf package:*PACKAGE-VERBOSE* nil)
(package:load-package "COM.INFORMATIMAGO.COMMON-LISP.LIST")
;;(package:load-package "COM.INFORMATIMAGO.COMMON-LISP.MAKE-DEPENDS")
(load "PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;MAKE-DEPENDS.LISP")
(LOAD "PACKAGES:NET;SOURCEFORGE;CCLAN;ASDF;ASDF.LISP")
(push (function package:PACKAGE-SYSTEM-DEFINITION)
ASDF:*SYSTEM-DEFINITION-SEARCH-FUNCTIONS*)
(defparameter *source-type* "el")
(COM.INFORMATIMAGO.COMMON-LISP.MAKE-DEPENDS:generate-summary
*sources*
:source-type *source-type*
:summary-path "summary.html"
:comment-start ";;"
:verbose nil
:repository-url
(lambda (pp)
(format nil "http://darcs.informatimago.com/darcs/public/emacs/~(~A~)"
(file-namestring
(merge-pathnames
(make-pathname :type *source-type* :defaults pp)
pp nil)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
\ No newline at end of file
(pjb-defclass 2)
;;****************************************************************************
;;FILE: init.lisp
;;LANGUAGE: Common-Lisp
;;SYSTEM: Common-Lisp
;;USER-INTERFACE: NONE
;;DESCRIPTION
;;
;; Initialization for common-lisp packages.
;;
;; This files remove some specificities from the lisp environment
;; (to make it more Common-Lisp),
;; loads the package COM.INFORMATIMAGO.COMMON-LISP.PACKAGE,
;; and add logical pathname translations to help find then other packages.
;;
;; Since we're generating an image, it should be useful only
;; at compilation-time, so any path present here should not be needed
;; at run-time. (But we don't clear them from the translations...).
;;
;;AUTHORS
;; <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
;;MODIFICATIONS
;; 2004-01-20 <PJB> Created.
;;BUGS
;;LEGAL
;; GPL
;;
;; Copyright Pascal J. Bourguignon 2004 - 2004
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version
;; 2 of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be
;; useful, but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE. See the GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public
;; License along with this program; if not, write to the Free
;; Software Foundation, Inc., 59 Temple Place, Suite 330,
;; Boston, MA 02111-1307 USA
;;****************************************************************************
(SETQ *LOAD-VERBOSE* T)
#+clisp (SETQ custom:*LOAD-echo* nil)
;; clean the imported packages:
(MAPC (LAMBDA (USED) (UNUSE-PACKAGE USED "COMMON-LISP-USER"))
(REMOVE (FIND-PACKAGE "COMMON-LISP")
(COPY-SEQ (PACKAGE-USE-LIST "COMMON-LISP-USER"))))
#+clisp
(when (string= (LISP-IMPLEMENTATION-VERSION) "2.33.83"
:end1 (min (length (LISP-IMPLEMENTATION-VERSION)) 7))
(EXT:WITHOUT-PACKAGE-LOCK ("COMMON-LISP")
(let ((oldload (function cl:load)))
(fmakunbound 'cl:load)
(defun cl:load (filespec &key (verbose *load-verbose*)
(print *load-print*)
(if-does-not-exist t)
(external-format :default))
(handler-case (funcall oldload filespec :verbose verbose
:print print :if-does-not-exist if-does-not-exist
:external-format external-format)
(SYSTEM::SIMPLE-PARSE-ERROR
()
(funcall oldload (translate-logical-pathname filespec)
:verbose verbose
:print print :if-does-not-exist if-does-not-exist
:external-format external-format)))))))
;; (DEFUN SCONC (&REST ARGS)
;; (apply (function CONCATENATE)
;; 'string
;; (mapcar (lambda (item) (typecase item
;; (pathname (namestring item))
;; (otherwise (string item)))) ARGS)));;SCONC
;; COM.INFORMATIMAGO.COMMON-LISP packages depends only on themselves,
;; from the current directory.
;; Load COM.INFORMATIMAGO.COMMON-LISP.PACKAGE:
(LOAD "/usr/local/share/lisp/packages/com/informatimago/common-lisp/package.lisp")
;; (HANDLER-CASE (LOAD "package")
;; (T () (LOAD "package.lisp")))
;; Import DEFINE-PACKAGE, and add translations:
(IMPORT 'PACKAGE:DEFINE-PACKAGE)
(SETF (LOGICAL-PATHNAME-TRANSLATIONS "PACKAGES")
(HANDLER-CASE (LOGICAL-PATHNAME-TRANSLATIONS "PACKAGES")
(ERROR NIL)))
(PACKAGE:ADD-TRANSLATIONS
(LIST (make-pathname
:host "PACKAGES"
:directory '(:absolute :wild-inferiors)
:name :wild :type :wild :version :wild)
(make-pathname
:case :common
:directory '(:absolute "USR" "LOCAL" "SHARE" "LISP" "PACKAGES"
:wild-inferiors)
:name :wild :type :wild :version :wild)))
;; #+sbcl (setf (logical-pathname-translations "PACKAGES")
;; (sort (copy-seq (logical-pathname-translations "PACKAGES"))
;; (lambda (a b) (< (length (second a)) (length (second b))))))
;;;; init.lisp -- -- ;;;;
#!/bin/bash
#******************************************************************************
#FILE: make-depends
#LANGUAGE: bash shell script
#SYSTEM: POSIX
#USER-INTERFACE: POSIX
#DESCRIPTION
#
# This scripts run pjb-make-depends elisp script to create a Makefile.depend
#
#USAGE
#
# make-depends [ -Iinclude-dir | lisp-object-file ] ...
#
#AUTHORS
# <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
#MODIFICATIONS
# 2002-12-04 <PJB> Created.
#BUGS
#LEGAL
# Copyright Pascal J. Bourguignon 2002 - 2002
#
# This script is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this library; see the file COPYING.LIB.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#******************************************************************************
pname="$(basename $0)"
pblan="${pname//?/ }"
function usage () {
echo "${pname} usage:"
echo " ${pname} [-Iinclude-dir|lisp-object-file]... "
}
DIR="$(dirname $0)"
IDIRES=""
OFILES=""
trace=0
closure=0
for arg ; do
case "$arg" in
-h|--help)
usage
exit 0
;;
-I*)
IDIRES="$IDIRES \"${arg/-I}\""
;;
-t)
trace=1
;;
-c)
closure=1
;;
-*)
echo "${pname}: Invalid option '$arg'."
usage
exit 1
;;
*)
OFILES="$OFILES \"$arg\""
;;
esac
done
if [ $closure -ne 0 ] ; then
emacs -q -nw --batch -l .emacs --eval "
(progn
(setq debugger (lambda (x y) (message \"### Error: %S %S\\n\" x y)
(backtrace) (kill-emacs)) debug-on-error t)
(add-to-list 'load-path \"$DIR\")
(load \"pjb-cl.el\")
(load \"pjb-list.el\")
(load \"pjb-make-depends.el\")
(mapc (lambda (item) (princ item) (princ \" \"))
(nreverse (list-to-set (nreverse
(get-closed-dependencies $OFILES '( $IDIRES )))))) ) "
else
emacs -q -nw --batch -l .emacs --eval "
(progn
;; (setq debugger (lambda (x y) (message \"### Error: %S %S\\n\" x y)
;; (backtrace) (kill-emacs)) debug-on-error t)
(add-to-list 'load-path \"$DIR\")
(load \"pjb-cl.el\")
(load \"pjb-make-depends.el\")
(make-depends '( $OFILES ) '( $IDIRES )) )"
fi | grep -v Loading
#END#
#### make-depends -- 2004-01-10 21:42:18 -- pascal ####
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
;;;;****************************************************************************
;;;;FILE: pjb-blink.el
;;;;LANGUAGE: emacs lisp
;;;;SYSTEM: POSIX
;;;;USER-INTERFACE: NONE
;;;;DESCRIPTION
;;;;
;;;; Alternate blinking parens.
;;;;
;;;;AUTHORS
;;;; <PJB> Pascal Bourguignon <pjb@informatimago.com>
;;;;MODIFICATIONS
;;;; 2005-09-20 <PJB> Created.
;;;;BUGS
;;;;LEGAL
;;;; GPL
;;;;
;;;; Copyright Pascal Bourguignon 2005 - 2005
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License
;;;; as published by the Free Software Foundation; either version
;;;; 2 of the License, or (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be
;;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;;; PURPOSE. See the GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public
;;;; License along with this program; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA
;;;;****************************************************************************
(defun blink (start end)
(set-mark start)
(goto-char (1+ end)))
(defun unblink (start end)
"Nothing to do")
;; Another implementation of blink and unblink could set the face,
;; or put some overlay on the region or on the start and end characters.
(defun blink-matching-open-and-close ()
"Move cursor momentarily to the beginning of the sexp before point."
(interactive)
(let ((close-point (1- (point))))
(and (> (point) (1+ (point-min)))
blink-matching-paren
;; Verify an even number of quoting characters precede the close.
(= 1 (logand 1 (- (point)
(save-excursion
(forward-char -1)
(skip-syntax-backward "/\\")
(point)))))
(let* ((oldpos (point))
(blinkpos)
(mismatch)
matching-paren)
(save-excursion
(save-restriction
(if blink-matching-paren-distance
(narrow-to-region (max (point-min)
(- (point) blink-matching-paren-distance))
oldpos))
(condition-case ()
(let ((parse-sexp-ignore-comments
(and parse-sexp-ignore-comments
(not blink-matching-paren-dont-ignore-comments))))
(setq blinkpos (scan-sexps oldpos -1)))
(error nil)))
(and blinkpos
;; Not syntax '$'.
(not (eq (syntax-class (syntax-after blinkpos)) 8))
(setq matching-paren
(let ((syntax (syntax-after blinkpos)))
(and (consp syntax)
(eq (syntax-class syntax) 4)
(cdr syntax)))
mismatch
(or (null matching-paren)
(/= (char-after (1- oldpos))
matching-paren))))
(if mismatch (setq blinkpos nil))
(if blinkpos
;; Don't log messages about paren matching.
(let (message-log-max)
(blink blinkpos close-point)
(if (pos-visible-in-window-p)
(and blink-matching-paren-on-screen
(sit-for blink-matching-delay))
(goto-char blinkpos)
(message
"Matches %s"
;; Show what precedes the open in its line, if anything.