From: Mark Wooding Date: Sat, 27 Jan 2007 18:44:13 +0000 (+0000) Subject: skelrc: Strip trailing whitespace when making banners. X-Git-Tag: 1.2.0~3 X-Git-Url: https://git.distorted.org.uk/~mdw/skel/commitdiff_plain/7e2d1edcb21bda593b1ff92b2b6a5e99fe87d6f0 skelrc: Strip trailing whitespace when making banners. --- diff --git a/skelrc b/skelrc index 4a8e105..b607b57 100644 --- a/skelrc +++ b/skelrc @@ -1,10 +1,21 @@ ;;; -*-emacs-lisp-*- +(defun skelrc-strip-trailing-whitespace (string) + (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) (let* ((start (skel-lookup 'block-start)) (end (skel-lookup (if block 'block-banner-knob 'block-banner-end))) (barlen (- 77 (length (concat start end " ----- " title))))) - (concat start "----- " title " " (make-string barlen ?-) end))) + (skelrc-strip-trailing-whitespace (concat start + "----- " + title + " " + (make-string barlen ?-) + end)))) (defvar skelrc-forced-major-mode 0)