From: thorne <thinly-disguised@spam-sucks.foo>
To: help-gnu-emacs@gnu.org
Subject: Lisp question: odd fontification problem
Date: Sun, 22 Apr 2007 06:32:12 -0700 [thread overview]
Message-ID: <m3tzv8sffn.fsf@timbral.net> (raw)
Hello. I have been tinkering with setting up a comfortable editing
onvironment (comfortable for me, that is) for editing fiction
manuscripts. I asked a question about this a while back and got very
useful help, so i now have another, odder question. I have a function
that is meant to toggle fontification of strings dimlimited by a
character as underlined. So, in my use, a string with underscores
would be underlined, and the underscores themselves would be
invisible. So it works. Horray! But when i toggle it back off,
something strange happens: the underlining disappears, but the
invisible underscores stay invisible... even if i go to
fundamental-mode, do (font-lock-fontify-buffer) or (and this is what i
don't understand) even if i do (kill-all-local-variables)--the
underscores stay invisible. I am guessing my whole approach is bad,
but in any case, i am pretty mystified, so here's the code:
(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))
(font-lock-fontify-buffer)))
--
þ theron tlåx þ
(compose-mail (concat "thorne@" (rot13 "gvzoeny") ".net"))
next reply other threads:[~2007-04-22 13:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-22 13:32 thorne [this message]
2007-04-22 13:41 ` Lisp question: odd fontification problem thorne
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=m3tzv8sffn.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).