gnu-emacs-sources
[Top][All Lists]
Advanced

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

Re: texinfo-fill-workaround.el -- no break after @: when filling


From: Kevin Ryde
Subject: Re: texinfo-fill-workaround.el -- no break after @: when filling
Date: Thu, 01 Sep 2005 11:22:01 +1000
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Stefan Monnier <address@hidden> 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))))




reply via email to

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