;;; -*-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)))))
(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
(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 ()