X-Git-Url: https://git.distorted.org.uk/~mdw/skel/blobdiff_plain/831c5bb2ad0a086e2d193e27f38cc21c33819444..89b7a3ae81e08415c68518d54c5d3c6ac25b9b66:/skel.el.in diff --git a/skel.el.in b/skel.el.in index 8847f7f..86ce7eb 100644 --- a/skel.el.in +++ b/skel.el.in @@ -1,6 +1,6 @@ ;;; -*-emacs-lisp-*- ;;; -;;; $Id: skel.el.in,v 1.4 2003/11/29 23:35:38 mdw Exp $ +;;; $Id: skel.el.in,v 1.5 2004/04/08 01:36:28 mdw Exp $ ;;; ;;; Filling in skeletons ;;; @@ -23,22 +23,6 @@ ;;; along with this program; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -;;;----- Revision history --------------------------------------------------- -;;; -;;; $Log: skel.el.in,v $ -;;; Revision 1.4 2003/11/29 23:35:38 mdw -;;; Debianization. -;;; -;;; Revision 1.3 1999/08/20 07:40:51 mdw -;;; Slight twiddles to the Lisp code. -;;; -;;; Revision 1.2 1999/05/05 19:30:38 mdw -;;; Misc tidying. -;;; -;;; Revision 1.1.1.1 1999/04/05 13:44:59 mdw -;;; Initial import. -;;; - ;;;----- Variables (largely tweakable) -------------------------------------- (defvar skel-directory-list '(".skel" "") @@ -49,16 +33,17 @@ (defvar skel-skelrc '(".skelrc" "skelrc") "*File containing skeleton substitution data, looked up using the standard -skeleton search mathod.") + skeleton search mathod.") (defvar skel-alist '() "Alist of values to substitute into a skeleton. It is filled in by skelrc -files and user interaction. + files and user interaction. -The alist's keys are symbols, interned from the placeholder strings in the -skeleton file. The values are forms to be evaluated. In the simplest case, -the form is a string added as a result of user interaction; however, it could -just as easily be a function call or something similarly complicated.") + The alist's keys are symbols, interned from the placeholder strings in the + skeleton file. The values are forms to be evaluated. In the simplest + case, the form is a string added as a result of user interaction; however, + it could just as easily be a function call or something similarly + complicated.") ;;;----- Finding skeleton files --------------------------------------------- @@ -74,8 +59,8 @@ just as easily be a function call or something similarly complicated.") (defun skel-join (jfun base &rest ll) "Return a list built from joining elements from the given lists in order, -left to right. JFUN is a function of two arguments which can join items -together. BASE is the initial item." + left to right. JFUN is a function of two arguments which can join items + together. BASE is the initial item." (nreverse (skel-do-join nil jfun ll base))) (defun skel-do-parents (dir acc) @@ -88,7 +73,7 @@ together. BASE is the initial item." (defun skel-parents (dir) "Returns a list of DIR, DIR's parent directory, etc., all the way up to the -root." + root." (setq dir (expand-file-name dir)) (nreverse (skel-do-parents dir nil))) @@ -103,12 +88,13 @@ root." acc)) (defun skel-find-skeleton (name &optional all acc) - "Searches for skeleton files. NAME is the name of the file to find, or -a list of possible names. + "Searches for skeleton files. NAME is the name of the file to find, or a + list of possible names. -If ALL is nil, or omitted, return only the first matching filename -encountered. Otherwise, return a list of all matching names, most `global' -first. ACC is a base list to which the matching filenames are prepended." + If ALL is nil, or omitted, return only the first matching filename + encountered. Otherwise, return a list of all matching names, most + `global' first. ACC is a base list to which the matching filenames are + prepended." ;; --- Build one big list of all the possible names --- @@ -137,7 +123,7 @@ first. ACC is a base list to which the matching filenames are prepended." (defun skel-lookup (name) "Reads the value of symbol NAME in skel-alist. If there is no currrent -value, the user is prompted for one." + value, the user is prompted for one." ;; --- Resolve NAME into a symbol --- @@ -159,10 +145,10 @@ value, the user is prompted for one." (defun skel-do-fill-in () "Does the actual donkey-work of filling in a file. For each fill-in area -in the current buffer, the function looks to see if the item in question has -been entered into ALIST: if so, it is replaced automatically; otherwise the -user is promted to enter a string to substitute into the buffer at this -point." + in the current buffer, the function looks to see if the item in question + has been entered into ALIST: if so, it is replaced automatically; + otherwise the user is promted to enter a string to substitute into the + buffer at this point." (if (re-search-forward "\\[\\[\\([^]]*\\)\\]\\]" nil t) (progn (replace-match (skel-lookup (match-string 1)) t t nil) @@ -174,7 +160,7 @@ point." (defun skel-do-create-file (name switch &optional skel) "Does the main work of creating a file based on a skeleton. The SWITCH -argument is called to display the buffer." + argument is called to display the buffer." ;; --- Some local variables --- ;; @@ -240,9 +226,9 @@ argument is called to display the buffer." (defun skel-create-file (name &optional skel) "Creates a new file called NAME and visits it. If SKEL is non-`nil', it is -the name of a skeleton file to insert and substitute. Otherwise the skeleton -file's name is derived from NAME by taking NAME's extension and appending it -to `skel'." + the name of a skeleton file to insert and substitute. Otherwise the + skeleton file's name is derived from NAME by taking NAME's extension and + appending it to `skel'." (interactive "FSkeleton create file: \nP") (skel-do-create-file name 'switch-to-buffer skel))