From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?Windows-1252?Q?Vincent_Bela=EFche?= Subject: =?UTF-8?B?UkU6IGluZm8gVVJMIMKrIG9wZW4gYXQgcG9pbnQgwrsgcGF0Y2g=?= Date: Sun, 24 Jun 2018 20:30:04 +0000 Message-ID: References: , <86C481C5-D11D-4598-92CB-9DA98ADA03CC@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <86C481C5-D11D-4598-92CB-9DA98ADA03CC@gmail.com> Content-Language: fr-FR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sender: "Emacs-devel" To: Jean-Christophe Helary Cc: "emacs-orgmode@gnu.org" , EMACS devel list List-Id: emacs-orgmode.gnu.org I generated the regexp with (regexp-opt '("ftp" "http" "https" "file")). I admit that the list of protocols is not clear from the regexp, but it was already done this way before my change, and I tried to minimize the change. More concerning in my opinion is how the Info-get-token is written. As some point of the code one can read the following statement: =A0=A0=A0=A0=A0 ;; First look for a match for START that goes across POS. =A0=A0=A0=A0=A0 (while (and (not (bobp)) (> (point) (- pos (length start))) =A0=A0=A0 (not (looking-at start))) =A0(forward-char -1)) Here start is a regexp, so (length start) is just the length of the string holding the regexp, not the max length over which the regexp match can span. For instance assume that aaaaaaaaaa is a new new protocol which you want Info-get-token to catch. This is 10 character long, but the typical regexp to catch it would be =AB=A0a\{10\}=A0=BB which= is only 7 character long. It would propably be cleaner to provide the value to be used instead of (length start) as a separate optional argument that would be set to (length start) if omitted. Another way would be to have some standard function max-matchable-length that given some regexp would compute the maximum length of its match (or output some special value like t if the maximum length is infinite), thus (length start) could be replaced by (max-matchable-length start) --- maybe this is already somthing existing. In the same vein there could be some standard function that given regexp re and some position pos-in would function position pos-out such that the following expression would be true: (save-excursion =A0 (goto-char pos-out) =A0 (and (<=3D pos-out pos-in) =A0=A0=A0=A0=A0=A0 (looking-at re) =A0=A0=A0=A0=A0=A0 (>=3D (match-end 0) pos-in))) I think that such standard function is already existing, but I can't remember the package name which provides it=85 =A0 V.=