Stefan Monnier <[EMAIL PROTECTED]> writes:
>
> That looks credible.  I'd point out that fill-nobreak-predicate is a hook in
> recent versions of Emacs, in which case add-hook should be used in place of
> set/make-local-variable.  Also things like (string-equal (buffer-substring
> ...) "blabla") are better written using (looking-at "blabla") which saves
> you from creating a new string just to throw it away immediately.

Thanks.  I had another go, below and on the wiki

        http://www.emacswiki.org/cgi-bin/wiki/Texinfo

and a similarly tiny function for no break after <a in html "<a href",
which I think much improves human readability

        http://www.emacswiki.org/cgi-bin/wiki/HtmlMode


(defun texinfo-nobreak-@:-p ()
  "Don't break after an @:.
This function is for use in `fill-nobreak-predicate' to avoid a line break
after an \"@:\".

makeinfo 4.7 has a slight bug where an @: at the end of a line has no
effect.  The easiest workaround is \"don't do that\" in the .texi source,
ie. don't break a line at an @:."

  (save-excursion
    (backward-char 3)
    (looking-at "@:")))

(add-hook 'texinfo-mode-hook
          (lambda ()
            (if (get 'fill-nobreak-predicate 'custom-type)
                ;; hook in emacs 22
                (add-hook 'fill-nobreak-predicate 'texinfo-nobreak-@:-p nil t)
              ;; variable holding a function in emacs 21
              (set (make-local-variable 'fill-nobreak-predicate)
                   'texinfo-nobreak-@:-p))))


_______________________________________________
Gnu-emacs-sources mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources

Reply via email to