[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] No more breaking links during fill
From: |
Michael Olson |
Subject: |
[emacs-wiki-discuss] No more breaking links during fill |
Date: |
Thu, 24 Mar 2005 23:16:40 -0500 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) |
I figured out how to keep long extended links like [[link][text]] from
being broken up when you execute fill. If you want to use this with
emacs-wiki, just replace all uses of "muse" with "emacs-wiki". The
following code also prevents flyspell from trying to highlight text in
links.
(defun my-muse-mode-affect-p ()
"Indicate whether this text should be messed with.
If nil is returned, it means that we should not fill here or
spell-check here. If non-nil, it is safe to do both of these
things."
(save-excursion
(save-match-data
(null (and (re-search-backward "\\[\\[\\|\\]\\]"
(line-beginning-position) t)
(string= (or (match-string 0) "")
"[["))))))
;; Make flyspell not mess with links
(put 'muse-mode
'flyspell-mode-predicate
'my-muse-mode-affect-p)
;; Make fill not split up links
(eval-after-load "fill"
(add-to-list 'fill-nobreak-predicate
(lambda nil (null (my-muse-mode-affect-p)))))
I think I might include the fill-nobreak part of it (but not the
flyspell part) in future versions of emacs-wiki and Muse. Would that
be OK with everyone?
--
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Jabber: mwolson_at_hcoop.net -- IRC: mwolson on freenode.net: #muse, #pulug
/` |\ | | |
|_] | \| |_| Interests: anime, Debian GNU/Linux, XHTML, wiki, Lisp
pgpVBylOtEjv8.pgp
Description: PGP signature
- [emacs-wiki-discuss] No more breaking links during fill,
Michael Olson <=