[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ffap -vs- RFCs
From: |
Kevin Ryde |
Subject: |
Re: ffap -vs- RFCs |
Date: |
Tue, 22 Jan 2008 08:00:49 +1100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux) |
Glenn Morris <address@hidden> writes:
>
> I think it's hard to get ffap to handle things with spaces, so I just
> removed the space from the RFC regexp.
I struck this too and massaged ffap-string-at-point to take a space.
Operative part below, whole thing at
http://www.geocities.com/user42_kevin/ffap/index.html#ffap-rfc-space
If the space in the alist regexp is not actively harmful perhaps it
could be left in.
For this and a couple of other ffap bits I thought it might be nice to
have ffap test some thing-at-point types as a way of extending what it
can recognise at point. But I never got to any actual code -- it'd
probably for instance want to tie in to ffap-alist so some "things"
could be mode-specific, then there'd be a matter of how to make it work
with ffap-next.
(put 'rfc 'bounds-of-thing-at-point
(lambda ()
;; this regexp is the same as in `ffap-alist'
(and (thing-at-point-looking-at "[Rr][Ff][Cc][- #]?\\([0-9]+\\)")
(cons (match-beginning 0) (match-end 0)))))
(defadvice ffap-string-at-point (around ffap-rfc-space activate)
"Recognise RFCs with a space, like \"RFC 1234\"."
(or (let ((bounds (bounds-of-thing-at-point 'rfc)))
(and bounds
(setq ffap-string-at-point-region (list (car bounds)
(cdr bounds)))
(setq ad-return-value (buffer-substring (car bounds)
(cdr bounds)))))
ad-do-it))