Path: utzoo!mnetor!uunet!husc6!yale!Ram-Ashwin From: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Newsgroups: comp.emacs Subject: Re: GNU 18.49 elisp question Message-ID: <24594@yale-celray.yale.UUCP> Date: 5 Mar 88 20:27:15 GMT References: <6878@drutx.ATT.COM> Sender: root@yale.UUCP Reply-To: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Organization: Computer Science, Yale University, New Haven, CT 06520-2158 Lines: 29 In-reply-to: jimb@drutx.ATT.COM (jim bryant) In article <6878@drutx.ATT.COM>, jimb@drutx (jim bryant) writes: > > i'm trying to write a simple function that will set "fill-prefix" > before calling "fill-region". for example > > # this is the comment block > # that i would like to fill > # it probably would fit on 2 lines > > how do i set "fill-prefix" to be the string between the beginning > of the line and the first non-whitespace character? Try: (defun fill-unix-comment-paragraph () "Fill current paragraph as a Unix comment paragraph." (interactive) (let ((fill-prefix (save-excursion (beginning-of-line) (buffer-substring (point) (progn (skip-chars-forward "# \t") (point)))))) (fill-paragraph nil))) -- Ashwin Ram -- ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin BITNET: Ram@yalecs