From 70a2db6bd67c1f9740192f93fc9ec00893287a5a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 18 Dec 2011 16:11:50 +0000 Subject: [PATCH] skelrc: Add docstrings for functions and variables. Sneakily rename `skelrc-assq' argument from `list' to `alist' so that the documentation is clearer. --- skelrc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/skelrc b/skelrc index b607b57..d23c96b 100644 --- a/skelrc +++ b/skelrc @@ -1,12 +1,16 @@ ;;; -*-emacs-lisp-*- (defun skelrc-strip-trailing-whitespace (string) + "Return STRING, but with trailing whitespace removed. + +Whitespace characters are those with space syntax." (let ((i (1- (length string)))) (while (and (>= i 0) (= (char-syntax (aref string i)) ? )) (setq i (1- i))) (substring string 0 (1+ i)))) (defun skelrc-banner (title &optional block) + "Return a comment banner with the given TITLE, and maybe a BLOCK of text." (let* ((start (skel-lookup 'block-start)) (end (skel-lookup (if block 'block-banner-knob 'block-banner-end))) (barlen (- 77 (length (concat start end " ----- " title))))) @@ -17,9 +21,16 @@ (make-string barlen ?-) end)))) -(defvar skelrc-forced-major-mode 0) +(defvar skelrc-forced-major-mode 0 + "The priority of the currently forced major mode") (defun skelrc-force-mode (new-mode &optional priority) + "Force the use of major mode NEW-MODE. + +If the PRIORITY (defaults to 1) is strictly greater than +`skelrc-forced-major-mode' then the NEW-MODE takes precedence. A `skelrc' +file which wants to delegate settings to another file should therefore force +its chosen major-mode before calling `skel-include'." (or priority (setq priority 1)) (if (> priority skelrc-forced-major-mode) (progn @@ -32,13 +43,15 @@ (setq skelrc-forced-major-mode priority)))) (defun skelrc-decode-major-mode () + "Return the mode dropping to put in a local-variables line." (let* ((name (symbol-name major-mode)) (endind (string-match "-mode$" name))) (if endind (substring name 0 endind) (name)))) -(defun skelrc-assq (key list) - (let ((val (assq key list))) +(defun skelrc-assq (key alist) + "Pick out the value associated with KEY in ALIST (rather than the cons)." + (let ((val (assq key alist))) (and val (cdr val)))) (defun skelrc-component () -- 2.11.0