From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Date: Tue, 07 Aug 2018 13:17:21 +0000 Message-ID: <87600m48pq.fsf@violet.siamics.net> References: <87h8k88l47.fsf@konghq.com> <87effc8kj1.fsf@konghq.com> <8736vsz0mo.fsf@gmail.com> <878t5j9674.fsf@konghq.com> <87mutzxq3k.fsf@gmail.com> <87600m8vn9.fsf@konghq.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1533647778 12774 195.159.176.226 (7 Aug 2018 13:16:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Aug 2018 13:16:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Raimon Grau , Noam Postavsky To: 32372@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 07 15:16:14 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fn1qP-0003Be-3D for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Aug 2018 15:16:13 +0200 Original-Received: from localhost ([::1]:39046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn1sV-0006Zv-EM for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Aug 2018 09:18:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn1sG-0006Yp-VS for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 09:18:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn1sB-0003ze-6l for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 09:18:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38227) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fn1sA-0003xY-PE for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 09:18:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fn1sA-0004dL-Bp for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 09:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Aug 2018 13:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32372 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153364784917764 (code B ref 32372); Tue, 07 Aug 2018 13:18:02 +0000 Original-Received: (at 32372) by debbugs.gnu.org; 7 Aug 2018 13:17:29 +0000 Original-Received: from localhost ([127.0.0.1]:43245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fn1rc-0004cR-SR for submit@debbugs.gnu.org; Tue, 07 Aug 2018 09:17:29 -0400 Original-Received: from fely.am-1.org ([78.47.74.50]:40410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fn1ra-0004cH-I7 for 32372@debbugs.gnu.org; Tue, 07 Aug 2018 09:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net ; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:In-Reply-To:Date:References:X-License:Cc:To:Subject:From:Sender: Reply-To:Content-ID:Content-Description; bh=c1WX5mLLdHZe9V42rcaEOQJebK3iju8he0lnn7iSU14=; b=AzQmLPoTp+J8lCFACv5oRw39pI aVVwtYba3uQVxqzmTZUBnybhMy1pqiOuHC0dN8buU0p3lbFM8sYQCZmwbMfb4DdVrs148tpxsAy0D 4HjJAVhd6OJWZ7L0Ipd+jZXbUUGfaeXYDHeOcus7B6S4UjH9kwYKC/ROGDpLZ7tNfNQA=; Original-Received: from violet.siamics.net ([2001:470:1f13:1eb::1:1d]) by fely.am-1.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1fn1rX-0001cr-KI; Tue, 07 Aug 2018 13:17:23 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtp (Exim 4.84_2) (envelope-from ) id 1fn1rW-0001NC-7p; Tue, 07 Aug 2018 13:17:22 +0000 X-License: CC-BY-SA-3.0+ (original contributions only) In-Reply-To: <87600m8vn9.fsf@konghq.com> (Raimon Grau's message of "Tue, 07 Aug 2018 08:48:26 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149312 Archived-At: >>>>> Raimon Grau writes: A few minor points. [=E2=80=A6] =20 > +--- > +** thingatpt.el supports a new "thing" called 'uuid'. > + > +A symbol 'uuid' can be passed to thing-at-point and it returns the > +uuid at point. I think the latter UUID should be spelled in all-caps. [=E2=80=A6] > +;; UUID > + > +(defvar thing-at-point-uuid-regexp There seem to be no precedent on the use of defconst in thingatpt.el, but given that the UUID format is ought to be stable, I guess this would be exactly the place for one. Or? > + (rx bow > + (repeat 8 hex-digit) "-" > + (repeat 4 hex-digit) "-" > + (repeat 4 hex-digit) "-" > + (repeat 4 hex-digit) "-" > + (repeat 12 hex-digit) > + eow) > + "A regular expression matching a UUID. > + > + More info on uuid's format in > + https://tools.ietf.org/html/rfc4122." ) AIUI, the docstrings are not indented like that; also, there should be no blank before the closing parenthesis. Given that there seem to be no URL references in thingatpt.el docstrings, either, I=E2=80=99d rather rewrite this one as: + "A regular expression matching a UUID. + +See RFC 4122 for the description of the format.") > + > +(put 'uuid 'bounds-of-thing-at-point > + (lambda () > + (let ((thing (thing-at-point-looking-at > + thing-at-point-uuid-regexp 36))) > + (if thing > + (let ((beginning (match-beginning 0)) > + (end (match-end 0))) > + (cons beginning end)))))) Why not simplify to (cons (match-beginning 0) (match-end 0))? > + > ;; Aliases > (defun word-at-point () [=E2=80=A6] --=20 FSF associate member #7257 http://am-1.org/~ivan/