From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Aug 2018 23:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32372 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 32372@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1533510790629 (code B ref -1); Sun, 05 Aug 2018 23:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Aug 2018 23:13:10 +0000 Received: from localhost ([127.0.0.1]:42106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmSD0-0000A4-3D for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:13:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmSCy-00009q-3D for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:13:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmSCr-0007XA-8Q for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:13:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40995) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fmSCr-0007X4-2a for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:13:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmSCp-0004n2-H6 for bug-gnu-emacs@gnu.org; Sun, 05 Aug 2018 19:13:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmSCm-0007UB-8S for bug-gnu-emacs@gnu.org; Sun, 05 Aug 2018 19:12:59 -0400 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:33937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmSCl-0007SX-R3 for bug-gnu-emacs@gnu.org; Sun, 05 Aug 2018 19:12:56 -0400 Received: by mail-wm0-x22f.google.com with SMTP id l2-v6so9986058wme.1 for ; Sun, 05 Aug 2018 16:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:subject:date:message-id:mime-version; bh=I7pPGo1mKPtAGLVq2vsshaMCIwYkR4L++d1DiMZNSLk=; b=MFZWhBtZHQdaJ/6neoSu8RLm4qaOrI/5H5PlEEPSei4s1o/V7jV8Qnk/VSriuN057W rbOVF5BZNgXeAI3XKmZkhF7kH10s1wzr4QXo98rmjwqcGVDj5a2jLoi+IAh5UTWZf1A7 8OJpC/yWQWih/RWp0BGv1HIGNJj9q5OLhGUEY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=I7pPGo1mKPtAGLVq2vsshaMCIwYkR4L++d1DiMZNSLk=; b=ghvmuxmeH+OY29aWHjf3x6/Wi8n1L6JkE9yA0VzCu41clqJDFY8UH4Xzdn9ZnHm7uF e8yEMm5++r5O/GB/kAt9Mt/KFhHO7O9y4/H0Hh1/DUiY3KFSwyw+7/6urdGcrTnp/vIu axe3XE/HCkSNDSlk66N68jPMpGRfbKPGPfaDfwflTHsyqypCEfyQ1Rb6ZedhMELLeGK1 0J+VdgQonuDUAt+obzbrnrofk0I49ypDyNXF7g/tevs55zZ/2XFI2aB1PUzQ2U0LwJ0T 2es+67T+z6FDVsJLhTxYJBYyk1p3qhvSvI0gUxvUomxL89hA69wuuA96lMd9zO4IkRBj bnkQ== X-Gm-Message-State: AOUpUlFe9LXffX9TXd1tNC056PTkm0CEuxVH2CtBfcGibkH6UBofrCSP oNQtVFTodmWy9Yy0zxA3coTTsBw3yzs= X-Google-Smtp-Source: AAOMgpct0GDGyTwmzU86w75mhrUxbRjuLquETjIL+1KsEYGFBCNYHvMJXe+gw0AJ+EnHKKSuEe/tNA== X-Received: by 2002:a1c:d942:: with SMTP id q63-v6mr10907269wmg.78.1533510774430; Sun, 05 Aug 2018 16:12:54 -0700 (PDT) Received: from raikong (81.61.106.180.dyn.user.ono.com. [81.61.106.180]) by smtp.gmail.com with ESMTPSA id b2-v6sm7088974wmh.3.2018.08.05.16.12.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Aug 2018 16:12:53 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau Date: Mon, 06 Aug 2018 00:11:20 +0100 Message-ID: <87h8k88l47.fsf@konghq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain Hi, I've added UUID to thing-at-point. I think it's a standard enough format that makes sense to have it in the core. It's my 2nd contribution, so still getting used to the tools and standards. The implementation relies on a regular expression to accept the different versions of uuids (versions 1 to 5), and also the "Nil UUID". I'm using rx as it makes clearer the intent of what we're parsing at each point. I hope it's ok to use it (I don't see it used a lot in emacs itself). If there are any comments or fixes to do, point them out and I'll make the changes accordingly. Thanks, Raimon Grau --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-uuid-as-allowed-thingatpt-symbol.patch >From faacdadc1beba467b915b65ffd668b9e6c3a1d41 Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 5 Aug 2018 22:47:30 +0100 Subject: [PATCH] Add uuid as allowed thingatpt symbol --- etc/NEWS | 6 ++++++ lisp/thingatpt.el | 41 ++++++++++++++++++++++++++++++++++++++--- test/lisp/thingatpt-tests.el | 11 ++++++++++- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a1c12a6..ee94572 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -96,6 +96,12 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'. --- ** shadowfile.el has been rewritten to support Tramp file names. +--- +** 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. + * New Modes and Packages in Emacs 26.2 diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6a978fe..ca8a5bd 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -58,7 +58,7 @@ forward-thing "Move forward to the end of the Nth next THING. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing))))) @@ -73,7 +73,7 @@ bounds-of-thing-at-point "Determine the start and end buffer locations for the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'. See the file `thingatpt.el' for documentation on how to define a @@ -131,7 +131,7 @@ thing-at-point "Return the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', `number', and `page'. When the optional argument NO-PROPERTIES is non-nil, @@ -554,6 +554,41 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +;; UUID + +(defvar thing-at-point-uuid-regexp + (rx (and bow + (or + "00000000-0000-0000-0000-000000000000" + (and + (repeat 8 hex-digit) "-" + (repeat 4 hex-digit) "-" + (or "1" "2" "3" "4" "5") + (repeat 3 hex-digit) "-" + (or "8" "9" "a" "b" "A" "B") + (repeat 3 hex-digit) "-" + (repeat 12 hex-digit))) + eow)) + "A regular expression matching a UUID from versions 1 to 5. + + More info on uuid's format in + https://tools.ietf.org/html/rfc4122." ) +(put 'uuid 'bounds-of-thing-at-point + (lambda () + (let ((thing (thing-at-point-looking-at + thing-at-point-uuid-regexp 500))) + (if thing + (let ((beginning (match-beginning 0)) + (end (match-end 0))) + (cons beginning end)))))) + +(put 'uuid 'thing-at-point + (lambda () + (let ((boundary-pair (bounds-of-thing-at-point 'uuid))) + (if boundary-pair + (buffer-substring-no-properties + (car boundary-pair) (cdr boundary-pair)))))) + ;; Aliases (defun word-at-point () diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index cfb57de..e8e9b6e 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -65,7 +65,16 @@ thing-at-point-test-data ("http://example.com/ab)c" 4 url "http://example.com/ab)c") ;; URL markup, lacking schema ("" 1 url "mailto:foo@example.com") - ("" 1 url "ftp://ftp.example.net/abc/")) + ("" 1 url "ftp://ftp.example.net/abc/") + ;; UUID + ("12345678-1234-1234-8123-123456789012" 1 uuid "12345678-1234-1234-8123-123456789012") + ("12345678-1234-2234-9123-123456789012" 1 uuid "12345678-1234-2234-9123-123456789012") + ("12345678-1234-3234-a123-123456789012" 1 uuid "12345678-1234-3234-a123-123456789012") + ("12345678-1234-4234-b123-123456789012" 1 uuid "12345678-1234-4234-b123-123456789012") + ("12345678-1234-5234-b123-123456789012" 1 uuid "12345678-1234-5234-b123-123456789012") + ("00000000-0000-0000-0000-000000000000" 1 uuid "00000000-0000-0000-0000-000000000000") + ("12345678-1234-4234-1123-123456789012" 1 uuid nil) + ("12345678-1234-6aaa-1123-123456789012" 1 uuid nil)) "List of thing-at-point tests. Each list element should have the form -- 2.7.4 --=-=-=-- From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Aug 2018 23:26:01 +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 To: 32372@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15335115531800 (code B ref -1); Sun, 05 Aug 2018 23:26:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Aug 2018 23:25:53 +0000 Received: from localhost ([127.0.0.1]:42112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmSPI-0000Sy-HD for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:25:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmSPG-0000Si-22 for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:25:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmSP9-0004Uf-MF for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:25:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48879) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fmSP9-0004UU-Gt for submit@debbugs.gnu.org; Sun, 05 Aug 2018 19:25:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmSP7-0007hP-KI for bug-gnu-emacs@gnu.org; Sun, 05 Aug 2018 19:25:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmSP4-0004Rf-Cs for bug-gnu-emacs@gnu.org; Sun, 05 Aug 2018 19:25:41 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:44591) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmSP3-0004PW-VT for bug-gnu-emacs@gnu.org; Sun, 05 Aug 2018 19:25:38 -0400 Received: by mail-wr1-x443.google.com with SMTP id r16-v6so10604894wrt.11 for ; Sun, 05 Aug 2018 16:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=b2zoK92W9rEZYpccXNaWzmkRsBdXJLyLqco3Tl8nT5U=; b=E+HEhVUn8YV5IxhyYZ55acvhUbqyKP/XXgfoNvhBn1u9pYpBYYGmVT9stU/S74fuLT vZe4xmfWUKzot0C3vdjs/1JpAwfa4pvS33GCtfB3/3rwzr6f4Ce4X4HOHNb0rRMQvO80 M1Id64OQgeoTWA7Tvpnqdm3x4gw4eMDDvB9Ak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=b2zoK92W9rEZYpccXNaWzmkRsBdXJLyLqco3Tl8nT5U=; b=ggzg4DGevwr9CsxzmR1UDKwNuSng4xcTzPtztBHARQ2IrxtJ5vzI5MQrGdY2ed3EI8 x3cwAem/T0qkgWrol3M5MnvO9c91yx0je4Oy3Z3LDyN8CRCkmoP6NzO8oSRSck7K+Ifc a9GfsKgXQ798ioubNwh3Ij5X1tGrFOVClF189JjvO95V3YfvNHxpgBFFbE1X1sLMsHoI N4CoboXz9qZql89RwL1rwXO1GlmORyMgAcAQHxriBR8amAJ/QGg+B5doWgLsDdWPpULt N1QwY6o08NmHG+6HYtLtEFvcZpXnzCEtDG1X3Qz9sVlN+xIu3Bo1bNR+oI4q3ZKeeaTq A/8Q== X-Gm-Message-State: AOUpUlFd7ydBFnSPe6vvVnJf22HvWdJ90dbN8j5w4EwznWbyHMqJwCWk oaTkjILmn/7KC/RgNsKCUPbmOR2Z1WI= X-Google-Smtp-Source: AAOMgpdyqjtve/Djstc2qlyKdPSOR9Znkp9AtDAVv9PNpGkmIc6qDhFCNgBRNilJyiAkRJI3TSJiWg== X-Received: by 2002:adf:a4d4:: with SMTP id h20-v6mr8127660wrb.167.1533511536613; Sun, 05 Aug 2018 16:25:36 -0700 (PDT) Received: from raikong (81.61.106.180.dyn.user.ono.com. [81.61.106.180]) by smtp.gmail.com with ESMTPSA id g125-v6sm4915249wmf.16.2018.08.05.16.25.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Aug 2018 16:25:36 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau In-Reply-To: <87h8k88l47.fsf@konghq.com> References: <87h8k88l47.fsf@konghq.com> Date: Mon, 06 Aug 2018 00:24:02 +0100 Message-ID: <87effc8kj1.fsf@konghq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain Raimon Grau writes: > Hi, > > I've added UUID to thing-at-point. I think it's a standard enough > format that makes sense to have it in the core. It's my 2nd > contribution, so still getting used to the tools and standards. > > The implementation relies on a regular expression to accept the > different versions of uuids (versions 1 to 5), and also the "Nil UUID". > > I'm using rx as it makes clearer the intent of what we're parsing at > each point. I hope it's ok to use it (I don't see it used a lot in emacs > itself). > > If there are any comments or fixes to do, point them out and I'll make > the changes accordingly. > > Thanks, > > Raimon Grau Hi again, Sending here an updated patch with improved comment message. Sorry for the noise, hope this one is ok! Raimon Grau --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-uuid-as-allowed-thingatpt-symbol.patch >From 8321b7af6f5249009bd1b76c0ccbf81b5dff70fb Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 5 Aug 2018 22:47:30 +0100 Subject: [PATCH] Add uuid as allowed thingatpt symbol * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. * test/lisp/thingatpt-tests.el: Add tests for uuid at point. --- etc/NEWS | 6 ++++++ lisp/thingatpt.el | 41 ++++++++++++++++++++++++++++++++++++++--- test/lisp/thingatpt-tests.el | 11 ++++++++++- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a1c12a6..ee94572 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -96,6 +96,12 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'. --- ** shadowfile.el has been rewritten to support Tramp file names. +--- +** 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. + * New Modes and Packages in Emacs 26.2 diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6a978fe..ca8a5bd 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -58,7 +58,7 @@ forward-thing "Move forward to the end of the Nth next THING. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing))))) @@ -73,7 +73,7 @@ bounds-of-thing-at-point "Determine the start and end buffer locations for the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'. See the file `thingatpt.el' for documentation on how to define a @@ -131,7 +131,7 @@ thing-at-point "Return the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', `number', and `page'. When the optional argument NO-PROPERTIES is non-nil, @@ -554,6 +554,41 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +;; UUID + +(defvar thing-at-point-uuid-regexp + (rx (and bow + (or + "00000000-0000-0000-0000-000000000000" + (and + (repeat 8 hex-digit) "-" + (repeat 4 hex-digit) "-" + (or "1" "2" "3" "4" "5") + (repeat 3 hex-digit) "-" + (or "8" "9" "a" "b" "A" "B") + (repeat 3 hex-digit) "-" + (repeat 12 hex-digit))) + eow)) + "A regular expression matching a UUID from versions 1 to 5. + + More info on uuid's format in + https://tools.ietf.org/html/rfc4122." ) +(put 'uuid 'bounds-of-thing-at-point + (lambda () + (let ((thing (thing-at-point-looking-at + thing-at-point-uuid-regexp 500))) + (if thing + (let ((beginning (match-beginning 0)) + (end (match-end 0))) + (cons beginning end)))))) + +(put 'uuid 'thing-at-point + (lambda () + (let ((boundary-pair (bounds-of-thing-at-point 'uuid))) + (if boundary-pair + (buffer-substring-no-properties + (car boundary-pair) (cdr boundary-pair)))))) + ;; Aliases (defun word-at-point () diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index cfb57de..e8e9b6e 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -65,7 +65,16 @@ thing-at-point-test-data ("http://example.com/ab)c" 4 url "http://example.com/ab)c") ;; URL markup, lacking schema ("" 1 url "mailto:foo@example.com") - ("" 1 url "ftp://ftp.example.net/abc/")) + ("" 1 url "ftp://ftp.example.net/abc/") + ;; UUID + ("12345678-1234-1234-8123-123456789012" 1 uuid "12345678-1234-1234-8123-123456789012") + ("12345678-1234-2234-9123-123456789012" 1 uuid "12345678-1234-2234-9123-123456789012") + ("12345678-1234-3234-a123-123456789012" 1 uuid "12345678-1234-3234-a123-123456789012") + ("12345678-1234-4234-b123-123456789012" 1 uuid "12345678-1234-4234-b123-123456789012") + ("12345678-1234-5234-b123-123456789012" 1 uuid "12345678-1234-5234-b123-123456789012") + ("00000000-0000-0000-0000-000000000000" 1 uuid "00000000-0000-0000-0000-000000000000") + ("12345678-1234-4234-1123-123456789012" 1 uuid nil) + ("12345678-1234-6aaa-1123-123456789012" 1 uuid nil)) "List of thing-at-point tests. Each list element should have the form -- 2.7.4 --=-=-=-- From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Aug 2018 02:32:01 +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 To: Raimon Grau Cc: 32372@debbugs.gnu.org Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153352271318859 (code B ref 32372); Mon, 06 Aug 2018 02:32:01 +0000 Received: (at 32372) by debbugs.gnu.org; 6 Aug 2018 02:31:53 +0000 Received: from localhost ([127.0.0.1]:42145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmVJJ-0004u1-II for submit@debbugs.gnu.org; Sun, 05 Aug 2018 22:31:53 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:55443) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmVJG-0004te-Pf; Sun, 05 Aug 2018 22:31:51 -0400 Received: by mail-it0-f68.google.com with SMTP id d10-v6so15468955itj.5; Sun, 05 Aug 2018 19:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=robbdieqbFWDQqedIfgrR1b26F+0RMv1m6w2SzM0BFw=; b=BpAOwid9S5efyfYPB7JCr4csUZFscWJPsQAQnINTnzWJ53130CJF8iafcyD+5RVaV9 BQnapQRE7bjnJhPsYyDsMK0L5N8e4F1C3x2HaEBu8UG1kOwnUnlju3xlhnLWE5A+HfZS TCZxjFDU/7WUsGOwuRzkOixmJ/c3a9fvzMPdHZbGuzAtHdGa6sWcY7lDoIyDu5vrXZuw AExl38Q+8IpIRsp5lFOZcP2tv16e8Yp/JvdVd7xgoSvUlPH4wBoUvssb9zIb18MMetLd ZgV6ZwfZgEtXHwhWuZCJmGH162ZsPbyxNqYXj0ATjaaDxrkFN5BEZIoNMkb63dVzHR5j gCLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=robbdieqbFWDQqedIfgrR1b26F+0RMv1m6w2SzM0BFw=; b=eAAO495jTl3KHNmRNZS+hGJ9XES7X4nmzKzDJxEn3n2FJmZ8fyDocvruZ1J9sZgAeR pVlip2LXdrp3xOr1InDFsk53u7J8IGbKHfJ70ULY/kck0tutYesFhDK3J/JDG9gpb6ya kPAZNmvhoTuIWTk2PLSav+FvwFtgqd2l0oKpiVB2Ni5Bko52UvqbmOMq/PC6X+O3b5Hb GKccrlRg8q4D3EO1ySEtFwnRRjRTPR8PE8ZGJS8GDp05X48xGLRdxHQ1WE0sDh0R11LD bmZ6HNTMTmNyMWVRJmF0o/2Q3tbY2G16A+PFCGroqjUI2WndPMg1BldjhJEIEVZHrORL pZ1A== X-Gm-Message-State: AOUpUlF8/BPFBHHQ1dJYUPbJTuXJzMQOtuSy6JSxR243xNiiZkdSSoOT 0wVksK8LEla6OhmmC04292RQj+GZ X-Google-Smtp-Source: AAOMgpeUlvzKoAshxdyDbka2yy/7gb5P2Pj1iBV1AVY9HKA1UtEQGe8wsFBFVfEIn+F0oXKZxLk8qQ== X-Received: by 2002:a24:94f:: with SMTP id 76-v6mr13443832itm.113.1533522705068; Sun, 05 Aug 2018 19:31:45 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id v82-v6sm4293848iod.14.2018.08.05.19.31.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Aug 2018 19:31:44 -0700 (PDT) From: Noam Postavsky References: <87h8k88l47.fsf@konghq.com> <87effc8kj1.fsf@konghq.com> Date: Sun, 05 Aug 2018 22:31:43 -0400 In-Reply-To: <87effc8kj1.fsf@konghq.com> (Raimon Grau's message of "Mon, 06 Aug 2018 00:24:02 +0100") Message-ID: <8736vsz0mo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 32372 wishlist quit Raimon Grau writes: > Subject: [PATCH] Add uuid as allowed thingatpt symbol > > * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. I guess you should mention something about the ops as well here. Though it's not 100% clear what kind of format you should use for those. Maybe just (top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'. > +;; UUID > + > +(defvar thing-at-point-uuid-regexp > + (rx (and bow Using rx is okay, I think. There was some discussion about it on emacs-devel a little time ago, with most people saying the increased verbosity made them not want to use it, but I kind of like it myself. However, Stefan made the point that `and' is potentially a bit confusing, because it could be misread as intersection. It's better to use one of the synonyms `seq' or `:'. > + (or > + "00000000-0000-0000-0000-000000000000" > + (and > + (repeat 8 hex-digit) "-" > + (repeat 4 hex-digit) "-" > + (or "1" "2" "3" "4" "5") > + (repeat 3 hex-digit) "-" > + (or "8" "9" "a" "b" "A" "B") > + (repeat 3 hex-digit) "-" > + (repeat 12 hex-digit))) > + eow)) > + "A regular expression matching a UUID from versions 1 to 5. > + > + More info on uuid's format in > + https://tools.ietf.org/html/rfc4122." ) So, in that RFC I see this grammar UUID = time-low "-" time-mid "-" time-high-and-version "-" clock-seq-and-reserved clock-seq-low "-" node time-low = 4hexOctet time-mid = 2hexOctet time-high-and-version = 2hexOctet clock-seq-and-reserved = hexOctet clock-seq-low = hexOctet node = 6hexOctet hexOctet = hexDigit hexDigit hexDigit = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / "a" / "b" / "c" / "d" / "e" / "f" / "A" / "B" / "C" / "D" / "E" / "F" It looks like you crafted a regexp which is a tighter match for just the UUID versions currently in use. I think we're better off with the looser definition though, that way it will continue to be correct even as new versions come out. Furthermore, I would guess a human user is going to be surprised if (thing-at-point 'uuid) picks up this 12345678-1234-1234-8123-123456789012 but not this: 12345678-1234-1234-5123-123456789012 > +(put 'uuid 'thing-at-point > + (lambda () > + (let ((boundary-pair (bounds-of-thing-at-point 'uuid))) > + (if boundary-pair > + (buffer-substring-no-properties > + (car boundary-pair) (cdr boundary-pair)))))) I think this isn't needed, because the `thing-at-point' function already does this for you: (let ((text (if (get thing 'thing-at-point) (funcall (get thing 'thing-at-point)) (let ((bounds (bounds-of-thing-at-point thing))) (when bounds (buffer-substring (car bounds) (cdr bounds))))))) From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Aug 2018 09:49:01 +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 To: Noam Postavsky Cc: Raimon Grau , 32372@debbugs.gnu.org Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153354889525946 (code B ref 32372); Mon, 06 Aug 2018 09:49:01 +0000 Received: (at 32372) by debbugs.gnu.org; 6 Aug 2018 09:48:15 +0000 Received: from localhost ([127.0.0.1]:42285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmc7b-0006kP-Kw for submit@debbugs.gnu.org; Mon, 06 Aug 2018 05:48:15 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:46992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmc7Z-0006kA-PH for 32372@debbugs.gnu.org; Mon, 06 Aug 2018 05:48:14 -0400 Received: by mail-wr1-f43.google.com with SMTP id h14-v6so11690396wrw.13 for <32372@debbugs.gnu.org>; Mon, 06 Aug 2018 02:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=kZMfhan1ZPp43tTSWS4RvexrGn9KDUDo/u0Y7a2Ix0Y=; b=neayQhnQiFKfB2XUfS/wt78/j+dg+5QMaVONgEMyr5uotzBjEMoh5sPWkBzpoP0ly7 VVlR2Rgx4f5xdqgej2NPSFG+oFY3YelicO+9B+FlSy8rCMlKDXt68t6JbJMt/LFO6swW qDhVkOIyAoAJJ1zMGtre1rEivyD/oTNF+hC1hIpeGUQANlOj1NqXDfo9+ybRf0TZi9JW FyD0QVwdkfU++Dv3cGxk02oYqOIWqYW7GAbc3XrvD5t9I9vZz/SLop9GX/1mIIRy6hFD ydkram0YG2HL9jCJo9Zla9+DWoxJHuldSrb2pSBMzmX6S6gWwjNkug+SgxpSaG8IfGpl g14Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=kZMfhan1ZPp43tTSWS4RvexrGn9KDUDo/u0Y7a2Ix0Y=; b=AoJvQidZFzXsMEmfl76usP6s3EKrPinX6DJy2HFrNVKp9CkLusKS7ulq8pJ9aFpzz4 F2NkUZbwwGWRF8trWUGObyz9I7GhgvGwI4zyJHBupS3CALZsRm3qhiXplrVSKLkoR/sl baEoc6EBYloC9KYzlSdMPQKy5VAzdZ6ckkmphGQoNgpZCx9E0NXNEU82aW/jESlYYvZs diBuxh258BwPS4hJZZ6i830yLBbtlkhmaKaRFbmrMpueWtvCk3E1/avQVRy2ngFpgRiz UZ6DJjqjQKAoeEqsXlgBkgDebBWkS1n2u2Zh2XLXA7sZBpL+ZjXIfpaenmaJC1UseuSi Zy4Q== X-Gm-Message-State: AOUpUlE7C/KwvC8SDe2wUNLrx1KZUubEKsrkWXhkaVTynlk80D4lHbsM 7Q123HfTe9mjBywO4voxRQV0NA== X-Google-Smtp-Source: AAOMgpfhzznod4ujze3a2LbnPoH4alfFWmCzKnUuR5S411I8jivKpnXtfi+HyxjUL09ajREEMPGtSw== X-Received: by 2002:adf:d142:: with SMTP id b2-v6mr8963624wri.17.1533548888110; Mon, 06 Aug 2018 02:48:08 -0700 (PDT) Received: from localhost (adsl-213.91.140.88.tellas.gr. [91.140.88.213]) by smtp.gmail.com with ESMTPSA id g125-v6sm5908377wmf.16.2018.08.06.02.48.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Aug 2018 02:48:07 -0700 (PDT) From: "Basil L. Contovounesios" References: <87h8k88l47.fsf@konghq.com> <87effc8kj1.fsf@konghq.com> <8736vsz0mo.fsf@gmail.com> Date: Mon, 06 Aug 2018 12:47:59 +0300 In-Reply-To: <8736vsz0mo.fsf@gmail.com> (Noam Postavsky's message of "Sun, 05 Aug 2018 22:31:43 -0400") Message-ID: <87mutz3jxs.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Noam Postavsky writes: > Raimon Grau writes: > >> +;; UUID >> + >> +(defvar thing-at-point-uuid-regexp >> + (rx (and bow > > Using rx is okay, I think. There was some discussion about it on > emacs-devel a little time ago, with most people saying the increased > verbosity made them not want to use it, but I kind of like it myself. > However, Stefan made the point that `and' is potentially a bit > confusing, because it could be misread as intersection. It's better to > use one of the synonyms `seq' or `:'. FWIW, the outer and/seq/: can be eliminated, as rx implicitly sequences its arguments. -- Basil From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Aug 2018 09:50: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 To: Noam Postavsky Cc: 32372@debbugs.gnu.org Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153354899726091 (code B ref 32372); Mon, 06 Aug 2018 09:50:02 +0000 Received: (at 32372) by debbugs.gnu.org; 6 Aug 2018 09:49:57 +0000 Received: from localhost ([127.0.0.1]:42289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmc9F-0006mk-0d for submit@debbugs.gnu.org; Mon, 06 Aug 2018 05:49:57 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmc9D-0006mX-5Z for 32372@debbugs.gnu.org; Mon, 06 Aug 2018 05:49:55 -0400 Received: by mail-wm0-f65.google.com with SMTP id y2-v6so13174606wma.1 for <32372@debbugs.gnu.org>; Mon, 06 Aug 2018 02:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=hzgxKNa1eUkgfvt9OhJK8NoXXAXHZ17PQ7hVoQAMSNw=; b=bA3ENvv8ubgghQEshM5zvtMQhwSXj3nPorqY/+ZiRwzp4ytMVvEOosLMC+VNZnu1oc O0H95YbkltSu1jwNOLlrN7creYhsBeOjbzRvH38e5m8OGHrRkkbP8s4BD1cFmxWGBabh CRUh6zBCq2n9l0W2h9TEsndOVJCOqFgRbwDP4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=hzgxKNa1eUkgfvt9OhJK8NoXXAXHZ17PQ7hVoQAMSNw=; b=G3R78C537E6VfkIz8EVX3uthyYSf9tEUpV29doUdDyUN2fZZYVBXZ5QQBalwfLM9m2 5UPQmPxhi0U2Ul/uFRKlrm07WAMOUYwn7rXJEg7pl6pl4f2SA2NGtIdgIIuYOdiHQFUF dmJ872im0Ba09ZtWyuqLmlkX0gd3AXBmK1K1Xm/MFzH1GwWdbEbKZDLymlKwUnYQWWr8 HHg8FsEHnoO+o6+huRFRsG+4qI+uWaepltKHgwaCXTlLGNQbrE4JGa6U1Ay8KcXTvAy2 y0F2WADWnGk0itWHtFh8VIuDRtwx01bFKcbbG61nZncpKF79ZFUlTNxRxsPK35qM0sAF Ko2Q== X-Gm-Message-State: AOUpUlFayJKsYw+87y8zQ4IWfrpufxW1q75q+SJig5o9mbP4co4V75nG E++Kik0Jq4UBDgBPeoqIoN7HE/3UoCw= X-Google-Smtp-Source: AAOMgpcxT9bQ4NxXV91LrteT6nb48mM7ahS/tcUCmqu8UteB1Xot2OjbeswMNuEEC1UO9zfTjccS0A== X-Received: by 2002:a1c:b984:: with SMTP id j126-v6mr10725072wmf.25.1533548989126; Mon, 06 Aug 2018 02:49:49 -0700 (PDT) Received: from raikong (81.61.106.180.dyn.user.ono.com. [81.61.106.180]) by smtp.gmail.com with ESMTPSA id v5-v6sm8991888wru.60.2018.08.06.02.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 02:49:48 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau In-Reply-To: <8736vsz0mo.fsf@gmail.com> References: <87h8k88l47.fsf@konghq.com> <87effc8kj1.fsf@konghq.com> <8736vsz0mo.fsf@gmail.com> Date: Mon, 06 Aug 2018 10:48:15 +0100 Message-ID: <878t5j9674.fsf@konghq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Noam Postavsky writes: > severity 32372 wishlist > quit > > Raimon Grau writes: > >> Subject: [PATCH] Add uuid as allowed thingatpt symbol >> >> * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. > > I guess you should mention something about the ops as well here. Though > it's not 100% clear what kind of format you should use for those. Maybe > just (top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'. Aha. Added it. > >> +;; UUID >> + >> +(defvar thing-at-point-uuid-regexp >> + (rx (and bow > > Using rx is okay, I think. There was some discussion about it on > emacs-devel a little time ago, with most people saying the increased > verbosity made them not want to use it, but I kind of like it myself. > However, Stefan made the point that `and' is potentially a bit > confusing, because it could be misread as intersection. It's better to > use one of the synonyms `seq' or `:'. > >> + (or >> + "00000000-0000-0000-0000-000000000000" >> + (and >> + (repeat 8 hex-digit) "-" >> + (repeat 4 hex-digit) "-" >> + (or "1" "2" "3" "4" "5") >> + (repeat 3 hex-digit) "-" >> + (or "8" "9" "a" "b" "A" "B") >> + (repeat 3 hex-digit) "-" >> + (repeat 12 hex-digit))) >> + eow)) >> + "A regular expression matching a UUID from versions 1 to 5. >> + >> + More info on uuid's format in >> + https://tools.ietf.org/html/rfc4122." ) > > So, in that RFC I see this grammar > > UUID = time-low "-" time-mid "-" > time-high-and-version "-" > clock-seq-and-reserved > clock-seq-low "-" node > time-low = 4hexOctet > time-mid = 2hexOctet > time-high-and-version = 2hexOctet > clock-seq-and-reserved = hexOctet > clock-seq-low = hexOctet > node = 6hexOctet > hexOctet = hexDigit hexDigit > hexDigit = > "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / > "a" / "b" / "c" / "d" / "e" / "f" / > "A" / "B" / "C" / "D" / "E" / "F" > > It looks like you crafted a regexp which is a tighter match for just the > UUID versions currently in use. I think we're better off with the > looser definition though, that way it will continue to be correct even > as new versions come out. > > Furthermore, I would guess a human user is going to be surprised if > (thing-at-point 'uuid) picks up this > > 12345678-1234-1234-8123-123456789012 > > but not this: > > 12345678-1234-1234-5123-123456789012 > Completely agree. Now using a simpler version that will be more predictable for users. > >> +(put 'uuid 'thing-at-point >> + (lambda () >> + (let ((boundary-pair (bounds-of-thing-at-point 'uuid))) >> + (if boundary-pair >> + (buffer-substring-no-properties >> + (car boundary-pair) (cdr boundary-pair)))))) > > I think this isn't needed, because the `thing-at-point' function already > does this for you: > > (let ((text > (if (get thing 'thing-at-point) > (funcall (get thing 'thing-at-point)) > (let ((bounds (bounds-of-thing-at-point thing))) > (when bounds > (buffer-substring (car bounds) (cdr bounds))))))) Right. I removed it. Thanks for the review! I fixed all the points raised. Cheers, Raimon Grau --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-uuid-as-allowed-thingatpt-symbol.patch >From ac14cf6841ae7c8aa09897e7e6f06814961462fa Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 5 Aug 2018 22:47:30 +0100 Subject: [PATCH] Add uuid as allowed thingatpt symbol * etc/NEWS: Mention changes in thingatpt.el. * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. (top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'. * test/lisp/thingatpt-tests.el: Add tests for uuid at point. --- etc/NEWS | 6 ++++++ lisp/thingatpt.el | 30 +++++++++++++++++++++++++++--- test/lisp/thingatpt-tests.el | 5 ++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a1c12a6..ee94572 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -96,6 +96,12 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'. --- ** shadowfile.el has been rewritten to support Tramp file names. +--- +** 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. + * New Modes and Packages in Emacs 26.2 diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6a978fe..5523a34 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -58,7 +58,7 @@ forward-thing "Move forward to the end of the Nth next THING. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing))))) @@ -73,7 +73,7 @@ bounds-of-thing-at-point "Determine the start and end buffer locations for the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'. See the file `thingatpt.el' for documentation on how to define a @@ -131,7 +131,7 @@ thing-at-point "Return the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', `number', and `page'. When the optional argument NO-PROPERTIES is non-nil, @@ -554,6 +554,30 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +;; UUID + +(defvar thing-at-point-uuid-regexp + (rx (seq 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." ) + +(put 'uuid 'bounds-of-thing-at-point + (lambda () + (let ((thing (thing-at-point-looking-at + thing-at-point-uuid-regexp 500))) + (if thing + (let ((beginning (match-beginning 0)) + (end (match-end 0))) + (cons beginning end)))))) + ;; Aliases (defun word-at-point () diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index cfb57de..b4a5fd9 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -65,7 +65,10 @@ thing-at-point-test-data ("http://example.com/ab)c" 4 url "http://example.com/ab)c") ;; URL markup, lacking schema ("" 1 url "mailto:foo@example.com") - ("" 1 url "ftp://ftp.example.net/abc/")) + ("" 1 url "ftp://ftp.example.net/abc/") + ;; UUID, only hex is allowed + ("01234567-89ab-cdef-ABCD-EF0123456789" 1 uuid "01234567-89ab-cdef-ABCD-EF0123456789") + ("01234567-89ab-cdef-ABCD-EF012345678G" 1 uuid nil)) "List of thing-at-point tests. Each list element should have the form -- 2.7.4 --=-=-=-- From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Aug 2018 19:17: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 To: Raimon Grau Cc: 32372@debbugs.gnu.org Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153358301822204 (code B ref 32372); Mon, 06 Aug 2018 19:17:02 +0000 Received: (at 32372) by debbugs.gnu.org; 6 Aug 2018 19:16:58 +0000 Received: from localhost ([127.0.0.1]:42884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmkzx-0005m1-9S for submit@debbugs.gnu.org; Mon, 06 Aug 2018 15:16:58 -0400 Received: from mail-io0-f182.google.com ([209.85.223.182]:35044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmkzv-0005ln-3b for 32372@debbugs.gnu.org; Mon, 06 Aug 2018 15:16:55 -0400 Received: by mail-io0-f182.google.com with SMTP id w11-v6so11980247iob.2 for <32372@debbugs.gnu.org>; Mon, 06 Aug 2018 12:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=mB9hFZVV2eGiwe/7mvFzEblClXLuGtRF1ZLQIAEEdEg=; b=M4g5Axi/Q8+baNjNaKHyQ9Wi5VxUeyEP2O8vosH/nWwsFTpZ3lFyGxlsjCtm2alhJF ACKhEu9FjHLzhdhf0sn1mH4fCXkWDPAsTWgl0DFwuB6qRCrQxZh2KRrxtAalf357c3xp LupmDQrmJpkCnRBA1HmbD5JOSaf8tKZLvvfxFq2MCjT9wPPmRg40lRlK3buZQc6O+tgW ykOlnxe2Xa/QOgQgABfp/O0m6Rd4qq1n1XKuN6oTTBJCTKS9gTipBWmkehBuEK1+5WMc tzk6RFJH8CL6x/ayzZ2y+QSCWpBi8VbtkkYz8WaLRZEHPyvIa97VxnY2JiWzI3FJQ+aY ggdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=mB9hFZVV2eGiwe/7mvFzEblClXLuGtRF1ZLQIAEEdEg=; b=hSn6qJpfcZvufon15SfYbKnM02mxzrxGcRqRWZ0QbFtG6cs+Mqs1VzdH5w9Ivk+ipF dySPNjgGju0U9t9ClFvDwUlrVr1zkOmBWoUMUPuR8A9GO/KZRIwGCVnkb0acyv+bxkPq Yk/oLH0a4hTbLIh9tqR8cW5HXAALPG+2+MXRMV8K2weFDhfjaQZkDf+Kcwgcky2XALZB MbWwZnspBYWXBz5d+TCLF5MgvthG0KF3nmB316K9gTE0Bi3bBEv6US+sSnGe6Tyzw68s l+17XosUskoVlcbIscZc31se7Iy0Y+Jszjg/9nPoLQexuj1oY+xXEobYyDWe9LRRBYIj kGUw== X-Gm-Message-State: AOUpUlG/N5ix7rfIjf+r7DCZkJwtmX2GbvuBMVynWAXTQX6YGTYZZCga z3X98v7mEGFj2bLLnHfqt1Cv2TpW X-Google-Smtp-Source: AA+uWPzv7dbrvO72TkFWN03mzGNTSf1niVFKZaWN1Gr4w9Od9YgUkn/ubgmvGL6rRlgqlyLO8K8kcQ== X-Received: by 2002:a6b:1495:: with SMTP id 143-v6mr1551081iou.78.1533583009256; Mon, 06 Aug 2018 12:16:49 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id w8-v6sm4897607itb.0.2018.08.06.12.16.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Aug 2018 12:16:48 -0700 (PDT) From: Noam Postavsky References: <87h8k88l47.fsf@konghq.com> <87effc8kj1.fsf@konghq.com> <8736vsz0mo.fsf@gmail.com> <878t5j9674.fsf@konghq.com> Date: Mon, 06 Aug 2018 15:16:47 -0400 In-Reply-To: <878t5j9674.fsf@konghq.com> (Raimon Grau's message of "Mon, 06 Aug 2018 10:48:15 +0100") Message-ID: <87mutzxq3k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Raimon Grau writes: > +(put 'uuid 'bounds-of-thing-at-point > + (lambda () > + (let ((thing (thing-at-point-looking-at > + thing-at-point-uuid-regexp 500))) I think since uuids are fixed size, we can just pass that length (36), rather than the somewhat arbitrary 500. From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Aug 2018 07:51: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 To: Noam Postavsky Cc: 32372@debbugs.gnu.org Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153362821010937 (code B ref 32372); Tue, 07 Aug 2018 07:51:02 +0000 Received: (at 32372) by debbugs.gnu.org; 7 Aug 2018 07:50:10 +0000 Received: from localhost ([127.0.0.1]:43131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmwkr-0002qK-Ff for submit@debbugs.gnu.org; Tue, 07 Aug 2018 03:50:09 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]:36990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmwkp-0002pn-JN for 32372@debbugs.gnu.org; Tue, 07 Aug 2018 03:50:08 -0400 Received: by mail-wr1-f44.google.com with SMTP id u12-v6so14765361wrr.4 for <32372@debbugs.gnu.org>; Tue, 07 Aug 2018 00:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=8GibKOn12lOEIaR0/RdV1b/BJqTLtFg1G3/tUwqgTlk=; b=hnumJ9JNO/JXXbqmTE8O4GGZRHha24puuTATsMhT4TPq8wgCIT7jEZJotTL396Y5pA xqmKoG66oCxrrGYt4YUyYETX3FJAyd/rrbWeflMihxlxl0pq0gov5lltbMS1iss/GYcZ r8oHwYlNkGdpYPx9YamRL9YFS8eQqurghTw9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=8GibKOn12lOEIaR0/RdV1b/BJqTLtFg1G3/tUwqgTlk=; b=Mw0gRrcCFieD+J4BHrdiK3+YsTman2XLbgdU8raJo/xXjpGdLk3VlkzVdijiL737EE f/PYlcHBIoCrPX2ufIEEtZ0LVyR0gd1E5GPnivsz+TurtxbnDIH0tiUSHE6vi0bqXWBU Ou8Jl9umlwAsGmO3WjL5GFwKK1hHUQIiY5DB+Htd9VDpYoS+50ScKkg/yNmYU2VOkCEa /uHyMGhfmAAhnrqF1Nz1DcJBEPqXAOQc2C6pKHSu2ENvgTBMzrXgmc93qEP+X7pP9/N/ rSr4TZxc5I9x+tFZ6EeEq7+R5CRaQUrfbMPELQ2bK7o2Cg4g2oJqqQ8EG41VHP3hJKxC OtNA== X-Gm-Message-State: AOUpUlFf92j76WU+Zoh/lWDWrMS8Z3fhbqYeC7xm/rf6W6t+uAW1w6a0 KRwdmVIgHiI7EFt2kFcuqaWsa07JLwg= X-Google-Smtp-Source: AA+uWPwVPnVAM0tW1WyD9nxzKEZjBHD4cVJ7zKFivbtRkkL731KA7fQTGI3Rq7qypUEpxb23WMxNYw== X-Received: by 2002:adf:9c93:: with SMTP id d19-v6mr489656wre.11.1533628201418; Tue, 07 Aug 2018 00:50:01 -0700 (PDT) Received: from raikong (81.61.106.180.dyn.user.ono.com. [81.61.106.180]) by smtp.gmail.com with ESMTPSA id i14-v6sm1806512wmd.13.2018.08.07.00.49.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 00:50:00 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau In-Reply-To: <87mutzxq3k.fsf@gmail.com> References: <87h8k88l47.fsf@konghq.com> <87effc8kj1.fsf@konghq.com> <8736vsz0mo.fsf@gmail.com> <878t5j9674.fsf@konghq.com> <87mutzxq3k.fsf@gmail.com> Date: Tue, 07 Aug 2018 08:48:26 +0100 Message-ID: <87600m8vn9.fsf@konghq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Noam Postavsky writes: > Raimon Grau writes: > >> +(put 'uuid 'bounds-of-thing-at-point >> + (lambda () >> + (let ((thing (thing-at-point-looking-at >> + thing-at-point-uuid-regexp 500))) > > I think since uuids are fixed size, we can just pass that length (36), > rather than the somewhat arbitrary 500. I adjusted it to 36 and removed the redundant `seq' on the rx expression. Attaching the updated patch. Thanks again for reviewing, Raimon Grau --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-uuid-as-allowed-thingatpt-symbol.patch >From 534c35917f17f3a73c780dcbcc4be86fafa97566 Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 5 Aug 2018 22:47:30 +0100 Subject: [PATCH] Add uuid as allowed thingatpt symbol * etc/NEWS: Mention changes in thingatpt.el. * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. (top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'. * test/lisp/thingatpt-tests.el: Add tests for uuid at point. --- etc/NEWS | 6 ++++++ lisp/thingatpt.el | 30 +++++++++++++++++++++++++++--- test/lisp/thingatpt-tests.el | 5 ++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a1c12a6..ee94572 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -96,6 +96,12 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'. --- ** shadowfile.el has been rewritten to support Tramp file names. +--- +** 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. + * New Modes and Packages in Emacs 26.2 diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6a978fe..e0443f4 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -58,7 +58,7 @@ forward-thing "Move forward to the end of the Nth next THING. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing))))) @@ -73,7 +73,7 @@ bounds-of-thing-at-point "Determine the start and end buffer locations for the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'. See the file `thingatpt.el' for documentation on how to define a @@ -131,7 +131,7 @@ thing-at-point "Return the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', `number', and `page'. When the optional argument NO-PROPERTIES is non-nil, @@ -554,6 +554,30 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +;; UUID + +(defvar thing-at-point-uuid-regexp + (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." ) + +(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)))))) + ;; Aliases (defun word-at-point () diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index cfb57de..b4a5fd9 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -65,7 +65,10 @@ thing-at-point-test-data ("http://example.com/ab)c" 4 url "http://example.com/ab)c") ;; URL markup, lacking schema ("" 1 url "mailto:foo@example.com") - ("" 1 url "ftp://ftp.example.net/abc/")) + ("" 1 url "ftp://ftp.example.net/abc/") + ;; UUID, only hex is allowed + ("01234567-89ab-cdef-ABCD-EF0123456789" 1 uuid "01234567-89ab-cdef-ABCD-EF0123456789") + ("01234567-89ab-cdef-ABCD-EF012345678G" 1 uuid nil)) "List of thing-at-point tests. Each list element should have the form -- 2.7.4 --=-=-=-- From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el 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 To: 32372@debbugs.gnu.org Cc: Raimon Grau , Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153364784917764 (code B ref 32372); Tue, 07 Aug 2018 13:18:02 +0000 Received: (at 32372) by debbugs.gnu.org; 7 Aug 2018 13:17:29 +0000 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 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=; 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 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 From: Ivan Shmakov X-License: CC-BY-SA-3.0+ (original contributions only) 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> Date: Tue, 07 Aug 2018 13:17:21 +0000 In-Reply-To: <87600m8vn9.fsf@konghq.com> (Raimon Grau's message of "Tue, 07 Aug 2018 08:48:26 +0100") Message-ID: <87600m48pq.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> 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/ From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Aug 2018 17:47: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 To: Ivan Shmakov Cc: Raimon Grau , Noam Postavsky , 32372@debbugs.gnu.org Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153366397111751 (code B ref 32372); Tue, 07 Aug 2018 17:47:02 +0000 Received: (at 32372) by debbugs.gnu.org; 7 Aug 2018 17:46:11 +0000 Received: from localhost ([127.0.0.1]:43895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fn63e-00033T-N9 for submit@debbugs.gnu.org; Tue, 07 Aug 2018 13:46:10 -0400 Received: from mail-lj1-f171.google.com ([209.85.208.171]:37535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fn63c-00033F-EW for 32372@debbugs.gnu.org; Tue, 07 Aug 2018 13:46:09 -0400 Received: by mail-lj1-f171.google.com with SMTP id v9-v6so14117630ljk.4 for <32372@debbugs.gnu.org>; Tue, 07 Aug 2018 10:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=YDe6dEHSTQxU/jkliPdruBqSJCH4WAJ+SXNZ1g0Sh0g=; b=CyurOcvBTOrFInOy/xeaLlA4GLk5Axu9LvHnxqZOsog0TCLooOzuRWomotkv/SNGTT ZEhAZTVx7aB56ujuE5yK+ypo4jbCPY97SoKxdxPUhmVYNLUClgWMijpY+UFNSxmVvc+h 4EZkpC3NXPKkVhv4HHOPwxiUCY3A2dsmblFLDlFc7wSjZlQykENsgmw8FvvCT6OriXFw nsShkX7t5L5frj92nDXjgnbqM7SIOWpy2eVrQV+sIk1KPwN6wft831t+numDBBGFx4Sr J/ZVpzAiCED714epUT9o+p70d0KwNTU69aAfgsisPf7ORpVodzbotY6mqmjhG43YXOHP vURQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=YDe6dEHSTQxU/jkliPdruBqSJCH4WAJ+SXNZ1g0Sh0g=; b=WZUmy19rBY8ytvf4eT3K6FRlSe7IFQ9dETeECO6gZ4ciumn5xj5s/L74ZSqIX9bGz8 eZLncBLNUGqzsvYtdvAwdaIX0hXKLZF0v2e89xH5WHa8yLHNaRIFguOpuj8ScRmYEzIl w3ng4tkxQxXLiyaANTttKtIM7CcYHlovJ+y7yFTdZoKPOukD+k1eYvnDqtLmCvUNtu4B YMXqJwwiLXlz6x5uisNl00QF3bd5HLIkVd7qre8B/kXJYhKBAkA9WZax3CNjvDLusDWs HAjbm/UpSsDewe4yxWaukQledQdJs4umN97YLRSaBwiYZMRume8zCYeJyRsBSv8ryq68 aJ5w== X-Gm-Message-State: AOUpUlHCO68VTHU/gkeqItqs9Z8hq/y8WZUG9ifUzKHQ8X8t8VvTjR/n wXyuyWeP+eWxnGmk032Sl4199g== X-Google-Smtp-Source: AAOMgpeyR+rZvCyJuU9BMv6ycfZrnU7nQKa1FqHQZ9b647OkumibBtWIDEMM0Z0KvHCrcKhfCXQdUQ== X-Received: by 2002:a2e:8185:: with SMTP id e5-v6mr9022105ljg.93.1533663962505; Tue, 07 Aug 2018 10:46:02 -0700 (PDT) Received: from localhost (adsl-213.91.140.88.tellas.gr. [91.140.88.213]) by smtp.gmail.com with ESMTPSA id g3-v6sm388445lfk.72.2018.08.07.10.46.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 10:46:01 -0700 (PDT) From: "Basil L. Contovounesios" 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> <87600m48pq.fsf@violet.siamics.net> Date: Tue, 07 Aug 2018 20:45:54 +0300 In-Reply-To: <87600m48pq.fsf@violet.siamics.net> (Ivan Shmakov's message of "Tue, 07 Aug 2018 13:17:21 +0000") Message-ID: <878t5i6pf1.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ivan Shmakov writes: >>>>>> Raimon Grau writes: > > + > > +(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))? If you're in the business of simplifying, why not take it all the way: (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) (cons (match-beginning 0) (match-end 0))) -- Basil From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Aug 2018 16:05:01 +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 To: Ivan Shmakov , 32372@debbugs.gnu.org Cc: Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.15338306904424 (code B ref 32372); Thu, 09 Aug 2018 16:05:01 +0000 Received: (at 32372) by debbugs.gnu.org; 9 Aug 2018 16:04:50 +0000 Received: from localhost ([127.0.0.1]:46074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnnQf-00019I-DN for submit@debbugs.gnu.org; Thu, 09 Aug 2018 12:04:49 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:39814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnnQd-000194-Bg for 32372@debbugs.gnu.org; Thu, 09 Aug 2018 12:04:48 -0400 Received: by mail-wm0-f51.google.com with SMTP id q8-v6so815020wmq.4 for <32372@debbugs.gnu.org>; Thu, 09 Aug 2018 09:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=lYkdO+CxVv1UAUFPwxl1XizaEHPx1WOEQkEQw8F95nw=; b=QicUhiee2+7nN74Cr+mGKhWrx+7/7bQ8uOaw4lq14Cxvwt5rz0mXUzR5V3iAHEWIx7 T2tG7lUvee6jh9bQFLSf77I2FhHO0PkK1572khvz89zYrUr41CaKwdXUJApDB8DKFrS2 PkPjuVE1R8xmWrAO3tlIjZnkloiAPSE8ESnc8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=lYkdO+CxVv1UAUFPwxl1XizaEHPx1WOEQkEQw8F95nw=; b=LByDC0LOncWcx90Q17ssS6gas0lWvOdGCZDEGX3Ag5eK8AXPZu0VyfI+CcCQU3Jzac POlidFagTsi7I0XnROqCHeyWL0OT4XP6ru/+pb3SVmeSgYCgO33Q5NQma9xumSkCo+6s j0QifII+7WsFygriK7Vs9z8p9xOoqWJk6atpVrABYmdR/qfadv2G0C1JwF5lwU5dxhmP mqwDVuATAqme9ArD/mf1xK0ivehZqgBMJOkkIybY0GklFeD3x/NQJrJnsNHYVvK4DiAj xFXYag2Ei86g+jDxcHONJY+eHemxtBimrkii0KDDx3Q6BCivWpFex+K3fdrz7P4gwV9L NJoA== X-Gm-Message-State: AOUpUlFR4D7Orwh2igynhuKjfg/aMAr9ukLwGzWmZnxYpLS+wweBKu0N ZXSxqt9gqK39F4M62AE3cVpmbQ== X-Google-Smtp-Source: AA+uWPwvUo0YVIkbvpOd3bMCjHIX9/4xlR/EGNS40vOxBCK/FhctY94DVUf+78wZ/GVyaI8kwYzy4w== X-Received: by 2002:a7b:c013:: with SMTP id c19-v6mr2045280wmb.53.1533830681720; Thu, 09 Aug 2018 09:04:41 -0700 (PDT) Received: from raikong (55.19.183.185.dyn.akiwifi.com. [185.183.19.55]) by smtp.gmail.com with ESMTPSA id f6-v6sm7433856wrw.78.2018.08.09.09.04.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 09:04:40 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau In-Reply-To: <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> <87600m48pq.fsf@violet.siamics.net> Date: Thu, 09 Aug 2018 17:03:03 +0100 Message-ID: <8736vny1c8.fsf@konghq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ivan Shmakov writes: >>>>>> Raimon Grau writes: > > A few minor points. > > [=E2=80=A6] > > > +--- > > +** 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. > Done. > > > +;; 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.") > True that there usually aren't urls in the docstrings like that , I used your suggested string now. > > + > > +(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))? > I used the even more succint form of a single `and'. I hope it doesn't hurt= readability. If the consensus is "yes, it's ok" I'll unify the style in o= ther places of the same file in a future patch. Thanks all for the suggestions, Raimon Grau --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-uuid-as-allowed-thingatpt-symbol.patch >From 0c7e3baea026acb83b1ba4fc7035675edce0e3bf Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 5 Aug 2018 22:47:30 +0100 Subject: [PATCH] Add uuid as allowed thingatpt symbol * etc/NEWS: Mention changes in thingatpt.el. * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. (top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'. * test/lisp/thingatpt-tests.el: Add tests for uuid at point. --- etc/NEWS | 6 ++++++ lisp/thingatpt.el | 25 ++++++++++++++++++++++--- test/lisp/thingatpt-tests.el | 5 ++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a1c12a6..57b2586 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -96,6 +96,12 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'. --- ** shadowfile.el has been rewritten to support Tramp file names. +--- +** 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. + * New Modes and Packages in Emacs 26.2 diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6a978fe..1e82e7b 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -58,7 +58,7 @@ forward-thing "Move forward to the end of the Nth next THING. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing))))) @@ -73,7 +73,7 @@ bounds-of-thing-at-point "Determine the start and end buffer locations for the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'. See the file `thingatpt.el' for documentation on how to define a @@ -131,7 +131,7 @@ thing-at-point "Return the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', `number', and `page'. When the optional argument NO-PROPERTIES is non-nil, @@ -554,6 +554,25 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +;; UUID + +(defconst thing-at-point-uuid-regexp + (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. + +See RFC 4122 for the description of the format.") + +(put 'uuid 'bounds-of-thing-at-point + (lambda () + (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) + (cons (match-beginning 0) (match-end 0))))) + ;; Aliases (defun word-at-point () diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index cfb57de..b4a5fd9 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -65,7 +65,10 @@ thing-at-point-test-data ("http://example.com/ab)c" 4 url "http://example.com/ab)c") ;; URL markup, lacking schema ("" 1 url "mailto:foo@example.com") - ("" 1 url "ftp://ftp.example.net/abc/")) + ("" 1 url "ftp://ftp.example.net/abc/") + ;; UUID, only hex is allowed + ("01234567-89ab-cdef-ABCD-EF0123456789" 1 uuid "01234567-89ab-cdef-ABCD-EF0123456789") + ("01234567-89ab-cdef-ABCD-EF012345678G" 1 uuid nil)) "List of thing-at-point tests. Each list element should have the form -- 2.7.4 --=-=-=-- From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Aug 2018 18:13:01 +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 To: 32372@debbugs.gnu.org Cc: Raimon Grau , Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153383838117424 (code B ref 32372); Thu, 09 Aug 2018 18:13:01 +0000 Received: (at 32372) by debbugs.gnu.org; 9 Aug 2018 18:13:01 +0000 Received: from localhost ([127.0.0.1]:46130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnpQj-0004Wv-1T for submit@debbugs.gnu.org; Thu, 09 Aug 2018 14:13:01 -0400 Received: from fely.am-1.org ([78.47.74.50]:41658) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnpQg-0004Wl-Ag for 32372@debbugs.gnu.org; Thu, 09 Aug 2018 14:13:00 -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=eb2uxc/rooyP5S7iYhjI9Y0NvqAZ/zgsGAOY1Y6x83U=; b=hKVJ+9CMfDH7BhTGhW8KXegJSP kAj18N5aqx9FXBEHjMoTbFZKkmvm6LVxJnfARsmDk16YbdxhIlPrkeY/2XOcDkcOnhZbTcXU2c0Xp 3Pc/gDQA1caFmo/s6LJn9+QKiDKbkzJ6/Wrb+SSSQSlnBGTAbbwB1pkcmRWf5db15OT0=; 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 1fnpQd-0008NI-SF; Thu, 09 Aug 2018 18:12:55 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtp (Exim 4.84_2) (envelope-from ) id 1fnpQc-00083a-Pe; Thu, 09 Aug 2018 18:12:54 +0000 From: Ivan Shmakov X-License: CC-BY-SA-3.0+ (original contributions only) 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> <87600m48pq.fsf@violet.siamics.net> <8736vny1c8.fsf@konghq.com> Date: Thu, 09 Aug 2018 18:12:54 +0000 In-Reply-To: <8736vny1c8.fsf@konghq.com> (Raimon Grau's message of "Thu, 09 Aug 2018 17:03:03 +0100") Message-ID: <87bmab2yu1.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> Raimon Grau writes: [=E2=80=A6] > +(put 'uuid 'bounds-of-thing-at-point > + (lambda () > + (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) > + (cons (match-beginning 0) (match-end 0))))) While either =E2=80=98and=E2=80=99 or =E2=80=98if=E2=80=99 can be used her= e, to exactly the same effect, the indentation above is one for =E2=80=98if=E2=80=99; =E2=80=98an= d=E2=80=99 should instead look like: (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) (cons (match-beginning 0) (match-end 0))) I think in this case it=E2=80=99s marginally better to keep indentation and replace =E2=80=98and=E2=80=99 with =E2=80=98if=E2=80=99 than the other= way around. Thanks. [=E2=80=A6] --=20 FSF associate member #7257 http://am-1.org/~ivan/ From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Aug 2018 18:52:01 +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 To: Ivan Shmakov , 32372@debbugs.gnu.org Cc: Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153384071521432 (code B ref 32372); Thu, 09 Aug 2018 18:52:01 +0000 Received: (at 32372) by debbugs.gnu.org; 9 Aug 2018 18:51:55 +0000 Received: from localhost ([127.0.0.1]:46147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnq2K-0005ZX-SG for submit@debbugs.gnu.org; Thu, 09 Aug 2018 14:51:54 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:36706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnq2J-0005ZH-AM for 32372@debbugs.gnu.org; Thu, 09 Aug 2018 14:51:51 -0400 Received: by mail-wr1-f41.google.com with SMTP id h9-v6so6041247wro.3 for <32372@debbugs.gnu.org>; Thu, 09 Aug 2018 11:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=La67Y6/dnY6Ol+cKgsNUd2rjIX+Z2Jl5CXCY4wVgIOM=; b=TQmAyX4PKOubnwHLmY3eWrl9IHvI50LF/oEC37ylH9RLoDxESJ0R2BJKmipP4/k6Ii d7Noo0RJSRBcn6UwotmX5zq44xWamvKsZMGdbnuQ1eZE//tgaVjE+6fRmSzylMUNjlgc OZmiYDK/zDg5hp+WY5qF28mrD866AvetupaL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=La67Y6/dnY6Ol+cKgsNUd2rjIX+Z2Jl5CXCY4wVgIOM=; b=qh9GwueMukiFCCwVVPtDM1C0r8zgiU/UiU4NSUIPp6Hg7sYDSno8u2CidRLWRddNFo ANU/qet2Jpx2Eq0o9NLLmFaFLQ5jsTMdJAP7Kt+FAq088ixyadp1BBwHUubRzhEVwJFj dwWor1H8Z+cNZ9C8hUOu7t7UbRgZY/ldjMeh0PGceUJdXYpC64hUU7tjbb379EXnraCA Z76bS36kOeJt461MtlqTkzwFFvK3tdZ7DhzunkzrULHLy79oE1vfq3rleK78/ABExnUk ov4GYhKH0w+XQFFs0d2ZuO1dxge6bBwzlHJQQD62deD11yccGKrDVfvP6RxPVPPM0COu 7j4w== X-Gm-Message-State: AOUpUlEB2HIny2WRPv28GcKSjePgt1wBpRXD9YEGVxotfR01Rbg8oyEB /cMV44h2R948Ag6+CkSUdsE4Vw== X-Google-Smtp-Source: AA+uWPywPWDYcVNQb8Ehqy/7zY8GGFG0Tmrx5Woo/PMV7MAUkaOsGjLSyDfqxXAGxwRNLUgH8k4wlg== X-Received: by 2002:adf:b188:: with SMTP id q8-v6mr2146440wra.95.1533840705547; Thu, 09 Aug 2018 11:51:45 -0700 (PDT) Received: from raikong (55.19.183.185.dyn.akiwifi.com. [185.183.19.55]) by smtp.gmail.com with ESMTPSA id 31-v6sm15198347wra.26.2018.08.09.11.51.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 11:51:44 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau In-Reply-To: <87bmab2yu1.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> <87600m48pq.fsf@violet.siamics.net> <8736vny1c8.fsf@konghq.com> <87bmab2yu1.fsf@violet.siamics.net> Date: Thu, 09 Aug 2018 19:50:07 +0100 Message-ID: <87zhxvwf1c.fsf@konghq.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ivan Shmakov writes: > While either =E2=80=98and=E2=80=99 or =E2=80=98if=E2=80=99 can be used h= ere, to exactly the same > effect, the indentation above is one for =E2=80=98if=E2=80=99; =E2=80=98= and=E2=80=99 should instead > look like: > > (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) > (cons (match-beginning 0) (match-end 0))) > > I think in this case it=E2=80=99s marginally better to keep indentation > and replace =E2=80=98and=E2=80=99 with =E2=80=98if=E2=80=99 than the oth= er way around. What about `when'? Is it ok to use it? One branch 'if' look funny to me but I don't see many (any?) `when' in the = emacs codebase. Thanks, Raimon Grau From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Aug 2018 22:21: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 To: Raimon Grau Cc: 32372@debbugs.gnu.org, Ivan Shmakov , Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.15338532309231 (code B ref 32372); Thu, 09 Aug 2018 22:21:02 +0000 Received: (at 32372) by debbugs.gnu.org; 9 Aug 2018 22:20:30 +0000 Received: from localhost ([127.0.0.1]:46213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fntIE-0002Op-8O for submit@debbugs.gnu.org; Thu, 09 Aug 2018 18:20:30 -0400 Received: from mail-lf1-f51.google.com ([209.85.167.51]:44091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fntIB-0002OX-Fm for 32372@debbugs.gnu.org; Thu, 09 Aug 2018 18:20:28 -0400 Received: by mail-lf1-f51.google.com with SMTP id g6-v6so5203083lfb.11 for <32372@debbugs.gnu.org>; Thu, 09 Aug 2018 15:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=yvO5U7ovjMo/qT9ktZbVtAySZvrO7xOmjxY8y4REo2c=; b=2Ni+gatYuRnBIV/0BsQkjeunphEAtHIEgHUAPP0pVxXhjN79YOQKyQH98W8ZlFpL+u fdwwuCLiMoN0B9MCkkgoAnquLL+m+0EkSAa6akP/fJGPRVqwqifDNNYmKoirOVTmZw8S gIqmmusQIAlodnz47yeZNazBpZXWsJl0mEgZp9BvpXd1FvfGAGT8BD61kuQM6TgrIdl/ RPyDawISi+2aS9CtWmOB+sj6Eg3fVx0nA8xY103ZpjRBVSVgQlqpKVhfd/Fom4m0jKhY mXQ9hVAQo0Z9sRCB66wp/mAF6JQpoUFOe2HsBG73ODiuQ2RhTWS9cJoyKQwUXQNInup1 KTzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=yvO5U7ovjMo/qT9ktZbVtAySZvrO7xOmjxY8y4REo2c=; b=WZrHlW70d+wnQWuVaUNqwZxZFtwdO6HDqE00kagO5PrDXzYow1XfdbNQ9HR+NdO4bb 9lpwRm0FsTmt0WkqHnTz24vqUH2vGhypn2lSZ8PtAjRMyfo2YDm//eQqgXCIikC3DboG mELbmHQpF0KfIMhAb5oT4xFa/J9JgMsSKE8BMzuvRB37bdntuWtw53kAGwQ3UbX6NeL7 ljqpm8z8FVvwVjy1muPeT9Qe0aCvqVUAjkl2mlhT3pfRgJZQTtinSLdebn5iFXFTKI+4 KKMyKVmLASMjnrbQ4NLOqHVYaW/oKygVEiDyZ7xwWu8yFA2Hie18+XXFKQT/V85yHap8 1Zuw== X-Gm-Message-State: AOUpUlEkZIFJa6Ds6xXVS+zI1LbQAO5utyP7uD+IAlI0lqhD2mWIzjV5 AFy2CTcMKE4Pe5oONrC9Qx2LWw== X-Google-Smtp-Source: AA+uWPxahwuYjIxtigLotqZ9jzODcyrmazqC+XFvL9IghsMKe4DvXh/+ICxcVzeqVfvSYi3RyqLTVg== X-Received: by 2002:a19:17c2:: with SMTP id 63-v6mr2594364lfx.112.1533853221378; Thu, 09 Aug 2018 15:20:21 -0700 (PDT) Received: from localhost (adsl-91.91.140.88.tellas.gr. [91.140.88.91]) by smtp.gmail.com with ESMTPSA id h90-v6sm1352748lji.66.2018.08.09.15.20.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 15:20:20 -0700 (PDT) From: "Basil L. Contovounesios" 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> <87600m48pq.fsf@violet.siamics.net> <8736vny1c8.fsf@konghq.com> <87bmab2yu1.fsf@violet.siamics.net> <87zhxvwf1c.fsf@konghq.com> Date: Fri, 10 Aug 2018 01:20:13 +0300 In-Reply-To: <87zhxvwf1c.fsf@konghq.com> (Raimon Grau's message of "Thu, 09 Aug 2018 19:50:07 +0100") Message-ID: <87sh3nxjvm.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Raimon Grau writes: > Ivan Shmakov writes: > >> While either =E2=80=98and=E2=80=99 or =E2=80=98if=E2=80=99 can be used = here, to exactly the same >> effect, the indentation above is one for =E2=80=98if=E2=80=99; =E2=80= =98and=E2=80=99 should instead >> look like: >> >> (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) >> (cons (match-beginning 0) (match-end 0))) >> >> I think in this case it=E2=80=99s marginally better to keep indentation >> and replace =E2=80=98and=E2=80=99 with =E2=80=98if=E2=80=99 than the ot= her way around. > > What about `when'? Is it ok to use it? > > One branch 'if' look funny to me but I don't see many (any?) `when' in th= e emacs > codebase. If you grep the codebase you will see countless occurences of and, or, if-then, if-then-else, when, unless, etc. What to use here is a mostly a matter of personal style, and a bit of a bikeshed at that, so you are likely to get varied opinions. At the end of the day it doesn't really matter what you go with. If you're interested in reading some opinions and common conventions on this, see https://emacs.stackexchange.com/q/14195/15748. FWIW, Ivan's argument to use 'if' instead of 'and' just to preserve indentation doesn't apply here, as your patch is adding new code, not modifying existing code in-place, where preserving surrounding indentation would create a cleaner diff. --=20 Basil From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Aug 2018 06:38: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 To: 32372@debbugs.gnu.org Cc: Raimon Grau , "Basil L. Contovounesios" , Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.15338830419474 (code B ref 32372); Fri, 10 Aug 2018 06:38:02 +0000 Received: (at 32372) by debbugs.gnu.org; 10 Aug 2018 06:37:21 +0000 Received: from localhost ([127.0.0.1]:46307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fo131-0002Si-MK for submit@debbugs.gnu.org; Fri, 10 Aug 2018 02:37:21 -0400 Received: from fely.am-1.org ([78.47.74.50]:41762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fo12z-0002Sa-SD for 32372@debbugs.gnu.org; Fri, 10 Aug 2018 02:37:18 -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=VcyuUpHRtYrLxBh3Ss0EjoaPAB3zHfQR3YuKbmERkT4=; b=CVLGAzuZKZtNT9L+BXLsWW7FCW eYUskNu/VzAYGcknEytzqzC/USu5h3sMhoWZKbJBcCTbX37t7NFh4IywsRpM2oEwGyMxkj7FoAA88 NHKaNcjannWSl1mYKwveRdaC6cLfl7n7pHp9Yi8i0OQVftz0uhk6GDRoOjDjte9m+lS0=; 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 1fo12w-0005UG-78; Fri, 10 Aug 2018 06:37:14 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtp (Exim 4.84_2) (envelope-from ) id 1fo12v-0007gr-1Z; Fri, 10 Aug 2018 06:37:13 +0000 From: Ivan Shmakov X-License: CC-BY-SA-3.0+ (original contributions only) 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> <87600m48pq.fsf@violet.siamics.net> <8736vny1c8.fsf@konghq.com> <87bmab2yu1.fsf@violet.siamics.net> <87zhxvwf1c.fsf@konghq.com> <87sh3nxjvm.fsf@tcd.ie> Date: Fri, 10 Aug 2018 06:37:12 +0000 In-Reply-To: <87sh3nxjvm.fsf@tcd.ie> (Basil L. Contovounesios's message of "Fri, 10 Aug 2018 01:20:13 +0300") Message-ID: <87va8i20dj.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> Basil L Contovounesios writes: >>>>> Raimon Grau writes: >>>>> Ivan Shmakov writes: >>> While either =E2=80=98and=E2=80=99 or =E2=80=98if=E2=80=99 can be used= here, to exactly the same >>> effect, the indentation above is one for =E2=80=98if=E2=80=99; =E2=80= =98and=E2=80=99 should instead >>> look like: >>> (and (thing-at-point-looking-at thing-at-point-uuid-regexp 36) >>> (cons (match-beginning 0) (match-end 0))) >>> I think in this case it=E2=80=99s marginally better to keep indentatio= n and >>> replace =E2=80=98and=E2=80=99 with =E2=80=98if=E2=80=99 than the other= way around. >> What about =E2=80=98when=E2=80=99? Is it ok to use it? Yes. Actually, I=E2=80=99ve somehow confused if with when in the above comment; with if, the indentation will be like: (if (thing-at-point-looking-at thing-at-point-uuid-regexp 36) (cons (match-beginning 0) (match-end 0))) >> One branch 'if' look funny to me but I don=E2=80=99t see many (any?) = =E2=80=98when=E2=80=99 >> in the emacs codebase. > If you grep the codebase you will see countless occurrences of and, > or, if-then, if-then-else, when, unless, etc. > What to use here is a mostly a matter of personal style, and a bit of > a bikeshed at that, so you are likely to get varied opinions. At the > end of the day it doesn=E2=80=99t really matter what you go with. Yes. [=E2=80=A6] --=20 FSF associate member #7257 np. Undercurrent =E2=80=94 Jami Sieber From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Raimon Grau Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Aug 2018 11:40: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 To: Ivan Shmakov , 32372@debbugs.gnu.org Cc: "Basil L. Contovounesios" , Noam Postavsky Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153398758219302 (code B ref 32372); Sat, 11 Aug 2018 11:40:02 +0000 Received: (at 32372) by debbugs.gnu.org; 11 Aug 2018 11:39:42 +0000 Received: from localhost ([127.0.0.1]:47851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1foSF9-00051D-FA for submit@debbugs.gnu.org; Sat, 11 Aug 2018 07:39:42 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:40347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1foSF7-000510-9c for 32372@debbugs.gnu.org; Sat, 11 Aug 2018 07:39:37 -0400 Received: by mail-wm0-f49.google.com with SMTP id y9-v6so4328538wma.5 for <32372@debbugs.gnu.org>; Sat, 11 Aug 2018 04:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=bmXKUrnfNd6aarYM6dyv746GgxKUL2xt5LUsePq07sI=; b=BROt7Lde7CaV9ipjFK5IIn6UAGzTkb9b1UwN4gtjk6WsFrQQ1EUcis+87zqm7p9N/F 2nj65f2aTfTQzBjyROYojW/K5Kx2nN7sT8ces6HM0jO4bZ9ZI4Ws5suNNg5O62aFFXvP W3op9bGaiIKBvdER9R89EuJzmhxoIuhqsElXc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=bmXKUrnfNd6aarYM6dyv746GgxKUL2xt5LUsePq07sI=; b=qZvsaq+YGELnYiRlsTZo/oJHYnQKJbV7PudMTVYhZbM4fDQFAk839bAlgRJLSUFMED J0O1z2d6UUP3hBSufswhuAAcjc3iQU32eALAOxQGEk5fmSu6pjEd04Ay2vQ43HQ6AT/i hKixaYNj2WlNByLGgxqyk21MlE+8KA/EAk/4WbZebRLkEwuwlYpihEZRKfgSv7J7Tt3d Yh17LDpR+AZeaRYNO7uBiSUBSN4R4EivePEAfYf5/NfiAY790bp9x8mamwnbsSintxSs PSbcL8YbwJ+t7x1+YK6BWg04jK0cvldJbaNQBblBiLQzPsf0I9bmMOTBSCIH8qvtTQFT zz9w== X-Gm-Message-State: AOUpUlF2f1BzkDFLkp19or0irKfrrvKti0JR2yk3E5EXCRTlSNaxLLca TBtZsA5NWa4tI8YhXdOtrOcE3A== X-Google-Smtp-Source: AA+uWPwJaJJ/dxI3h+y5O/lSgSDV79SO2Yf7JiCAfUOzqJCJsK26mo4R+q3+pIhKsfqrVGBaTCsxSA== X-Received: by 2002:a1c:30d2:: with SMTP id w201-v6mr3510313wmw.47.1533987571648; Sat, 11 Aug 2018 04:39:31 -0700 (PDT) Received: from raikong (55.19.183.185.dyn.akiwifi.com. [185.183.19.55]) by smtp.gmail.com with ESMTPSA id 200-v6sm6742365wmv.6.2018.08.11.04.39.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Aug 2018 04:39:31 -0700 (PDT) From: Raimon Grau X-Google-Original-From: Raimon Grau In-Reply-To: <87va8i20dj.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> <87600m48pq.fsf@violet.siamics.net> <8736vny1c8.fsf@konghq.com> <87bmab2yu1.fsf@violet.siamics.net> <87zhxvwf1c.fsf@konghq.com> <87sh3nxjvm.fsf@tcd.ie> <87va8i20dj.fsf@violet.siamics.net> Date: Sat, 11 Aug 2018 12:37:51 +0100 Message-ID: <87k1oxw2uo.fsf@konghq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ivan Shmakov writes: > > What to use here is a mostly a matter of personal style, and a bit of > > a bikeshed at that, so you are likely to get varied opinions. At the > > end of the day it doesn=E2=80=99t really matter what you go with. > > Yes. I ended up using when (and indenting it correctly) if that's ok. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-uuid-as-allowed-thingatpt-symbol.patch >From f7c76007aef325abc31871db108e7e48fe46022c Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 5 Aug 2018 22:47:30 +0100 Subject: [PATCH] Add uuid as allowed thingatpt symbol * etc/NEWS: Mention changes in thingatpt.el. * lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid. (top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'. * test/lisp/thingatpt-tests.el: Add tests for uuid at point. --- etc/NEWS | 6 ++++++ lisp/thingatpt.el | 25 ++++++++++++++++++++++--- test/lisp/thingatpt-tests.el | 5 ++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a1c12a6..57b2586 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -96,6 +96,12 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'. --- ** shadowfile.el has been rewritten to support Tramp file names. +--- +** 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. + * New Modes and Packages in Emacs 26.2 diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 6a978fe..abeb167 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -58,7 +58,7 @@ forward-thing "Move forward to the end of the Nth next THING. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'." (let ((forward-op (or (get thing 'forward-op) (intern-soft (format "forward-%s" thing))))) @@ -73,7 +73,7 @@ bounds-of-thing-at-point "Determine the start and end buffer locations for the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', and `page'. See the file `thingatpt.el' for documentation on how to define a @@ -131,7 +131,7 @@ thing-at-point "Return the THING at point. THING should be a symbol specifying a type of syntactic entity. Possibilities include `symbol', `list', `sexp', `defun', -`filename', `url', `email', `word', `sentence', `whitespace', +`filename', `url', `email', `uuid', `word', `sentence', `whitespace', `line', `number', and `page'. When the optional argument NO-PROPERTIES is non-nil, @@ -554,6 +554,25 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +;; UUID + +(defconst thing-at-point-uuid-regexp + (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. + +See RFC 4122 for the description of the format.") + +(put 'uuid 'bounds-of-thing-at-point + (lambda () + (when (thing-at-point-looking-at thing-at-point-uuid-regexp 36) + (cons (match-beginning 0) (match-end 0))))) + ;; Aliases (defun word-at-point () diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index cfb57de..b4a5fd9 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -65,7 +65,10 @@ thing-at-point-test-data ("http://example.com/ab)c" 4 url "http://example.com/ab)c") ;; URL markup, lacking schema ("" 1 url "mailto:foo@example.com") - ("" 1 url "ftp://ftp.example.net/abc/")) + ("" 1 url "ftp://ftp.example.net/abc/") + ;; UUID, only hex is allowed + ("01234567-89ab-cdef-ABCD-EF0123456789" 1 uuid "01234567-89ab-cdef-ABCD-EF0123456789") + ("01234567-89ab-cdef-ABCD-EF012345678G" 1 uuid nil)) "List of thing-at-point tests. Each list element should have the form -- 2.7.4 --=-=-=-- From unknown Sun Jun 15 08:57:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32372: [PATCH] Add "uuid" to thing-at-point.el Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Aug 2018 11:50: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 To: Raimon Grau Cc: "Basil L. Contovounesios" , 32372@debbugs.gnu.org, Ivan Shmakov Received: via spool by 32372-submit@debbugs.gnu.org id=B32372.153416099620627 (code B ref 32372); Mon, 13 Aug 2018 11:50:02 +0000 Received: (at 32372) by debbugs.gnu.org; 13 Aug 2018 11:49:56 +0000 Received: from localhost ([127.0.0.1]:49310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fpBMC-0005MY-KB for submit@debbugs.gnu.org; Mon, 13 Aug 2018 07:49:56 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:50211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fpBMA-0005MC-Eu; Mon, 13 Aug 2018 07:49:55 -0400 Received: by mail-it0-f51.google.com with SMTP id j81-v6so12737386ite.0; Mon, 13 Aug 2018 04:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XebyXbfS+fntuT0v5ke/StOPWcnla8cZ7dRhcerSCKo=; b=dZb/f9I/kcfqogsnuzgXIsvWgkfRFLeNIIuPTJZ2/1FEzqP/W8DK63Tbj+47IKVBeb wKmuqLxO5R+9qzx8da0lr7WWF6DMYI6PNJ+U7T/JeWRKaxMgtae6juZh6IdjUUx9Dxa2 tyrOZVHvUquSeVYuMSI7QauRlyG3IW/wtUVqQ6kvJ/qJ3FC5uNOXb3dSwP6r85b3ZnCK BTq68EP2P+v+lMW/ZL9BcNJaJwLRWa1Np+rT6R6EMcoA7caUQlv6HwMtngog6WyZ+LkQ ZZAM4kJRroAt6WyzTLqbR/II8Aw/zvkt9uoYirbwmA/z24INvIpBxCVvBvH0C1T9/ane 01wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=XebyXbfS+fntuT0v5ke/StOPWcnla8cZ7dRhcerSCKo=; b=AeuUJQ7pIOmjLbm2yl8DqqED33UtIHt3RZp8ha66ikhiC9jJp/ZTnTL86TSqfo81f5 HfpcY23RGoUNl3Nzz7CWt1RDyO7/hnfsJfjisaxQlypRt7JO2bup8eQgUjQOANVIuigU 8fWhVf8Z/xjfU72TKOeUXzMUHaC025NMTXnBKf0/VH8gOrIZRANVAZdtBOis5LA6XGHB 7gz39SHpgomCw3bUDWFAGfnvwqPNsj4pfGEUul6xta4kQKFQ7yBnoNDNweLMz6XCINqG OsCY04EQ9qKp9bl5oDQ72nWekFFLr5u0J7s2VJ+2FupaelXwK8pV6E8RmGs/rJhLLCQF u1YA== X-Gm-Message-State: AOUpUlFyqnc0R0uLV0MmzcKwPI45M4zxfFLLtuMSGgl4AF4Tw2TSc7Kd Y9FW0iIDX1NspcaMJs8z7ItJ8kgl X-Google-Smtp-Source: AA+uWPxvgxXBRvQQX9HkSLUeObynUTqUhczj5tuFbI0GVlUjXZgorm1T5CGArS9w5AFIKrnQs/PNEA== X-Received: by 2002:a02:45cd:: with SMTP id o74-v6mr14060116jad.43.1534160988294; Mon, 13 Aug 2018 04:49:48 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id x73-v6sm5254933ita.30.2018.08.13.04.49.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Aug 2018 04:49:47 -0700 (PDT) From: Noam Postavsky 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> <87600m48pq.fsf@violet.siamics.net> <8736vny1c8.fsf@konghq.com> <87bmab2yu1.fsf@violet.siamics.net> <87zhxvwf1c.fsf@konghq.com> <87sh3nxjvm.fsf@tcd.ie> <87va8i20dj.fsf@violet.siamics.net> <87k1oxw2uo.fsf@konghq.com> Date: Mon, 13 Aug 2018 07:49:43 -0400 In-Reply-To: <87k1oxw2uo.fsf@konghq.com> (Raimon Grau's message of "Sat, 11 Aug 2018 12:37:51 +0100") Message-ID: <871sb2wko8.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 32372 fixed close 32372 27.1 quit Raimon Grau writes: > I ended up using when (and indenting it correctly) if that's ok. That's fine, we've certainly had enough debate over it. I've pushed your patch (minus a few blank lines) to master. [1: eb787d749f]: 2018-08-13 07:46:35 -0400 Add uuid as allowed thingatpt symbol (Bug#32372) https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=eb787d749f28583906428269b926fa83aef092b9