[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: underline with character e.g. '-' or '='

From: David Hansen
Subject: Re: underline with character e.g. '-' or '='
Date: Tue, 13 May 2008 23:33:10 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

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.
    (goto-char (point-at-eol))
    (insert "\n"
            (make-string (- (point-at-eol)

If it's only about visual feedback in emacs: tried outline-mode?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]