From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Hansen Newsgroups: gmane.emacs.help Subject: Re: underline with character e.g. '-' or '=' Date: Tue, 13 May 2008 23:33:10 +0200 Organization: disorganized Message-ID: <8763th99ex.fsf@localhorst.mine.nu> References: <871w4655ux.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210714731 24409 80.91.229.12 (13 May 2008 21:38:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 May 2008 21:38:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 13 23:39:27 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jw2DV-0000q7-6f for geh-help-gnu-emacs@m.gmane.org; Tue, 13 May 2008 23:39:25 +0200 Original-Received: from localhost ([127.0.0.1]:46881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jw2Cl-0004z5-Cz for geh-help-gnu-emacs@m.gmane.org; Tue, 13 May 2008 17:38:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jw2CT-0004z0-Tf for help-gnu-emacs@gnu.org; Tue, 13 May 2008 17:38:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jw2CR-0004yk-F1 for help-gnu-emacs@gnu.org; Tue, 13 May 2008 17:38:20 -0400 Original-Received: from [199.232.76.173] (port=52145 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jw2CR-0004yh-7q for help-gnu-emacs@gnu.org; Tue, 13 May 2008 17:38:19 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:58665 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jw2CQ-0006MA-VA for help-gnu-emacs@gnu.org; Tue, 13 May 2008 17:38:19 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Jw2CP-0007pa-UV for help-gnu-emacs@gnu.org; Tue, 13 May 2008 21:38:18 +0000 Original-Received: from e178020057.adsl.alicedsl.de ([85.178.20.57]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 May 2008 21:38:17 +0000 Original-Received: from david.hansen by e178020057.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 May 2008 21:38:17 +0000 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 35 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178020057.adsl.alicedsl.de Mail-Copies-To: nobody User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:50AJWlFP0/R0vnsriOVSubacSFc= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:53975 Archived-At: On Tue, 13 May 2008 16:03:34 -0400 Brian Adkins wrote: > I often underline text with a hyphen or equal sign manually. I would > appreciate any info regarding how to accomplish this with a small elisp > function. Actually, if I had a function to compute the length of the > line, I think I would be all set. > > For example, if I had the following line: > > Section One > > I would like to position the the cursor on the 'S' and invoke: > M-x underline-line-with-char > > Which would prompte for a character in the minibuffer. If = was > supplied, the result would be: > > Section One > =========== (defun underline-with-char (char) (interactive (list (read-from-minibuffer "Char: "))) (when (= 0 (length char)) (error "Need a character")) (setq char (aref char 0)) ; Ignore everything but the first char. (save-excursion (goto-char (point-at-eol)) (insert "\n" (make-string (- (point-at-eol) (point-at-bol)) char)))) If it's only about visual feedback in emacs: tried outline-mode? David