unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: thorne <thinly-disguised@spam-sucks.foo>
To: help-gnu-emacs@gnu.org
Subject: Re: Lisp question: odd fontification problem
Date: Sun, 22 Apr 2007 06:41:12 -0700	[thread overview]
Message-ID: <m3ps5wsf0n.fsf@timbral.net> (raw)
In-Reply-To: m3tzv8sffn.fsf@timbral.net

Ugh.  It doesn't matter how careful i try to be.  Here's a (hopefully)
unmangled version:

(defvar underline-by-font-lock-delimiter "_")
(defvar underline-by-font-lock-flag nil)

(defun toggle-underline-by-font-lock (delimiter)
  "Toggle font-lock-based underlinging of text between DELIMITER.
Simultaneusly make the string DELIMITER itself invisible.

Default delimiter defined by `underline-by-font-lock-delimiter'."
  (interactive "P")
  (let* ((delim (if delimiter
                    (read-string "Delimiter: ")
                  underline-by-font-lock-delimiter))
         (delim-regex
          (concat "\\(" delim "\\)\\([^" delim "]*\\)\\("
                  delim "\\)\\(.\\)")))
    (funcall (if underline-by-font-lock-flag
                 #'font-lock-remove-keywords
               #'font-lock-add-keywords)
             nil
             `((,delim-regex
                (1 '(face nil invisible t))
                (2 'underline)
                (3 '(face nil invisible t))
                (4 'default))))
    (setq underline-by-font-lock-flag
          (not underline-by-font-lock-flag))
    (font-lock-fontify-buffer)))

      reply	other threads:[~2007-04-22 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-22 13:32 Lisp question: odd fontification problem thorne
2007-04-22 13:41 ` thorne [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ps5wsf0n.fsf@timbral.net \
    --to=thinly-disguised@spam-sucks.foo \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).