From fc28b314072ca5d72319847648198a0feaf13acc Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Fri, 12 Feb 2016 17:59:53 +0100 Subject: [PATCH] thing-at-point Amazon instance ID identify an Amazon Instance ID at point. Use aws cli with Emacs key bindings. --- bba.org | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bba.org b/bba.org index 633b9718..0b034434 100644 --- a/bba.org +++ b/bba.org @@ -2624,6 +2624,26 @@ Use aws command line tool via Emacs. 'fqdn-bounds-of-fqdn-at-point) #+END_SRC +* thing-at-point-instanceID +[2016-02-12 Fri 14:13] + +Amazon instance ID at point. + +#+BEGIN_SRC emacs-lisp + (defun instanceid-bounds-of-instanceid-at-point () + "Return the start and end points of an Amazon instance ID at the current point. + The result is a paired list of character positions for an fqdn + located at the current point in the current buffer." + (save-excursion + (skip-chars-backward "-.0123456789abcdefi") + (if (looking-at "i-[-.0-9abcdef]+") + (cons (point) (match-end 0)) ; bounds of fqdn + nil))) ; no fqdn at point + + (put 'instanceid 'bounds-of-thing-at-point + 'instanceid-bounds-of-instanceid-at-point) +#+END_SRC + * post [2015-10-02 Fri 13:26] -- 2.47.3